@univerjs/ui 1.1.0 → 1.2.0
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 +148 -94
- package/lib/es/index.js +148 -94
- package/lib/index.css +28 -10
- package/lib/index.js +148 -94
- package/lib/types/views/emoji-picker/EmojiPicker.d.ts +1 -1
- package/lib/types/views/emoji-picker/emoji-picker-utils.d.ts +1 -1
- package/lib/umd/index.js +19 -19
- package/package.json +8 -8
package/lib/cjs/index.js
CHANGED
|
@@ -1835,17 +1835,23 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1835
1835
|
|
|
1836
1836
|
//#endregion
|
|
1837
1837
|
//#region src/views/components/feature-search/FeatureSearch.tsx
|
|
1838
|
+
/**
|
|
1839
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1840
|
+
*
|
|
1841
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1842
|
+
* you may not use this file except in compliance with the License.
|
|
1843
|
+
* You may obtain a copy of the License at
|
|
1844
|
+
*
|
|
1845
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1846
|
+
*
|
|
1847
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1848
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1849
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1850
|
+
* See the License for the specific language governing permissions and
|
|
1851
|
+
* limitations under the License.
|
|
1852
|
+
*/
|
|
1838
1853
|
const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
|
|
1839
1854
|
const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
|
|
1840
|
-
function resolveParams(item, value) {
|
|
1841
|
-
return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
|
|
1842
|
-
}
|
|
1843
|
-
function resolveOptionParams(option) {
|
|
1844
|
-
return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
|
|
1845
|
-
}
|
|
1846
|
-
function deduplicate(items) {
|
|
1847
|
-
return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && _univerjs_core.Tools.diffValue(candidate.params, item.params)) === index);
|
|
1848
|
-
}
|
|
1849
1855
|
function FeatureSearch() {
|
|
1850
1856
|
const menuManagerService = (0, _wendellhu_redi_react_bindings.useDependency)(IMenuManagerService);
|
|
1851
1857
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
@@ -1854,6 +1860,15 @@ function FeatureSearch() {
|
|
|
1854
1860
|
const layoutService = (0, _wendellhu_redi_react_bindings.useDependency)(ILayoutService);
|
|
1855
1861
|
const ribbonService = (0, _wendellhu_redi_react_bindings.useDependency)(IRibbonService);
|
|
1856
1862
|
const items$ = (0, react.useMemo)(() => {
|
|
1863
|
+
function resolveParams(item, value) {
|
|
1864
|
+
return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
|
|
1865
|
+
}
|
|
1866
|
+
function resolveOptionParams(option) {
|
|
1867
|
+
return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
|
|
1868
|
+
}
|
|
1869
|
+
function deduplicate(items) {
|
|
1870
|
+
return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && _univerjs_core.Tools.diffValue(candidate.params, item.params)) === index);
|
|
1871
|
+
}
|
|
1857
1872
|
function getItemTitle(item) {
|
|
1858
1873
|
const titleKey = item.title ?? item.tooltip ?? item.description;
|
|
1859
1874
|
return titleKey ? localeService.t(titleKey) : "";
|
|
@@ -1978,7 +1993,7 @@ function FeatureSearch() {
|
|
|
1978
1993
|
children: item.title
|
|
1979
1994
|
})]
|
|
1980
1995
|
}), item.path && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1981
|
-
className: "univer-max-w-
|
|
1996
|
+
className: "univer-max-w-[50%] univer-truncate univer-text-xs univer-text-gray-400",
|
|
1982
1997
|
children: item.path
|
|
1983
1998
|
})]
|
|
1984
1999
|
}, item.key)) })] })]
|
|
@@ -3221,6 +3236,21 @@ function useComponentsOfPart(part, injector) {
|
|
|
3221
3236
|
|
|
3222
3237
|
//#endregion
|
|
3223
3238
|
//#region src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
|
|
3239
|
+
/**
|
|
3240
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3241
|
+
*
|
|
3242
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3243
|
+
* you may not use this file except in compliance with the License.
|
|
3244
|
+
* You may obtain a copy of the License at
|
|
3245
|
+
*
|
|
3246
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3247
|
+
*
|
|
3248
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3249
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3250
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3251
|
+
* See the License for the specific language governing permissions and
|
|
3252
|
+
* limitations under the License.
|
|
3253
|
+
*/
|
|
3224
3254
|
function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3225
3255
|
const localeService = (0, _wendellhu_redi_react_bindings.useDependency)(_univerjs_core.LocaleService);
|
|
3226
3256
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -3234,7 +3264,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3234
3264
|
"aria-selected": isActive,
|
|
3235
3265
|
title: localeService.t(group.title || group.key),
|
|
3236
3266
|
onClick: () => onSelectTab(group),
|
|
3237
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
3267
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-cursor-pointer univer-appearance-none univer-items-center univer-gap-1 univer-rounded-sm univer-border-none univer-px-2 univer-py-1 univer-text-sm univer-transition-colors focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:focus:!univer-ring-primary-300", isActive ? "univer-bg-primary-50 univer-font-semibold univer-text-primary-600 univer-shadow-sm dark:!univer-bg-primary-900 dark:!univer-text-primary-300" : "univer-bg-transparent univer-text-gray-700 hover:univer-bg-gray-100 dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700"),
|
|
3238
3268
|
children: localeService.t(group.title || group.key)
|
|
3239
3269
|
}, group.key);
|
|
3240
3270
|
})
|
|
@@ -4929,6 +4959,21 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
4929
4959
|
|
|
4930
4960
|
//#endregion
|
|
4931
4961
|
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
4962
|
+
/**
|
|
4963
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4964
|
+
*
|
|
4965
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4966
|
+
* you may not use this file except in compliance with the License.
|
|
4967
|
+
* You may obtain a copy of the License at
|
|
4968
|
+
*
|
|
4969
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4970
|
+
*
|
|
4971
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4972
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4973
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4974
|
+
* See the License for the specific language governing permissions and
|
|
4975
|
+
* limitations under the License.
|
|
4976
|
+
*/
|
|
4932
4977
|
const EMPTY_HIDDEN_ITEM_IDS = [];
|
|
4933
4978
|
const EMPTY_TINY_MENU_CHILDREN = [];
|
|
4934
4979
|
const quickTileMenuButtonVariants = (0, _univerjs_design.cva)("univer-relative univer-box-border univer-flex univer-size-12 univer-w-full univer-appearance-none univer-flex-col univer-items-center univer-justify-center univer-gap-0.5 univer-rounded-lg univer-border-none univer-bg-gray-0 univer-p-0 univer-font-medium univer-text-gray-700 univer-outline-none univer-transition-all focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 focus-visible:univer-ring-offset-0 dark:!univer-bg-gray-700 dark:!univer-text-gray-100", {
|
|
@@ -5055,7 +5100,7 @@ function UIQuickTileMenuGroup(props) {
|
|
|
5055
5100
|
const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
|
|
5056
5101
|
if (!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) return null;
|
|
5057
5102
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
5058
|
-
className: "univer-
|
|
5103
|
+
className: "univer-grid univer-grid-cols-3 univer-items-center univer-gap-1.5 univer-py-1",
|
|
5059
5104
|
children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickTileMenuItem, {
|
|
5060
5105
|
menuSchema,
|
|
5061
5106
|
activeItemIds,
|
|
@@ -6370,7 +6415,7 @@ function Sidebar() {
|
|
|
6370
6415
|
}),
|
|
6371
6416
|
style: { width: isDragging ? void 0 : width },
|
|
6372
6417
|
children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6373
|
-
className: "
|
|
6418
|
+
className: "univer-absolute univer-left-0 univer-top-0 univer-z-20 univer-h-full univer-w-1 univer-cursor-col-resize univer-transition-colors hover:univer-bg-primary-500 active:univer-bg-primary-500",
|
|
6374
6419
|
onMouseDown: handleResizeMouseDown,
|
|
6375
6420
|
role: "separator",
|
|
6376
6421
|
"aria-orientation": "vertical",
|
|
@@ -6401,7 +6446,7 @@ function Sidebar() {
|
|
|
6401
6446
|
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
6402
6447
|
ref: closeButtonRef,
|
|
6403
6448
|
type: "button",
|
|
6404
|
-
className: "
|
|
6449
|
+
className: "univer-flex univer-size-6 univer-cursor-pointer univer-appearance-none univer-items-center univer-justify-center univer-rounded-sm univer-border-none univer-bg-transparent univer-p-0 univer-text-gray-500 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-500 dark:!univer-text-gray-300",
|
|
6405
6450
|
onClick: handleClose,
|
|
6406
6451
|
"aria-label": localeService.t("ui.sidebar.close"),
|
|
6407
6452
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
|
|
@@ -6630,16 +6675,8 @@ function useLatest(value) {
|
|
|
6630
6675
|
ref.current = value;
|
|
6631
6676
|
return ref;
|
|
6632
6677
|
}
|
|
6633
|
-
|
|
6634
|
-
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
6678
|
+
function useVirtualListMetrics(list, itemHeight) {
|
|
6635
6679
|
const itemHeightRef = useLatest(itemHeight);
|
|
6636
|
-
const [size, setSize] = (0, react.useState)(null);
|
|
6637
|
-
const scrollTriggerByScrollToFunc = (0, react.useRef)(false);
|
|
6638
|
-
const [targetList, setTargetList] = (0, react.useState)([]);
|
|
6639
|
-
const [wrapperStyle, setWrapperStyle] = (0, react.useState)({
|
|
6640
|
-
height: void 0,
|
|
6641
|
-
marginTop: void 0
|
|
6642
|
-
});
|
|
6643
6680
|
const getVisibleCount = (containerHeight, fromIndex) => {
|
|
6644
6681
|
if (typeof itemHeightRef.current === "number") return Math.ceil(containerHeight / itemHeightRef.current);
|
|
6645
6682
|
let sum = 0;
|
|
@@ -6670,29 +6707,18 @@ const useVirtualList = (list, options) => {
|
|
|
6670
6707
|
if (typeof itemHeightRef.current === "number") return index * itemHeightRef.current;
|
|
6671
6708
|
return list.slice(0, index).reduce((sum, _, i) => sum + itemHeightRef.current(i, list[i]), 0);
|
|
6672
6709
|
};
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
const offset = getOffset(scrollTop);
|
|
6682
|
-
const visibleCount = getVisibleCount(clientHeight, offset);
|
|
6683
|
-
const start = Math.max(0, offset - overscan);
|
|
6684
|
-
const end = Math.min(list.length, offset + visibleCount + overscan);
|
|
6685
|
-
const offsetTop = getDistanceTop(start);
|
|
6686
|
-
setWrapperStyle({
|
|
6687
|
-
height: `${totalHeight - offsetTop}px`,
|
|
6688
|
-
marginTop: `${offsetTop}px`
|
|
6689
|
-
});
|
|
6690
|
-
setTargetList(list.slice(start, end).map((ele, index) => ({
|
|
6691
|
-
data: ele,
|
|
6692
|
-
index: index + start
|
|
6693
|
-
})));
|
|
6694
|
-
}
|
|
6710
|
+
return {
|
|
6711
|
+
getVisibleCount,
|
|
6712
|
+
getOffset,
|
|
6713
|
+
getDistanceTop,
|
|
6714
|
+
totalHeight: (0, react.useMemo)(() => {
|
|
6715
|
+
if (isNumber(itemHeightRef.current)) return list.length * itemHeightRef.current;
|
|
6716
|
+
return list.reduce((sum, _, index) => sum + itemHeightRef.current(index, list[index]), 0);
|
|
6717
|
+
}, [list])
|
|
6695
6718
|
};
|
|
6719
|
+
}
|
|
6720
|
+
function useContainerSize(containerTarget) {
|
|
6721
|
+
const [size, setSize] = (0, react.useState)(null);
|
|
6696
6722
|
(0, react.useEffect)(() => {
|
|
6697
6723
|
if (containerTarget.current) {
|
|
6698
6724
|
const getSize = () => {
|
|
@@ -6711,6 +6737,37 @@ const useVirtualList = (list, options) => {
|
|
|
6711
6737
|
};
|
|
6712
6738
|
}
|
|
6713
6739
|
}, []);
|
|
6740
|
+
return size;
|
|
6741
|
+
}
|
|
6742
|
+
const useVirtualList = (list, options) => {
|
|
6743
|
+
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
6744
|
+
const { getVisibleCount, getOffset, getDistanceTop, totalHeight } = useVirtualListMetrics(list, itemHeight);
|
|
6745
|
+
const size = useContainerSize(containerTarget);
|
|
6746
|
+
const scrollTriggerByScrollToFunc = (0, react.useRef)(false);
|
|
6747
|
+
const [targetList, setTargetList] = (0, react.useState)([]);
|
|
6748
|
+
const [wrapperStyle, setWrapperStyle] = (0, react.useState)({
|
|
6749
|
+
height: void 0,
|
|
6750
|
+
marginTop: void 0
|
|
6751
|
+
});
|
|
6752
|
+
const calculateRange = () => {
|
|
6753
|
+
const container = containerTarget.current;
|
|
6754
|
+
if (container) {
|
|
6755
|
+
const { scrollTop, clientHeight } = container;
|
|
6756
|
+
const offset = getOffset(scrollTop);
|
|
6757
|
+
const visibleCount = getVisibleCount(clientHeight, offset);
|
|
6758
|
+
const start = Math.max(0, offset - overscan);
|
|
6759
|
+
const end = Math.min(list.length, offset + visibleCount + overscan);
|
|
6760
|
+
const offsetTop = getDistanceTop(start);
|
|
6761
|
+
setWrapperStyle({
|
|
6762
|
+
height: `${totalHeight - offsetTop}px`,
|
|
6763
|
+
marginTop: `${offsetTop}px`
|
|
6764
|
+
});
|
|
6765
|
+
setTargetList(list.slice(start, end).map((ele, index) => ({
|
|
6766
|
+
data: ele,
|
|
6767
|
+
index: index + start
|
|
6768
|
+
})));
|
|
6769
|
+
}
|
|
6770
|
+
};
|
|
6714
6771
|
(0, react.useEffect)(() => {
|
|
6715
6772
|
if (!(size === null || size === void 0 ? void 0 : size.width) || !(size === null || size === void 0 ? void 0 : size.height)) return;
|
|
6716
6773
|
calculateRange();
|
|
@@ -7036,7 +7093,7 @@ const IUIController = (0, _univerjs_core.createIdentifier)("univer.ui.ui-control
|
|
|
7036
7093
|
//#endregion
|
|
7037
7094
|
//#region package.json
|
|
7038
7095
|
var name = "@univerjs/ui";
|
|
7039
|
-
var version = "1.
|
|
7096
|
+
var version = "1.2.0";
|
|
7040
7097
|
|
|
7041
7098
|
//#endregion
|
|
7042
7099
|
//#region src/views/color-picker/interface.ts
|
|
@@ -22708,6 +22765,37 @@ function EmojiPicker(props) {
|
|
|
22708
22765
|
const recentStorageKey = (extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) ?? RECENTS_STORAGE_KEY;
|
|
22709
22766
|
const isSearching = deferredQuery.trim().length > 0;
|
|
22710
22767
|
const { rows, sectionPositions } = (0, react.useMemo)(() => {
|
|
22768
|
+
function createEmojiVirtualRows(sections, locale) {
|
|
22769
|
+
const rows = [];
|
|
22770
|
+
const sectionPositions = [];
|
|
22771
|
+
let top = 0;
|
|
22772
|
+
sections.forEach((section) => {
|
|
22773
|
+
if (!section.emojis.length) return;
|
|
22774
|
+
sectionPositions.push({
|
|
22775
|
+
key: section.key,
|
|
22776
|
+
rowIndex: rows.length,
|
|
22777
|
+
top
|
|
22778
|
+
});
|
|
22779
|
+
rows.push({
|
|
22780
|
+
key: `${locale}-${section.key}-header`,
|
|
22781
|
+
title: section.title,
|
|
22782
|
+
type: "header"
|
|
22783
|
+
});
|
|
22784
|
+
top += EMOJI_SECTION_HEADER_HEIGHT;
|
|
22785
|
+
for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
|
|
22786
|
+
rows.push({
|
|
22787
|
+
items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
|
|
22788
|
+
key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
|
|
22789
|
+
type: "emojis"
|
|
22790
|
+
});
|
|
22791
|
+
top += EMOJI_ROW_HEIGHT;
|
|
22792
|
+
}
|
|
22793
|
+
});
|
|
22794
|
+
return {
|
|
22795
|
+
rows,
|
|
22796
|
+
sectionPositions
|
|
22797
|
+
};
|
|
22798
|
+
}
|
|
22711
22799
|
const normalSections = [{
|
|
22712
22800
|
key: "recent",
|
|
22713
22801
|
title: localeService.t("ui.emojiPicker.recents"),
|
|
@@ -22732,7 +22820,7 @@ function EmojiPicker(props) {
|
|
|
22732
22820
|
]);
|
|
22733
22821
|
const [virtualRows, { containerProps, scrollTo, wrapperStyle }] = useVirtualList(rows, {
|
|
22734
22822
|
containerTarget: scrollRef,
|
|
22735
|
-
itemHeight:
|
|
22823
|
+
itemHeight: (_index, row) => row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT,
|
|
22736
22824
|
overscan: EMOJI_VIRTUAL_OVERSCAN
|
|
22737
22825
|
});
|
|
22738
22826
|
(0, react.useEffect)(() => {
|
|
@@ -22764,6 +22852,16 @@ function EmojiPicker(props) {
|
|
|
22764
22852
|
scrollTo,
|
|
22765
22853
|
sectionPositions
|
|
22766
22854
|
]);
|
|
22855
|
+
function writeStorageItem(localStorageService, storageKey, value) {
|
|
22856
|
+
localStorageService.setItem(storageKey, value).catch(() => void 0);
|
|
22857
|
+
}
|
|
22858
|
+
function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
|
|
22859
|
+
let active = "recent";
|
|
22860
|
+
sectionPositions.forEach((position) => {
|
|
22861
|
+
if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
|
|
22862
|
+
});
|
|
22863
|
+
return active;
|
|
22864
|
+
}
|
|
22767
22865
|
const handleSelect = (item, options) => {
|
|
22768
22866
|
var _props$onChange, _extraProps$onSelect;
|
|
22769
22867
|
const nextRecents = promoteRecentEmoji(recents, item);
|
|
@@ -22928,7 +23026,7 @@ function EmojiButton(props) {
|
|
|
22928
23026
|
type: "button",
|
|
22929
23027
|
"aria-label": `${title}, ${props.moreTitle}`,
|
|
22930
23028
|
title: `${title}, ${props.moreTitle}`,
|
|
22931
|
-
className: "univer-
|
|
23029
|
+
className: "univer-absolute univer-bottom-0 univer-right-0 univer-flex univer-size-3 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-sm univer-border-0 univer-bg-gray-0 univer-p-0 univer-text-gray-500 hover:univer-bg-gray-100 hover:univer-text-gray-700 focus-visible:univer-outline-none focus-visible:univer-ring-1 focus-visible:univer-ring-primary-600 dark:!univer-bg-gray-800 dark:!univer-text-gray-300 dark:hover:!univer-bg-gray-700",
|
|
22932
23030
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, { className: "!univer-size-2.5" })
|
|
22933
23031
|
})
|
|
22934
23032
|
})]
|
|
@@ -23016,50 +23114,6 @@ function CategoryButton(props) {
|
|
|
23016
23114
|
children: props.children
|
|
23017
23115
|
});
|
|
23018
23116
|
}
|
|
23019
|
-
function writeStorageItem(localStorageService, storageKey, value) {
|
|
23020
|
-
localStorageService.setItem(storageKey, value).catch(() => void 0);
|
|
23021
|
-
}
|
|
23022
|
-
function createEmojiVirtualRows(sections, locale) {
|
|
23023
|
-
const rows = [];
|
|
23024
|
-
const sectionPositions = [];
|
|
23025
|
-
let top = 0;
|
|
23026
|
-
sections.forEach((section) => {
|
|
23027
|
-
if (!section.emojis.length) return;
|
|
23028
|
-
sectionPositions.push({
|
|
23029
|
-
key: section.key,
|
|
23030
|
-
rowIndex: rows.length,
|
|
23031
|
-
top
|
|
23032
|
-
});
|
|
23033
|
-
rows.push({
|
|
23034
|
-
key: `${locale}-${section.key}-header`,
|
|
23035
|
-
title: section.title,
|
|
23036
|
-
type: "header"
|
|
23037
|
-
});
|
|
23038
|
-
top += EMOJI_SECTION_HEADER_HEIGHT;
|
|
23039
|
-
for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
|
|
23040
|
-
rows.push({
|
|
23041
|
-
items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
|
|
23042
|
-
key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
|
|
23043
|
-
type: "emojis"
|
|
23044
|
-
});
|
|
23045
|
-
top += EMOJI_ROW_HEIGHT;
|
|
23046
|
-
}
|
|
23047
|
-
});
|
|
23048
|
-
return {
|
|
23049
|
-
rows,
|
|
23050
|
-
sectionPositions
|
|
23051
|
-
};
|
|
23052
|
-
}
|
|
23053
|
-
function getEmojiVirtualRowHeight(_index, row) {
|
|
23054
|
-
return row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT;
|
|
23055
|
-
}
|
|
23056
|
-
function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
|
|
23057
|
-
let active = "recent";
|
|
23058
|
-
sectionPositions.forEach((position) => {
|
|
23059
|
-
if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
|
|
23060
|
-
});
|
|
23061
|
-
return active;
|
|
23062
|
-
}
|
|
23063
23117
|
function CategoryIcon(props) {
|
|
23064
23118
|
switch (props.category) {
|
|
23065
23119
|
case "activity": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ActivityIcon, {});
|
|
@@ -24123,7 +24177,7 @@ function MobileRibbonToolbar(props) {
|
|
|
24123
24177
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24124
24178
|
className: (0, _univerjs_design.clsx)("univer-flex univer-shrink-0 univer-items-center univer-gap-0.5 univer-pr-1.5 rtl:univer-pl-1.5 rtl:univer-pr-0", { [_univerjs_design.borderRightClassName]: groupIndex !== activeGroups.length - 1 }),
|
|
24125
24179
|
children: groupItems.map((child) => child.item && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24126
|
-
className: (0, _univerjs_design.clsx)("
|
|
24180
|
+
className: (0, _univerjs_design.clsx)("univer-flex univer-h-8 univer-shrink-0 univer-items-center univer-rounded-md [&_*]:univer-box-border [&_.univer-custom-label]:univer-text-sm [&_.univer-custom-label]:univer-leading-none [&_.univer-toolbar-button-selector-main]:!univer-h-8 [&_.univer-toolbar-button-selector-main]:!univer-rounded-none [&_.univer-toolbar-button-selector-main]:!univer-rounded-l-md [&_.univer-toolbar-button-selector-main]:!univer-px-1.5 [&_.univer-toolbar-button-selector-root]:!univer-h-8 [&_.univer-toolbar-button-selector-root]:univer-overflow-hidden [&_.univer-toolbar-button-selector-root]:!univer-rounded-md [&_.univer-toolbar-button-selector-root]:!univer-pr-0 [&_.univer-toolbar-button-selector-trigger]:!univer-static [&_.univer-toolbar-button-selector-trigger]:!univer-h-8 [&_.univer-toolbar-button-selector-trigger]:!univer-w-6 [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-none [&_.univer-toolbar-button-selector-trigger]:!univer-rounded-r-md [&_.univer-toolbar-selector-root]:!univer-h-8 [&_.univer-toolbar-selector-root]:!univer-gap-1 [&_.univer-toolbar-selector-root]:!univer-rounded-md [&_.univer-toolbar-selector-root]:!univer-px-1.5 [&_.univer-toolbar-selector-trigger]:!univer-pl-0.5 [&_.univer-tooltip]:univer-inline-flex [&_.univer-tooltip]:univer-h-full [&_.univer-tooltip]:univer-items-center [&_[data-u-command]]:!univer-h-8 [&_[data-u-command]]:!univer-min-h-8 [&_[data-u-command]]:!univer-rounded-md [&_[data-u-command]]:!univer-px-1.5 [&_button]:!univer-m-0 [&_button]:!univer-h-8 [&_button]:!univer-min-w-8 [&_button]:!univer-appearance-none [&_button]:!univer-rounded-md [&_button]:!univer-border-0 [&_button]:!univer-bg-transparent [&_button]:!univer-p-0 [&_button]:!univer-px-1.5 [&_button]:!univer-leading-none [&_button]:!univer-outline-none [&_button]:![font-family:inherit] [&_input]:!univer-m-0 [&_input]:!univer-appearance-none [&_input]:!univer-border-0 [&_input]:!univer-bg-transparent [&_input]:!univer-p-0 [&_input]:!univer-leading-none [&_input]:!univer-outline-none"),
|
|
24127
24181
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileToolbarItem, {
|
|
24128
24182
|
...child.item,
|
|
24129
24183
|
preserveStrokeWidth: true
|
|
@@ -27798,7 +27852,7 @@ function Slider(props) {
|
|
|
27798
27852
|
onPointerDown: handlePointerDown,
|
|
27799
27853
|
children: [
|
|
27800
27854
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
27801
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
27855
|
+
className: (0, _univerjs_design.clsx)("univer-absolute univer-top-0 univer-h-full univer-rounded-full univer-bg-primary-500", isRtl ? "univer-right-0" : "univer-left-0"),
|
|
27802
27856
|
style: { width: `${sliderOffset}%` }
|
|
27803
27857
|
}),
|
|
27804
27858
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|