@univerjs/ui 1.1.0 → 1.3.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 +912 -618
- package/lib/cjs/locale/ar-SA.js +16 -1
- package/lib/cjs/locale/ca-ES.js +16 -1
- package/lib/cjs/locale/de-DE.js +16 -1
- package/lib/cjs/locale/en-US.js +16 -1
- package/lib/cjs/locale/es-ES.js +16 -1
- package/lib/cjs/locale/fa-IR.js +16 -1
- package/lib/cjs/locale/fr-FR.js +16 -1
- package/lib/cjs/locale/id-ID.js +16 -1
- package/lib/cjs/locale/it-IT.js +16 -1
- package/lib/cjs/locale/ja-JP.js +16 -1
- package/lib/cjs/locale/ko-KR.js +16 -1
- package/lib/cjs/locale/pl-PL.js +16 -1
- package/lib/cjs/locale/pt-BR.js +16 -1
- package/lib/cjs/locale/ru-RU.js +16 -1
- package/lib/cjs/locale/sk-SK.js +16 -1
- package/lib/cjs/locale/vi-VN.js +16 -1
- package/lib/cjs/locale/zh-CN.js +16 -1
- package/lib/cjs/locale/zh-HK.js +16 -1
- package/lib/cjs/locale/zh-TW.js +16 -1
- package/lib/es/index.js +912 -619
- package/lib/es/locale/ar-SA.js +16 -1
- package/lib/es/locale/ca-ES.js +16 -1
- package/lib/es/locale/de-DE.js +16 -1
- package/lib/es/locale/en-US.js +16 -1
- package/lib/es/locale/es-ES.js +16 -1
- package/lib/es/locale/fa-IR.js +16 -1
- package/lib/es/locale/fr-FR.js +16 -1
- package/lib/es/locale/id-ID.js +16 -1
- package/lib/es/locale/it-IT.js +16 -1
- package/lib/es/locale/ja-JP.js +16 -1
- package/lib/es/locale/ko-KR.js +16 -1
- package/lib/es/locale/pl-PL.js +16 -1
- package/lib/es/locale/pt-BR.js +16 -1
- package/lib/es/locale/ru-RU.js +16 -1
- package/lib/es/locale/sk-SK.js +16 -1
- package/lib/es/locale/vi-VN.js +16 -1
- package/lib/es/locale/zh-CN.js +16 -1
- package/lib/es/locale/zh-HK.js +16 -1
- package/lib/es/locale/zh-TW.js +16 -1
- package/lib/index.css +126 -31
- package/lib/index.js +912 -619
- package/lib/locale/ar-SA.js +16 -1
- package/lib/locale/ca-ES.js +16 -1
- package/lib/locale/de-DE.js +16 -1
- package/lib/locale/en-US.js +16 -1
- package/lib/locale/es-ES.js +16 -1
- package/lib/locale/fa-IR.js +16 -1
- package/lib/locale/fr-FR.js +16 -1
- package/lib/locale/id-ID.js +16 -1
- package/lib/locale/it-IT.js +16 -1
- package/lib/locale/ja-JP.js +16 -1
- package/lib/locale/ko-KR.js +16 -1
- package/lib/locale/pl-PL.js +16 -1
- package/lib/locale/pt-BR.js +16 -1
- package/lib/locale/ru-RU.js +16 -1
- package/lib/locale/sk-SK.js +16 -1
- package/lib/locale/vi-VN.js +16 -1
- package/lib/locale/zh-CN.js +16 -1
- package/lib/locale/zh-HK.js +16 -1
- package/lib/locale/zh-TW.js +16 -1
- package/lib/types/facade/f-univer.d.ts +5 -3
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/en-US.d.ts +15 -0
- package/lib/types/services/font.service.d.ts +9 -2
- package/lib/types/services/menu/menu-manager.service.d.ts +1 -1
- package/lib/types/views/components/ribbon/RibbonOverflow.d.ts +22 -0
- package/lib/types/views/components/ribbon/ToolbarItem.d.ts +1 -0
- package/lib/types/views/components/ribbon/hook.d.ts +2 -2
- 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/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1374,45 +1374,102 @@ let MenuManagerService = _MenuManagerService = class MenuManagerService extends
|
|
|
1374
1374
|
["ribbon.start"]: {
|
|
1375
1375
|
order: 0,
|
|
1376
1376
|
title: "ui.ribbon.start",
|
|
1377
|
-
["ribbon.start.history"]: {
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
["ribbon.start.
|
|
1377
|
+
["ribbon.start.history"]: {
|
|
1378
|
+
order: 0,
|
|
1379
|
+
title: "ui.ribbon.groups.clipboard"
|
|
1380
|
+
},
|
|
1381
|
+
["ribbon.start.format"]: {
|
|
1382
|
+
order: 1,
|
|
1383
|
+
title: "ui.ribbon.groups.font"
|
|
1384
|
+
},
|
|
1385
|
+
["ribbon.start.layout"]: {
|
|
1386
|
+
order: 2,
|
|
1387
|
+
title: "ui.ribbon.groups.layout"
|
|
1388
|
+
},
|
|
1389
|
+
["ribbon.start.number"]: {
|
|
1390
|
+
order: 3,
|
|
1391
|
+
title: "ui.ribbon.groups.number"
|
|
1392
|
+
},
|
|
1393
|
+
["ribbon.start.others"]: {
|
|
1394
|
+
order: 4,
|
|
1395
|
+
title: "ui.ribbon.groups.tools"
|
|
1396
|
+
}
|
|
1382
1397
|
},
|
|
1383
1398
|
["ribbon.insert"]: {
|
|
1384
1399
|
order: 1,
|
|
1385
1400
|
title: "ui.ribbon.insert",
|
|
1386
|
-
["ribbon.insert.edit"]: {
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1401
|
+
["ribbon.insert.edit"]: {
|
|
1402
|
+
order: 0,
|
|
1403
|
+
title: "ui.ribbon.groups.editing"
|
|
1404
|
+
},
|
|
1405
|
+
["ribbon.insert.media"]: {
|
|
1406
|
+
order: 1,
|
|
1407
|
+
title: "ui.ribbon.groups.media"
|
|
1408
|
+
},
|
|
1409
|
+
["ribbon.insert.cell"]: {
|
|
1410
|
+
order: 2,
|
|
1411
|
+
title: "ui.ribbon.groups.cells"
|
|
1412
|
+
},
|
|
1413
|
+
["ribbon.insert.others"]: {
|
|
1414
|
+
order: 3,
|
|
1415
|
+
title: "ui.ribbon.groups.tools"
|
|
1416
|
+
}
|
|
1390
1417
|
},
|
|
1391
1418
|
["ribbon.formulas"]: {
|
|
1392
1419
|
order: 2,
|
|
1393
1420
|
title: "ui.ribbon.formulas",
|
|
1394
|
-
["ribbon.formulas.basic"]: {
|
|
1395
|
-
|
|
1421
|
+
["ribbon.formulas.basic"]: {
|
|
1422
|
+
order: 0,
|
|
1423
|
+
title: "ui.ribbon.groups.formulas"
|
|
1424
|
+
},
|
|
1425
|
+
["ribbon.formulas.others"]: {
|
|
1426
|
+
order: 1,
|
|
1427
|
+
title: "ui.ribbon.groups.tools"
|
|
1428
|
+
}
|
|
1396
1429
|
},
|
|
1397
1430
|
["ribbon.data"]: {
|
|
1398
1431
|
order: 3,
|
|
1399
1432
|
title: "ui.ribbon.data",
|
|
1400
|
-
["ribbon.data.formulas"]: {
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1433
|
+
["ribbon.data.formulas"]: {
|
|
1434
|
+
order: 0,
|
|
1435
|
+
title: "ui.ribbon.groups.formulas"
|
|
1436
|
+
},
|
|
1437
|
+
["ribbon.data.rules"]: {
|
|
1438
|
+
order: 1,
|
|
1439
|
+
title: "ui.ribbon.groups.rules"
|
|
1440
|
+
},
|
|
1441
|
+
["ribbon.data.organization"]: {
|
|
1442
|
+
order: 2,
|
|
1443
|
+
title: "ui.ribbon.groups.organization"
|
|
1444
|
+
},
|
|
1445
|
+
["ribbon.data.others"]: {
|
|
1446
|
+
order: 3,
|
|
1447
|
+
title: "ui.ribbon.groups.tools"
|
|
1448
|
+
}
|
|
1404
1449
|
},
|
|
1405
1450
|
["ribbon.view"]: {
|
|
1406
1451
|
order: 4,
|
|
1407
1452
|
title: "ui.ribbon.view",
|
|
1408
|
-
["ribbon.view.display"]: {
|
|
1409
|
-
|
|
1410
|
-
|
|
1453
|
+
["ribbon.view.display"]: {
|
|
1454
|
+
order: 0,
|
|
1455
|
+
title: "ui.ribbon.groups.display"
|
|
1456
|
+
},
|
|
1457
|
+
["ribbon.view.Visibility"]: {
|
|
1458
|
+
order: 0,
|
|
1459
|
+
title: "ui.ribbon.groups.visibility"
|
|
1460
|
+
},
|
|
1461
|
+
["ribbon.view.others"]: {
|
|
1462
|
+
order: 0,
|
|
1463
|
+
title: "ui.ribbon.groups.tools"
|
|
1464
|
+
}
|
|
1411
1465
|
},
|
|
1412
1466
|
["ribbon.others"]: {
|
|
1413
1467
|
order: 5,
|
|
1414
1468
|
title: "ui.ribbon.others",
|
|
1415
|
-
["ribbon.others.others"]: {
|
|
1469
|
+
["ribbon.others.others"]: {
|
|
1470
|
+
order: 0,
|
|
1471
|
+
title: "ui.ribbon.groups.tools"
|
|
1472
|
+
}
|
|
1416
1473
|
}
|
|
1417
1474
|
},
|
|
1418
1475
|
["contextMenu"]: {
|
|
@@ -1834,17 +1891,23 @@ function useObservableRef(observable, defaultValue) {
|
|
|
1834
1891
|
|
|
1835
1892
|
//#endregion
|
|
1836
1893
|
//#region src/views/components/feature-search/FeatureSearch.tsx
|
|
1894
|
+
/**
|
|
1895
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1896
|
+
*
|
|
1897
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1898
|
+
* you may not use this file except in compliance with the License.
|
|
1899
|
+
* You may obtain a copy of the License at
|
|
1900
|
+
*
|
|
1901
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1902
|
+
*
|
|
1903
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1904
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1905
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1906
|
+
* See the License for the specific language governing permissions and
|
|
1907
|
+
* limitations under the License.
|
|
1908
|
+
*/
|
|
1837
1909
|
const FEATURE_SEARCH_COMPONENT = "FeatureSearch";
|
|
1838
1910
|
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
1911
|
function FeatureSearch() {
|
|
1849
1912
|
const menuManagerService = useDependency(IMenuManagerService);
|
|
1850
1913
|
const localeService = useDependency(LocaleService);
|
|
@@ -1853,6 +1916,15 @@ function FeatureSearch() {
|
|
|
1853
1916
|
const layoutService = useDependency(ILayoutService);
|
|
1854
1917
|
const ribbonService = useDependency(IRibbonService);
|
|
1855
1918
|
const items$ = useMemo(() => {
|
|
1919
|
+
function resolveParams(item, value) {
|
|
1920
|
+
return (typeof item.params === "function" ? item.params() : item.params) ?? (value === void 0 ? void 0 : { value });
|
|
1921
|
+
}
|
|
1922
|
+
function resolveOptionParams(option) {
|
|
1923
|
+
return (typeof option.params === "function" ? option.params(option.value) : option.params) ?? (option.value === void 0 ? void 0 : { value: option.value });
|
|
1924
|
+
}
|
|
1925
|
+
function deduplicate(items) {
|
|
1926
|
+
return items.filter((item, index) => items.findIndex((candidate) => candidate.commandId === item.commandId && Tools.diffValue(candidate.params, item.params)) === index);
|
|
1927
|
+
}
|
|
1856
1928
|
function getItemTitle(item) {
|
|
1857
1929
|
const titleKey = item.title ?? item.tooltip ?? item.description;
|
|
1858
1930
|
return titleKey ? localeService.t(titleKey) : "";
|
|
@@ -1977,7 +2049,7 @@ function FeatureSearch() {
|
|
|
1977
2049
|
children: item.title
|
|
1978
2050
|
})]
|
|
1979
2051
|
}), item.path && /* @__PURE__ */ jsx("span", {
|
|
1980
|
-
className: "univer-max-w-
|
|
2052
|
+
className: "univer-max-w-[50%] univer-truncate univer-text-xs univer-text-gray-400",
|
|
1981
2053
|
children: item.path
|
|
1982
2054
|
})]
|
|
1983
2055
|
}, item.key)) })] })]
|
|
@@ -3220,6 +3292,21 @@ function useComponentsOfPart(part, injector) {
|
|
|
3220
3292
|
|
|
3221
3293
|
//#endregion
|
|
3222
3294
|
//#region src/views/components/ribbon/ribbon-menu/ClassicMenu.tsx
|
|
3295
|
+
/**
|
|
3296
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3297
|
+
*
|
|
3298
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3299
|
+
* you may not use this file except in compliance with the License.
|
|
3300
|
+
* You may obtain a copy of the License at
|
|
3301
|
+
*
|
|
3302
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3303
|
+
*
|
|
3304
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3305
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3306
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3307
|
+
* See the License for the specific language governing permissions and
|
|
3308
|
+
* limitations under the License.
|
|
3309
|
+
*/
|
|
3223
3310
|
function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
3224
3311
|
const localeService = useDependency(LocaleService);
|
|
3225
3312
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -3233,7 +3320,7 @@ function ClassicMenu({ ribbon, activatedTab, onSelectTab }) {
|
|
|
3233
3320
|
"aria-selected": isActive,
|
|
3234
3321
|
title: localeService.t(group.title || group.key),
|
|
3235
3322
|
onClick: () => onSelectTab(group),
|
|
3236
|
-
className: clsx("univer-
|
|
3323
|
+
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
3324
|
children: localeService.t(group.title || group.key)
|
|
3238
3325
|
}, group.key);
|
|
3239
3326
|
})
|
|
@@ -3345,6 +3432,7 @@ function placeRibbonGridItems(items) {
|
|
|
3345
3432
|
const columnSpan = layout.columnSpan ?? 1;
|
|
3346
3433
|
const cells = getCells(layout.row, layout.column, rowSpan, columnSpan);
|
|
3347
3434
|
if (!isValidGridGeometry(layout, rowSpan, cells)) {
|
|
3435
|
+
globalThis.console.warn(`[RibbonGrid] Invalid gridLayout for "${item.key}"; using fallback placement.`);
|
|
3348
3436
|
fallbackItems.push({ item });
|
|
3349
3437
|
continue;
|
|
3350
3438
|
}
|
|
@@ -3411,6 +3499,83 @@ function getCells(row, column, rowSpan, columnSpan) {
|
|
|
3411
3499
|
return cells;
|
|
3412
3500
|
}
|
|
3413
3501
|
|
|
3502
|
+
//#endregion
|
|
3503
|
+
//#region src/views/components/ribbon/ToolbarButton.tsx
|
|
3504
|
+
/**
|
|
3505
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3506
|
+
*
|
|
3507
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3508
|
+
* you may not use this file except in compliance with the License.
|
|
3509
|
+
* You may obtain a copy of the License at
|
|
3510
|
+
*
|
|
3511
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3512
|
+
*
|
|
3513
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3514
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3515
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3516
|
+
* See the License for the specific language governing permissions and
|
|
3517
|
+
* limitations under the License.
|
|
3518
|
+
*/
|
|
3519
|
+
const toolbarButtonClassName = `
|
|
3520
|
+
univer-box-border univer-flex univer-h-6 univer-min-w-6 univer-cursor-pointer univer-items-center
|
|
3521
|
+
univer-justify-center univer-rounded univer-border-none univer-bg-transparent univer-px-0 univer-py-0
|
|
3522
|
+
univer-text-gray-900 univer-outline-none univer-transition-colors univer-animate-in univer-fade-in
|
|
3523
|
+
dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700 dark:disabled:!univer-text-gray-600
|
|
3524
|
+
disabled:univer-cursor-not-allowed disabled:univer-text-gray-300 disabled:hover:univer-bg-transparent
|
|
3525
|
+
hover:univer-bg-gray-100 whitespace-nowrap univer-w-max
|
|
3526
|
+
[&_svg]:univer-shrink-0
|
|
3527
|
+
`;
|
|
3528
|
+
const toolbarButtonVariants = cva(toolbarButtonClassName, {
|
|
3529
|
+
variants: {
|
|
3530
|
+
noIcon: {
|
|
3531
|
+
true: "univer-px-2",
|
|
3532
|
+
false: ""
|
|
3533
|
+
},
|
|
3534
|
+
active: {
|
|
3535
|
+
true: "!univer-bg-gray-200 dark:!univer-bg-gray-500",
|
|
3536
|
+
false: ""
|
|
3537
|
+
}
|
|
3538
|
+
},
|
|
3539
|
+
defaultVariants: {
|
|
3540
|
+
noIcon: false,
|
|
3541
|
+
active: false
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3544
|
+
/**
|
|
3545
|
+
* Button Component
|
|
3546
|
+
*/
|
|
3547
|
+
function ToolbarButton(props) {
|
|
3548
|
+
const { children, className, style, disabled = false, active = false, noIcon, onClick, onDoubleClick, ...restProps } = props;
|
|
3549
|
+
const handleClick = (e) => {
|
|
3550
|
+
if (disabled) {
|
|
3551
|
+
e.preventDefault();
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
onClick && onClick(e);
|
|
3555
|
+
};
|
|
3556
|
+
const handleDoubleClick = (e) => {
|
|
3557
|
+
if (disabled) {
|
|
3558
|
+
e.preventDefault();
|
|
3559
|
+
return;
|
|
3560
|
+
}
|
|
3561
|
+
onDoubleClick && onDoubleClick(e);
|
|
3562
|
+
};
|
|
3563
|
+
return /* @__PURE__ */ jsx("button", {
|
|
3564
|
+
type: "button",
|
|
3565
|
+
className: clsx(toolbarButtonVariants({
|
|
3566
|
+
noIcon,
|
|
3567
|
+
active,
|
|
3568
|
+
className
|
|
3569
|
+
})),
|
|
3570
|
+
style,
|
|
3571
|
+
disabled,
|
|
3572
|
+
onClick: handleClick,
|
|
3573
|
+
onDoubleClick: handleDoubleClick,
|
|
3574
|
+
...restProps,
|
|
3575
|
+
children
|
|
3576
|
+
});
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3414
3579
|
//#endregion
|
|
3415
3580
|
//#region src/views/custom-label/CustomLabel.tsx
|
|
3416
3581
|
/**
|
|
@@ -3513,82 +3678,334 @@ function useToolbarShortcutDisplay({ id, commandId, shortcut }) {
|
|
|
3513
3678
|
}
|
|
3514
3679
|
|
|
3515
3680
|
//#endregion
|
|
3516
|
-
//#region src/
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
[
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
},
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3681
|
+
//#region src/services/font.service.ts
|
|
3682
|
+
const IFontService = createIdentifier("univer.font-service");
|
|
3683
|
+
let FontCategory = /* @__PURE__ */ function(FontCategory) {
|
|
3684
|
+
FontCategory["SANS_SERIF"] = "sans-serif";
|
|
3685
|
+
FontCategory["SERIF"] = "serif";
|
|
3686
|
+
FontCategory["MONOSPACE"] = "monospace";
|
|
3687
|
+
FontCategory["DISPLAY"] = "display";
|
|
3688
|
+
FontCategory["HANDWRITING"] = "handwriting";
|
|
3689
|
+
return FontCategory;
|
|
3690
|
+
}({});
|
|
3691
|
+
const DEFAULT_FONT_LIST = [
|
|
3692
|
+
["宋体", { category: "serif" }],
|
|
3693
|
+
["Arial", { category: "sans-serif" }],
|
|
3694
|
+
["Baskerville", { category: "serif" }],
|
|
3695
|
+
["Comic Sans MS", { category: "handwriting" }],
|
|
3696
|
+
["Courier New", { category: "monospace" }],
|
|
3697
|
+
["Helvetica", { category: "sans-serif" }],
|
|
3698
|
+
["Times New Roman", { category: "serif" }],
|
|
3699
|
+
["Verdana", { category: "sans-serif" }],
|
|
3700
|
+
["Apple LiGothic", { category: "sans-serif" }],
|
|
3701
|
+
["Apple LiSung", { category: "serif" }],
|
|
3702
|
+
["Hei", { category: "sans-serif" }],
|
|
3703
|
+
["Kai", { category: "handwriting" }],
|
|
3704
|
+
["LiHei Pro", { category: "sans-serif" }],
|
|
3705
|
+
["LiSong Pro", { category: "serif" }],
|
|
3706
|
+
["STFangsong", { category: "serif" }],
|
|
3707
|
+
["STHeiti", { category: "sans-serif" }],
|
|
3708
|
+
["STKaiti", { category: "handwriting" }],
|
|
3709
|
+
["STSong", { category: "serif" }],
|
|
3710
|
+
["报隶-繁", { category: "handwriting" }],
|
|
3711
|
+
["报隶-简", { category: "handwriting" }],
|
|
3712
|
+
["冬青黑体简体中文", { category: "sans-serif" }],
|
|
3713
|
+
["黑体-繁", { category: "sans-serif" }],
|
|
3714
|
+
["黑体-简", { category: "sans-serif" }],
|
|
3715
|
+
["华文仿宋", { category: "serif" }],
|
|
3716
|
+
["华文楷体", { category: "handwriting" }],
|
|
3717
|
+
["华文宋体", { category: "serif" }],
|
|
3718
|
+
["楷体-繁", { category: "handwriting" }],
|
|
3719
|
+
["楷体-简", { category: "handwriting" }],
|
|
3720
|
+
["兰亭黑-繁", { category: "sans-serif" }],
|
|
3721
|
+
["兰亭黑-简", { category: "sans-serif" }],
|
|
3722
|
+
["隶变-繁", { category: "handwriting" }],
|
|
3723
|
+
["隶变-简", { category: "handwriting" }],
|
|
3724
|
+
["凌慧体-繁", { category: "handwriting" }],
|
|
3725
|
+
["凌慧体-简", { category: "handwriting" }],
|
|
3726
|
+
["翩翩体-繁", { category: "handwriting" }],
|
|
3727
|
+
["翩翩体-简", { category: "handwriting" }],
|
|
3728
|
+
["苹方-繁", { category: "sans-serif" }],
|
|
3729
|
+
["苹方-港", { category: "sans-serif" }],
|
|
3730
|
+
["苹方-简", { category: "sans-serif" }],
|
|
3731
|
+
["手札体-繁", { category: "handwriting" }],
|
|
3732
|
+
["手札体-简", { category: "handwriting" }],
|
|
3733
|
+
["宋体-繁", { category: "serif" }],
|
|
3734
|
+
["宋体-简", { category: "serif" }],
|
|
3735
|
+
["娃娃体-繁", { category: "handwriting" }],
|
|
3736
|
+
["娃娃体-简", { category: "handwriting" }],
|
|
3737
|
+
["魏碑-繁", { category: "handwriting" }],
|
|
3738
|
+
["魏碑-简", { category: "handwriting" }],
|
|
3739
|
+
["行楷-繁", { category: "handwriting" }],
|
|
3740
|
+
["行楷-简", { category: "handwriting" }],
|
|
3741
|
+
["雅痞-繁", { category: "display" }],
|
|
3742
|
+
["雅痞-简", { category: "display" }],
|
|
3743
|
+
["圆体-繁", { category: "sans-serif" }],
|
|
3744
|
+
["圆体-简", { category: "sans-serif" }],
|
|
3745
|
+
["Arial Black", { category: "sans-serif" }],
|
|
3746
|
+
["Big Caslon", { category: "serif" }],
|
|
3747
|
+
["Courier", { category: "monospace" }],
|
|
3748
|
+
["Didot", { category: "serif" }],
|
|
3749
|
+
["Futura", { category: "sans-serif" }],
|
|
3750
|
+
["Georgia", { category: "serif" }],
|
|
3751
|
+
["Helvetica Neue", { category: "sans-serif" }],
|
|
3752
|
+
["Optima", { category: "sans-serif" }],
|
|
3753
|
+
["Times", { category: "serif" }],
|
|
3754
|
+
["Tahoma", { category: "sans-serif" }],
|
|
3755
|
+
["BIZ UDGothic", { category: "monospace" }],
|
|
3756
|
+
["BIZ UDMincho", { category: "monospace" }],
|
|
3757
|
+
["Hiragino Maru Gothic Pro", { category: "sans-serif" }],
|
|
3758
|
+
["Hiragino Maru Gothic ProN", { category: "sans-serif" }],
|
|
3759
|
+
["Hiragino Mincho Pro", { category: "serif" }],
|
|
3760
|
+
["Hiragino Mincho ProN", { category: "serif" }],
|
|
3761
|
+
["Hiragino Sans", { category: "sans-serif" }],
|
|
3762
|
+
["Klee", { category: "handwriting" }],
|
|
3763
|
+
["Osaka", { category: "sans-serif" }],
|
|
3764
|
+
["Toppan Bunkyu Gothic", { category: "sans-serif" }],
|
|
3765
|
+
["Toppan Bunkyu Midashi Gothic", { category: "sans-serif" }],
|
|
3766
|
+
["Toppan Bunkyu Midashi Mincho", { category: "serif" }],
|
|
3767
|
+
["Toppan Bunkyu Mincho", { category: "serif" }],
|
|
3768
|
+
["Tsukushi A Round Gothic", { category: "sans-serif" }],
|
|
3769
|
+
["Tsukushi B Round Gothic", { category: "sans-serif" }],
|
|
3770
|
+
["YuKyokasho", { category: "handwriting" }],
|
|
3771
|
+
["YuKyokasho Yoko", { category: "handwriting" }],
|
|
3772
|
+
["YuMincho +36p Kana", { category: "serif" }],
|
|
3773
|
+
["American Typewriter", { category: "serif" }],
|
|
3774
|
+
["Andale Mono", { category: "monospace" }],
|
|
3775
|
+
["Apple Chancery", { category: "handwriting" }],
|
|
3776
|
+
["Apple SD Gothic Neo", { category: "sans-serif" }],
|
|
3777
|
+
["Apple Symbols", { category: "display" }],
|
|
3778
|
+
["AppleGothic", { category: "sans-serif" }],
|
|
3779
|
+
["AppleMyungjo", { category: "serif" }],
|
|
3780
|
+
["Arial Unicode MS", { category: "sans-serif" }],
|
|
3781
|
+
["Athelas", { category: "serif" }],
|
|
3782
|
+
["Avenir", { category: "sans-serif" }],
|
|
3783
|
+
["Avenir Next", { category: "sans-serif" }],
|
|
3784
|
+
["Avenir Next Condensed", { category: "sans-serif" }],
|
|
3785
|
+
["Ayuthaya", { category: "sans-serif" }],
|
|
3786
|
+
["Bangla MN", { category: "serif" }],
|
|
3787
|
+
["Bangla Sangam MN", { category: "sans-serif" }],
|
|
3788
|
+
["Bauhaus 93", { category: "display" }],
|
|
3789
|
+
["Bodoni 72", { category: "serif" }],
|
|
3790
|
+
["Bodoni 72 Oldstyle", { category: "serif" }],
|
|
3791
|
+
["Bodoni 72 Smallcaps", { category: "serif" }],
|
|
3792
|
+
["Bodoni Ornaments", { category: "display" }],
|
|
3793
|
+
["Bookshelf Symbol 7", { category: "display" }],
|
|
3794
|
+
["Bradley Hand", { category: "handwriting" }],
|
|
3795
|
+
["Chalkboard", { category: "handwriting" }],
|
|
3796
|
+
["Chalkboard SE", { category: "handwriting" }],
|
|
3797
|
+
["Chalkduster", { category: "handwriting" }],
|
|
3798
|
+
["Charter", { category: "serif" }],
|
|
3799
|
+
["Cochin", { category: "serif" }],
|
|
3800
|
+
["Copperplate", { category: "serif" }],
|
|
3801
|
+
["Devanagari Sangam MN", { category: "sans-serif" }],
|
|
3802
|
+
["Din Alternate", { category: "sans-serif" }],
|
|
3803
|
+
["Euphemia UCAS", { category: "sans-serif" }],
|
|
3804
|
+
["Galvji", { category: "sans-serif" }],
|
|
3805
|
+
["Geneva", { category: "sans-serif" }],
|
|
3806
|
+
["Gill Sans", { category: "sans-serif" }],
|
|
3807
|
+
["Gujarati Sangam MN", { category: "sans-serif" }],
|
|
3808
|
+
["GungSeo", { category: "handwriting" }],
|
|
3809
|
+
["Gurmukhi MN", { category: "serif" }],
|
|
3810
|
+
["Gurmukhi Sangam MN", { category: "sans-serif" }],
|
|
3811
|
+
["HeadLineA", { category: "display" }],
|
|
3812
|
+
["Herculanum", { category: "display" }],
|
|
3813
|
+
["Hiragino Kaku Gothic Pro", { category: "sans-serif" }],
|
|
3814
|
+
["Hiragino Kaku Gothic ProN", { category: "sans-serif" }],
|
|
3815
|
+
["Hiragino Kaku Gothic Std", { category: "sans-serif" }],
|
|
3816
|
+
["Hiragino Kaku Gothic StdN", { category: "sans-serif" }],
|
|
3817
|
+
["Hoefler Text", { category: "serif" }],
|
|
3818
|
+
["Impact", { category: "sans-serif" }],
|
|
3819
|
+
["InaiMathi", { category: "sans-serif" }],
|
|
3820
|
+
["Iowan Old Style", { category: "serif" }],
|
|
3821
|
+
["Kannada MN", { category: "serif" }],
|
|
3822
|
+
["Kannada Sangam MN", { category: "sans-serif" }],
|
|
3823
|
+
["Kefa", { category: "serif" }],
|
|
3824
|
+
["Khmer MN", { category: "serif" }],
|
|
3825
|
+
["Khmer Sangam MN", { category: "sans-serif" }],
|
|
3826
|
+
["Kohinoor Bangla", { category: "sans-serif" }],
|
|
3827
|
+
["Kohinoor Devanagari", { category: "sans-serif" }],
|
|
3828
|
+
["Kohinoor Telugu", { category: "sans-serif" }],
|
|
3829
|
+
["Krungthep", { category: "sans-serif" }],
|
|
3830
|
+
["Lao MN", { category: "serif" }],
|
|
3831
|
+
["Lao Sangam MN", { category: "sans-serif" }],
|
|
3832
|
+
["Lucida Grande", { category: "sans-serif" }],
|
|
3833
|
+
["Luminari", { category: "display" }],
|
|
3834
|
+
["Malayalam MN", { category: "serif" }],
|
|
3835
|
+
["Malayalam Sangam MN", { category: "sans-serif" }],
|
|
3836
|
+
["Marion", { category: "serif" }],
|
|
3837
|
+
["Marker Felt", { category: "handwriting" }],
|
|
3838
|
+
["Menlo", { category: "monospace" }],
|
|
3839
|
+
["Microsoft Sans Serif", { category: "sans-serif" }],
|
|
3840
|
+
["Modern No. 20", { category: "serif" }],
|
|
3841
|
+
["Monaco", { category: "monospace" }],
|
|
3842
|
+
["Mukta Mahee", { category: "sans-serif" }],
|
|
3843
|
+
["Nanum Brush Script", { category: "handwriting" }],
|
|
3844
|
+
["Nanum Gothic", { category: "sans-serif" }],
|
|
3845
|
+
["Nanum Myeongjo", { category: "serif" }],
|
|
3846
|
+
["Nanum Pen Script", { category: "handwriting" }],
|
|
3847
|
+
["Noteworthy", { category: "handwriting" }],
|
|
3848
|
+
["Oriya MN", { category: "serif" }],
|
|
3849
|
+
["Oriya Sangam MN", { category: "sans-serif" }],
|
|
3850
|
+
["Palatino", { category: "serif" }],
|
|
3851
|
+
["Papyrus", { category: "display" }],
|
|
3852
|
+
["PCMyungjo", { category: "monospace" }],
|
|
3853
|
+
["Phosphate", { category: "display" }],
|
|
3854
|
+
["PilGi", { category: "handwriting" }],
|
|
3855
|
+
["Plantagenet Cherokee", { category: "serif" }],
|
|
3856
|
+
["PT Mono", { category: "monospace" }],
|
|
3857
|
+
["PT Sans", { category: "sans-serif" }],
|
|
3858
|
+
["PT Sans Caption", { category: "sans-serif" }],
|
|
3859
|
+
["PT Serif", { category: "serif" }],
|
|
3860
|
+
["PT Serif Caption", { category: "serif" }],
|
|
3861
|
+
["Rockwell", { category: "serif" }],
|
|
3862
|
+
["Sathu", { category: "sans-serif" }],
|
|
3863
|
+
["Savoye LET", { category: "handwriting" }],
|
|
3864
|
+
["Seravek", { category: "sans-serif" }],
|
|
3865
|
+
["Shree Devanagari 714", { category: "sans-serif" }],
|
|
3866
|
+
["SignPainter", { category: "handwriting" }],
|
|
3867
|
+
["Silom", { category: "display" }],
|
|
3868
|
+
["Sinhala MN", { category: "serif" }],
|
|
3869
|
+
["Sinhala Sangam MN", { category: "sans-serif" }],
|
|
3870
|
+
["Skia", { category: "sans-serif" }],
|
|
3871
|
+
["Snell Roundhand", { category: "handwriting" }],
|
|
3872
|
+
["STIXGeneral", { category: "serif" }],
|
|
3873
|
+
["Sukhumvit Set", { category: "sans-serif" }],
|
|
3874
|
+
["Superclarendon", { category: "serif" }],
|
|
3875
|
+
["Tamil MN", { category: "serif" }],
|
|
3876
|
+
["Tamil Sangam MN", { category: "sans-serif" }],
|
|
3877
|
+
["Telugu MN", { category: "serif" }],
|
|
3878
|
+
["Telugu Sangam MN", { category: "sans-serif" }],
|
|
3879
|
+
["Trattatello", { category: "handwriting" }],
|
|
3880
|
+
["Trebuchet MS", { category: "sans-serif" }],
|
|
3881
|
+
["Webdings", { category: "display" }],
|
|
3882
|
+
["Wingdings", { category: "display" }],
|
|
3883
|
+
["Wingdings 2", { category: "display" }],
|
|
3884
|
+
["Wingdings 3", { category: "display" }],
|
|
3885
|
+
["YuGothic", { category: "sans-serif" }],
|
|
3886
|
+
["YuGothic Light", { category: "sans-serif" }],
|
|
3887
|
+
["YuGothic Medium", { category: "sans-serif" }],
|
|
3888
|
+
["Zapfino", { category: "handwriting" }]
|
|
3889
|
+
].map(([value, config]) => ({
|
|
3890
|
+
value,
|
|
3891
|
+
label: value,
|
|
3892
|
+
...config
|
|
3893
|
+
}));
|
|
3894
|
+
let FontService = class FontService {
|
|
3895
|
+
constructor(_configService) {
|
|
3896
|
+
this._configService = _configService;
|
|
3897
|
+
_defineProperty(this, "fonts$", new BehaviorSubject([]));
|
|
3898
|
+
const { customFontFamily } = this._configService.getConfig("ui.config") ?? {};
|
|
3899
|
+
let fonts = [];
|
|
3900
|
+
if (customFontFamily) {
|
|
3901
|
+
if (Array.isArray(customFontFamily)) fonts = [...DEFAULT_FONT_LIST, ...customFontFamily];
|
|
3902
|
+
else if (customFontFamily.override) fonts = [...customFontFamily.list];
|
|
3903
|
+
else fonts = [...DEFAULT_FONT_LIST, ...customFontFamily.list];
|
|
3904
|
+
} else fonts = [...DEFAULT_FONT_LIST];
|
|
3905
|
+
this.fonts$.next(fonts);
|
|
3555
3906
|
}
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3907
|
+
dispose() {
|
|
3908
|
+
this.resetToDefaults();
|
|
3909
|
+
this.fonts$.complete();
|
|
3910
|
+
}
|
|
3911
|
+
getFonts() {
|
|
3912
|
+
return this.fonts$.getValue();
|
|
3913
|
+
}
|
|
3914
|
+
getFontByValue(value) {
|
|
3915
|
+
return this.getFonts().find((font) => font.value === value);
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Check if the current browser environment supports the font
|
|
3919
|
+
* @param fontValue
|
|
3920
|
+
* @returns boolean Whether the font is supported
|
|
3921
|
+
*/
|
|
3922
|
+
isFontSupported(fontValue) {
|
|
3923
|
+
const context = document.createElement("canvas").getContext("2d");
|
|
3924
|
+
if (!context) return false;
|
|
3925
|
+
const text = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
3926
|
+
const size = "72px";
|
|
3927
|
+
const baseFonts = [
|
|
3928
|
+
"monospace",
|
|
3929
|
+
"serif",
|
|
3930
|
+
"sans-serif"
|
|
3931
|
+
];
|
|
3932
|
+
const defaultWidths = {};
|
|
3933
|
+
baseFonts.forEach((base) => {
|
|
3934
|
+
context.font = `${size} ${base}`;
|
|
3935
|
+
defaultWidths[base] = context.measureText(text).width;
|
|
3936
|
+
});
|
|
3937
|
+
return baseFonts.some((base) => {
|
|
3938
|
+
context.font = `${size} "${fontValue}", ${base}`;
|
|
3939
|
+
return context.measureText(text).width !== defaultWidths[base];
|
|
3940
|
+
});
|
|
3941
|
+
}
|
|
3942
|
+
addFont(font) {
|
|
3943
|
+
if (this.getFontByValue(font.value)) throw new Error(`[FontService]: Font with value "${font.value}" already exists.`);
|
|
3944
|
+
const updatedFonts = [...this.getFonts(), font].sort();
|
|
3945
|
+
this.fonts$.next(updatedFonts);
|
|
3946
|
+
}
|
|
3947
|
+
updateFont(value, updates) {
|
|
3948
|
+
const fonts = this.getFonts();
|
|
3949
|
+
const fontIndex = fonts.findIndex((font) => font.value === value);
|
|
3950
|
+
if (fontIndex === -1) throw new Error(`Font with value "${value}" not found.`);
|
|
3951
|
+
const updatedFont = {
|
|
3952
|
+
...fonts[fontIndex],
|
|
3953
|
+
...updates
|
|
3954
|
+
};
|
|
3955
|
+
const updatedFonts = [...fonts];
|
|
3956
|
+
updatedFonts[fontIndex] = updatedFont;
|
|
3957
|
+
this.fonts$.next(updatedFonts);
|
|
3958
|
+
}
|
|
3959
|
+
removeFont(value) {
|
|
3960
|
+
const fonts = this.getFonts();
|
|
3961
|
+
if (fonts.findIndex((font) => font.value === value) === -1) return false;
|
|
3962
|
+
const updatedFonts = fonts.filter((font) => font.value !== value);
|
|
3963
|
+
this.fonts$.next(updatedFonts);
|
|
3964
|
+
return true;
|
|
3965
|
+
}
|
|
3966
|
+
resetToDefaults() {
|
|
3967
|
+
this.fonts$.next([...DEFAULT_FONT_LIST]);
|
|
3968
|
+
}
|
|
3969
|
+
};
|
|
3970
|
+
FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
|
|
3971
|
+
|
|
3972
|
+
//#endregion
|
|
3973
|
+
//#region src/views/font-family/use-font-list.ts
|
|
3974
|
+
function useFontList() {
|
|
3975
|
+
const fontService = useDependency(IFontService);
|
|
3976
|
+
return {
|
|
3977
|
+
fonts: useObservable(fontService.fonts$, fontService.getFonts()),
|
|
3978
|
+
fontService
|
|
3575
3979
|
};
|
|
3576
|
-
return /* @__PURE__ */ jsx("button", {
|
|
3577
|
-
type: "button",
|
|
3578
|
-
className: clsx(toolbarButtonVariants({
|
|
3579
|
-
noIcon,
|
|
3580
|
-
active,
|
|
3581
|
-
className
|
|
3582
|
-
})),
|
|
3583
|
-
style,
|
|
3584
|
-
disabled,
|
|
3585
|
-
onClick: handleClick,
|
|
3586
|
-
onDoubleClick: handleDoubleClick,
|
|
3587
|
-
...restProps,
|
|
3588
|
-
children
|
|
3589
|
-
});
|
|
3590
3980
|
}
|
|
3591
3981
|
|
|
3982
|
+
//#endregion
|
|
3983
|
+
//#region src/views/font-family/FontFamilyItem.tsx
|
|
3984
|
+
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
3985
|
+
const FontFamilyItem = ({ value, onChange }) => {
|
|
3986
|
+
const localeService = useDependency(LocaleService);
|
|
3987
|
+
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
3988
|
+
const { fonts, fontService } = useFontList();
|
|
3989
|
+
function handleSelectFont(nextValue) {
|
|
3990
|
+
onChange(nextValue);
|
|
3991
|
+
}
|
|
3992
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
3993
|
+
dir: direction,
|
|
3994
|
+
className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
|
|
3995
|
+
style: { fontFamily: value },
|
|
3996
|
+
children: fonts.map((font) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
3997
|
+
className: "univer-flex univer-h-7 univer-w-full univer-appearance-none univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
|
|
3998
|
+
style: { fontFamily: font.value },
|
|
3999
|
+
type: "button",
|
|
4000
|
+
onClick: () => handleSelectFont(font.value),
|
|
4001
|
+
children: [localeService.t(font.label), !fontService.isFontSupported(font.value) && /* @__PURE__ */ jsx(Tooltip, {
|
|
4002
|
+
title: localeService.t("ui.fontFamily.not-supported"),
|
|
4003
|
+
children: /* @__PURE__ */ jsx(InfoIcon, { className: "univer-text-gray-300 dark:!univer-text-gray-400" })
|
|
4004
|
+
})]
|
|
4005
|
+
}) }, font.value))
|
|
4006
|
+
});
|
|
4007
|
+
};
|
|
4008
|
+
|
|
3592
4009
|
//#endregion
|
|
3593
4010
|
//#region src/views/components/ribbon/TooltipButtonWrapper.tsx
|
|
3594
4011
|
const TooltipWrapperContext = createContext({
|
|
@@ -3734,10 +4151,6 @@ function DropdownMenuLabel({ icon, value, option, preserveStrokeWidth, onOptionS
|
|
|
3734
4151
|
})]
|
|
3735
4152
|
});
|
|
3736
4153
|
}
|
|
3737
|
-
function getOptionKey(option) {
|
|
3738
|
-
var _option$label2;
|
|
3739
|
-
return String(option.id ?? option.commandId ?? option.value ?? (typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name));
|
|
3740
|
-
}
|
|
3741
4154
|
function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled, preserveStrokeWidth, onOptionSelect, dropdownComponent, dropdownMenuComponent: DropdownMenuComponent = DropdownMenu }) {
|
|
3742
4155
|
const { dropdownVisible, setDropdownVisible } = useContext(TooltipWrapperContext);
|
|
3743
4156
|
const shortcutService = useDependency(IShortcutService);
|
|
@@ -3870,6 +4283,10 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
3870
4283
|
function handleEmbedBoundaryFocusOutside(event) {
|
|
3871
4284
|
keepInteractionInsideSameEmbedBoundary(event);
|
|
3872
4285
|
}
|
|
4286
|
+
function getOptionKey(option) {
|
|
4287
|
+
var _option$label2;
|
|
4288
|
+
return String(option.id ?? option.commandId ?? option.value ?? (typeof option.label === "string" ? option.label : (_option$label2 = option.label) === null || _option$label2 === void 0 ? void 0 : _option$label2.name));
|
|
4289
|
+
}
|
|
3873
4290
|
function handleOptionSelect(option) {
|
|
3874
4291
|
var _instanceService$getC, _instanceService$getC2;
|
|
3875
4292
|
const target = sheetTarget;
|
|
@@ -3901,8 +4318,8 @@ function DropdownMenuWrapper({ menuId, slot, value, options, children, disabled,
|
|
|
3901
4318
|
return {
|
|
3902
4319
|
type: "item",
|
|
3903
4320
|
className: clsx({
|
|
3904
|
-
"focus:univer-bg-
|
|
3905
|
-
"!univer-p-0": isSingleEmbeddedCustomPanel
|
|
4321
|
+
"focus:univer-bg-transparent dark:focus:!univer-bg-transparent": typeof option.label !== "string" && ((_option$label3 = option.label) === null || _option$label3 === void 0 ? void 0 : _option$label3.hoverable) === false,
|
|
4322
|
+
"!univer-p-0": isSingleEmbeddedCustomPanel || typeof option.label === "object" && option.label.name === "UI_FONT_FAMILY_ITEM_COMPONENT"
|
|
3906
4323
|
}),
|
|
3907
4324
|
children: /* @__PURE__ */ jsx(DropdownMenuLabel, {
|
|
3908
4325
|
icon: option.icon,
|
|
@@ -4091,16 +4508,17 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4091
4508
|
const { value, hidden, disabled, activated } = useToolbarItemStatus(props);
|
|
4092
4509
|
const executeCommand = (commandId, params) => {
|
|
4093
4510
|
layoutService.focus();
|
|
4094
|
-
commandService.executeCommand(commandId, params);
|
|
4511
|
+
return commandService.executeCommand(commandId, params);
|
|
4095
4512
|
};
|
|
4096
|
-
const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, large, showLabel, iconSize, iconColor, fullWidth, preserveStrokeWidth, dropdownComponent, dropdownMenuComponent } = props;
|
|
4513
|
+
const { tooltip, shortcut, icon, title, label, id, commandId, type, slot, params, grid, overflow, large, showLabel, iconSize, iconColor, fullWidth, preserveStrokeWidth, dropdownComponent, dropdownMenuComponent } = props;
|
|
4097
4514
|
const gridLabel = title ?? tooltip;
|
|
4098
4515
|
const shortcutDisplay = useToolbarShortcutDisplay({
|
|
4099
4516
|
id,
|
|
4100
4517
|
commandId,
|
|
4101
4518
|
shortcut
|
|
4102
4519
|
});
|
|
4103
|
-
|
|
4520
|
+
const tooltipLabel = tooltip ?? (overflow ? title : void 0);
|
|
4521
|
+
let tooltipTitle = typeof tooltipLabel === "string" ? localeService.t(tooltipLabel) : "";
|
|
4104
4522
|
if (shortcutDisplay) tooltipTitle += ` (${shortcutDisplay})`;
|
|
4105
4523
|
const { selections } = props;
|
|
4106
4524
|
const selections$ = useMemo(() => {
|
|
@@ -4127,26 +4545,27 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4127
4545
|
const selectionsCommandId = props.selectionsCommandId;
|
|
4128
4546
|
const bId = commandId ?? id;
|
|
4129
4547
|
const sId = selectionsCommandId ?? commandId ?? id;
|
|
4130
|
-
const titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
|
|
4131
4548
|
const customLabelName = typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "";
|
|
4132
4549
|
const hasCustomLabel = Boolean(componentManager.get(customLabelName));
|
|
4133
|
-
|
|
4550
|
+
let titleToDisplay = grid ? showLabel ? gridLabel : large ? void 0 : title : title;
|
|
4551
|
+
if (overflow) titleToDisplay = hasCustomLabel || iconToDisplay && !showLabel ? void 0 : gridLabel;
|
|
4552
|
+
const selectorAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
4134
4553
|
function handleSelect(option) {
|
|
4135
4554
|
if (disabled) return;
|
|
4136
4555
|
let commandId = sId;
|
|
4137
4556
|
if (option.id) commandId = option.id;
|
|
4138
4557
|
const commandParams = typeof option.params === "function" ? option.params(option.value) : option.params;
|
|
4139
|
-
executeCommand(commandId, commandParams ?? { value: option.value });
|
|
4558
|
+
return executeCommand(commandId, commandParams ?? { value: option.value });
|
|
4140
4559
|
}
|
|
4141
4560
|
function handleSelectionsValueChange(value) {
|
|
4142
4561
|
if (disabled) return;
|
|
4143
|
-
executeCommand(sId, { value });
|
|
4562
|
+
return executeCommand(sId, { value });
|
|
4144
4563
|
}
|
|
4145
4564
|
function handleClick() {
|
|
4146
4565
|
if (disabled) return;
|
|
4147
4566
|
if (menuType === 2) {
|
|
4148
4567
|
const commandParams = typeof params === "function" ? params() : params;
|
|
4149
|
-
executeCommand(bId, commandParams ?? { value });
|
|
4568
|
+
return executeCommand(bId, commandParams ?? { value });
|
|
4150
4569
|
}
|
|
4151
4570
|
}
|
|
4152
4571
|
if (menuType === 2) return /* @__PURE__ */ jsxs("div", {
|
|
@@ -4155,15 +4574,21 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4155
4574
|
"aria-disabled": disabled,
|
|
4156
4575
|
className: clsx(toolbarButtonSelectorRootVariants({ disabled }), {
|
|
4157
4576
|
"univer-box-border univer-h-full univer-min-w-14 univer-flex-col !univer-pr-0": grid && large,
|
|
4158
|
-
"univer-box-border univer-h-full": grid && !large
|
|
4577
|
+
"univer-box-border univer-h-full": grid && !large,
|
|
4578
|
+
"!univer-h-auto univer-min-h-7 univer-w-full univer-text-xs": overflow
|
|
4159
4579
|
}),
|
|
4160
|
-
children: [/* @__PURE__ */ jsx("
|
|
4161
|
-
|
|
4580
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
4581
|
+
type: "button",
|
|
4582
|
+
disabled,
|
|
4583
|
+
"aria-label": selectorAriaLabel,
|
|
4584
|
+
"aria-pressed": props.activated$ ? activated : void 0,
|
|
4585
|
+
className: clsx("univer-border-0 univer-bg-transparent univer-text-inherit focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600", toolbarButtonSelectorMainVariants({
|
|
4162
4586
|
active: activated,
|
|
4163
4587
|
disabled
|
|
4164
4588
|
}), {
|
|
4165
4589
|
"univer-h-full univer-w-full univer-flex-col univer-justify-center univer-rounded univer-px-1 univer-pb-4 [&>svg]:univer-size-6": grid && large,
|
|
4166
|
-
"[&>svg]:univer-size-4": grid && !large
|
|
4590
|
+
"[&>svg]:univer-size-4": grid && !large,
|
|
4591
|
+
"univer-min-h-7 univer-min-w-0 univer-flex-1 univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-text-start": overflow
|
|
4167
4592
|
}),
|
|
4168
4593
|
onClick: handleClick,
|
|
4169
4594
|
children: /* @__PURE__ */ jsx(CustomLabel, {
|
|
@@ -4185,8 +4610,11 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4185
4610
|
onOptionSelect: handleSelect,
|
|
4186
4611
|
dropdownComponent,
|
|
4187
4612
|
dropdownMenuComponent,
|
|
4188
|
-
children: /* @__PURE__ */ jsx("
|
|
4189
|
-
|
|
4613
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
4614
|
+
type: "button",
|
|
4615
|
+
disabled,
|
|
4616
|
+
"aria-label": `${selectorAriaLabel ?? ""} ${localeService.t("ui.ribbon.more")}`,
|
|
4617
|
+
className: clsx("univer-border-0 univer-bg-transparent univer-text-inherit focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600", toolbarButtonSelectorTriggerVariants({
|
|
4190
4618
|
disabled,
|
|
4191
4619
|
active: activated
|
|
4192
4620
|
}), {
|
|
@@ -4221,7 +4649,8 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4221
4649
|
"univer-box-border univer-h-full univer-min-w-14 univer-flex-col univer-justify-center univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6": grid && large,
|
|
4222
4650
|
"univer-box-border univer-h-full": grid && !large,
|
|
4223
4651
|
"univer-bg-gray-0 dark:!univer-bg-gray-800": grid && !large && !icon,
|
|
4224
|
-
"[&>svg]:univer-size-4": grid && !large
|
|
4652
|
+
"[&>svg]:univer-size-4": grid && !large,
|
|
4653
|
+
"!univer-h-auto univer-min-h-7 univer-w-full univer-min-w-0 univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 [&>span]:univer-min-w-0 [&>span]:univer-whitespace-normal": overflow
|
|
4225
4654
|
}, grid && !large && !icon && borderClassName),
|
|
4226
4655
|
children: grid && large ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CustomLabel, {
|
|
4227
4656
|
icon: iconToDisplay,
|
|
@@ -4253,7 +4682,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4253
4682
|
function renderButtonType() {
|
|
4254
4683
|
const isCustomComponent = componentManager.get(typeof label === "string" ? label : (label === null || label === void 0 ? void 0 : label.name) ?? "");
|
|
4255
4684
|
const buttonAriaLabel = tooltip ? localeService.t(tooltip) : typeof title === "string" ? localeService.t(title) : void 0;
|
|
4256
|
-
const buttonClassName = clsx(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0");
|
|
4685
|
+
const buttonClassName = clsx(grid && !large && "[&>svg]:univer-size-4", grid && large ? "univer-h-full univer-min-w-14 univer-flex-col univer-gap-1 univer-px-1.5 univer-py-1 univer-text-xs [&>svg]:univer-size-6" : showLabel ? "univer-gap-1 univer-px-1.5 univer-text-sm" : "univer-text-sm", grid && fullWidth && isCustomComponent && "!univer-px-0", overflow && "!univer-h-auto univer-min-h-7 univer-w-full univer-justify-start univer-gap-1.5 univer-whitespace-normal univer-px-1.5 univer-py-1 univer-text-start univer-text-xs focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600");
|
|
4257
4686
|
const buttonStyle = grid && large ? {
|
|
4258
4687
|
textAlign: "center",
|
|
4259
4688
|
whiteSpace: "normal"
|
|
@@ -4271,7 +4700,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4271
4700
|
"aria-disabled": disabled,
|
|
4272
4701
|
children: /* @__PURE__ */ jsx(CustomLabel, {
|
|
4273
4702
|
className: grid && fullWidth ? "!univer-w-full" : void 0,
|
|
4274
|
-
title: grid && showLabel ? gridLabel : title,
|
|
4703
|
+
title: overflow ? void 0 : grid && showLabel ? gridLabel : title,
|
|
4275
4704
|
value,
|
|
4276
4705
|
label
|
|
4277
4706
|
})
|
|
@@ -4289,7 +4718,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4289
4718
|
onClick: (event) => {
|
|
4290
4719
|
if (props.subId && event.detail > 1) return;
|
|
4291
4720
|
const commandParams = typeof params === "function" ? params() : params;
|
|
4292
|
-
executeCommand(props.commandId ?? props.id, commandParams ?? (typeof value === "undefined" ? void 0 : { value }));
|
|
4721
|
+
return executeCommand(props.commandId ?? props.id, commandParams ?? (typeof value === "undefined" ? void 0 : { value }));
|
|
4293
4722
|
},
|
|
4294
4723
|
onDoubleClick: () => props.subId && executeCommand(props.subId),
|
|
4295
4724
|
children: icon ? /* @__PURE__ */ jsx(CustomLabel, {
|
|
@@ -4297,7 +4726,7 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4297
4726
|
iconSize,
|
|
4298
4727
|
preserveStrokeWidth,
|
|
4299
4728
|
title: grid && (large || showLabel) ? gridLabel : void 0
|
|
4300
|
-
}) : /* @__PURE__ */ jsx(CustomLabel, { title })
|
|
4729
|
+
}) : /* @__PURE__ */ jsx(CustomLabel, { title: overflow ? gridLabel : title })
|
|
4301
4730
|
});
|
|
4302
4731
|
}
|
|
4303
4732
|
function renderItem() {
|
|
@@ -4318,49 +4747,219 @@ const ToolbarItem = forwardRef((props, ref) => {
|
|
|
4318
4747
|
});
|
|
4319
4748
|
});
|
|
4320
4749
|
|
|
4750
|
+
//#endregion
|
|
4751
|
+
//#region src/views/components/ribbon/RibbonOverflow.tsx
|
|
4752
|
+
/**
|
|
4753
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
4754
|
+
*
|
|
4755
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4756
|
+
* you may not use this file except in compliance with the License.
|
|
4757
|
+
* You may obtain a copy of the License at
|
|
4758
|
+
*
|
|
4759
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4760
|
+
*
|
|
4761
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4762
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4763
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4764
|
+
* See the License for the specific language governing permissions and
|
|
4765
|
+
* limitations under the License.
|
|
4766
|
+
*/
|
|
4767
|
+
function RibbonOverflow({ groups, grid = false }) {
|
|
4768
|
+
const localeService = useDependency(LocaleService);
|
|
4769
|
+
const dialogService = useDependency(IDialogService);
|
|
4770
|
+
const sidebarService = useDependency(ISidebarService);
|
|
4771
|
+
const { direction } = useContext(ConfigContext);
|
|
4772
|
+
const [openedGroups, setOpenedGroups] = useState(null);
|
|
4773
|
+
const open = openedGroups === groups;
|
|
4774
|
+
const keyboardRef = useRef(false);
|
|
4775
|
+
const restoreFocusRef = useRef(true);
|
|
4776
|
+
const label = localeService.t("ui.ribbon.more");
|
|
4777
|
+
useEffect(() => {
|
|
4778
|
+
if (!open) return;
|
|
4779
|
+
const closeForPanel = () => {
|
|
4780
|
+
restoreFocusRef.current = false;
|
|
4781
|
+
setOpenedGroups(null);
|
|
4782
|
+
};
|
|
4783
|
+
const sidebar = sidebarService.sidebarOptions$.subscribe((options) => {
|
|
4784
|
+
if (options.visible) closeForPanel();
|
|
4785
|
+
});
|
|
4786
|
+
const dialogs = dialogService.getDialogs$().subscribe((options) => {
|
|
4787
|
+
if (options.some((dialog) => dialog.open)) closeForPanel();
|
|
4788
|
+
});
|
|
4789
|
+
return () => {
|
|
4790
|
+
sidebar.unsubscribe();
|
|
4791
|
+
dialogs.unsubscribe();
|
|
4792
|
+
};
|
|
4793
|
+
}, [
|
|
4794
|
+
open,
|
|
4795
|
+
dialogService,
|
|
4796
|
+
sidebarService
|
|
4797
|
+
]);
|
|
4798
|
+
return /* @__PURE__ */ jsx(Dropdown, {
|
|
4799
|
+
open,
|
|
4800
|
+
onOpenChange: (visible) => {
|
|
4801
|
+
if (visible) restoreFocusRef.current = true;
|
|
4802
|
+
setOpenedGroups(visible ? groups : null);
|
|
4803
|
+
},
|
|
4804
|
+
align: direction === "rtl" ? "start" : "end",
|
|
4805
|
+
collisionPadding: 12,
|
|
4806
|
+
"aria-label": label,
|
|
4807
|
+
"data-u-comp": "ribbon-overflow",
|
|
4808
|
+
className: "univer-w-80 univer-max-w-[--radix-popper-available-width] univer-overflow-x-hidden",
|
|
4809
|
+
onOpenAutoFocus: (event) => {
|
|
4810
|
+
if (!keyboardRef.current) event.preventDefault();
|
|
4811
|
+
},
|
|
4812
|
+
onFocusOutside: (event) => {
|
|
4813
|
+
event.preventDefault();
|
|
4814
|
+
},
|
|
4815
|
+
onCloseAutoFocus: (event) => {
|
|
4816
|
+
if (!restoreFocusRef.current) event.preventDefault();
|
|
4817
|
+
},
|
|
4818
|
+
overlay: /* @__PURE__ */ jsx(ToolbarDropdownProvider, { children: /* @__PURE__ */ jsx("div", {
|
|
4819
|
+
className: "univer-px-2 univer-py-1",
|
|
4820
|
+
children: groups.map((group, index) => /* @__PURE__ */ jsxs("section", {
|
|
4821
|
+
"aria-label": group.title ? localeService.t(group.title) : void 0,
|
|
4822
|
+
className: clsx("univer-py-1.5", index > 0 && borderTopClassName),
|
|
4823
|
+
children: [group.title && /* @__PURE__ */ jsx("h3", {
|
|
4824
|
+
className: "univer-m-0 univer-mb-1 univer-px-1 univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-400",
|
|
4825
|
+
children: localeService.t(group.title)
|
|
4826
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4827
|
+
className: "univer-flex univer-flex-wrap univer-items-center univer-gap-1",
|
|
4828
|
+
children: (group.children ?? [group]).map((child) => {
|
|
4829
|
+
var _child$gridLayout, _child$gridLayout2;
|
|
4830
|
+
return child.item && /* @__PURE__ */ jsx("div", {
|
|
4831
|
+
className: "univer-min-w-0 univer-max-w-full [&>span]:univer-block [&>span]:univer-h-full",
|
|
4832
|
+
style: { width: child.item.label && !child.item.icon ? (_child$gridLayout = child.gridLayout) === null || _child$gridLayout === void 0 ? void 0 : _child$gridLayout.width : void 0 },
|
|
4833
|
+
children: /* @__PURE__ */ jsx(ToolbarItem, {
|
|
4834
|
+
...child.item,
|
|
4835
|
+
grid: true,
|
|
4836
|
+
showLabel: (_child$gridLayout2 = child.gridLayout) === null || _child$gridLayout2 === void 0 ? void 0 : _child$gridLayout2.showLabel,
|
|
4837
|
+
fullWidth: true,
|
|
4838
|
+
overflow: true,
|
|
4839
|
+
preserveStrokeWidth: true
|
|
4840
|
+
})
|
|
4841
|
+
}, child.key);
|
|
4842
|
+
})
|
|
4843
|
+
})]
|
|
4844
|
+
}, group.key))
|
|
4845
|
+
}) }),
|
|
4846
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
4847
|
+
type: "button",
|
|
4848
|
+
"aria-label": label,
|
|
4849
|
+
onPointerDown: () => {
|
|
4850
|
+
keyboardRef.current = false;
|
|
4851
|
+
},
|
|
4852
|
+
onKeyDown: () => {
|
|
4853
|
+
keyboardRef.current = true;
|
|
4854
|
+
},
|
|
4855
|
+
className: clsx(toolbarButtonClassName, "data-[state=open]:univer-bg-primary-50 data-[state=open]:univer-text-primary-600 focus-visible:univer-ring-2 focus-visible:univer-ring-primary-600 dark:data-[state=open]:!univer-bg-gray-700 dark:data-[state=open]:!univer-text-primary-300", grid && "!univer-h-14 !univer-w-14 univer-flex-col univer-gap-1.5 univer-text-xs"),
|
|
4856
|
+
children: grid ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, {
|
|
4857
|
+
className: "univer-size-5",
|
|
4858
|
+
preserveStrokeWidth: true
|
|
4859
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
4860
|
+
className: "univer-flex univer-items-center univer-gap-0.5",
|
|
4861
|
+
children: [label, /* @__PURE__ */ jsx(MoreDownIcon, {
|
|
4862
|
+
className: "univer-size-3",
|
|
4863
|
+
preserveStrokeWidth: true
|
|
4864
|
+
})]
|
|
4865
|
+
})] }) : /* @__PURE__ */ jsx(MoreVerticalIcon, { preserveStrokeWidth: true })
|
|
4866
|
+
})
|
|
4867
|
+
});
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4321
4870
|
//#endregion
|
|
4322
4871
|
//#region src/views/components/ribbon/RibbonGrid.tsx
|
|
4323
4872
|
function RibbonGrid({ groups, title, className, ...props }) {
|
|
4324
4873
|
const localeService = useDependency(LocaleService);
|
|
4874
|
+
const containerRef = useRef(null);
|
|
4875
|
+
const moreRef = useRef(null);
|
|
4876
|
+
const groupsRef = useRef(/* @__PURE__ */ new Map());
|
|
4877
|
+
const [visibleGroupCount, setVisibleGroupCount] = useState(groups.length);
|
|
4878
|
+
useLayoutEffect(() => {
|
|
4879
|
+
const container = containerRef.current;
|
|
4880
|
+
if (!container) return;
|
|
4881
|
+
const measure = () => {
|
|
4882
|
+
var _moreRef$current;
|
|
4883
|
+
const style = getComputedStyle(container);
|
|
4884
|
+
const availableWidth = container.clientWidth - Number.parseFloat(style.paddingLeft || "0") - Number.parseFloat(style.paddingRight || "0");
|
|
4885
|
+
const widths = groups.map((group) => {
|
|
4886
|
+
var _groupsRef$current$ge;
|
|
4887
|
+
return ((_groupsRef$current$ge = groupsRef.current.get(group.key)) === null || _groupsRef$current$ge === void 0 ? void 0 : _groupsRef$current$ge.getBoundingClientRect().width) ?? 0;
|
|
4888
|
+
});
|
|
4889
|
+
const limit = widths.reduce((sum, width) => sum + width, 0) <= availableWidth ? availableWidth : availableWidth - (((_moreRef$current = moreRef.current) === null || _moreRef$current === void 0 ? void 0 : _moreRef$current.getBoundingClientRect().width) ?? 0);
|
|
4890
|
+
let used = 0;
|
|
4891
|
+
let count = 0;
|
|
4892
|
+
for (const width of widths) {
|
|
4893
|
+
if (used + width > limit) break;
|
|
4894
|
+
used += width;
|
|
4895
|
+
count += 1;
|
|
4896
|
+
}
|
|
4897
|
+
setVisibleGroupCount(count);
|
|
4898
|
+
};
|
|
4899
|
+
const observer = new ResizeObserver(measure);
|
|
4900
|
+
observer.observe(container);
|
|
4901
|
+
groupsRef.current.forEach((element) => observer.observe(element));
|
|
4902
|
+
if (moreRef.current) observer.observe(moreRef.current);
|
|
4903
|
+
return () => observer.disconnect();
|
|
4904
|
+
}, [groups, visibleGroupCount]);
|
|
4905
|
+
const hiddenGroups = groups.slice(visibleGroupCount);
|
|
4325
4906
|
return /* @__PURE__ */ jsx("div", {
|
|
4326
4907
|
...props,
|
|
4908
|
+
ref: containerRef,
|
|
4327
4909
|
"data-testid": "ribbon-grid-toolbar",
|
|
4328
4910
|
"data-u-comp": "ribbon-grid-toolbar",
|
|
4329
|
-
className: clsx("univer-box-border univer-flex univer-
|
|
4911
|
+
className: clsx("univer-relative univer-box-border univer-flex univer-h-[73px] univer-min-w-0 univer-overflow-hidden univer-bg-gray-50 univer-px-2 univer-text-sm dark:!univer-bg-gray-900", borderBottomClassName, className),
|
|
4330
4912
|
role: "toolbar",
|
|
4331
4913
|
"aria-label": localeService.t(title),
|
|
4332
|
-
children: /* @__PURE__ */
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4914
|
+
children: /* @__PURE__ */ jsxs(ToolbarDropdownProvider, { children: [/* @__PURE__ */ jsx("div", {
|
|
4915
|
+
className: "univer-flex univer-min-w-0 univer-overflow-hidden",
|
|
4916
|
+
children: groups.map((group, index) => {
|
|
4917
|
+
const placements = placeRibbonGridItems(group.children ?? []);
|
|
4918
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4919
|
+
ref: (element) => {
|
|
4920
|
+
if (element) groupsRef.current.set(group.key, element);
|
|
4921
|
+
else groupsRef.current.delete(group.key);
|
|
4922
|
+
},
|
|
4923
|
+
"data-u-comp": "ribbon-grid-group",
|
|
4924
|
+
"data-group-key": group.key,
|
|
4925
|
+
"aria-hidden": index >= visibleGroupCount || void 0,
|
|
4926
|
+
className: clsx("univer-relative univer-box-border univer-flex univer-w-max univer-shrink-0 univer-flex-col univer-px-2", index >= visibleGroupCount && "univer-pointer-events-none univer-invisible univer-absolute"),
|
|
4927
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
4928
|
+
"data-testid": "ribbon-grid-group-grid",
|
|
4929
|
+
className: "univer-grid univer-min-h-0 univer-flex-1 univer-grid-flow-col univer-grid-rows-[repeat(2,1.5rem)] univer-content-center univer-gap-2 univer-py-2 [&>div>span>span]:univer-h-full",
|
|
4930
|
+
children: placements.map((placement) => placement.item.item && /* @__PURE__ */ jsx("div", {
|
|
4931
|
+
className: clsx("univer-flex univer-items-stretch [&>span>button]:univer-h-full [&>span]:univer-h-full", placement.width && "[&>span>span]:univer-w-full [&>span]:univer-w-full [&_[data-u-command]]:univer-w-full"),
|
|
4932
|
+
style: {
|
|
4933
|
+
gridRow: `${placement.row} / span ${placement.rowSpan}`,
|
|
4934
|
+
gridColumn: `${placement.column} / span ${placement.columnSpan}`,
|
|
4935
|
+
width: placement.width
|
|
4936
|
+
},
|
|
4937
|
+
children: /* @__PURE__ */ jsx(ToolbarItem, {
|
|
4938
|
+
...placement.item.item,
|
|
4939
|
+
grid: true,
|
|
4940
|
+
large: placement.rowSpan > 1,
|
|
4941
|
+
showLabel: placement.showLabel,
|
|
4942
|
+
iconSize: placement.iconSize,
|
|
4943
|
+
fullWidth: placement.width !== void 0,
|
|
4944
|
+
preserveStrokeWidth: true
|
|
4945
|
+
})
|
|
4946
|
+
}, placement.item.key))
|
|
4947
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
4948
|
+
"data-testid": "ribbon-grid-group-divider",
|
|
4949
|
+
className: clsx("univer-pointer-events-none univer-absolute univer-bottom-1.5 univer-right-0 univer-top-3.5 !univer-border-gray-300 univer-opacity-50 rtl:univer-left-0 rtl:univer-right-auto", borderRightClassName),
|
|
4950
|
+
"aria-hidden": "true"
|
|
4951
|
+
})]
|
|
4952
|
+
}, group.key);
|
|
4953
|
+
})
|
|
4954
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
4955
|
+
ref: moreRef,
|
|
4956
|
+
"aria-hidden": hiddenGroups.length === 0 || void 0,
|
|
4957
|
+
className: clsx("univer-box-border univer-w-16 univer-shrink-0 univer-py-2 univer-pl-2 rtl:univer-pl-0 rtl:univer-pr-2", hiddenGroups.length === 0 && "univer-invisible univer-absolute"),
|
|
4958
|
+
children: hiddenGroups.length > 0 && /* @__PURE__ */ jsx(RibbonOverflow, {
|
|
4959
|
+
groups: hiddenGroups,
|
|
4960
|
+
grid: true
|
|
4961
|
+
})
|
|
4962
|
+
})] }, visibleGroupCount)
|
|
4364
4963
|
});
|
|
4365
4964
|
}
|
|
4366
4965
|
|
|
@@ -4550,7 +5149,7 @@ function Ribbon(props) {
|
|
|
4550
5149
|
...embedRibbonOverrideAttributes,
|
|
4551
5150
|
groups: activeGroup.allGroups,
|
|
4552
5151
|
title: activatedTabTitle
|
|
4553
|
-
}),
|
|
5152
|
+
}, effectiveActivatedTab),
|
|
4554
5153
|
!hideToolbar && ribbonType !== "grid" && /* @__PURE__ */ jsxs("div", {
|
|
4555
5154
|
...embedRibbonOverrideAttributes,
|
|
4556
5155
|
className: clsx("univer-box-border univer-grid univer-h-10 univer-grid-flow-col univer-items-center univer-px-3 univer-text-sm", {
|
|
@@ -4578,37 +5177,7 @@ function Ribbon(props) {
|
|
|
4578
5177
|
}) }, groupItem.key);
|
|
4579
5178
|
}), collapsedIds.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
4580
5179
|
className: "univer-pl-2 rtl:univer-pr-2",
|
|
4581
|
-
children: /* @__PURE__ */ jsx(
|
|
4582
|
-
collisionPadding: {
|
|
4583
|
-
right: 12,
|
|
4584
|
-
left: 12
|
|
4585
|
-
},
|
|
4586
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
4587
|
-
overlay: /* @__PURE__ */ jsx("div", {
|
|
4588
|
-
className: "univer-box-border univer-grid univer-max-w-[--radix-popper-available-width] univer-gap-2 univer-p-2",
|
|
4589
|
-
children: activeGroup.hiddenGroups.map((groupItem) => {
|
|
4590
|
-
var _groupItem$children5;
|
|
4591
|
-
return /* @__PURE__ */ jsx("div", {
|
|
4592
|
-
className: "univer-flex univer-items-center univer-gap-2",
|
|
4593
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
4594
|
-
className: "univer-flex univer-flex-wrap univer-gap-2",
|
|
4595
|
-
children: groupItem.children ? (_groupItem$children5 = groupItem.children) === null || _groupItem$children5 === void 0 ? void 0 : _groupItem$children5.map((child) => child.item && /* @__PURE__ */ jsx(ToolbarItem, {
|
|
4596
|
-
...child.item,
|
|
4597
|
-
preserveStrokeWidth: true
|
|
4598
|
-
}, child.key)) : groupItem.item && /* @__PURE__ */ jsx(ToolbarItem, {
|
|
4599
|
-
...groupItem.item,
|
|
4600
|
-
preserveStrokeWidth: true
|
|
4601
|
-
}, groupItem.key)
|
|
4602
|
-
})
|
|
4603
|
-
}, groupItem.key);
|
|
4604
|
-
})
|
|
4605
|
-
}),
|
|
4606
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
4607
|
-
type: "button",
|
|
4608
|
-
className: toolbarButtonClassName,
|
|
4609
|
-
children: /* @__PURE__ */ jsx(MoreVerticalIcon, { preserveStrokeWidth: true })
|
|
4610
|
-
})
|
|
4611
|
-
})
|
|
5180
|
+
children: /* @__PURE__ */ jsx(RibbonOverflow, { groups: activeGroup.hiddenGroups })
|
|
4612
5181
|
})] }, effectiveActivatedTab)
|
|
4613
5182
|
})]
|
|
4614
5183
|
}),
|
|
@@ -4928,6 +5497,21 @@ function DesignTinyMenuGroup({ items, columns, sizeVariant = "default", layoutVa
|
|
|
4928
5497
|
|
|
4929
5498
|
//#endregion
|
|
4930
5499
|
//#region src/views/menu/desktop/TinyMenuGroup.tsx
|
|
5500
|
+
/**
|
|
5501
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
5502
|
+
*
|
|
5503
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5504
|
+
* you may not use this file except in compliance with the License.
|
|
5505
|
+
* You may obtain a copy of the License at
|
|
5506
|
+
*
|
|
5507
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5508
|
+
*
|
|
5509
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5510
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5511
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5512
|
+
* See the License for the specific language governing permissions and
|
|
5513
|
+
* limitations under the License.
|
|
5514
|
+
*/
|
|
4931
5515
|
const EMPTY_HIDDEN_ITEM_IDS = [];
|
|
4932
5516
|
const EMPTY_TINY_MENU_CHILDREN = [];
|
|
4933
5517
|
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 +5638,7 @@ function UIQuickTileMenuGroup(props) {
|
|
|
5054
5638
|
const { item, activeItemIds, hiddenItemIds = EMPTY_HIDDEN_ITEM_IDS, onOptionSelect } = props;
|
|
5055
5639
|
if (!((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length)) return null;
|
|
5056
5640
|
return /* @__PURE__ */ jsx("div", {
|
|
5057
|
-
className: "univer-
|
|
5641
|
+
className: "univer-grid univer-grid-cols-3 univer-items-center univer-gap-1.5 univer-py-1",
|
|
5058
5642
|
children: getVisibleTinyMenuChildren(item.children, hiddenItemIds).map((menuSchema) => /* @__PURE__ */ jsx(QuickTileMenuItem, {
|
|
5059
5643
|
menuSchema,
|
|
5060
5644
|
activeItemIds,
|
|
@@ -5729,8 +6313,9 @@ function ContextMenuMenuItem(props) {
|
|
|
5729
6313
|
const scheduleSubmenuClose = useCallback(() => {
|
|
5730
6314
|
clearSubmenuCloseTimer();
|
|
5731
6315
|
submenuCloseTimerRef.current = setTimeout(() => {
|
|
6316
|
+
var _submenuElementRef$cu;
|
|
5732
6317
|
submenuCloseTimerRef.current = null;
|
|
5733
|
-
closeSubmenu();
|
|
6318
|
+
if (!((_submenuElementRef$cu = submenuElementRef.current) === null || _submenuElementRef$cu === void 0 ? void 0 : _submenuElementRef$cu.contains(document.activeElement))) closeSubmenu();
|
|
5734
6319
|
}, 500);
|
|
5735
6320
|
}, [clearSubmenuCloseTimer, closeSubmenu]);
|
|
5736
6321
|
useEffect(() => {
|
|
@@ -5746,9 +6331,9 @@ function ContextMenuMenuItem(props) {
|
|
|
5746
6331
|
return preventBrowserZoomInContainers([submenuElement]);
|
|
5747
6332
|
}, [submenuVisible]);
|
|
5748
6333
|
useLayoutEffect(() => {
|
|
5749
|
-
var _submenuElementRef$
|
|
6334
|
+
var _submenuElementRef$cu2;
|
|
5750
6335
|
if (!submenuVisible || !submenuPositionReady || !keyboardSubmenuFocusRequested) return;
|
|
5751
|
-
const firstEnabledButton = (_submenuElementRef$
|
|
6336
|
+
const firstEnabledButton = (_submenuElementRef$cu2 = submenuElementRef.current) === null || _submenuElementRef$cu2 === void 0 ? void 0 : _submenuElementRef$cu2.querySelector("button:not(:disabled)");
|
|
5752
6337
|
firstEnabledButton === null || firstEnabledButton === void 0 || firstEnabledButton.focus();
|
|
5753
6338
|
}, [
|
|
5754
6339
|
keyboardSubmenuFocusRequested,
|
|
@@ -5782,10 +6367,13 @@ function ContextMenuMenuItem(props) {
|
|
|
5782
6367
|
setSubmenuPositionReady(true);
|
|
5783
6368
|
};
|
|
5784
6369
|
const frameId = window.requestAnimationFrame(updateSubmenuPosition);
|
|
6370
|
+
const resizeObserver = new ResizeObserver(updateSubmenuPosition);
|
|
6371
|
+
if (submenuElementRef.current) resizeObserver.observe(submenuElementRef.current);
|
|
5785
6372
|
window.addEventListener("resize", updateSubmenuPosition);
|
|
5786
6373
|
window.addEventListener("scroll", updateSubmenuPosition, true);
|
|
5787
6374
|
return () => {
|
|
5788
6375
|
window.cancelAnimationFrame(frameId);
|
|
6376
|
+
resizeObserver.disconnect();
|
|
5789
6377
|
window.removeEventListener("resize", updateSubmenuPosition);
|
|
5790
6378
|
window.removeEventListener("scroll", updateSubmenuPosition, true);
|
|
5791
6379
|
};
|
|
@@ -5842,9 +6430,10 @@ function ContextMenuMenuItem(props) {
|
|
|
5842
6430
|
},
|
|
5843
6431
|
onMouseLeave: (event) => {
|
|
5844
6432
|
if (hasSubmenu) {
|
|
5845
|
-
var _submenuElementRef$
|
|
6433
|
+
var _submenuElementRef$cu3, _submenuElementRef$cu4;
|
|
6434
|
+
if ((_submenuElementRef$cu3 = submenuElementRef.current) === null || _submenuElementRef$cu3 === void 0 ? void 0 : _submenuElementRef$cu3.contains(document.activeElement)) return;
|
|
5846
6435
|
const nextTarget = event.relatedTarget;
|
|
5847
|
-
if (nextTarget && ((_submenuElementRef$
|
|
6436
|
+
if (nextTarget && ((_submenuElementRef$cu4 = submenuElementRef.current) === null || _submenuElementRef$cu4 === void 0 ? void 0 : _submenuElementRef$cu4.contains(nextTarget))) return;
|
|
5848
6437
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
5849
6438
|
closeSubmenu();
|
|
5850
6439
|
return;
|
|
@@ -5940,7 +6529,8 @@ function ContextMenuMenuItem(props) {
|
|
|
5940
6529
|
onMenuPointerEnter === null || onMenuPointerEnter === void 0 || onMenuPointerEnter();
|
|
5941
6530
|
},
|
|
5942
6531
|
onMouseLeave: (event) => {
|
|
5943
|
-
var _menuItemElementRef$c;
|
|
6532
|
+
var _submenuElementRef$cu5, _menuItemElementRef$c;
|
|
6533
|
+
if ((_submenuElementRef$cu5 = submenuElementRef.current) === null || _submenuElementRef$cu5 === void 0 ? void 0 : _submenuElementRef$cu5.contains(document.activeElement)) return;
|
|
5944
6534
|
const nextTarget = event.relatedTarget;
|
|
5945
6535
|
if (nextTarget && ((_menuItemElementRef$c = menuItemElementRef.current) === null || _menuItemElementRef$c === void 0 ? void 0 : _menuItemElementRef$c.contains(nextTarget))) return;
|
|
5946
6536
|
if (isContextMenuPointerLeaveTarget(nextTarget, menuItemElementRef.current, rootMenuElement)) {
|
|
@@ -6369,7 +6959,7 @@ function Sidebar() {
|
|
|
6369
6959
|
}),
|
|
6370
6960
|
style: { width: isDragging ? void 0 : width },
|
|
6371
6961
|
children: [(options === null || options === void 0 ? void 0 : options.visible) && /* @__PURE__ */ jsx("div", {
|
|
6372
|
-
className: "
|
|
6962
|
+
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
6963
|
onMouseDown: handleResizeMouseDown,
|
|
6374
6964
|
role: "separator",
|
|
6375
6965
|
"aria-orientation": "vertical",
|
|
@@ -6400,7 +6990,7 @@ function Sidebar() {
|
|
|
6400
6990
|
children: [options === null || options === void 0 ? void 0 : options.header, /* @__PURE__ */ jsx("button", {
|
|
6401
6991
|
ref: closeButtonRef,
|
|
6402
6992
|
type: "button",
|
|
6403
|
-
className: "
|
|
6993
|
+
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
6994
|
onClick: handleClose,
|
|
6405
6995
|
"aria-label": localeService.t("ui.sidebar.close"),
|
|
6406
6996
|
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
@@ -6629,16 +7219,8 @@ function useLatest(value) {
|
|
|
6629
7219
|
ref.current = value;
|
|
6630
7220
|
return ref;
|
|
6631
7221
|
}
|
|
6632
|
-
|
|
6633
|
-
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
7222
|
+
function useVirtualListMetrics(list, itemHeight) {
|
|
6634
7223
|
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
7224
|
const getVisibleCount = (containerHeight, fromIndex) => {
|
|
6643
7225
|
if (typeof itemHeightRef.current === "number") return Math.ceil(containerHeight / itemHeightRef.current);
|
|
6644
7226
|
let sum = 0;
|
|
@@ -6669,29 +7251,18 @@ const useVirtualList = (list, options) => {
|
|
|
6669
7251
|
if (typeof itemHeightRef.current === "number") return index * itemHeightRef.current;
|
|
6670
7252
|
return list.slice(0, index).reduce((sum, _, i) => sum + itemHeightRef.current(i, list[i]), 0);
|
|
6671
7253
|
};
|
|
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
|
-
}
|
|
7254
|
+
return {
|
|
7255
|
+
getVisibleCount,
|
|
7256
|
+
getOffset,
|
|
7257
|
+
getDistanceTop,
|
|
7258
|
+
totalHeight: useMemo(() => {
|
|
7259
|
+
if (isNumber(itemHeightRef.current)) return list.length * itemHeightRef.current;
|
|
7260
|
+
return list.reduce((sum, _, index) => sum + itemHeightRef.current(index, list[index]), 0);
|
|
7261
|
+
}, [list])
|
|
6694
7262
|
};
|
|
7263
|
+
}
|
|
7264
|
+
function useContainerSize(containerTarget) {
|
|
7265
|
+
const [size, setSize] = useState(null);
|
|
6695
7266
|
useEffect(() => {
|
|
6696
7267
|
if (containerTarget.current) {
|
|
6697
7268
|
const getSize = () => {
|
|
@@ -6710,6 +7281,37 @@ const useVirtualList = (list, options) => {
|
|
|
6710
7281
|
};
|
|
6711
7282
|
}
|
|
6712
7283
|
}, []);
|
|
7284
|
+
return size;
|
|
7285
|
+
}
|
|
7286
|
+
const useVirtualList = (list, options) => {
|
|
7287
|
+
const { containerTarget, itemHeight, overscan = 5 } = options;
|
|
7288
|
+
const { getVisibleCount, getOffset, getDistanceTop, totalHeight } = useVirtualListMetrics(list, itemHeight);
|
|
7289
|
+
const size = useContainerSize(containerTarget);
|
|
7290
|
+
const scrollTriggerByScrollToFunc = useRef(false);
|
|
7291
|
+
const [targetList, setTargetList] = useState([]);
|
|
7292
|
+
const [wrapperStyle, setWrapperStyle] = useState({
|
|
7293
|
+
height: void 0,
|
|
7294
|
+
marginTop: void 0
|
|
7295
|
+
});
|
|
7296
|
+
const calculateRange = () => {
|
|
7297
|
+
const container = containerTarget.current;
|
|
7298
|
+
if (container) {
|
|
7299
|
+
const { scrollTop, clientHeight } = container;
|
|
7300
|
+
const offset = getOffset(scrollTop);
|
|
7301
|
+
const visibleCount = getVisibleCount(clientHeight, offset);
|
|
7302
|
+
const start = Math.max(0, offset - overscan);
|
|
7303
|
+
const end = Math.min(list.length, offset + visibleCount + overscan);
|
|
7304
|
+
const offsetTop = getDistanceTop(start);
|
|
7305
|
+
setWrapperStyle({
|
|
7306
|
+
height: `${totalHeight - offsetTop}px`,
|
|
7307
|
+
marginTop: `${offsetTop}px`
|
|
7308
|
+
});
|
|
7309
|
+
setTargetList(list.slice(start, end).map((ele, index) => ({
|
|
7310
|
+
data: ele,
|
|
7311
|
+
index: index + start
|
|
7312
|
+
})));
|
|
7313
|
+
}
|
|
7314
|
+
};
|
|
6713
7315
|
useEffect(() => {
|
|
6714
7316
|
if (!(size === null || size === void 0 ? void 0 : size.width) || !(size === null || size === void 0 ? void 0 : size.height)) return;
|
|
6715
7317
|
calculateRange();
|
|
@@ -7035,7 +7637,7 @@ const IUIController = createIdentifier("univer.ui.ui-controller");
|
|
|
7035
7637
|
//#endregion
|
|
7036
7638
|
//#region package.json
|
|
7037
7639
|
var name = "@univerjs/ui";
|
|
7038
|
-
var version = "1.
|
|
7640
|
+
var version = "1.3.0";
|
|
7039
7641
|
|
|
7040
7642
|
//#endregion
|
|
7041
7643
|
//#region src/views/color-picker/interface.ts
|
|
@@ -22707,6 +23309,37 @@ function EmojiPicker(props) {
|
|
|
22707
23309
|
const recentStorageKey = (extraProps === null || extraProps === void 0 ? void 0 : extraProps.recentStorageKey) ?? RECENTS_STORAGE_KEY;
|
|
22708
23310
|
const isSearching = deferredQuery.trim().length > 0;
|
|
22709
23311
|
const { rows, sectionPositions } = useMemo(() => {
|
|
23312
|
+
function createEmojiVirtualRows(sections, locale) {
|
|
23313
|
+
const rows = [];
|
|
23314
|
+
const sectionPositions = [];
|
|
23315
|
+
let top = 0;
|
|
23316
|
+
sections.forEach((section) => {
|
|
23317
|
+
if (!section.emojis.length) return;
|
|
23318
|
+
sectionPositions.push({
|
|
23319
|
+
key: section.key,
|
|
23320
|
+
rowIndex: rows.length,
|
|
23321
|
+
top
|
|
23322
|
+
});
|
|
23323
|
+
rows.push({
|
|
23324
|
+
key: `${locale}-${section.key}-header`,
|
|
23325
|
+
title: section.title,
|
|
23326
|
+
type: "header"
|
|
23327
|
+
});
|
|
23328
|
+
top += EMOJI_SECTION_HEADER_HEIGHT;
|
|
23329
|
+
for (let start = 0; start < section.emojis.length; start += EMOJI_COLUMN_COUNT) {
|
|
23330
|
+
rows.push({
|
|
23331
|
+
items: section.emojis.slice(start, start + EMOJI_COLUMN_COUNT),
|
|
23332
|
+
key: `${locale}-${section.key}-${start / EMOJI_COLUMN_COUNT}`,
|
|
23333
|
+
type: "emojis"
|
|
23334
|
+
});
|
|
23335
|
+
top += EMOJI_ROW_HEIGHT;
|
|
23336
|
+
}
|
|
23337
|
+
});
|
|
23338
|
+
return {
|
|
23339
|
+
rows,
|
|
23340
|
+
sectionPositions
|
|
23341
|
+
};
|
|
23342
|
+
}
|
|
22710
23343
|
const normalSections = [{
|
|
22711
23344
|
key: "recent",
|
|
22712
23345
|
title: localeService.t("ui.emojiPicker.recents"),
|
|
@@ -22731,7 +23364,7 @@ function EmojiPicker(props) {
|
|
|
22731
23364
|
]);
|
|
22732
23365
|
const [virtualRows, { containerProps, scrollTo, wrapperStyle }] = useVirtualList(rows, {
|
|
22733
23366
|
containerTarget: scrollRef,
|
|
22734
|
-
itemHeight:
|
|
23367
|
+
itemHeight: (_index, row) => row.type === "header" ? EMOJI_SECTION_HEADER_HEIGHT : EMOJI_ROW_HEIGHT,
|
|
22735
23368
|
overscan: EMOJI_VIRTUAL_OVERSCAN
|
|
22736
23369
|
});
|
|
22737
23370
|
useEffect(() => {
|
|
@@ -22763,6 +23396,16 @@ function EmojiPicker(props) {
|
|
|
22763
23396
|
scrollTo,
|
|
22764
23397
|
sectionPositions
|
|
22765
23398
|
]);
|
|
23399
|
+
function writeStorageItem(localStorageService, storageKey, value) {
|
|
23400
|
+
localStorageService.setItem(storageKey, value).catch(() => void 0);
|
|
23401
|
+
}
|
|
23402
|
+
function getActiveSectionByScrollTop(sectionPositions, scrollTop) {
|
|
23403
|
+
let active = "recent";
|
|
23404
|
+
sectionPositions.forEach((position) => {
|
|
23405
|
+
if (position.top <= scrollTop + ACTIVE_SECTION_SCROLL_OFFSET) active = position.key;
|
|
23406
|
+
});
|
|
23407
|
+
return active;
|
|
23408
|
+
}
|
|
22766
23409
|
const handleSelect = (item, options) => {
|
|
22767
23410
|
var _props$onChange, _extraProps$onSelect;
|
|
22768
23411
|
const nextRecents = promoteRecentEmoji(recents, item);
|
|
@@ -22927,7 +23570,7 @@ function EmojiButton(props) {
|
|
|
22927
23570
|
type: "button",
|
|
22928
23571
|
"aria-label": `${title}, ${props.moreTitle}`,
|
|
22929
23572
|
title: `${title}, ${props.moreTitle}`,
|
|
22930
|
-
className: "univer-
|
|
23573
|
+
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
23574
|
children: /* @__PURE__ */ jsx(MoreDownIcon, { className: "!univer-size-2.5" })
|
|
22932
23575
|
})
|
|
22933
23576
|
})]
|
|
@@ -23015,50 +23658,6 @@ function CategoryButton(props) {
|
|
|
23015
23658
|
children: props.children
|
|
23016
23659
|
});
|
|
23017
23660
|
}
|
|
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
23661
|
function CategoryIcon(props) {
|
|
23063
23662
|
switch (props.category) {
|
|
23064
23663
|
case "activity": return /* @__PURE__ */ jsx(ActivityIcon, {});
|
|
@@ -23080,299 +23679,6 @@ function MobileEmojiPicker(props) {
|
|
|
23080
23679
|
});
|
|
23081
23680
|
}
|
|
23082
23681
|
|
|
23083
|
-
//#endregion
|
|
23084
|
-
//#region src/services/font.service.ts
|
|
23085
|
-
const IFontService = createIdentifier("univer.font-service");
|
|
23086
|
-
const DEFAULT_FONT_LIST = [
|
|
23087
|
-
"宋体",
|
|
23088
|
-
"Arial",
|
|
23089
|
-
"Baskerville",
|
|
23090
|
-
"Comic Sans MS",
|
|
23091
|
-
"Courier New",
|
|
23092
|
-
"Helvetica",
|
|
23093
|
-
"Times New Roman",
|
|
23094
|
-
"Verdana",
|
|
23095
|
-
"Apple LiGothic",
|
|
23096
|
-
"Apple LiSung",
|
|
23097
|
-
"Hei",
|
|
23098
|
-
"Kai",
|
|
23099
|
-
"LiHei Pro",
|
|
23100
|
-
"LiSong Pro",
|
|
23101
|
-
"STFangsong",
|
|
23102
|
-
"STHeiti",
|
|
23103
|
-
"STKaiti",
|
|
23104
|
-
"STSong",
|
|
23105
|
-
"报隶-繁",
|
|
23106
|
-
"报隶-简",
|
|
23107
|
-
"冬青黑体简体中文",
|
|
23108
|
-
"黑体-繁",
|
|
23109
|
-
"黑体-简",
|
|
23110
|
-
"华文仿宋",
|
|
23111
|
-
"华文楷体",
|
|
23112
|
-
"华文宋体",
|
|
23113
|
-
"楷体-繁",
|
|
23114
|
-
"楷体-简",
|
|
23115
|
-
"兰亭黑-繁",
|
|
23116
|
-
"兰亭黑-简",
|
|
23117
|
-
"隶变-繁",
|
|
23118
|
-
"隶变-简",
|
|
23119
|
-
"凌慧体-繁",
|
|
23120
|
-
"凌慧体-简",
|
|
23121
|
-
"翩翩体-繁",
|
|
23122
|
-
"翩翩体-简",
|
|
23123
|
-
"苹方-繁",
|
|
23124
|
-
"苹方-港",
|
|
23125
|
-
"苹方-简",
|
|
23126
|
-
"手札体-繁",
|
|
23127
|
-
"手札体-简",
|
|
23128
|
-
"宋体-繁",
|
|
23129
|
-
"宋体-简",
|
|
23130
|
-
"娃娃体-繁",
|
|
23131
|
-
"娃娃体-简",
|
|
23132
|
-
"魏碑-繁",
|
|
23133
|
-
"魏碑-简",
|
|
23134
|
-
"行楷-繁",
|
|
23135
|
-
"行楷-简",
|
|
23136
|
-
"雅痞-繁",
|
|
23137
|
-
"雅痞-简",
|
|
23138
|
-
"圆体-繁",
|
|
23139
|
-
"圆体-简",
|
|
23140
|
-
"Arial Black",
|
|
23141
|
-
"Big Caslon",
|
|
23142
|
-
"Courier",
|
|
23143
|
-
"Didot",
|
|
23144
|
-
"Futura",
|
|
23145
|
-
"Georgia",
|
|
23146
|
-
"Helvetica Neue",
|
|
23147
|
-
"Optima",
|
|
23148
|
-
"Times",
|
|
23149
|
-
"Tahoma",
|
|
23150
|
-
"BIZ UDGothic",
|
|
23151
|
-
"BIZ UDMincho",
|
|
23152
|
-
"Hiragino Maru Gothic Pro",
|
|
23153
|
-
"Hiragino Maru Gothic ProN",
|
|
23154
|
-
"Hiragino Mincho Pro",
|
|
23155
|
-
"Hiragino Mincho ProN",
|
|
23156
|
-
"Hiragino Sans",
|
|
23157
|
-
"Klee",
|
|
23158
|
-
"Osaka",
|
|
23159
|
-
"Toppan Bunkyu Gothic",
|
|
23160
|
-
"Toppan Bunkyu Midashi Gothic",
|
|
23161
|
-
"Toppan Bunkyu Midashi Mincho",
|
|
23162
|
-
"Toppan Bunkyu Mincho",
|
|
23163
|
-
"Tsukushi A Round Gothic",
|
|
23164
|
-
"Tsukushi B Round Gothic",
|
|
23165
|
-
"YuKyokasho",
|
|
23166
|
-
"YuKyokasho Yoko",
|
|
23167
|
-
"YuMincho +36p Kana",
|
|
23168
|
-
"American Typewriter",
|
|
23169
|
-
"Andale Mono",
|
|
23170
|
-
"Apple Chancery",
|
|
23171
|
-
"Apple SD Gothic Neo",
|
|
23172
|
-
"Apple Symbols",
|
|
23173
|
-
"AppleGothic",
|
|
23174
|
-
"AppleMyungjo",
|
|
23175
|
-
"Arial Unicode MS",
|
|
23176
|
-
"Athelas",
|
|
23177
|
-
"Avenir",
|
|
23178
|
-
"Avenir Next",
|
|
23179
|
-
"Avenir Next Condensed",
|
|
23180
|
-
"Ayuthaya",
|
|
23181
|
-
"Bangla MN",
|
|
23182
|
-
"Bangla Sangam MN",
|
|
23183
|
-
"Bauhaus 93",
|
|
23184
|
-
"Bodoni 72",
|
|
23185
|
-
"Bodoni 72 Oldstyle",
|
|
23186
|
-
"Bodoni 72 Smallcaps",
|
|
23187
|
-
"Bodoni Ornaments",
|
|
23188
|
-
"Bookshelf Symbol 7",
|
|
23189
|
-
"Bradley Hand",
|
|
23190
|
-
"Chalkboard",
|
|
23191
|
-
"Chalkboard SE",
|
|
23192
|
-
"Chalkduster",
|
|
23193
|
-
"Charter",
|
|
23194
|
-
"Cochin",
|
|
23195
|
-
"Copperplate",
|
|
23196
|
-
"Devanagari Sangam MN",
|
|
23197
|
-
"Din Alternate",
|
|
23198
|
-
"Euphemia UCAS",
|
|
23199
|
-
"Galvji",
|
|
23200
|
-
"Geneva",
|
|
23201
|
-
"Gill Sans",
|
|
23202
|
-
"Gujarati Sangam MN",
|
|
23203
|
-
"GungSeo",
|
|
23204
|
-
"Gurmukhi MN",
|
|
23205
|
-
"Gurmukhi Sangam MN",
|
|
23206
|
-
"HeadLineA",
|
|
23207
|
-
"Herculanum",
|
|
23208
|
-
"Hiragino Kaku Gothic Pro",
|
|
23209
|
-
"Hiragino Kaku Gothic ProN",
|
|
23210
|
-
"Hiragino Kaku Gothic Std",
|
|
23211
|
-
"Hiragino Kaku Gothic StdN",
|
|
23212
|
-
"Hoefler Text",
|
|
23213
|
-
"Impact",
|
|
23214
|
-
"InaiMathi",
|
|
23215
|
-
"Iowan Old Style",
|
|
23216
|
-
"Kannada MN",
|
|
23217
|
-
"Kannada Sangam MN",
|
|
23218
|
-
"Kefa",
|
|
23219
|
-
"Khmer MN",
|
|
23220
|
-
"Khmer Sangam MN",
|
|
23221
|
-
"Kohinoor Bangla",
|
|
23222
|
-
"Kohinoor Devanagari",
|
|
23223
|
-
"Kohinoor Telugu",
|
|
23224
|
-
"Krungthep",
|
|
23225
|
-
"Lao MN",
|
|
23226
|
-
"Lao Sangam MN",
|
|
23227
|
-
"Lucida Grande",
|
|
23228
|
-
"Luminari",
|
|
23229
|
-
"Malayalam MN",
|
|
23230
|
-
"Malayalam Sangam MN",
|
|
23231
|
-
"Marion",
|
|
23232
|
-
"Marker Felt",
|
|
23233
|
-
"Menlo",
|
|
23234
|
-
"Microsoft Sans Serif",
|
|
23235
|
-
"Modern No. 20",
|
|
23236
|
-
"Monaco",
|
|
23237
|
-
"Mukta Mahee",
|
|
23238
|
-
"Nanum Brush Script",
|
|
23239
|
-
"Nanum Gothic",
|
|
23240
|
-
"Nanum Myeongjo",
|
|
23241
|
-
"Nanum Pen Script",
|
|
23242
|
-
"Noteworthy",
|
|
23243
|
-
"Oriya MN",
|
|
23244
|
-
"Oriya Sangam MN",
|
|
23245
|
-
"Palatino",
|
|
23246
|
-
"Papyrus",
|
|
23247
|
-
"PCMyungjo",
|
|
23248
|
-
"Phosphate",
|
|
23249
|
-
"PilGi",
|
|
23250
|
-
"Plantagenet Cherokee",
|
|
23251
|
-
"PT Mono",
|
|
23252
|
-
"PT Sans",
|
|
23253
|
-
"PT Sans Caption",
|
|
23254
|
-
"PT Serif",
|
|
23255
|
-
"PT Serif Caption",
|
|
23256
|
-
"Rockwell",
|
|
23257
|
-
"Sathu",
|
|
23258
|
-
"Savoye LET",
|
|
23259
|
-
"Seravek",
|
|
23260
|
-
"Shree Devanagari 714",
|
|
23261
|
-
"SignPainter",
|
|
23262
|
-
"Silom",
|
|
23263
|
-
"Sinhala MN",
|
|
23264
|
-
"Sinhala Sangam MN",
|
|
23265
|
-
"Skia",
|
|
23266
|
-
"Snell Roundhand",
|
|
23267
|
-
"STIXGeneral",
|
|
23268
|
-
"Sukhumvit Set",
|
|
23269
|
-
"Superclarendon",
|
|
23270
|
-
"Tamil MN",
|
|
23271
|
-
"Tamil Sangam MN",
|
|
23272
|
-
"Telugu MN",
|
|
23273
|
-
"Telugu Sangam MN",
|
|
23274
|
-
"Trattatello",
|
|
23275
|
-
"Trebuchet MS",
|
|
23276
|
-
"Webdings",
|
|
23277
|
-
"Wingdings",
|
|
23278
|
-
"Wingdings 2",
|
|
23279
|
-
"Wingdings 3",
|
|
23280
|
-
"YuGothic",
|
|
23281
|
-
"YuGothic Light",
|
|
23282
|
-
"YuGothic Medium",
|
|
23283
|
-
"Zapfino"
|
|
23284
|
-
].map((value) => ({
|
|
23285
|
-
value,
|
|
23286
|
-
label: value
|
|
23287
|
-
}));
|
|
23288
|
-
let FontService = class FontService {
|
|
23289
|
-
constructor(_configService) {
|
|
23290
|
-
this._configService = _configService;
|
|
23291
|
-
_defineProperty(this, "fonts$", new BehaviorSubject([]));
|
|
23292
|
-
const { customFontFamily } = this._configService.getConfig("ui.config") ?? {};
|
|
23293
|
-
let fonts = [];
|
|
23294
|
-
if (customFontFamily) {
|
|
23295
|
-
if (Array.isArray(customFontFamily)) fonts = [...DEFAULT_FONT_LIST, ...customFontFamily];
|
|
23296
|
-
else if (customFontFamily.override) fonts = [...customFontFamily.list];
|
|
23297
|
-
else fonts = [...DEFAULT_FONT_LIST, ...customFontFamily.list];
|
|
23298
|
-
} else fonts = [...DEFAULT_FONT_LIST];
|
|
23299
|
-
this.fonts$.next(fonts);
|
|
23300
|
-
}
|
|
23301
|
-
dispose() {
|
|
23302
|
-
this.resetToDefaults();
|
|
23303
|
-
this.fonts$.complete();
|
|
23304
|
-
}
|
|
23305
|
-
getFonts() {
|
|
23306
|
-
return this.fonts$.getValue();
|
|
23307
|
-
}
|
|
23308
|
-
getFontByValue(value) {
|
|
23309
|
-
return this.getFonts().find((font) => font.value === value);
|
|
23310
|
-
}
|
|
23311
|
-
/**
|
|
23312
|
-
* Check if the current browser environment supports the font
|
|
23313
|
-
* @param fontValue
|
|
23314
|
-
* @returns boolean Whether the font is supported
|
|
23315
|
-
*/
|
|
23316
|
-
isFontSupported(fontValue) {
|
|
23317
|
-
const context = document.createElement("canvas").getContext("2d");
|
|
23318
|
-
if (!context) return false;
|
|
23319
|
-
const text = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
23320
|
-
const size = "72px";
|
|
23321
|
-
const baseFonts = [
|
|
23322
|
-
"monospace",
|
|
23323
|
-
"serif",
|
|
23324
|
-
"sans-serif"
|
|
23325
|
-
];
|
|
23326
|
-
const defaultWidths = {};
|
|
23327
|
-
baseFonts.forEach((base) => {
|
|
23328
|
-
context.font = `${size} ${base}`;
|
|
23329
|
-
defaultWidths[base] = context.measureText(text).width;
|
|
23330
|
-
});
|
|
23331
|
-
return baseFonts.some((base) => {
|
|
23332
|
-
context.font = `${size} "${fontValue}", ${base}`;
|
|
23333
|
-
return context.measureText(text).width !== defaultWidths[base];
|
|
23334
|
-
});
|
|
23335
|
-
}
|
|
23336
|
-
addFont(font) {
|
|
23337
|
-
if (this.getFontByValue(font.value)) throw new Error(`[FontService]: Font with value "${font.value}" already exists.`);
|
|
23338
|
-
const updatedFonts = [...this.getFonts(), font].sort();
|
|
23339
|
-
this.fonts$.next(updatedFonts);
|
|
23340
|
-
}
|
|
23341
|
-
updateFont(value, updates) {
|
|
23342
|
-
const fonts = this.getFonts();
|
|
23343
|
-
const fontIndex = fonts.findIndex((font) => font.value === value);
|
|
23344
|
-
if (fontIndex === -1) throw new Error(`Font with value "${value}" not found.`);
|
|
23345
|
-
const updatedFont = {
|
|
23346
|
-
...fonts[fontIndex],
|
|
23347
|
-
...updates
|
|
23348
|
-
};
|
|
23349
|
-
const updatedFonts = [...fonts];
|
|
23350
|
-
updatedFonts[fontIndex] = updatedFont;
|
|
23351
|
-
this.fonts$.next(updatedFonts);
|
|
23352
|
-
}
|
|
23353
|
-
removeFont(value) {
|
|
23354
|
-
const fonts = this.getFonts();
|
|
23355
|
-
if (fonts.findIndex((font) => font.value === value) === -1) return false;
|
|
23356
|
-
const updatedFonts = fonts.filter((font) => font.value !== value);
|
|
23357
|
-
this.fonts$.next(updatedFonts);
|
|
23358
|
-
return true;
|
|
23359
|
-
}
|
|
23360
|
-
resetToDefaults() {
|
|
23361
|
-
this.fonts$.next([...DEFAULT_FONT_LIST]);
|
|
23362
|
-
}
|
|
23363
|
-
};
|
|
23364
|
-
FontService = __decorate([__decorateParam(0, IConfigService)], FontService);
|
|
23365
|
-
|
|
23366
|
-
//#endregion
|
|
23367
|
-
//#region src/views/font-family/use-font-list.ts
|
|
23368
|
-
function useFontList() {
|
|
23369
|
-
const fontService = useDependency(IFontService);
|
|
23370
|
-
return {
|
|
23371
|
-
fonts: useObservable(fontService.fonts$, fontService.getFonts()),
|
|
23372
|
-
fontService
|
|
23373
|
-
};
|
|
23374
|
-
}
|
|
23375
|
-
|
|
23376
23682
|
//#endregion
|
|
23377
23683
|
//#region src/views/font-family/FontFamily.tsx
|
|
23378
23684
|
const FONT_FAMILY_COMPONENT = "UI_FONT_FAMILY_COMPONENT";
|
|
@@ -23448,33 +23754,6 @@ const FontFamily = ({ className, disabled: disabledProp, value, disabled$, onCha
|
|
|
23448
23754
|
});
|
|
23449
23755
|
};
|
|
23450
23756
|
|
|
23451
|
-
//#endregion
|
|
23452
|
-
//#region src/views/font-family/FontFamilyItem.tsx
|
|
23453
|
-
const FONT_FAMILY_ITEM_COMPONENT = "UI_FONT_FAMILY_ITEM_COMPONENT";
|
|
23454
|
-
const FontFamilyItem = ({ value, onChange }) => {
|
|
23455
|
-
const localeService = useDependency(LocaleService);
|
|
23456
|
-
const direction = useObservable(localeService.direction$, localeService.getDirection());
|
|
23457
|
-
const { fonts, fontService } = useFontList();
|
|
23458
|
-
function handleSelectFont(nextValue) {
|
|
23459
|
-
onChange(nextValue);
|
|
23460
|
-
}
|
|
23461
|
-
return /* @__PURE__ */ jsx("ul", {
|
|
23462
|
-
dir: direction,
|
|
23463
|
-
className: "univer-m-0 univer-list-none univer-p-0 univer-text-sm",
|
|
23464
|
-
style: { fontFamily: value },
|
|
23465
|
-
children: fonts.map((font) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("button", {
|
|
23466
|
-
className: "univer-flex univer-h-7 univer-w-full univer-appearance-none univer-items-center univer-justify-between univer-gap-6 univer-rounded univer-border-none univer-bg-transparent univer-px-2 univer-text-gray-900 hover:univer-bg-gray-100 dark:!univer-text-gray-0 dark:hover:!univer-bg-gray-700",
|
|
23467
|
-
style: { fontFamily: font.value },
|
|
23468
|
-
type: "button",
|
|
23469
|
-
onClick: () => handleSelectFont(font.value),
|
|
23470
|
-
children: [localeService.t(font.label), !fontService.isFontSupported(font.value) && /* @__PURE__ */ jsx(Tooltip, {
|
|
23471
|
-
title: localeService.t("ui.fontFamily.not-supported"),
|
|
23472
|
-
children: /* @__PURE__ */ jsx(InfoIcon, { className: "univer-text-gray-300 dark:!univer-text-gray-400" })
|
|
23473
|
-
})]
|
|
23474
|
-
}) }, font.value))
|
|
23475
|
-
});
|
|
23476
|
-
};
|
|
23477
|
-
|
|
23478
23757
|
//#endregion
|
|
23479
23758
|
//#region src/views/font-size/FontSize.tsx
|
|
23480
23759
|
const FontSize = (props) => {
|
|
@@ -24122,7 +24401,7 @@ function MobileRibbonToolbar(props) {
|
|
|
24122
24401
|
return /* @__PURE__ */ jsx("div", {
|
|
24123
24402
|
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
24403
|
children: groupItems.map((child) => child.item && /* @__PURE__ */ jsx("div", {
|
|
24125
|
-
className: clsx("
|
|
24404
|
+
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
24405
|
children: /* @__PURE__ */ jsx(MobileToolbarItem, {
|
|
24127
24406
|
...child.item,
|
|
24128
24407
|
preserveStrokeWidth: true
|
|
@@ -27788,34 +28067,48 @@ function Slider(props) {
|
|
|
27788
28067
|
/* @__PURE__ */ jsx("div", {
|
|
27789
28068
|
className: "univer-hidden univer-h-6 univer-items-center sm:!univer-flex",
|
|
27790
28069
|
children: /* @__PURE__ */ jsx("div", {
|
|
27791
|
-
className: clsx("univer-relative univer-h-1.5 univer-
|
|
28070
|
+
className: clsx("univer-relative univer-h-1.5 univer-px-1.5", { "univer-opacity-60": disabled }),
|
|
27792
28071
|
style: { width: `${SLIDER_WIDTH}px` },
|
|
27793
28072
|
children: /* @__PURE__ */ jsxs("div", {
|
|
27794
28073
|
ref: sliderInnerRailRef,
|
|
27795
28074
|
role: "track",
|
|
27796
|
-
className: "univer-relative univer-h-1.5 univer-bg-gray-200 dark:!univer-bg-gray-600",
|
|
28075
|
+
className: "univer-relative univer-h-1.5 univer-rounded-full univer-bg-gray-200 univer-transition-colors dark:!univer-bg-gray-600",
|
|
27797
28076
|
onPointerDown: handlePointerDown,
|
|
27798
28077
|
children: [
|
|
27799
28078
|
/* @__PURE__ */ jsx("div", {
|
|
27800
|
-
className: clsx("univer-
|
|
28079
|
+
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
28080
|
style: { width: `${sliderOffset}%` }
|
|
27802
28081
|
}),
|
|
27803
|
-
/* @__PURE__ */ jsx("
|
|
27804
|
-
className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-
|
|
27805
|
-
|
|
27806
|
-
|
|
27807
|
-
|
|
27808
|
-
|
|
27809
|
-
|
|
27810
|
-
|
|
27811
|
-
|
|
27812
|
-
|
|
27813
|
-
|
|
27814
|
-
|
|
27815
|
-
|
|
27816
|
-
|
|
28082
|
+
/* @__PURE__ */ jsx("div", {
|
|
28083
|
+
className: "univer-absolute univer-left-1/2 univer-top-1/2 univer-size-6 -univer-translate-x-1/2 -univer-translate-y-1/2",
|
|
28084
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
28085
|
+
title: `${localeService.t("ui.accessibility.resetZoom")} (${resetPoint}%)`,
|
|
28086
|
+
placement: "top",
|
|
28087
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
28088
|
+
className: "univer-size-6 univer-p-0 focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-100",
|
|
28089
|
+
size: "small",
|
|
28090
|
+
variant: "link",
|
|
28091
|
+
type: "button",
|
|
28092
|
+
"data-u-comp": "zoom-reset",
|
|
28093
|
+
"aria-label": localeService.t("ui.accessibility.resetZoom"),
|
|
28094
|
+
disabled,
|
|
28095
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
28096
|
+
onClick: handleReset,
|
|
28097
|
+
onKeyDown: (e) => {
|
|
28098
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
28099
|
+
e.preventDefault();
|
|
28100
|
+
e.stopPropagation();
|
|
28101
|
+
handleReset();
|
|
28102
|
+
},
|
|
28103
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
28104
|
+
"aria-hidden": "true",
|
|
28105
|
+
className: "univer-box-border univer-h-3 univer-w-1 univer-rounded-full univer-border univer-border-solid univer-border-gray-0 univer-bg-gray-600 dark:!univer-border-gray-800 dark:!univer-bg-gray-100"
|
|
28106
|
+
})
|
|
28107
|
+
})
|
|
28108
|
+
})
|
|
28109
|
+
}),
|
|
27817
28110
|
/* @__PURE__ */ jsx("button", {
|
|
27818
|
-
className: clsx("univer-absolute univer-top-1/2 univer-size-3.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-gray-0 univer-shadow-sm univer-transition
|
|
28111
|
+
className: clsx("univer-absolute univer-top-1/2 univer-size-3.5 -univer-translate-x-1/2 -univer-translate-y-1/2 univer-rounded-full univer-bg-gray-0 univer-shadow-sm univer-transition focus-visible:univer-outline-none focus-visible:univer-ring-2 focus-visible:univer-ring-primary-100 dark:!univer-bg-gray-800", borderClassName, {
|
|
27819
28112
|
"univer-cursor-pointer hover:univer-border-primary-600 hover:univer-shadow-md": !disabled,
|
|
27820
28113
|
"univer-cursor-not-allowed": disabled,
|
|
27821
28114
|
"univer-scale-105 univer-border-primary-600 univer-shadow-md": isDragging
|
|
@@ -29880,4 +30173,4 @@ function ProgressBar(props) {
|
|
|
29880
30173
|
}
|
|
29881
30174
|
|
|
29882
30175
|
//#endregion
|
|
29883
|
-
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, 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, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, 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, FloatingObjectToolbarPosition, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, FormatPainterSessionService, HEADING_ITEM_COMPONENT, HEADING_LIST, HOVER_TRACK_HOST_CLASS_NAME, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, HoverTrack, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IUnitPresenceUIAdapterRegistry, IWorkbenchService, IconManager, KeyCode, MOBILE_UI_MODE, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileCanvasGesture, MobileContextMenu, MobileDialogService, MobileDrawer, MobileFontFamilyDropdown, MobileKeyboardInsetContext, MobileMenu, MobileZoomIndicator, MockMessageService, NativeTextEditorShortcutBehavior, ObjectPermissionButton, ObjectPermissionPanelButton, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoRedoGroupService, UndoShortcutItem, UnitPresenceUIAdapterRegistry, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, WorkbenchService, ZIndexManager, ZoomInput, bindFormatPainterCanvas, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getMobileCanvasPanDelta, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, objectPermissionMenuItemFactory, openObjectPermissionDialog, openObjectPermissionPanel, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, preventBrowserZoomInContainers, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useMobileCanvasPanel, useMobileCanvasViewport, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|
|
30176
|
+
export { AnchoredContextMenu, BrowserClipboardService, BuiltInUIPart, COLOR_PICKER_COMPONENT, COMMON_LABEL_COMPONENT, CanvasFloatDomPreviewService, 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, EMBED_CHILD_UNIT_ID_ATTRIBUTE, EMBED_INTERACTION_BOUNDARY_OWNER_ATTRIBUTE, 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, FloatingObjectToolbarPosition, FontCategory, FontFamily, FontFamilyDropdown, FontFamilyItem, FontService, FontSize, FormatPainterSessionService, HEADING_ITEM_COMPONENT, HEADING_LIST, HOVER_TRACK_HOST_CLASS_NAME, HTML_CLIPBOARD_MIME_TYPE, HeadingItem, HoverTrack, IBeforeCloseService, ICanvasPopupService, IClipboardInterfaceService, IContextMenuHostService, IContextMenuService, IDialogService, IFontService, IGalleryService, ILayoutService, ILeftSidebarService, ILocalFileService, IMenuManagerService, IMessageService, INotificationService, IPlatformService, IRibbonOverrideService, IRibbonService, IShortcutService, ISidebarService, IUIController, IUIPartsService, IUIRuntimeScopeService, IUnitPresenceUIAdapterRegistry, IWorkbenchService, IconManager, KeyCode, MOBILE_UI_MODE, MenuItemType, MenuManagerPosition, MenuManagerService, MetaKeys, MobileCanvasGesture, MobileContextMenu, MobileDialogService, MobileDrawer, MobileFontFamilyDropdown, MobileKeyboardInsetContext, MobileMenu, MobileZoomIndicator, MockMessageService, NativeTextEditorShortcutBehavior, ObjectPermissionButton, ObjectPermissionPanelButton, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, PasteCommand, PlatformService, PrintFloatDomSingle, ProgressBar, RectPopup, RediConsumer, RediContext, RediProvider, RedoShortcutItem, Ribbon, RibbonDataGroup, RibbonFormulasGroup, RibbonInsertGroup, RibbonOthersGroup, RibbonOverrideService, RibbonPosition, RibbonStartGroup, RibbonViewGroup, SYMBOL_CATEGORIES, SYMBOL_PICKER_COMPONENT, SharedController, SheetPasteShortKeyCommandName, ShortcutPanelController, ShortcutPanelService, ShortcutService, Sidebar, SingleCanvasPopup, SingleUnitUIController, Slider, SymbolPicker, ThemeSwitcherService, ToggleFullscreenOperation, ToggleShortcutPanelOperation, ToolbarButton, ToolbarItem, menuSchema as UIMenuSchema, UIPartsService, UIRuntimeScopeService, UI_PLUGIN_CONFIG_KEY, UNI_DISABLE_CHANGING_FOCUS_KEY, UndoRedoGroupService, UndoShortcutItem, UnitPresenceUIAdapterRegistry, UniverMobileUIPlugin, UniverUIPlugin, WithDependency, WorkbenchService, ZIndexManager, ZoomInput, bindFormatPainterCanvas, connectDependencies, connectInjector, getAllEmojis, getDefaultRecentEmojis, getEmbedBoundaryOwner, getEmbedChildUnitId, getEmojiLocaleData, getHeaderFooterMenuHiddenObservable, getLocalizedEmojiTitle, getMenuHiddenObservable, getMobileCanvasPanDelta, getRandomEmoji, handelExcelToJson, handelTableToJson, handleDomToJson, handlePlainToJson, handleStringToStyle, handleTableColgroup, handleTableMergeData, handleTableRowGroup, imageMimeTypeSet, isEmbedBoundaryTarget, keepInteractionInsideSameEmbedBoundary, mergeMenuConfigs, objectPermissionMenuItemFactory, openObjectPermissionDialog, openObjectPermissionPanel, parseHtmlDocument, parseHtmlFragment, parseStoredRecentEmojis, preventBrowserZoomInContainers, promoteRecentEmoji, sanitizeParsedHtml, searchEmojis, splitSpanText, supportClipboardAPI, textTrim, useClickOutSide, useComponentsOfPart, useConfigValue, useDebounceFn, useDependency, useEvent, useInjector, useMobileCanvasPanel, useMobileCanvasViewport, useObservable, useObservableRef, useScrollYOverContainer, useSidebarClick, useToolbarItemStatus, useUpdateBinder, useUpdateEffect, useVirtualList };
|