@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/index.js
CHANGED
|
@@ -1834,17 +1834,23 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1834
1834
|
|
|
1835
1835
|
//#endregion
|
|
1836
1836
|
//#region src/views/components/feature-search/FeatureSearch.tsx
|
|
1837
|
+
/**
|
|
1838
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1839
|
+
*
|
|
1840
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1841
|
+
* you may not use this file except in compliance with the License.
|
|
1842
|
+
* You may obtain a copy of the License at
|
|
1843
|
+
*
|
|
1844
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1845
|
+
*
|
|
1846
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1847
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1848
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1849
|
+
* See the License for the specific language governing permissions and
|
|
1850
|
+
* limitations under the License.
|
|
1851
|
+
*/
|
|
1837
1852
|
const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
|
|
1838
1853
|
const FEATURE_SEARCH_DIALOG_ID = "FEATURE_SEARCH_DIALOG";
|
|
1839
|
-
function resolveParams(item, value) {
|
|
1840
|
-
return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
|
|
1841
|
-
}
|
|
1842
|
-
function resolveOptionParams(option) {
|
|
1843
|
-
return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
|
|
1844
|
-
}
|
|
1845
|
-
function deduplicate(items) {
|
|
1846
|
-
return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && Tools.diffValue(candidate.params, item.params)) === index);
|
|
1847
|
-
}
|
|
1848
1854
|
function FeatureSearch() {
|
|
1849
1855
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
1850
1856
|
const localeService = useDependency(LocaleService);
|
|
@@ -1853,6 +1859,15 @@ function FeatureSearch() {
|
|
|
1853
1859
|
const layoutService = useDependency(ILayoutService);
|
|
1854
1860
|
const ribbonService = useDependency(IRibbonService);
|
|
1855
1861
|
const items$ = useMemo(() => {
|
|
1862
|
+
function resolveParams(item, value) {
|
|
1863
|
+
return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
|
|
1864
|
+
}
|
|
1865
|
+
function resolveOptionParams(option) {
|
|
1866
|
+
return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
|
|
1867
|
+
}
|
|
1868
|
+
function deduplicate(items) {
|
|
1869
|
+
return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && Tools.diffValue(candidate.params, item.params)) === index);
|
|
1870
|
+
}
|
|
1856
1871
|
function getItemTitle(item) {
|
|
1857
1872
|
const titleKey = item.title ?? item.tooltip ?? item.description;
|
|
1858
1873
|
return titleKey ? localeService.t(titleKey) : "";
|
|
@@ -1977,7 +1992,7 @@ function FeatureSearch() {
|
|
|
1977
1992
|
children: item.title
|
|
1978
1993
|
})]
|
|
1979
1994
|
}), item.path && /* @__PURE__ */ jsx("span", {
|
|
1980
|
-
className: "univer-max-w-
|
|
1995
|
+
className: "univer-max-w-[50%] univer-truncate univer-text-xs univer-text-gray-400",
|
|
1981
1996
|
children: item.path
|
|
1982
1997
|
})]
|
|
1983
1998
|
}, item.key)) })] })]
|
|
@@ -3220,6 +3235,21 @@ function useComponentsOfPart(part, injector) {
|
|
|
3220
3235
|
|
|
3221
3236
|
//#endregion
|
|
3222
3237
|
//#region src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
|
|
3238
|
+
/**
|
|
3239
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3240
|
+
*
|
|
3241
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3242
|
+
* you may not use this file except in compliance with the License.
|
|
3243
|
+
* You may obtain a copy of the License at
|
|
3244
|
+
*
|
|
3245
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3246
|
+
*
|
|
3247
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3248
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3249
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3250
|
+
* See the License for the specific language governing permissions and
|
|
3251
|
+
* limitations under the License.
|
|
3252
|
+
*/
|
|
3223
3253
|
function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3224
3254
|
const localeService = useDependency(LocaleService);
|
|
3225
3255
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -3233,7 +3263,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3233
3263
|
"aria-selected": isActive,
|
|
3234
3264
|
title: localeService.t(group.title || group.key),
|
|
3235
3265
|
onClick: () => onSelectTab(group),
|
|
3236
|
-
className: clsx("univer-
|
|
3266
|
+
className: 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"),
|
|
3237
3267
|
children: localeService.t(group.title || group.key)
|
|
3238
3268
|
}, group.key);
|
|
3239
3269
|
})
|
|
@@ -4928,6 +4958,21 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
4928
4958
|
|
|
4929
4959
|
//#endregion
|
|
4930
4960
|
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
4961
|
+
/**
|
|
4962
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4963
|
+
*
|
|
4964
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4965
|
+
* you may not use this file except in compliance with the License.
|
|
4966
|
+
* You may obtain a copy of the License at
|
|
4967
|
+
*
|
|
4968
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4969
|
+
*
|
|
4970
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4971
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4972
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4973
|
+
* See the License for the specific language governing permissions and
|
|
4974
|
+
* limitations under the License.
|
|
4975
|
+
*/
|
|
4931
4976
|
const EMPTY_HIDDEN_ITEM_IDS = [];
|
|
4932
4977
|
const EMPTY_TINY_MENU_CHILDREN = [];
|
|
4933
4978
|
const quickTileMenuButtonVariants = 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", {
|
|
@@ -5054,7 +5099,7 @@ function UIQuickTileMenuGroup(props) {
|
|
|
5054
5099
|
const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
|
|
5055
5100
|
if (!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) return null;
|
|
5056
5101
|
return /* @__PURE__ */ jsx("div", {
|
|
5057
|
-
className: "univer-
|
|
5102
|
+
className: "univer-grid univer-grid-cols-3 univer-items-center univer-gap-1.5 univer-py-1",
|
|
5058
5103
|
children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ jsx(QuickTileMenuItem, {
|
|
5059
5104
|
menuSchema,
|
|
5060
5105
|
activeItemIds,
|
|
@@ -6369,7 +6414,7 @@ function Sidebar() {
|
|
|
6369
6414
|
}),
|
|
6370
6415
|
style: { width: isDragging ? void 0 : width },
|
|
6371
6416
|
children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ jsx("div", {
|
|
6372
|
-
className: "
|
|
6417
|
+
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",
|
|
6373
6418
|
onMouseDown: handleResizeMouseDown,
|
|
6374
6419
|
role: "separator",
|
|
6375
6420
|
"aria-orientation": "vertical",
|
|
@@ -6400,7 +6445,7 @@ function Sidebar() {
|
|
|
6400
6445
|
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ jsx("button", {
|
|
6401
6446
|
ref: closeButtonRef,
|
|
6402
6447
|
type: "button",
|
|
6403
|
-
className: "
|
|
6448
|
+
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",
|
|
6404
6449
|
onClick: handleClose,
|
|
6405
6450
|
"aria-label": localeService.t("ui.sidebar.close"),
|
|
6406
6451
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
@@ -6629,16 +6674,8 @@ function useLatest(value) {
|
|
|
6629
6674
|
ref.current = value;
|
|
6630
6675
|
return ref;
|
|
6631
6676
|
}
|
|
6632
|
-
|
|
6633
|
-
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
6677
|
+
function useVirtualListMetrics(list, itemHeight) {
|
|
6634
6678
|
const itemHeightRef = useLatest(itemHeight);
|
|
6635
|
-
const [size, setSize] = useState(null);
|
|
6636
|
-
const scrollTriggerByScrollToFunc = useRef(false);
|
|
6637
|
-
const [targetList, setTargetList] = useState([]);
|
|
6638
|
-
const [wrapperStyle, setWrapperStyle] = useState({
|
|
6639
|
-
height: void 0,
|
|
6640
|
-
marginTop: void 0
|
|
6641
|
-
});
|
|
6642
6679
|
const getVisibleCount = (containerHeight, fromIndex) => {
|
|
6643
6680
|
if (typeof itemHeightRef.current === "number") return Math.ceil(containerHeight / itemHeightRef.current);
|
|
6644
6681
|
let sum = 0;
|
|
@@ -6669,29 +6706,18 @@ const useVirtualList = (list, options) => {
|
|
|
6669
6706
|
if (typeof itemHeightRef.current === "number") return index * itemHeightRef.current;
|
|
6670
6707
|
return list.slice(0, index).reduce((sum, _, i) => sum + itemHeightRef.current(i, list[i]), 0);
|
|
6671
6708
|
};
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
const offset = getOffset(scrollTop);
|
|
6681
|
-
const visibleCount = getVisibleCount(clientHeight, offset);
|
|
6682
|
-
const start = Math.max(0, offset - overscan);
|
|
6683
|
-
const end = Math.min(list.length, offset + visibleCount + overscan);
|
|
6684
|
-
const offsetTop = getDistanceTop(start);
|
|
6685
|
-
setWrapperStyle({
|
|
6686
|
-
height: `${totalHeight - offsetTop}px`,
|
|
6687
|
-
marginTop: `${offsetTop}px`
|
|
6688
|
-
});
|
|
6689
|
-
setTargetList(list.slice(start, end).map((ele, index) => ({
|
|
6690
|
-
data: ele,
|
|
6691
|
-
index: index + start
|
|
6692
|
-
})));
|
|
6693
|
-
}
|
|
6709
|
+
return {
|
|
6710
|
+
getVisibleCount,
|
|
6711
|
+
getOffset,
|
|
6712
|
+
getDistanceTop,
|
|
6713
|
+
totalHeight: useMemo(() => {
|
|
6714
|
+
if (isNumber(itemHeightRef.current)) return list.length * itemHeightRef.current;
|
|
6715
|
+
return list.reduce((sum, _, index) => sum + itemHeightRef.current(index, list[index]), 0);
|
|
6716
|
+
}, [list])
|
|
6694
6717
|
};
|
|
6718
|
+
}
|
|
6719
|
+
function useContainerSize(containerTarget) {
|
|
6720
|
+
const [size, setSize] = useState(null);
|
|
6695
6721
|
useEffect(() => {
|
|
6696
6722
|
if (containerTarget.current) {
|
|
6697
6723
|
const getSize = () => {
|
|
@@ -6710,6 +6736,37 @@ const useVirtualList = (list, options) => {
|
|
|
6710
6736
|
};
|
|
6711
6737
|
}
|
|
6712
6738
|
}, []);
|
|
6739
|
+
return size;
|
|
6740
|
+
}
|
|
6741
|
+
const useVirtualList = (list, options) => {
|
|
6742
|
+
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
6743
|
+
const { getVisibleCount, getOffset, getDistanceTop, totalHeight } = useVirtualListMetrics(list, itemHeight);
|
|
6744
|
+
const size = useContainerSize(containerTarget);
|
|
6745
|
+
const scrollTriggerByScrollToFunc = useRef(false);
|
|
6746
|
+
const [targetList, setTargetList] = useState([]);
|
|
6747
|
+
const [wrapperStyle, setWrapperStyle] = useState({
|
|
6748
|
+
height: void 0,
|
|
6749
|
+
marginTop: void 0
|
|
6750
|
+
});
|
|
6751
|
+
const calculateRange = () => {
|
|
6752
|
+
const container = containerTarget.current;
|
|
6753
|
+
if (container) {
|
|
6754
|
+
const { scrollTop, clientHeight } = container;
|
|
6755
|
+
const offset = getOffset(scrollTop);
|
|
6756
|
+
const visibleCount = getVisibleCount(clientHeight, offset);
|
|
6757
|
+
const start = Math.max(0, offset - overscan);
|
|
6758
|
+
const end = Math.min(list.length, offset + visibleCount + overscan);
|
|
6759
|
+
const offsetTop = getDistanceTop(start);
|
|
6760
|
+
setWrapperStyle({
|
|
6761
|
+
height: `${totalHeight - offsetTop}px`,
|
|
6762
|
+
marginTop: `${offsetTop}px`
|
|
6763
|
+
});
|
|
6764
|
+
setTargetList(list.slice(start, end).map((ele, index) => ({
|
|
6765
|
+
data: ele,
|
|
6766
|
+
index: index + start
|
|
6767
|
+
})));
|
|
6768
|
+
}
|
|
6769
|
+
};
|
|
6713
6770
|
useEffect(() => {
|
|
6714
6771
|
if (!(size === null || size === void 0 ? void 0 : size.width) || !(size === null || size === void 0 ? void 0 : size.height)) return;
|
|
6715
6772
|
calculateRange();
|
|
@@ -7035,7 +7092,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
|
7035
7092
|
//#endregion
|
|
7036
7093
|
//#region package.json
|
|
7037
7094
|
var name = "@univerjs/ui";
|
|
7038
|
-
var version = "1.
|
|
7095
|
+
var version = "1.2.0";
|
|
7039
7096
|
|
|
7040
7097
|
//#endregion
|
|
7041
7098
|
//#region src/views/color-picker/interface.ts
|
|
@@ -22707,6 +22764,37 @@ function EmojiPicker(props) {
|
|
|
22707
22764
|
const recentStorageKey = (extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) ?? RECENTS_STORAGE_KEY;
|
|
22708
22765
|
const isSearching = deferredQuery.trim().length > 0;
|
|
22709
22766
|
const { rows, sectionPositions } = useMemo(() => {
|
|
22767
|
+
function createEmojiVirtualRows(sections, locale) {
|
|
22768
|
+
const rows = [];
|
|
22769
|
+
const sectionPositions = [];
|
|
22770
|
+
let top = 0;
|
|
22771
|
+
sections.forEach((section) => {
|
|
22772
|
+
if (!section.emojis.length) return;
|
|
22773
|
+
sectionPositions.push({
|
|
22774
|
+
key: section.key,
|
|
22775
|
+
rowIndex: rows.length,
|
|
22776
|
+
top
|
|
22777
|
+
});
|
|
22778
|
+
rows.push({
|
|
22779
|
+
key: `${locale}-${section.key}-header`,
|
|
22780
|
+
title: section.title,
|
|
22781
|
+
type: "header"
|
|
22782
|
+
});
|
|
22783
|
+
top += EMOJI_SECTION_HEADER_HEIGHT;
|
|
22784
|
+
for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
|
|
22785
|
+
rows.push({
|
|
22786
|
+
items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
|
|
22787
|
+
key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
|
|
22788
|
+
type: "emojis"
|
|
22789
|
+
});
|
|
22790
|
+
top += EMOJI_ROW_HEIGHT;
|
|
22791
|
+
}
|
|
22792
|
+
});
|
|
22793
|
+
return {
|
|
22794
|
+
rows,
|
|
22795
|
+
sectionPositions
|
|
22796
|
+
};
|
|
22797
|
+
}
|
|
22710
22798
|
const normalSections = [{
|
|
22711
22799
|
key: "recent",
|
|
22712
22800
|
title: localeService.t("ui.emojiPicker.recents"),
|
|
@@ -22731,7 +22819,7 @@ function EmojiPicker(props) {
|
|
|
22731
22819
|
]);
|
|
22732
22820
|
const [virtualRows, { containerProps, scrollTo, wrapperStyle }] = useVirtualList(rows, {
|
|
22733
22821
|
containerTarget: scrollRef,
|
|
22734
|
-
itemHeight:
|
|
22822
|
+
itemHeight: (_index, row) => row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT,
|
|
22735
22823
|
overscan: EMOJI_VIRTUAL_OVERSCAN
|
|
22736
22824
|
});
|
|
22737
22825
|
useEffect(() => {
|
|
@@ -22763,6 +22851,16 @@ function EmojiPicker(props) {
|
|
|
22763
22851
|
scrollTo,
|
|
22764
22852
|
sectionPositions
|
|
22765
22853
|
]);
|
|
22854
|
+
function writeStorageItem(localStorageService, storageKey, value) {
|
|
22855
|
+
localStorageService.setItem(storageKey, value).catch(() => void 0);
|
|
22856
|
+
}
|
|
22857
|
+
function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
|
|
22858
|
+
let active = "recent";
|
|
22859
|
+
sectionPositions.forEach((position) => {
|
|
22860
|
+
if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
|
|
22861
|
+
});
|
|
22862
|
+
return active;
|
|
22863
|
+
}
|
|
22766
22864
|
const handleSelect = (item, options) => {
|
|
22767
22865
|
var _props$onChange, _extraProps$onSelect;
|
|
22768
22866
|
const nextRecents = promoteRecentEmoji(recents, item);
|
|
@@ -22927,7 +23025,7 @@ function EmojiButton(props) {
|
|
|
22927
23025
|
type: "button",
|
|
22928
23026
|
"aria-label": `${title}, ${props.moreTitle}`,
|
|
22929
23027
|
title: `${title}, ${props.moreTitle}`,
|
|
22930
|
-
className: "univer-
|
|
23028
|
+
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",
|
|
22931
23029
|
children: /* @__PURE__ */ jsx(MoreDownIcon, { className: "!univer-size-2.5" })
|
|
22932
23030
|
})
|
|
22933
23031
|
})]
|
|
@@ -23015,50 +23113,6 @@ function CategoryButton(props) {
|
|
|
23015
23113
|
children: props.children
|
|
23016
23114
|
});
|
|
23017
23115
|
}
|
|
23018
|
-
function writeStorageItem(localStorageService, storageKey, value) {
|
|
23019
|
-
localStorageService.setItem(storageKey, value).catch(() => void 0);
|
|
23020
|
-
}
|
|
23021
|
-
function createEmojiVirtualRows(sections, locale) {
|
|
23022
|
-
const rows = [];
|
|
23023
|
-
const sectionPositions = [];
|
|
23024
|
-
let top = 0;
|
|
23025
|
-
sections.forEach((section) => {
|
|
23026
|
-
if (!section.emojis.length) return;
|
|
23027
|
-
sectionPositions.push({
|
|
23028
|
-
key: section.key,
|
|
23029
|
-
rowIndex: rows.length,
|
|
23030
|
-
top
|
|
23031
|
-
});
|
|
23032
|
-
rows.push({
|
|
23033
|
-
key: `${locale}-${section.key}-header`,
|
|
23034
|
-
title: section.title,
|
|
23035
|
-
type: "header"
|
|
23036
|
-
});
|
|
23037
|
-
top += EMOJI_SECTION_HEADER_HEIGHT;
|
|
23038
|
-
for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
|
|
23039
|
-
rows.push({
|
|
23040
|
-
items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
|
|
23041
|
-
key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
|
|
23042
|
-
type: "emojis"
|
|
23043
|
-
});
|
|
23044
|
-
top += EMOJI_ROW_HEIGHT;
|
|
23045
|
-
}
|
|
23046
|
-
});
|
|
23047
|
-
return {
|
|
23048
|
-
rows,
|
|
23049
|
-
sectionPositions
|
|
23050
|
-
};
|
|
23051
|
-
}
|
|
23052
|
-
function getEmojiVirtualRowHeight(_index, row) {
|
|
23053
|
-
return row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT;
|
|
23054
|
-
}
|
|
23055
|
-
function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
|
|
23056
|
-
let active = "recent";
|
|
23057
|
-
sectionPositions.forEach((position) => {
|
|
23058
|
-
if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
|
|
23059
|
-
});
|
|
23060
|
-
return active;
|
|
23061
|
-
}
|
|
23062
23116
|
function CategoryIcon(props) {
|
|
23063
23117
|
switch (props.category) {
|
|
23064
23118
|
case "activity": return /* @__PURE__ */ jsx(ActivityIcon, {});
|
|
@@ -24122,7 +24176,7 @@ function MobileRibbonToolbar(props) {
|
|
|
24122
24176
|
return /* @__PURE__ */ jsx("div", {
|
|
24123
24177
|
className: 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", { [borderRightClassName]: groupIndex !== activeGroups.length - 1 }),
|
|
24124
24178
|
children: groupItems.map((child) => child.item && /* @__PURE__ */ jsx("div", {
|
|
24125
|
-
className: clsx("
|
|
24179
|
+
className: 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"),
|
|
24126
24180
|
children: /* @__PURE__ */ jsx(MobileToolbarItem, {
|
|
24127
24181
|
...child.item,
|
|
24128
24182
|
preserveStrokeWidth: true
|
|
@@ -27797,7 +27851,7 @@ function Slider(props) {
|
|
|
27797
27851
|
onPointerDown: handlePointerDown,
|
|
27798
27852
|
children: [
|
|
27799
27853
|
/* @__PURE__ */ jsx("div", {
|
|
27800
|
-
className: clsx("univer-
|
|
27854
|
+
className: clsx("univer-absolute univer-top-0 univer-h-full univer-rounded-full univer-bg-primary-500", isRtl ? "univer-right-0" : "univer-left-0"),
|
|
27801
27855
|
style: { width: `${sliderOffset}%` }
|
|
27802
27856
|
}),
|
|
27803
27857
|
/* @__PURE__ */ jsx("a", {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IPopup } from '../../services/popup/canvas-popup.service';
|
|
17
16
|
import { Dropdown } from '@univerjs/design';
|
|
17
|
+
import type { IPopup } from '../../services/popup/canvas-popup.service';
|
|
18
18
|
export declare const EMOJI_PICKER_COMPONENT = "ui.emoji-picker";
|
|
19
19
|
interface IEmojiPickerPopupProps {
|
|
20
20
|
activeEmoji?: string;
|
|
@@ -35,7 +35,7 @@ export declare const EMOJI_SKIN_TONE_OPTIONS: ReadonlyArray<IEmojiVariant & {
|
|
|
35
35
|
export declare const EMOJI_RECENT_LIMIT = 11;
|
|
36
36
|
export declare const EMOJI_CATEGORIES: {
|
|
37
37
|
key: EmojiCategory;
|
|
38
|
-
titleKey: "ui.row" | "ui.column" | "ui.clearFormatting" | "ui.formatPainter" | "ui.common-edit" | "ui.toggle-shortcut-panel" | "ui.global-shortcut" | "ui.fontFamily.not-supported" | "ui.
|
|
38
|
+
titleKey: "ui.row" | "ui.column" | "ui.clearFormatting" | "ui.formatPainter" | "ui.common-edit" | "ui.toggle-shortcut-panel" | "ui.global-shortcut" | "ui.fontFamily.not-supported" | "ui.navigation.back" | "ui.navigation.next" | "ui.navigation.previous" | "ui.toolbar.heading.title" | "ui.toolbar.heading.normal" | "ui.toolbar.heading.subTitle" | "ui.accessibility.menu" | "ui.accessibility.zoom" | "ui.accessibility.zoomIn" | "ui.accessibility.zoomOut" | "ui.accessibility.resetZoom" | "ui.ribbon.start" | "ui.ribbon.view" | "ui.ribbon.insert" | "ui.ribbon.data" | "ui.ribbon.startDesc" | "ui.ribbon.insertDesc" | "ui.ribbon.formulas" | "ui.ribbon.formulasDesc" | "ui.ribbon.dataDesc" | "ui.ribbon.viewDesc" | "ui.ribbon.others" | "ui.ribbon.othersDesc" | "ui.ribbon.more" | "ui.clipboard.authentication.title" | "ui.clipboard.authentication.content" | "ui.objectPermission.all" | "ui.objectPermission.title" | "ui.objectPermission.paragraph" | "ui.objectPermission.table" | "ui.objectPermission.page" | "ui.objectPermission.empty" | "ui.objectPermission.field" | "ui.objectPermission.record" | "ui.objectPermission.view" | "ui.objectPermission.error" | "ui.objectPermission.search" | "ui.objectPermission.document" | "ui.objectPermission.remove" | "ui.objectPermission.owner" | "ui.objectPermission.members" | "ui.objectPermission.edit" | "ui.objectPermission.comment" | "ui.objectPermission.cancel" | "ui.objectPermission.copy" | "ui.objectPermission.base" | "ui.objectPermission.presentation" | "ui.objectPermission.section" | "ui.objectPermission.loading" | "ui.objectPermission.more" | "ui.objectPermission.operationDenied" | "ui.objectPermission.roleOwner" | "ui.objectPermission.roleEditor" | "ui.objectPermission.selectedCount" | "ui.objectPermission.searchPeople" | "ui.objectPermission.noMatchingPeople" | "ui.objectPermission.loadMore" | "ui.objectPermission.fileHint" | "ui.objectPermission.documentParent" | "ui.objectPermission.paragraphParent" | "ui.objectPermission.documentObjectParent" | "ui.objectPermission.slideParent" | "ui.objectPermission.slideObjectParent" | "ui.objectPermission.baseParent" | "ui.objectPermission.baseObjectParent" | "ui.objectPermission.recordParent" | "ui.objectPermission.boardParent" | "ui.objectPermission.ownerInherit" | "ui.objectPermission.peopleError" | "ui.objectPermission.entity" | "ui.objectPermission.master" | "ui.objectPermission.board" | "ui.objectPermission.objectName" | "ui.objectPermission.save" | "ui.objectPermission.saving" | "ui.objectPermission.conflict" | "ui.objectPermission.reload" | "ui.objectPermission.denied" | "ui.objectPermission.print" | "ui.objectPermission.export" | "ui.objectPermission.parentHint" | "ui.featureSearch.title" | "ui.featureSearch.empty" | "ui.featureSearch.placeholder" | "ui.featureSearch.contextMenu" | "ui.featureSearch.ribbon" | "ui.emojiPicker.search" | "ui.emojiPicker.objects" | "ui.emojiPicker.animals" | "ui.emojiPicker.food" | "ui.emojiPicker.random" | "ui.emojiPicker.recents" | "ui.emojiPicker.emojis" | "ui.emojiPicker.activities" | "ui.emojiPicker.places" | "ui.emojiPicker.symbols" | "ui.emojiPicker.searchResults" | "ui.emojiPicker.noResults" | `ui.emojiPicker.emojiSearchIndex.${string}` | `ui.emojiPicker.emojiTitles.${string}` | "ui.symbolPicker.mathematics" | "ui.symbolPicker.greek" | "ui.symbolPicker.common" | "ui.shortcut-panel.title" | "ui.shortcut.copy" | "ui.shortcut.cut" | "ui.shortcut.paste" | "ui.shortcut.shortcut-panel" | "ui.shortcut.undo" | "ui.shortcut.redo" | "ui.sidebar.close" | "ui.sidebar.resize" | "ui.sidebar.panel" | "ui.beforeClose.title" | "ui.rangeSelector.cancel";
|
|
39
39
|
}[];
|
|
40
40
|
export declare function getDefaultRecentEmojis(): IEmojiItem[];
|
|
41
41
|
export declare function getAllEmojis(): IEmojiItem[];
|