@univerjs/sheets-formula-ui 1.0.0-alpha.3 → 1.0.0-alpha.5

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/index.css CHANGED
@@ -42,6 +42,11 @@
42
42
  margin-bottom: .5rem;
43
43
  }
44
44
 
45
+ .univer-my-3 {
46
+ margin-top: .75rem;
47
+ margin-bottom: .75rem;
48
+ }
49
+
45
50
  .univer-mb-0 {
46
51
  margin-bottom: 0;
47
52
  }
@@ -74,6 +79,10 @@
74
79
  margin-top: .25rem;
75
80
  }
76
81
 
82
+ .univer-mt-1\.5 {
83
+ margin-top: .375rem;
84
+ }
85
+
77
86
  .univer-mt-2 {
78
87
  margin-top: .5rem;
79
88
  }
@@ -82,6 +91,10 @@
82
91
  margin-top: .75rem;
83
92
  }
84
93
 
94
+ .univer-mt-4 {
95
+ margin-top: 1rem;
96
+ }
97
+
85
98
  .univer-box-border {
86
99
  box-sizing: border-box;
87
100
  }
@@ -194,6 +207,10 @@
194
207
  gap: .5rem;
195
208
  }
196
209
 
210
+ .univer-gap-3 {
211
+ gap: .75rem;
212
+ }
213
+
197
214
  .univer-gap-4 {
198
215
  gap: 1rem;
199
216
  }
@@ -232,10 +249,18 @@
232
249
  border-radius: .25rem;
233
250
  }
234
251
 
252
+ .univer-rounded-full {
253
+ border-radius: 9999px;
254
+ }
255
+
235
256
  .univer-rounded-lg {
236
257
  border-radius: .5rem;
237
258
  }
238
259
 
260
+ .univer-rounded-md {
261
+ border-radius: .375rem;
262
+ }
263
+
239
264
  .univer-rounded-none {
240
265
  border-radius: 0;
241
266
  }
@@ -265,10 +290,22 @@
265
290
  background-color: var(--univer-gray-600) !important;
266
291
  }
267
292
 
293
+ .univer-bg-gray-100 {
294
+ background-color: var(--univer-gray-100);
295
+ }
296
+
268
297
  .univer-bg-gray-200 {
269
298
  background-color: var(--univer-gray-200);
270
299
  }
271
300
 
301
+ .univer-bg-gray-50 {
302
+ background-color: var(--univer-gray-50);
303
+ }
304
+
305
+ .univer-bg-primary-50 {
306
+ background-color: var(--univer-primary-50);
307
+ }
308
+
272
309
  .univer-bg-primary-600 {
273
310
  background-color: var(--univer-primary-600);
274
311
  }
@@ -302,6 +339,11 @@
302
339
  padding-right: .5rem;
303
340
  }
304
341
 
342
+ .univer-px-3 {
343
+ padding-left: .75rem;
344
+ padding-right: .75rem;
345
+ }
346
+
305
347
  .univer-px-4 {
306
348
  padding-left: 1rem;
307
349
  padding-right: 1rem;
@@ -317,6 +359,11 @@
317
359
  padding-right: 1.75rem;
318
360
  }
319
361
 
362
+ .univer-py-0\.5 {
363
+ padding-top: .125rem;
364
+ padding-bottom: .125rem;
365
+ }
366
+
320
367
  .univer-py-1 {
321
368
  padding-top: .25rem;
322
369
  padding-bottom: .25rem;
@@ -340,6 +387,10 @@
340
387
  padding-top: 0;
341
388
  }
342
389
 
390
+ .univer-font-mono {
391
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
392
+ }
393
+
343
394
  .univer-text-base {
344
395
  font-size: 1rem;
345
396
  line-height: 1.5rem;
@@ -363,6 +414,14 @@
363
414
  font-weight: 500;
364
415
  }
365
416
 
417
+ .univer-font-semibold {
418
+ font-weight: 600;
419
+ }
420
+
421
+ .univer-leading-4 {
422
+ line-height: 1rem;
423
+ }
424
+
366
425
  .univer-leading-5 {
367
426
  line-height: 1.25rem;
368
427
  }
@@ -452,10 +511,22 @@
452
511
  background-color: var(--univer-gray-600) !important;
453
512
  }
454
513
 
514
+ .dark\:\!univer-bg-gray-700:where(.univer-dark, .univer-dark *) {
515
+ background-color: var(--univer-gray-700) !important;
516
+ }
517
+
518
+ .dark\:\!univer-bg-gray-800:where(.univer-dark, .univer-dark *) {
519
+ background-color: var(--univer-gray-800) !important;
520
+ }
521
+
455
522
  .dark\:\!univer-bg-gray-900:where(.univer-dark, .univer-dark *) {
456
523
  background-color: var(--univer-gray-900) !important;
457
524
  }
458
525
 
526
+ .dark\:\!univer-bg-primary-900:where(.univer-dark, .univer-dark *) {
527
+ background-color: var(--univer-primary-900) !important;
528
+ }
529
+
459
530
  .dark\:\!univer-text-gray-200:where(.univer-dark, .univer-dark *) {
460
531
  color: var(--univer-gray-200) !important;
461
532
  }
@@ -464,6 +535,10 @@
464
535
  color: var(--univer-gray-300) !important;
465
536
  }
466
537
 
538
+ .dark\:\!univer-text-primary-200:where(.univer-dark, .univer-dark *) {
539
+ color: var(--univer-primary-200) !important;
540
+ }
541
+
467
542
  .dark\:\!univer-text-white:where(.univer-dark, .univer-dark *) {
468
543
  color: var(--univer-white) !important;
469
544
  }
package/lib/index.js CHANGED
@@ -8,8 +8,8 @@ import { BEFORE_CELL_EDIT, INTERCEPTOR_POINT, IRefSelectionsService, REF_SELECTI
8
8
  import { IDescriptionService, ImageFormulaCellInterceptorController, InsertFunctionCommand, PLUGIN_CONFIG_KEY_BASE, QuickSumCommand, TriggerCalculationController, UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
9
9
  import { BuiltInUIPart, ComponentManager, IContextMenuService, IMenuManagerService, IShortcutService, ISidebarService, IUIPartsService, IconManager, KeyCode, MenuItemType, MetaKeys, ProgressBar, RectPopup, RibbonFormulasGroup, connectInjector, getMenuHiddenObservable, useDependency, useEvent, useObservable, useUpdateEffect } from "@univerjs/ui";
10
10
  import { DocSelectionManagerService } from "@univerjs/docs";
11
- import { CheckMarkIcon, CloseIcon, DeleteIcon, FunctionIcon, IncreaseIcon, MoreRightIcon, SelectRangeIcon } from "@univerjs/icons";
12
- import { Button, Dialog, Input, Select, Tooltip, borderClassName, borderLeftClassName, borderTopClassName, clsx, scrollbarClassName } from "@univerjs/design";
11
+ import { CheckMarkIcon, CloseIcon, DatabaseFunctionIcon, DateFunctionIcon, DeleteIcon, EngineeringFunctionIcon, FinancialFunctionIcon, FunctionIcon, IncreaseIcon, InformationFunctionIcon, LogicalFunctionIcon, LookupFunctionIcon, MathFunctionIcon, MoreRightIcon, SelectRangeIcon, StatisticalFunctionIcon, TextFunctionIcon } from "@univerjs/icons";
12
+ import { Button, Dialog, Input, Select, Tooltip, borderClassName, borderLeftClassName, borderTopClassName, clsx, divideYClassName, scrollbarClassName } from "@univerjs/design";
13
13
  import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
14
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
15
  import { debounceTime as debounceTime$1 } from "rxjs/operators";
@@ -832,11 +832,12 @@ function createInsertFunctionCategoryMenuItemFactory(functionType, categoryKey,
832
832
  } catch {
833
833
  selections = [];
834
834
  }
835
+ const localeKey = `sheets-formula-ui.functionType.${categoryKey}`;
835
836
  return {
836
837
  id: `${InsertFunctionOperation.id}.${categoryKey}`,
837
838
  commandId: InsertFunctionOperation.id,
838
- title: `sheets-formula-ui.functionType.${categoryKey}`,
839
- tooltip: "sheets-formula-ui.insert.tooltip",
839
+ title: localeKey,
840
+ tooltip: localeKey,
840
841
  icon,
841
842
  type: MenuItemType.SELECTOR,
842
843
  selections,
@@ -844,16 +845,16 @@ function createInsertFunctionCategoryMenuItemFactory(functionType, categoryKey,
844
845
  };
845
846
  };
846
847
  }
847
- const InsertFinancialFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Financial, "financial");
848
- const InsertLogicalFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Logical, "logical");
849
- const InsertTextFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Text, "text");
850
- const InsertDateFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Date, "date");
851
- const InsertLookupFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Lookup, "lookup");
852
- const InsertMathFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Math, "math");
853
- const InsertStatisticalFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Statistical, "statistical");
854
- const InsertEngineeringFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Engineering, "engineering");
855
- const InsertInformationFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Information, "information");
856
- const InsertDatabaseFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Database, "database");
848
+ const InsertFinancialFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Financial, "financial", "FinancialFunctionIcon");
849
+ const InsertLogicalFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Logical, "logical", "LogicalFunctionIcon");
850
+ const InsertTextFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Text, "text", "TextFunctionIcon");
851
+ const InsertDateFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Date, "date", "DateFunctionIcon");
852
+ const InsertLookupFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Lookup, "lookup", "LookupFunctionIcon");
853
+ const InsertMathFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Math, "math", "MathFunctionIcon");
854
+ const InsertStatisticalFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Statistical, "statistical", "StatisticalFunctionIcon");
855
+ const InsertEngineeringFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Engineering, "engineering", "EngineeringFunctionIcon");
856
+ const InsertInformationFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Information, "information", "InformationFunctionIcon");
857
+ const InsertDatabaseFunctionMenuItemFactory = createInsertFunctionCategoryMenuItemFactory(FunctionType.Database, "database", "DatabaseFunctionIcon");
857
858
  function AllFunctionsMenuItemFactory(accessor) {
858
859
  return {
859
860
  id: MoreFunctionsOperation.id,
@@ -909,83 +910,43 @@ const menuSchema = {
909
910
  },
910
911
  [`${InsertFunctionOperation.id}.financial`]: {
911
912
  order: 1,
912
- menuItemFactory: InsertFinancialFunctionMenuItemFactory,
913
- [MoreFunctionsOperation.id]: {
914
- order: 0,
915
- menuItemFactory: AllFunctionsMenuItemFactory
916
- }
913
+ menuItemFactory: InsertFinancialFunctionMenuItemFactory
917
914
  },
918
915
  [`${InsertFunctionOperation.id}.logical`]: {
919
916
  order: 2,
920
- menuItemFactory: InsertLogicalFunctionMenuItemFactory,
921
- [MoreFunctionsOperation.id]: {
922
- order: 0,
923
- menuItemFactory: AllFunctionsMenuItemFactory
924
- }
917
+ menuItemFactory: InsertLogicalFunctionMenuItemFactory
925
918
  },
926
919
  [`${InsertFunctionOperation.id}.text`]: {
927
920
  order: 3,
928
- menuItemFactory: InsertTextFunctionMenuItemFactory,
929
- [MoreFunctionsOperation.id]: {
930
- order: 0,
931
- menuItemFactory: AllFunctionsMenuItemFactory
932
- }
921
+ menuItemFactory: InsertTextFunctionMenuItemFactory
933
922
  },
934
923
  [`${InsertFunctionOperation.id}.date`]: {
935
924
  order: 4,
936
- menuItemFactory: InsertDateFunctionMenuItemFactory,
937
- [MoreFunctionsOperation.id]: {
938
- order: 0,
939
- menuItemFactory: AllFunctionsMenuItemFactory
940
- }
925
+ menuItemFactory: InsertDateFunctionMenuItemFactory
941
926
  },
942
927
  [`${InsertFunctionOperation.id}.lookup`]: {
943
928
  order: 5,
944
- menuItemFactory: InsertLookupFunctionMenuItemFactory,
945
- [MoreFunctionsOperation.id]: {
946
- order: 0,
947
- menuItemFactory: AllFunctionsMenuItemFactory
948
- }
929
+ menuItemFactory: InsertLookupFunctionMenuItemFactory
949
930
  },
950
931
  [`${InsertFunctionOperation.id}.math`]: {
951
932
  order: 6,
952
- menuItemFactory: InsertMathFunctionMenuItemFactory,
953
- [MoreFunctionsOperation.id]: {
954
- order: 0,
955
- menuItemFactory: AllFunctionsMenuItemFactory
956
- }
933
+ menuItemFactory: InsertMathFunctionMenuItemFactory
957
934
  },
958
935
  [`${InsertFunctionOperation.id}.statistical`]: {
959
936
  order: 7,
960
- menuItemFactory: InsertStatisticalFunctionMenuItemFactory,
961
- [MoreFunctionsOperation.id]: {
962
- order: 0,
963
- menuItemFactory: AllFunctionsMenuItemFactory
964
- }
937
+ menuItemFactory: InsertStatisticalFunctionMenuItemFactory
965
938
  },
966
939
  [`${InsertFunctionOperation.id}.engineering`]: {
967
940
  order: 8,
968
- menuItemFactory: InsertEngineeringFunctionMenuItemFactory,
969
- [MoreFunctionsOperation.id]: {
970
- order: 0,
971
- menuItemFactory: AllFunctionsMenuItemFactory
972
- }
941
+ menuItemFactory: InsertEngineeringFunctionMenuItemFactory
973
942
  },
974
943
  [`${InsertFunctionOperation.id}.information`]: {
975
944
  order: 9,
976
- menuItemFactory: InsertInformationFunctionMenuItemFactory,
977
- [MoreFunctionsOperation.id]: {
978
- order: 0,
979
- menuItemFactory: AllFunctionsMenuItemFactory
980
- }
945
+ menuItemFactory: InsertInformationFunctionMenuItemFactory
981
946
  },
982
947
  [`${InsertFunctionOperation.id}.database`]: {
983
948
  order: 10,
984
- menuItemFactory: InsertDatabaseFunctionMenuItemFactory,
985
- [MoreFunctionsOperation.id]: {
986
- order: 0,
987
- menuItemFactory: AllFunctionsMenuItemFactory
988
- }
949
+ menuItemFactory: InsertDatabaseFunctionMenuItemFactory
989
950
  }
990
951
  },
991
952
  [COPY_SPECIAL_MENU_ID]: { [SheetCopyFormulaOnlyCommand.id]: {
@@ -1001,7 +962,7 @@ const menuSchema = {
1001
962
  //#endregion
1002
963
  //#region package.json
1003
964
  var name = "@univerjs/sheets-formula-ui";
1004
- var version = "1.0.0-alpha.3";
965
+ var version = "1.0.0-alpha.5";
1005
966
 
1006
967
  //#endregion
1007
968
  //#region src/config/config.ts
@@ -3295,7 +3256,7 @@ function SearchFunctionFactory(props, ref) {
3295
3256
  const shortcutService = useDependency(IShortcutService);
3296
3257
  const commandService = useDependency(ICommandService);
3297
3258
  const { searchList, searchText, handlerFormulaReplace, reset: resetFormulaSearch } = useFormulaSearch(isFocus, sequenceNodes, editor);
3298
- const visible = useMemo(() => !!searchList.length, [searchList]);
3259
+ const visible = searchList.length > 0;
3299
3260
  const ulRef = useRef(void 0);
3300
3261
  const [active, setActive] = useState(0);
3301
3262
  const isEnableMouseEnterOrOut = useRef(false);
@@ -3481,7 +3442,7 @@ function syncCounterpartFormulaEditorSelection(editorService, editorId, selectio
3481
3442
  (_editorService$getEdi = editorService.getEditor(syncEditorId)) === null || _editorService$getEdi === void 0 || _editorService$getEdi.setSelectionRanges(selections, false);
3482
3443
  }
3483
3444
  const FormulaEditor = forwardRef((props, ref) => {
3484
- var _document$getBody$dat, _document$getBody, _configService$getCon, _configService$getCon2;
3445
+ var _document$getBody$dat2, _document$getBody2, _configService$getCon, _configService$getCon2;
3485
3446
  const { errorText, initValue, unitId, subUnitId, isFocus: _isFocus = true, isSupportAcrossSheet = false, onFocus = noop, onBlur = noop, onChange: propOnChange, onVerify, className, editorId: propEditorId, moveCursor = true, onFormulaSelectingChange: propOnFormulaSelectingChange, keyboardEventConfig, onMoveInEditor, resetSelectionOnBlur = true, autoScrollbar = true, isSingle = true, disableSelectionOnClick = false, autofocus = true, disableContextMenu, style, borderless = false, canvasStyle } = props;
3486
3447
  const editorService = useDependency(IEditorService);
3487
3448
  const commandService = useDependency(ICommandService);
@@ -3499,12 +3460,14 @@ const FormulaEditor = forwardRef((props, ref) => {
3499
3460
  const [isFocus, setIsFocus] = useState(_isFocus);
3500
3461
  const formulaEditorContainerRef = useRef(null);
3501
3462
  const editorId = useMemo(() => propEditorId !== null && propEditorId !== void 0 ? propEditorId : createInternalEditorID(`${EMBEDDING_FORMULA_EDITOR}-${generateRandomId(4)}`), []);
3502
- const isError = useMemo(() => errorText !== void 0, [errorText]);
3463
+ const isError = errorText !== void 0;
3503
3464
  const univerInstanceService = useDependency(IUniverInstanceService);
3504
3465
  const document = univerInstanceService.getUnit(editorId);
3505
- useObservable(document === null || document === void 0 ? void 0 : document.change$);
3506
3466
  const getFormulaToken = useFormulaToken();
3507
- const formulaText = BuildTextUtils.transform.getPlainText((_document$getBody$dat = document === null || document === void 0 || (_document$getBody = document.getBody()) === null || _document$getBody === void 0 ? void 0 : _document$getBody.dataStream) !== null && _document$getBody$dat !== void 0 ? _document$getBody$dat : "");
3467
+ const formulaText = useObservable(document ? () => document.change$.pipe(map(() => {
3468
+ var _document$getBody$dat, _document$getBody;
3469
+ return BuildTextUtils.transform.getPlainText((_document$getBody$dat = (_document$getBody = document.getBody()) === null || _document$getBody === void 0 ? void 0 : _document$getBody.dataStream) !== null && _document$getBody$dat !== void 0 ? _document$getBody$dat : "");
3470
+ })) : null, BuildTextUtils.transform.getPlainText((_document$getBody$dat2 = document === null || document === void 0 || (_document$getBody2 = document.getBody()) === null || _document$getBody2 === void 0 ? void 0 : _document$getBody2.dataStream) !== null && _document$getBody$dat2 !== void 0 ? _document$getBody$dat2 : ""), false, [document]);
3508
3471
  const formulaTextRef = useStateRef(formulaText);
3509
3472
  const formulaWithoutEqualSymbol = useMemo(() => getFormulaText(formulaText), [formulaText]);
3510
3473
  const sequenceNodes = useMemo(() => getFormulaToken(formulaWithoutEqualSymbol), [formulaWithoutEqualSymbol, getFormulaToken]);
@@ -3522,8 +3485,8 @@ const FormulaEditor = forwardRef((props, ref) => {
3522
3485
  const isFocusing = docSelectionRenderService === null || docSelectionRenderService === void 0 ? void 0 : docSelectionRenderService.isFocusing;
3523
3486
  const currentDoc = useObservable(useMemo(() => univerInstanceService.getCurrentTypeOfUnit$(UniverInstanceType.UNIVER_DOC), [univerInstanceService]));
3524
3487
  const docFocusing = (currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) === editorId;
3525
- const refSelections = useRef([]);
3526
- const getRefSelections = useEvent(() => refSelections.current);
3488
+ const refSelectionsRef = useRef([]);
3489
+ const getRefSelections = useEvent(() => refSelectionsRef.current);
3527
3490
  const getRefSelectionCount = useEvent(() => getRefSelections().length);
3528
3491
  const selectingMode = isSelecting;
3529
3492
  const functionScreenTips = (_configService$getCon = (_configService$getCon2 = useDependency(IConfigService).getConfig("sheets-formula-ui.base.config")) === null || _configService$getCon2 === void 0 ? void 0 : _configService$getCon2.functionScreenTips) !== null && _configService$getCon !== void 0 ? _configService$getCon : true;
@@ -3559,7 +3522,7 @@ const FormulaEditor = forwardRef((props, ref) => {
3559
3522
  const formulaStr = text[0] === "=" ? text.slice(1) : "";
3560
3523
  const sequenceNodes = getFormulaToken(formulaStr);
3561
3524
  const ranges = highlightDoc(editorRef.current, sequenceNodes, isNeedResetSelection, newSelections, formulaStr);
3562
- refSelections.current = ranges;
3525
+ refSelectionsRef.current = ranges;
3563
3526
  if (isEnd) {
3564
3527
  const currentDocSelections = newSelections !== null && newSelections !== void 0 ? newSelections : editor === null || editor === void 0 ? void 0 : editor.getSelectionRanges();
3565
3528
  if ((currentDocSelections === null || currentDocSelections === void 0 ? void 0 : currentDocSelections.length) === 1) {
@@ -3858,6 +3821,13 @@ function FunctionParams(props) {
3858
3821
  function InputParams(props) {
3859
3822
  const { functionInfo, onChange } = props;
3860
3823
  if (!functionInfo) return null;
3824
+ return /* @__PURE__ */ jsx(InputParamsInner, {
3825
+ functionInfo,
3826
+ onChange
3827
+ });
3828
+ }
3829
+ function InputParamsInner(props) {
3830
+ const { functionInfo, onChange } = props;
3861
3831
  const [params, setParams] = useState([]);
3862
3832
  const [functionParameter, setFunctionParameter] = useState(functionInfo.functionParameter);
3863
3833
  const [activeIndex, setActiveIndex] = useState(-1);
@@ -4002,27 +3972,60 @@ function SelectFunction(props) {
4002
3972
  }, index))
4003
3973
  }),
4004
3974
  functionInfo && /* @__PURE__ */ jsxs("div", {
4005
- className: clsx("univer-mx-0 univer-my-2 univer-overflow-y-auto", scrollbarClassName),
3975
+ "data-u-comp": "formula-function-details",
3976
+ className: clsx("univer-mx-0 univer-my-3 univer-overflow-y-auto", scrollbarClassName),
4006
3977
  children: [
4007
- /* @__PURE__ */ jsx(FunctionParams, {
4008
- title: functionInfo.functionName,
4009
- value: functionInfo.description
4010
- }),
4011
- /* @__PURE__ */ jsx(FunctionParams, {
4012
- title: localeService.t("sheets-formula-ui.moreFunctions.syntax"),
4013
- value: /* @__PURE__ */ jsx(FunctionHelp, {
4014
- prefix: functionInfo.functionName,
4015
- value: functionInfo.functionParameter
4016
- })
3978
+ /* @__PURE__ */ jsxs("div", {
3979
+ className: "univer-rounded-lg univer-bg-gray-50 univer-p-3 dark:!univer-bg-gray-800",
3980
+ children: [/* @__PURE__ */ jsx("div", {
3981
+ className: "univer-text-sm univer-font-semibold univer-text-gray-900 dark:!univer-text-white",
3982
+ children: functionInfo.functionName
3983
+ }), /* @__PURE__ */ jsx("div", {
3984
+ className: "univer-mt-1 univer-text-xs univer-leading-5 univer-text-gray-600 dark:!univer-text-gray-300",
3985
+ children: functionInfo.description
3986
+ })]
4017
3987
  }),
4018
- /* @__PURE__ */ jsx(FunctionParams, {
4019
- title: localeService.t("sheets-formula-ui.prompt.helpExample"),
4020
- value: `${functionInfo.functionName}(${functionInfo.functionParameter.map((item) => item.example).join(",")})`
3988
+ /* @__PURE__ */ jsxs("div", {
3989
+ className: "univer-mt-4 univer-flex univer-flex-col univer-gap-3",
3990
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
3991
+ className: "univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
3992
+ children: localeService.t("sheets-formula-ui.moreFunctions.syntax")
3993
+ }), /* @__PURE__ */ jsx("div", {
3994
+ "data-u-comp": "formula-function-syntax",
3995
+ className: clsx("univer-mt-1.5 univer-break-words univer-rounded-md univer-bg-gray-50 univer-px-3 univer-py-2 univer-font-mono univer-text-xs univer-leading-5 univer-text-gray-900 dark:!univer-bg-gray-800 dark:!univer-text-white", borderClassName),
3996
+ children: /* @__PURE__ */ jsx(FunctionHelp, {
3997
+ prefix: functionInfo.functionName,
3998
+ value: functionInfo.functionParameter
3999
+ })
4000
+ })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
4001
+ className: "univer-text-xs univer-font-medium univer-text-gray-500 dark:!univer-text-gray-300",
4002
+ children: localeService.t("sheets-formula-ui.prompt.helpExample")
4003
+ }), /* @__PURE__ */ jsx("div", {
4004
+ "data-u-comp": "formula-function-example",
4005
+ className: clsx("univer-mt-1.5 univer-break-words univer-rounded-md univer-bg-gray-50 univer-px-3 univer-py-2 univer-font-mono univer-text-xs univer-leading-5 univer-text-gray-900 dark:!univer-bg-gray-800 dark:!univer-text-white", borderClassName),
4006
+ children: `${functionInfo.functionName}(${functionInfo.functionParameter.map((item) => item.example).join(",")})`
4007
+ })] })]
4021
4008
  }),
4022
- functionInfo.functionParameter && functionInfo.functionParameter.map((item) => /* @__PURE__ */ jsx(FunctionParams, {
4023
- title: item.name,
4024
- value: `${item.require ? required : optional} ${item.detail}`
4025
- }, item.name))
4009
+ functionInfo.functionParameter.length > 0 && /* @__PURE__ */ jsx("div", {
4010
+ className: clsx("univer-mt-4 univer-rounded-lg univer-px-3", borderClassName, divideYClassName),
4011
+ children: functionInfo.functionParameter.map((item) => /* @__PURE__ */ jsxs("div", {
4012
+ "data-u-comp": "formula-function-parameter",
4013
+ className: "univer-py-3",
4014
+ children: [/* @__PURE__ */ jsxs("div", {
4015
+ className: "univer-flex univer-items-center univer-gap-2",
4016
+ children: [/* @__PURE__ */ jsx("span", {
4017
+ className: "univer-text-xs univer-font-medium univer-text-gray-900 dark:!univer-text-white",
4018
+ children: item.name
4019
+ }), /* @__PURE__ */ jsx("span", {
4020
+ className: clsx("univer-rounded-full univer-px-2 univer-py-0.5 univer-text-xs univer-leading-4", item.require ? "univer-bg-primary-50 univer-text-primary-600 dark:!univer-bg-primary-900 dark:!univer-text-primary-200" : "univer-bg-gray-100 univer-text-gray-600 dark:!univer-bg-gray-700 dark:!univer-text-gray-200"),
4021
+ children: item.require ? required : optional
4022
+ })]
4023
+ }), /* @__PURE__ */ jsx("div", {
4024
+ className: "univer-mt-1 univer-text-xs univer-leading-5 univer-text-gray-600 dark:!univer-text-gray-300",
4025
+ children: item.detail
4026
+ })]
4027
+ }, item.name))
4028
+ })
4026
4029
  ]
4027
4030
  })
4028
4031
  ] });
@@ -4508,7 +4511,19 @@ let ComponentsController = class ComponentsController extends Disposable {
4508
4511
  this._registerComponents();
4509
4512
  }
4510
4513
  _registerIcons() {
4511
- this.disposeWithMe(this._iconManager.register({ FunctionIcon }));
4514
+ this.disposeWithMe(this._iconManager.register({
4515
+ DatabaseFunctionIcon,
4516
+ DateFunctionIcon,
4517
+ EngineeringFunctionIcon,
4518
+ FinancialFunctionIcon,
4519
+ FunctionIcon,
4520
+ InformationFunctionIcon,
4521
+ LogicalFunctionIcon,
4522
+ LookupFunctionIcon,
4523
+ MathFunctionIcon,
4524
+ StatisticalFunctionIcon,
4525
+ TextFunctionIcon
4526
+ }));
4512
4527
  }
4513
4528
  _registerComponents() {
4514
4529
  this.disposeWithMe(this._componentManager.register(MORE_FUNCTIONS_COMPONENT, MoreFunctions));