@univerjs/ui 1.0.0-alpha.1 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +93 -47
- package/lib/es/index.js +93 -48
- package/lib/index.css +52 -0
- package/lib/index.js +93 -48
- package/lib/types/common/menu-hidden-observable.d.ts +2 -1
- package/lib/types/index.d.ts +6 -4
- package/lib/types/views/font-family/FontFamily.d.ts +10 -2
- package/lib/types/views/font-family/FontFamilyDropdown.d.ts +32 -0
- package/lib/types/views/font-family/FontFamilyItem.d.ts +5 -3
- package/lib/types/views/font-family/index.d.ts +6 -2
- package/lib/types/views/font-family/{interface.d.ts → use-font-list.d.ts} +6 -9
- package/lib/umd/index.js +14 -14
- package/package.json +8 -8
package/lib/cjs/index.js
CHANGED
|
@@ -307,11 +307,11 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
|
307
307
|
return new rxjs.Observable((subscriber) => {
|
|
308
308
|
const subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
309
309
|
if (unitId == null) return subscriber.next(true);
|
|
310
|
-
const docDataModel = univerInstanceService.
|
|
310
|
+
const docDataModel = univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
311
311
|
const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
312
312
|
subscriber.next(documentFlavor !== _univerjs_core.DocumentFlavor.TRADITIONAL);
|
|
313
313
|
});
|
|
314
|
-
const docDataModel = univerInstanceService.
|
|
314
|
+
const docDataModel = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
315
315
|
if (docDataModel == null) subscriber.next(true);
|
|
316
316
|
else {
|
|
317
317
|
const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
@@ -2668,14 +2668,14 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
2668
2668
|
//#endregion
|
|
2669
2669
|
//#region src/views/components/ribbon/ToolbarItem.tsx
|
|
2670
2670
|
const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
|
|
2671
|
-
const toolbarButtonSelectorRootVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
|
|
2671
|
+
const toolbarButtonSelectorRootVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-5 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
|
|
2672
2672
|
variants: { disabled: {
|
|
2673
2673
|
true: toolbarDisabledClassName,
|
|
2674
2674
|
false: "univer-text-gray-900 dark:!univer-text-white"
|
|
2675
2675
|
} },
|
|
2676
2676
|
defaultVariants: { disabled: false }
|
|
2677
2677
|
});
|
|
2678
|
-
const toolbarButtonSelectorMainVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
|
|
2678
|
+
const toolbarButtonSelectorMainVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
|
|
2679
2679
|
variants: {
|
|
2680
2680
|
active: {
|
|
2681
2681
|
true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
|
|
@@ -2696,7 +2696,7 @@ const toolbarButtonSelectorMainVariants = (0, _univerjs_design.cva)("univer-tool
|
|
|
2696
2696
|
disabled: false
|
|
2697
2697
|
}
|
|
2698
2698
|
});
|
|
2699
|
-
const toolbarButtonSelectorTriggerVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
|
|
2699
|
+
const toolbarButtonSelectorTriggerVariants = (0, _univerjs_design.cva)("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
|
|
2700
2700
|
variants: {
|
|
2701
2701
|
disabled: {
|
|
2702
2702
|
true: toolbarDisabledClassName,
|
|
@@ -3028,7 +3028,7 @@ function Ribbon(props) {
|
|
|
3028
3028
|
activatedTab,
|
|
3029
3029
|
onSelectTab: handleSelectTab
|
|
3030
3030
|
}), headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3031
|
-
className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-items-center univer-gap-2 [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
|
|
3031
|
+
className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-flex-row univer-items-center univer-gap-2 rtl:univer-left-2 rtl:univer-right-auto [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
|
|
3032
3032
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ComponentContainer, { components: headerMenuComponents })
|
|
3033
3033
|
})]
|
|
3034
3034
|
}),
|
|
@@ -3044,7 +3044,7 @@ function Ribbon(props) {
|
|
|
3044
3044
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3045
3045
|
"data-u-comp": "ribbon-toolbar",
|
|
3046
3046
|
ref: containerRef,
|
|
3047
|
-
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3047
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", _univerjs_design.divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3048
3048
|
role: "toolbar",
|
|
3049
3049
|
"aria-label": localeService.t(activatedTabTitle),
|
|
3050
3050
|
children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
@@ -4199,7 +4199,9 @@ function ContextMenuMenuItem(props) {
|
|
|
4199
4199
|
const submenuRect = submenuElement.getBoundingClientRect();
|
|
4200
4200
|
const rightLeft = menuItemRect.right - submenuOverlapOffset;
|
|
4201
4201
|
const leftLeft = menuItemRect.left - submenuRect.width + submenuOverlapOffset;
|
|
4202
|
-
const
|
|
4202
|
+
const hasLeftSpace = leftLeft >= menuViewportPadding;
|
|
4203
|
+
const hasRightSpace = rightLeft + submenuRect.width + menuViewportPadding <= window.innerWidth;
|
|
4204
|
+
const useLeft = direction === "rtl" ? hasLeftSpace || !hasRightSpace : !hasRightSpace && hasLeftSpace;
|
|
4203
4205
|
const left = useLeft ? leftLeft : rightLeft;
|
|
4204
4206
|
setSubmenuPlacement(useLeft ? "left" : "right");
|
|
4205
4207
|
const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
|
|
@@ -4218,6 +4220,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4218
4220
|
window.removeEventListener("scroll", updateSubmenuPosition, true);
|
|
4219
4221
|
};
|
|
4220
4222
|
}, [
|
|
4223
|
+
direction,
|
|
4221
4224
|
submenuVisible,
|
|
4222
4225
|
hasSelectionSubmenu,
|
|
4223
4226
|
hasSubItemSubmenu
|
|
@@ -5258,7 +5261,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
5258
5261
|
//#endregion
|
|
5259
5262
|
//#region package.json
|
|
5260
5263
|
var name = "@univerjs/ui";
|
|
5261
|
-
var version = "1.0.0-alpha.
|
|
5264
|
+
var version = "1.0.0-alpha.2";
|
|
5262
5265
|
|
|
5263
5266
|
//#endregion
|
|
5264
5267
|
//#region src/views/color-picker/interface.ts
|
|
@@ -20558,14 +20561,10 @@ let FontService = class FontService {
|
|
|
20558
20561
|
FontService = __decorate([__decorateParam(0, _univerjs_core.IConfigService)], FontService);
|
|
20559
20562
|
|
|
20560
20563
|
//#endregion
|
|
20561
|
-
//#region src/views/font-family/
|
|
20562
|
-
|
|
20563
|
-
const disabled = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$);
|
|
20564
|
-
const commandService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.ICommandService);
|
|
20565
|
-
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
20564
|
+
//#region src/views/font-family/use-font-list.ts
|
|
20565
|
+
function useFontList() {
|
|
20566
20566
|
const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
|
|
20567
|
-
const [
|
|
20568
|
-
const [fonts, setFonts] = (0, react.useState)([]);
|
|
20567
|
+
const [fonts, setFonts] = (0, react.useState)(() => fontService.getFonts());
|
|
20569
20568
|
(0, react.useEffect)(() => {
|
|
20570
20569
|
const subscription = fontService.fonts$.subscribe((fonts) => {
|
|
20571
20570
|
setFonts(fonts);
|
|
@@ -20573,7 +20572,22 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20573
20572
|
return () => {
|
|
20574
20573
|
subscription.unsubscribe();
|
|
20575
20574
|
};
|
|
20576
|
-
}, []);
|
|
20575
|
+
}, [fontService]);
|
|
20576
|
+
return {
|
|
20577
|
+
fonts,
|
|
20578
|
+
fontService
|
|
20579
|
+
};
|
|
20580
|
+
}
|
|
20581
|
+
|
|
20582
|
+
//#endregion
|
|
20583
|
+
//#region src/views/font-family/FontFamily.tsx
|
|
20584
|
+
const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
|
|
20585
|
+
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
|
|
20586
|
+
const disabledObservableValue = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$);
|
|
20587
|
+
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
20588
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
20589
|
+
const { fonts } = useFontList();
|
|
20590
|
+
const [draftValue, setDraftValue] = (0, react.useState)(null);
|
|
20577
20591
|
const viewValue = (0, react.useMemo)(() => {
|
|
20578
20592
|
if (value == null) return "";
|
|
20579
20593
|
const font = fonts.find((font) => {
|
|
@@ -20586,14 +20600,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20586
20600
|
fonts,
|
|
20587
20601
|
localeService
|
|
20588
20602
|
]);
|
|
20589
|
-
|
|
20590
|
-
setInputValue(viewValue);
|
|
20591
|
-
}, [value]);
|
|
20603
|
+
const inputValue = draftValue !== null && draftValue !== void 0 ? draftValue : viewValue;
|
|
20592
20604
|
function resetValue() {
|
|
20593
|
-
|
|
20605
|
+
setDraftValue(null);
|
|
20594
20606
|
}
|
|
20595
20607
|
function handleChangeSelection(e) {
|
|
20596
|
-
|
|
20608
|
+
setDraftValue(e.target.value);
|
|
20597
20609
|
}
|
|
20598
20610
|
function handleKeyDown(e) {
|
|
20599
20611
|
e.stopPropagation();
|
|
@@ -20605,7 +20617,7 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20605
20617
|
}
|
|
20606
20618
|
}
|
|
20607
20619
|
function handleBlur() {
|
|
20608
|
-
if (inputValue !==
|
|
20620
|
+
if (draftValue !== null && inputValue !== viewValue) resetValue();
|
|
20609
20621
|
}
|
|
20610
20622
|
function confirm() {
|
|
20611
20623
|
const font = fonts.find((item) => {
|
|
@@ -20617,11 +20629,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20617
20629
|
}
|
|
20618
20630
|
handleSelectFont(font.value);
|
|
20619
20631
|
}
|
|
20620
|
-
function handleSelectFont(
|
|
20621
|
-
|
|
20632
|
+
function handleSelectFont(nextValue) {
|
|
20633
|
+
resetValue();
|
|
20634
|
+
onChange(nextValue);
|
|
20622
20635
|
}
|
|
20623
20636
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20624
|
-
className: "univer-w-32 univer-truncate univer-text-sm",
|
|
20637
|
+
className: (0, _univerjs_design.clsx)("univer-w-32 univer-truncate univer-text-sm", className),
|
|
20625
20638
|
style: { fontFamily: value },
|
|
20626
20639
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
20627
20640
|
className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 focus:univer-outline-none dark:!univer-text-white [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
|
|
@@ -20637,23 +20650,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20637
20650
|
|
|
20638
20651
|
//#endregion
|
|
20639
20652
|
//#region src/views/font-family/FontFamilyItem.tsx
|
|
20640
|
-
const
|
|
20641
|
-
|
|
20642
|
-
const fontService = (0, _wendellhu_redi_react_bindings.useDependency)(IFontService);
|
|
20643
|
-
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
20644
|
-
const [fonts, setFonts] = (0, react.useState)([]);
|
|
20645
|
-
(0, react.useEffect)(() => {
|
|
20646
|
-
const subscription = fontService.fonts$.subscribe((fonts) => {
|
|
20647
|
-
setFonts(fonts);
|
|
20648
|
-
});
|
|
20649
|
-
return () => {
|
|
20650
|
-
subscription.unsubscribe();
|
|
20651
|
-
};
|
|
20652
|
-
}, []);
|
|
20653
|
+
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
20654
|
+
const FontFamilyItem = ({ value, onChange }) => {
|
|
20653
20655
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
20654
|
-
|
|
20655
|
-
|
|
20656
|
-
|
|
20656
|
+
const { fonts, fontService } = useFontList();
|
|
20657
|
+
function handleSelectFont(nextValue) {
|
|
20658
|
+
onChange(nextValue);
|
|
20657
20659
|
}
|
|
20658
20660
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
20659
20661
|
className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
|
|
@@ -20672,9 +20674,48 @@ const FontFamilyItem = ({ id, value }) => {
|
|
|
20672
20674
|
};
|
|
20673
20675
|
|
|
20674
20676
|
//#endregion
|
|
20675
|
-
//#region src/views/font-family/
|
|
20676
|
-
|
|
20677
|
-
const
|
|
20677
|
+
//#region src/views/font-family/FontFamilyDropdown.tsx
|
|
20678
|
+
function FontFamilyDropdown(props) {
|
|
20679
|
+
const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
|
|
20680
|
+
const disabledObservableValue = (0, _wendellhu_redi_react_bindings.useObservable)(disabled$);
|
|
20681
|
+
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
20682
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
20683
|
+
const popupDataAttributes = popupDataComponent ? { "data-u-comp": popupDataComponent } : void 0;
|
|
20684
|
+
function handleChange(nextValue) {
|
|
20685
|
+
setOpen(false);
|
|
20686
|
+
onChange(nextValue);
|
|
20687
|
+
}
|
|
20688
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Dropdown, {
|
|
20689
|
+
disabled,
|
|
20690
|
+
open,
|
|
20691
|
+
onOpenChange: setOpen,
|
|
20692
|
+
overlay: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
20693
|
+
className: (0, _univerjs_design.clsx)("univer-max-h-72 univer-min-w-44 univer-overflow-y-auto univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900", popupClassName),
|
|
20694
|
+
...popupDataAttributes,
|
|
20695
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontFamilyItem, {
|
|
20696
|
+
value,
|
|
20697
|
+
onChange: handleChange
|
|
20698
|
+
})
|
|
20699
|
+
}),
|
|
20700
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20701
|
+
"aria-disabled": disabled,
|
|
20702
|
+
"aria-expanded": open,
|
|
20703
|
+
"aria-label": ariaLabel,
|
|
20704
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-6 univer-min-w-0 univer-cursor-default univer-items-center univer-justify-between univer-gap-1 univer-rounded-md univer-px-1.5 univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-cursor-not-allowed univer-opacity-60": disabled }, className),
|
|
20705
|
+
role: "combobox",
|
|
20706
|
+
tabIndex: disabled ? -1 : 0,
|
|
20707
|
+
title: typeof title === "string" ? title : void 0,
|
|
20708
|
+
onMouseDown,
|
|
20709
|
+
onPointerDown,
|
|
20710
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FontFamily, {
|
|
20711
|
+
className: (0, _univerjs_design.clsx)("univer-min-w-0 univer-flex-1", inputClassName),
|
|
20712
|
+
value,
|
|
20713
|
+
disabled,
|
|
20714
|
+
onChange: handleChange
|
|
20715
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "univer-flex-shrink-0 univer-text-xs univer-text-gray-500" })]
|
|
20716
|
+
})
|
|
20717
|
+
});
|
|
20718
|
+
}
|
|
20678
20719
|
|
|
20679
20720
|
//#endregion
|
|
20680
20721
|
//#region src/views/font-size/FontSize.tsx
|
|
@@ -20834,7 +20875,9 @@ const DRAG_COMMIT_INTERVAL = 50;
|
|
|
20834
20875
|
function Slider(props) {
|
|
20835
20876
|
var _getSliderOffset;
|
|
20836
20877
|
const iconManager = (0, _wendellhu_redi_react_bindings.useDependency)(IconManager);
|
|
20878
|
+
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
20837
20879
|
const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
|
|
20880
|
+
const isRtl = (0, _wendellhu_redi_react_bindings.useObservable)(localeService.direction$, localeService.getDirection()) === "rtl";
|
|
20838
20881
|
const sliderInnerRailRef = (0, react.useRef)(null);
|
|
20839
20882
|
const isEditingZoomRef = (0, react.useRef)(false);
|
|
20840
20883
|
const dragValueRef = (0, react.useRef)(value);
|
|
@@ -20878,6 +20921,7 @@ function Slider(props) {
|
|
|
20878
20921
|
let offsetX = clientX - railRect.x;
|
|
20879
20922
|
if (offsetX <= 0) offsetX = 0;
|
|
20880
20923
|
else if (offsetX >= railWidth) offsetX = railWidth;
|
|
20924
|
+
if (isRtl) offsetX = railWidth - offsetX;
|
|
20881
20925
|
const ratio = offsetX / railWidth;
|
|
20882
20926
|
if (ratio <= .5) return min + ratio * (resetPoint - min) * 2;
|
|
20883
20927
|
return resetPoint + (ratio - .5) * (max - resetPoint) * 2;
|
|
@@ -20996,6 +21040,7 @@ function Slider(props) {
|
|
|
20996
21040
|
}];
|
|
20997
21041
|
const visualValue = isDragging ? dragValue : value;
|
|
20998
21042
|
const sliderOffset = Math.min(Math.max((_getSliderOffset = getSliderOffset(visualValue)) !== null && _getSliderOffset !== void 0 ? _getSliderOffset : 0, 0), 100);
|
|
21043
|
+
const handleOffset = isRtl ? 100 - sliderOffset : sliderOffset;
|
|
20999
21044
|
const ReduceIcon = iconManager.get("ReduceIcon");
|
|
21000
21045
|
const IncreaseIcon = iconManager.get("IncreaseIcon");
|
|
21001
21046
|
const MoreDownIcon = iconManager.get("MoreDownIcon");
|
|
@@ -21022,7 +21067,7 @@ function Slider(props) {
|
|
|
21022
21067
|
onPointerDown: handlePointerDown,
|
|
21023
21068
|
children: [
|
|
21024
21069
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
21025
|
-
className: "univer-bg-primary-500/60 univer-absolute univer-
|
|
21070
|
+
className: (0, _univerjs_design.clsx)("univer-bg-primary-500/60 univer-absolute univer-top-0 univer-h-full univer-rounded-full", isRtl ? "univer-right-0" : "univer-left-0"),
|
|
21026
21071
|
style: { width: `${sliderOffset}%` }
|
|
21027
21072
|
}),
|
|
21028
21073
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
@@ -21041,7 +21086,7 @@ function Slider(props) {
|
|
|
21041
21086
|
"aria-valuemax": max,
|
|
21042
21087
|
"aria-valuenow": visualValue,
|
|
21043
21088
|
type: "button",
|
|
21044
|
-
style: { left: `${
|
|
21089
|
+
style: { left: `${handleOffset}%` },
|
|
21045
21090
|
onPointerDown: handlePointerDown
|
|
21046
21091
|
})
|
|
21047
21092
|
]
|
|
@@ -24139,6 +24184,7 @@ exports.FONT_SIZE_LIST = FONT_SIZE_LIST;
|
|
|
24139
24184
|
exports.FloatDom = FloatDom;
|
|
24140
24185
|
exports.FloatDomSingle = FloatDomSingle;
|
|
24141
24186
|
exports.FontFamily = FontFamily;
|
|
24187
|
+
exports.FontFamilyDropdown = FontFamilyDropdown;
|
|
24142
24188
|
exports.FontFamilyItem = FontFamilyItem;
|
|
24143
24189
|
Object.defineProperty(exports, 'FontService', {
|
|
24144
24190
|
enumerable: true,
|
package/lib/es/index.js
CHANGED
|
@@ -306,11 +306,11 @@ function getHeaderFooterMenuHiddenObservable(accessor) {
|
|
|
306
306
|
return new Observable((subscriber) => {
|
|
307
307
|
const subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
308
308
|
if (unitId == null) return subscriber.next(true);
|
|
309
|
-
const docDataModel = univerInstanceService.
|
|
309
|
+
const docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC);
|
|
310
310
|
const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
311
311
|
subscriber.next(documentFlavor !== DocumentFlavor.TRADITIONAL);
|
|
312
312
|
});
|
|
313
|
-
const docDataModel = univerInstanceService.
|
|
313
|
+
const docDataModel = univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_DOC);
|
|
314
314
|
if (docDataModel == null) subscriber.next(true);
|
|
315
315
|
else {
|
|
316
316
|
const documentFlavor = docDataModel === null || docDataModel === void 0 ? void 0 : docDataModel.getSnapshot().documentStyle.documentFlavor;
|
|
@@ -2667,14 +2667,14 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
2667
2667
|
//#endregion
|
|
2668
2668
|
//#region src/views/components/ribbon/ToolbarItem.tsx
|
|
2669
2669
|
const toolbarDisabledClassName = "univer-pointer-events-none univer-cursor-not-allowed univer-text-gray-300 dark:!univer-text-gray-600";
|
|
2670
|
-
const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-700", {
|
|
2670
|
+
const toolbarButtonSelectorRootVariants = cva("univer-toolbar-button-selector-root univer-animate-in univer-fade-in univer-group univer-relative univer-flex univer-h-6 univer-cursor-pointer univer-items-center univer-rounded univer-pr-5 univer-text-sm univer-transition-colors hover:univer-bg-gray-100 rtl:univer-pl-5 rtl:univer-pr-0 dark:hover:!univer-bg-gray-700", {
|
|
2671
2671
|
variants: { disabled: {
|
|
2672
2672
|
true: toolbarDisabledClassName,
|
|
2673
2673
|
false: "univer-text-gray-900 dark:!univer-text-white"
|
|
2674
2674
|
} },
|
|
2675
2675
|
defaultVariants: { disabled: false }
|
|
2676
2676
|
});
|
|
2677
|
-
const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
|
|
2677
|
+
const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-main univer-relative univer-z-[1] univer-flex univer-h-full univer-items-center univer-rounded-l univer-px-1 univer-transition-colors hover:univer-bg-gray-200 rtl:univer-rounded-l-none rtl:univer-rounded-r dark:hover:!univer-bg-gray-600", {
|
|
2678
2678
|
variants: {
|
|
2679
2679
|
active: {
|
|
2680
2680
|
true: "univer-bg-gray-200 dark:!univer-bg-gray-500",
|
|
@@ -2695,7 +2695,7 @@ const toolbarButtonSelectorMainVariants = cva("univer-toolbar-button-selector-ma
|
|
|
2695
2695
|
disabled: false
|
|
2696
2696
|
}
|
|
2697
2697
|
});
|
|
2698
|
-
const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 dark:hover:!univer-bg-gray-600", {
|
|
2698
|
+
const toolbarButtonSelectorTriggerVariants = cva("univer-toolbar-button-selector-trigger univer-absolute univer-right-0 univer-top-0 univer-box-border univer-flex univer-h-6 univer-w-5 univer-items-center univer-justify-center univer-rounded-r univer-transition-colors hover:univer-bg-gray-200 rtl:univer-left-0 rtl:univer-right-auto rtl:univer-rounded-l rtl:univer-rounded-r-none dark:hover:!univer-bg-gray-600", {
|
|
2699
2699
|
variants: {
|
|
2700
2700
|
disabled: {
|
|
2701
2701
|
true: toolbarDisabledClassName,
|
|
@@ -3027,7 +3027,7 @@ function Ribbon(props) {
|
|
|
3027
3027
|
activatedTab,
|
|
3028
3028
|
onSelectTab: handleSelectTab
|
|
3029
3029
|
}), headerMenu && headerMenuComponents && headerMenuComponents.size > 0 && /* @__PURE__ */ jsx("div", {
|
|
3030
|
-
className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-items-center univer-gap-2 [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
|
|
3030
|
+
className: "univer-absolute univer-right-2 univer-top-0 univer-flex univer-h-full univer-flex-row univer-items-center univer-gap-2 rtl:univer-left-2 rtl:univer-right-auto [&>*]:univer-inline-flex [&>*]:univer-h-6 [&>*]:univer-items-center [&>*]:univer-rounded [&>*]:univer-px-1 [&>*]:univer-transition-colors hover:[&>*]:univer-bg-gray-100",
|
|
3031
3031
|
children: /* @__PURE__ */ jsx(ComponentContainer, { components: headerMenuComponents })
|
|
3032
3032
|
})]
|
|
3033
3033
|
}),
|
|
@@ -3043,7 +3043,7 @@ function Ribbon(props) {
|
|
|
3043
3043
|
}), /* @__PURE__ */ jsxs("div", {
|
|
3044
3044
|
"data-u-comp": "ribbon-toolbar",
|
|
3045
3045
|
ref: containerRef,
|
|
3046
|
-
className: clsx("univer-flex univer-overflow-hidden", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3046
|
+
className: clsx("univer-flex univer-overflow-hidden rtl:univer-divide-x-reverse", divideXClassName, { "univer-justify-center": ribbonType === "classic" }),
|
|
3047
3047
|
role: "toolbar",
|
|
3048
3048
|
"aria-label": localeService.t(activatedTabTitle),
|
|
3049
3049
|
children: [activeGroup.visibleGroups.map((groupItem) => {
|
|
@@ -4198,7 +4198,9 @@ function ContextMenuMenuItem(props) {
|
|
|
4198
4198
|
const submenuRect = submenuElement.getBoundingClientRect();
|
|
4199
4199
|
const rightLeft = menuItemRect.right - submenuOverlapOffset;
|
|
4200
4200
|
const leftLeft = menuItemRect.left - submenuRect.width + submenuOverlapOffset;
|
|
4201
|
-
const
|
|
4201
|
+
const hasLeftSpace = leftLeft >= menuViewportPadding;
|
|
4202
|
+
const hasRightSpace = rightLeft + submenuRect.width + menuViewportPadding <= window.innerWidth;
|
|
4203
|
+
const useLeft = direction === "rtl" ? hasLeftSpace || !hasRightSpace : !hasRightSpace && hasLeftSpace;
|
|
4202
4204
|
const left = useLeft ? leftLeft : rightLeft;
|
|
4203
4205
|
setSubmenuPlacement(useLeft ? "left" : "right");
|
|
4204
4206
|
const maxTop = window.innerHeight - menuViewportPadding - submenuRect.height;
|
|
@@ -4217,6 +4219,7 @@ function ContextMenuMenuItem(props) {
|
|
|
4217
4219
|
window.removeEventListener("scroll", updateSubmenuPosition, true);
|
|
4218
4220
|
};
|
|
4219
4221
|
}, [
|
|
4222
|
+
direction,
|
|
4220
4223
|
submenuVisible,
|
|
4221
4224
|
hasSelectionSubmenu,
|
|
4222
4225
|
hasSubItemSubmenu
|
|
@@ -5257,7 +5260,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
|
5257
5260
|
//#endregion
|
|
5258
5261
|
//#region package.json
|
|
5259
5262
|
var name = "@univerjs/ui";
|
|
5260
|
-
var version = "1.0.0-alpha.
|
|
5263
|
+
var version = "1.0.0-alpha.2";
|
|
5261
5264
|
|
|
5262
5265
|
//#endregion
|
|
5263
5266
|
//#region src/views/color-picker/interface.ts
|
|
@@ -20557,14 +20560,10 @@ let FontService = class FontService {
|
|
|
20557
20560
|
FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
|
|
20558
20561
|
|
|
20559
20562
|
//#endregion
|
|
20560
|
-
//#region src/views/font-family/
|
|
20561
|
-
|
|
20562
|
-
const disabled = useObservable(disabled$);
|
|
20563
|
-
const commandService = useDependency(ICommandService);
|
|
20564
|
-
const localeService = useDependency(LocaleService);
|
|
20563
|
+
//#region src/views/font-family/use-font-list.ts
|
|
20564
|
+
function useFontList() {
|
|
20565
20565
|
const fontService = useDependency(IFontService);
|
|
20566
|
-
const [
|
|
20567
|
-
const [fonts, setFonts] = useState([]);
|
|
20566
|
+
const [fonts, setFonts] = useState(() => fontService.getFonts());
|
|
20568
20567
|
useEffect(() => {
|
|
20569
20568
|
const subscription = fontService.fonts$.subscribe((fonts) => {
|
|
20570
20569
|
setFonts(fonts);
|
|
@@ -20572,7 +20571,22 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20572
20571
|
return () => {
|
|
20573
20572
|
subscription.unsubscribe();
|
|
20574
20573
|
};
|
|
20575
|
-
}, []);
|
|
20574
|
+
}, [fontService]);
|
|
20575
|
+
return {
|
|
20576
|
+
fonts,
|
|
20577
|
+
fontService
|
|
20578
|
+
};
|
|
20579
|
+
}
|
|
20580
|
+
|
|
20581
|
+
//#endregion
|
|
20582
|
+
//#region src/views/font-family/FontFamily.tsx
|
|
20583
|
+
const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
|
|
20584
|
+
const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onChange }) => {
|
|
20585
|
+
const disabledObservableValue = useObservable(disabled$);
|
|
20586
|
+
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
20587
|
+
const localeService = useDependency(LocaleService);
|
|
20588
|
+
const { fonts } = useFontList();
|
|
20589
|
+
const [draftValue, setDraftValue] = useState(null);
|
|
20576
20590
|
const viewValue = useMemo(() => {
|
|
20577
20591
|
if (value == null) return "";
|
|
20578
20592
|
const font = fonts.find((font) => {
|
|
@@ -20585,14 +20599,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20585
20599
|
fonts,
|
|
20586
20600
|
localeService
|
|
20587
20601
|
]);
|
|
20588
|
-
|
|
20589
|
-
setInputValue(viewValue);
|
|
20590
|
-
}, [value]);
|
|
20602
|
+
const inputValue = draftValue !== null && draftValue !== void 0 ? draftValue : viewValue;
|
|
20591
20603
|
function resetValue() {
|
|
20592
|
-
|
|
20604
|
+
setDraftValue(null);
|
|
20593
20605
|
}
|
|
20594
20606
|
function handleChangeSelection(e) {
|
|
20595
|
-
|
|
20607
|
+
setDraftValue(e.target.value);
|
|
20596
20608
|
}
|
|
20597
20609
|
function handleKeyDown(e) {
|
|
20598
20610
|
e.stopPropagation();
|
|
@@ -20604,7 +20616,7 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20604
20616
|
}
|
|
20605
20617
|
}
|
|
20606
20618
|
function handleBlur() {
|
|
20607
|
-
if (inputValue !==
|
|
20619
|
+
if (draftValue !== null && inputValue !== viewValue) resetValue();
|
|
20608
20620
|
}
|
|
20609
20621
|
function confirm() {
|
|
20610
20622
|
const font = fonts.find((item) => {
|
|
@@ -20616,11 +20628,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20616
20628
|
}
|
|
20617
20629
|
handleSelectFont(font.value);
|
|
20618
20630
|
}
|
|
20619
|
-
function handleSelectFont(
|
|
20620
|
-
|
|
20631
|
+
function handleSelectFont(nextValue) {
|
|
20632
|
+
resetValue();
|
|
20633
|
+
onChange(nextValue);
|
|
20621
20634
|
}
|
|
20622
20635
|
return /* @__PURE__ */ jsx("div", {
|
|
20623
|
-
className: "univer-w-32 univer-truncate univer-text-sm",
|
|
20636
|
+
className: clsx("univer-w-32 univer-truncate univer-text-sm", className),
|
|
20624
20637
|
style: { fontFamily: value },
|
|
20625
20638
|
children: /* @__PURE__ */ jsx("input", {
|
|
20626
20639
|
className: "univer-block univer-h-6 univer-border-none univer-bg-transparent univer-leading-6 focus:univer-outline-none dark:!univer-text-white [&_input:focus]:!univer-ring-0 [&_input]:univer-h-6 [&_input]:univer-w-7 [&_input]:univer-border-none [&_input]:!univer-bg-transparent [&_input]:univer-p-0 [&_input]:univer-text-sm",
|
|
@@ -20636,23 +20649,12 @@ const FontFamily = ({ id, value, disabled$ }) => {
|
|
|
20636
20649
|
|
|
20637
20650
|
//#endregion
|
|
20638
20651
|
//#region src/views/font-family/FontFamilyItem.tsx
|
|
20639
|
-
const
|
|
20640
|
-
|
|
20641
|
-
const fontService = useDependency(IFontService);
|
|
20642
|
-
const layoutService = useDependency(ILayoutService);
|
|
20643
|
-
const [fonts, setFonts] = useState([]);
|
|
20644
|
-
useEffect(() => {
|
|
20645
|
-
const subscription = fontService.fonts$.subscribe((fonts) => {
|
|
20646
|
-
setFonts(fonts);
|
|
20647
|
-
});
|
|
20648
|
-
return () => {
|
|
20649
|
-
subscription.unsubscribe();
|
|
20650
|
-
};
|
|
20651
|
-
}, []);
|
|
20652
|
+
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
20653
|
+
const FontFamilyItem = ({ value, onChange }) => {
|
|
20652
20654
|
const localeService = useDependency(LocaleService);
|
|
20653
|
-
|
|
20654
|
-
|
|
20655
|
-
|
|
20655
|
+
const { fonts, fontService } = useFontList();
|
|
20656
|
+
function handleSelectFont(nextValue) {
|
|
20657
|
+
onChange(nextValue);
|
|
20656
20658
|
}
|
|
20657
20659
|
return /* @__PURE__ */ jsx("ul", {
|
|
20658
20660
|
className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
|
|
@@ -20671,9 +20673,48 @@ const FontFamilyItem = ({ id, value }) => {
|
|
|
20671
20673
|
};
|
|
20672
20674
|
|
|
20673
20675
|
//#endregion
|
|
20674
|
-
//#region src/views/font-family/
|
|
20675
|
-
|
|
20676
|
-
const
|
|
20676
|
+
//#region src/views/font-family/FontFamilyDropdown.tsx
|
|
20677
|
+
function FontFamilyDropdown(props) {
|
|
20678
|
+
const { value, onChange, ariaLabel, className, disabled: disabledProp, disabled$, inputClassName, popupClassName, popupDataComponent, title, onMouseDown, onPointerDown } = props;
|
|
20679
|
+
const disabledObservableValue = useObservable(disabled$);
|
|
20680
|
+
const disabled = Boolean(disabledProp || disabledObservableValue);
|
|
20681
|
+
const [open, setOpen] = useState(false);
|
|
20682
|
+
const popupDataAttributes = popupDataComponent ? { "data-u-comp": popupDataComponent } : void 0;
|
|
20683
|
+
function handleChange(nextValue) {
|
|
20684
|
+
setOpen(false);
|
|
20685
|
+
onChange(nextValue);
|
|
20686
|
+
}
|
|
20687
|
+
return /* @__PURE__ */ jsx(Dropdown, {
|
|
20688
|
+
disabled,
|
|
20689
|
+
open,
|
|
20690
|
+
onOpenChange: setOpen,
|
|
20691
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
20692
|
+
className: clsx("univer-max-h-72 univer-min-w-44 univer-overflow-y-auto univer-rounded-lg univer-border univer-border-solid univer-border-gray-200 univer-bg-white univer-p-1 univer-shadow-lg dark:!univer-border-gray-700 dark:!univer-bg-gray-900", popupClassName),
|
|
20693
|
+
...popupDataAttributes,
|
|
20694
|
+
children: /* @__PURE__ */ jsx(FontFamilyItem, {
|
|
20695
|
+
value,
|
|
20696
|
+
onChange: handleChange
|
|
20697
|
+
})
|
|
20698
|
+
}),
|
|
20699
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
20700
|
+
"aria-disabled": disabled,
|
|
20701
|
+
"aria-expanded": open,
|
|
20702
|
+
"aria-label": ariaLabel,
|
|
20703
|
+
className: clsx("univer-flex univer-h-6 univer-min-w-0 univer-cursor-default univer-items-center univer-justify-between univer-gap-1 univer-rounded-md univer-px-1.5 univer-text-sm univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-100 dark:hover:!univer-bg-gray-700", { "univer-cursor-not-allowed univer-opacity-60": disabled }, className),
|
|
20704
|
+
role: "combobox",
|
|
20705
|
+
tabIndex: disabled ? -1 : 0,
|
|
20706
|
+
title: typeof title === "string" ? title : void 0,
|
|
20707
|
+
onMouseDown,
|
|
20708
|
+
onPointerDown,
|
|
20709
|
+
children: [/* @__PURE__ */ jsx(FontFamily, {
|
|
20710
|
+
className: clsx("univer-min-w-0 univer-flex-1", inputClassName),
|
|
20711
|
+
value,
|
|
20712
|
+
disabled,
|
|
20713
|
+
onChange: handleChange
|
|
20714
|
+
}), /* @__PURE__ */ jsx(MoreDownIcon, { className: "univer-flex-shrink-0 univer-text-xs univer-text-gray-500" })]
|
|
20715
|
+
})
|
|
20716
|
+
});
|
|
20717
|
+
}
|
|
20677
20718
|
|
|
20678
20719
|
//#endregion
|
|
20679
20720
|
//#region src/views/font-size/FontSize.tsx
|
|
@@ -20833,7 +20874,9 @@ const DRAG_COMMIT_INTERVAL = 50;
|
|
|
20833
20874
|
function Slider(props) {
|
|
20834
20875
|
var _getSliderOffset;
|
|
20835
20876
|
const iconManager = useDependency(IconManager);
|
|
20877
|
+
const localeService = useDependency(LocaleService);
|
|
20836
20878
|
const { value, min = 0, max = 400, disabled = false, resetPoint = 100, shortcuts, onChange } = props;
|
|
20879
|
+
const isRtl = useObservable(localeService.direction$, localeService.getDirection()) === "rtl";
|
|
20837
20880
|
const sliderInnerRailRef = useRef(null);
|
|
20838
20881
|
const isEditingZoomRef = useRef(false);
|
|
20839
20882
|
const dragValueRef = useRef(value);
|
|
@@ -20877,6 +20920,7 @@ function Slider(props) {
|
|
|
20877
20920
|
let offsetX = clientX - railRect.x;
|
|
20878
20921
|
if (offsetX <= 0) offsetX = 0;
|
|
20879
20922
|
else if (offsetX >= railWidth) offsetX = railWidth;
|
|
20923
|
+
if (isRtl) offsetX = railWidth - offsetX;
|
|
20880
20924
|
const ratio = offsetX / railWidth;
|
|
20881
20925
|
if (ratio <= .5) return min + ratio * (resetPoint - min) * 2;
|
|
20882
20926
|
return resetPoint + (ratio - .5) * (max - resetPoint) * 2;
|
|
@@ -20995,6 +21039,7 @@ function Slider(props) {
|
|
|
20995
21039
|
}];
|
|
20996
21040
|
const visualValue = isDragging ? dragValue : value;
|
|
20997
21041
|
const sliderOffset = Math.min(Math.max((_getSliderOffset = getSliderOffset(visualValue)) !== null && _getSliderOffset !== void 0 ? _getSliderOffset : 0, 0), 100);
|
|
21042
|
+
const handleOffset = isRtl ? 100 - sliderOffset : sliderOffset;
|
|
20998
21043
|
const ReduceIcon = iconManager.get("ReduceIcon");
|
|
20999
21044
|
const IncreaseIcon = iconManager.get("IncreaseIcon");
|
|
21000
21045
|
const MoreDownIcon = iconManager.get("MoreDownIcon");
|
|
@@ -21021,7 +21066,7 @@ function Slider(props) {
|
|
|
21021
21066
|
onPointerDown: handlePointerDown,
|
|
21022
21067
|
children: [
|
|
21023
21068
|
/* @__PURE__ */ jsx("div", {
|
|
21024
|
-
className: "univer-bg-primary-500/60 univer-absolute univer-
|
|
21069
|
+
className: clsx("univer-bg-primary-500/60 univer-absolute univer-top-0 univer-h-full univer-rounded-full", isRtl ? "univer-right-0" : "univer-left-0"),
|
|
21025
21070
|
style: { width: `${sliderOffset}%` }
|
|
21026
21071
|
}),
|
|
21027
21072
|
/* @__PURE__ */ jsx("a", {
|
|
@@ -21040,7 +21085,7 @@ function Slider(props) {
|
|
|
21040
21085
|
"aria-valuemax": max,
|
|
21041
21086
|
"aria-valuenow": visualValue,
|
|
21042
21087
|
type: "button",
|
|
21043
|
-
style: { left: `${
|
|
21088
|
+
style: { left: `${handleOffset}%` },
|
|
21044
21089
|
onPointerDown: handlePointerDown
|
|
21045
21090
|
})
|
|
21046
21091
|
]
|
|
@@ -24026,4 +24071,4 @@ function ProgressBar(props) {
|
|
|
24026
24071
|
}
|
|
24027
24072
|
|
|
24028
24073
|
//#endregion
|
|
24029
|
-
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FontFamily, FontFamilyItem, FontService, FontSize, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileContextMenu, MockMessageService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, ThemeSwitcherService, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, mergeMenuConfigs, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|
|
24074
|
+
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomService, CanvasPopup, CanvasPopupService, CommonLabel, ComponentContainer, ComponentManager, DesktopContextMenu as ContextMenu, ContextMenuGroup, ContextMenuHostService, ContextMenuPanel, ContextMenuPosition, ContextMenuService, CopyCommand, CopyShortcutItem, CustomLabel, CutCommand, CutShortcutItem, DISABLE_AUTO_FOCUS_KEY, DesktopBeforeCloseService, DesktopConfirmService, DesktopDialogService, DesktopGalleryService, DesktopLayoutService, DesktopLocalFileService, DesktopLocalStorageService, DesktopMessageService, DesktopNotificationService, DesktopRibbonService, DesktopSidebarService, DesktopUIController, EMOJI_CATEGORIES, EMOJI_PICKER_COMPONENT, EMOJI_RECENT_LIMIT, EmojiPicker, ErrorController, FILE_PNG_CLIPBOARD_MIME_TYPE, FILE_SVG_XML_CLIPBOARD_MIME_TYPE, FILE__BMP_CLIPBOARD_MIME_TYPE, FILE__JPEG_CLIPBOARD_MIME_TYPE, FILE__WEBP_CLIPBOARD_MIME_TYPE, FONT_FAMILY_COMPONENT, FONT_FAMILY_ITEM_COMPONENT, FONT_SIZE_COMPONENT, FONT_SIZE_LIST, FloatDom, FloatDomSingle, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, HEADING_ITEM_COMPONENT, HEADING_LIST, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IconManager, KeyCode, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileContextMenu, MockMessageService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, ThemeSwitcherService, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoShortcutItem, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, ZIndexManager, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, mergeMenuConfigs, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|