@univerjs/sheets-ui 1.0.0-alpha.0 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/lib/cjs/facade.js +4 -3
  2. package/lib/cjs/index.js +189 -50
  3. package/lib/cjs/locale/ar-SA.js +11 -4
  4. package/lib/cjs/locale/ca-ES.js +11 -4
  5. package/lib/cjs/locale/de-DE.js +11 -4
  6. package/lib/cjs/locale/en-US.js +9 -2
  7. package/lib/cjs/locale/es-ES.js +11 -4
  8. package/lib/cjs/locale/fa-IR.js +11 -4
  9. package/lib/cjs/locale/fr-FR.js +11 -4
  10. package/lib/cjs/locale/id-ID.js +11 -4
  11. package/lib/cjs/locale/it-IT.js +11 -4
  12. package/lib/cjs/locale/ja-JP.js +9 -2
  13. package/lib/cjs/locale/ko-KR.js +9 -2
  14. package/lib/cjs/locale/pl-PL.js +11 -4
  15. package/lib/cjs/locale/pt-BR.js +11 -4
  16. package/lib/cjs/locale/ru-RU.js +11 -4
  17. package/lib/cjs/locale/sk-SK.js +11 -4
  18. package/lib/cjs/locale/vi-VN.js +11 -4
  19. package/lib/cjs/locale/zh-CN.js +9 -2
  20. package/lib/cjs/locale/zh-HK.js +9 -2
  21. package/lib/cjs/locale/zh-TW.js +9 -2
  22. package/lib/es/facade.js +4 -3
  23. package/lib/es/index.js +192 -54
  24. package/lib/es/locale/ar-SA.js +11 -4
  25. package/lib/es/locale/ca-ES.js +11 -4
  26. package/lib/es/locale/de-DE.js +11 -4
  27. package/lib/es/locale/en-US.js +9 -2
  28. package/lib/es/locale/es-ES.js +11 -4
  29. package/lib/es/locale/fa-IR.js +11 -4
  30. package/lib/es/locale/fr-FR.js +11 -4
  31. package/lib/es/locale/id-ID.js +11 -4
  32. package/lib/es/locale/it-IT.js +11 -4
  33. package/lib/es/locale/ja-JP.js +9 -2
  34. package/lib/es/locale/ko-KR.js +9 -2
  35. package/lib/es/locale/pl-PL.js +11 -4
  36. package/lib/es/locale/pt-BR.js +11 -4
  37. package/lib/es/locale/ru-RU.js +11 -4
  38. package/lib/es/locale/sk-SK.js +11 -4
  39. package/lib/es/locale/vi-VN.js +11 -4
  40. package/lib/es/locale/zh-CN.js +9 -2
  41. package/lib/es/locale/zh-HK.js +9 -2
  42. package/lib/es/locale/zh-TW.js +9 -2
  43. package/lib/facade.js +4 -3
  44. package/lib/index.css +38 -4
  45. package/lib/index.js +192 -54
  46. package/lib/locale/ar-SA.js +11 -4
  47. package/lib/locale/ca-ES.js +11 -4
  48. package/lib/locale/de-DE.js +11 -4
  49. package/lib/locale/en-US.js +9 -2
  50. package/lib/locale/es-ES.js +11 -4
  51. package/lib/locale/fa-IR.js +11 -4
  52. package/lib/locale/fr-FR.js +11 -4
  53. package/lib/locale/id-ID.js +11 -4
  54. package/lib/locale/it-IT.js +11 -4
  55. package/lib/locale/ja-JP.js +9 -2
  56. package/lib/locale/ko-KR.js +9 -2
  57. package/lib/locale/pl-PL.js +11 -4
  58. package/lib/locale/pt-BR.js +11 -4
  59. package/lib/locale/ru-RU.js +11 -4
  60. package/lib/locale/sk-SK.js +11 -4
  61. package/lib/locale/vi-VN.js +11 -4
  62. package/lib/locale/zh-CN.js +9 -2
  63. package/lib/locale/zh-HK.js +9 -2
  64. package/lib/locale/zh-TW.js +9 -2
  65. package/lib/types/commands/commands/clipboard.command.d.ts +1 -0
  66. package/lib/types/controllers/clipboard/clipboard.controller.d.ts +4 -2
  67. package/lib/types/controllers/editor/data-sync.controller.d.ts +5 -2
  68. package/lib/types/facade/f-range.d.ts +5 -4
  69. package/lib/types/index.d.ts +1 -1
  70. package/lib/types/locale/en-US.d.ts +10 -1
  71. package/lib/types/services/clipboard/clipboard.service.d.ts +8 -2
  72. package/lib/umd/facade.js +1 -1
  73. package/lib/umd/index.js +8 -8
  74. package/lib/umd/locale/ar-SA.js +1 -1
  75. package/lib/umd/locale/ca-ES.js +1 -1
  76. package/lib/umd/locale/de-DE.js +1 -1
  77. package/lib/umd/locale/en-US.js +1 -1
  78. package/lib/umd/locale/es-ES.js +1 -1
  79. package/lib/umd/locale/fa-IR.js +1 -1
  80. package/lib/umd/locale/fr-FR.js +1 -1
  81. package/lib/umd/locale/id-ID.js +1 -1
  82. package/lib/umd/locale/it-IT.js +1 -1
  83. package/lib/umd/locale/ja-JP.js +1 -1
  84. package/lib/umd/locale/ko-KR.js +1 -1
  85. package/lib/umd/locale/pl-PL.js +1 -1
  86. package/lib/umd/locale/pt-BR.js +1 -1
  87. package/lib/umd/locale/ru-RU.js +1 -1
  88. package/lib/umd/locale/sk-SK.js +1 -1
  89. package/lib/umd/locale/vi-VN.js +1 -1
  90. package/lib/umd/locale/zh-CN.js +1 -1
  91. package/lib/umd/locale/zh-HK.js +1 -1
  92. package/lib/umd/locale/zh-TW.js +1 -1
  93. package/package.json +15 -15
package/lib/cjs/facade.js CHANGED
@@ -1276,13 +1276,14 @@ _univerjs_sheets_facade.FRange.extend(FRangeSheetsUIMixin);
1276
1276
  * @returns {string} The transformed component key.
1277
1277
  */
1278
1278
  function transformComponentKey(component, componentManager) {
1279
- const { componentKey, isVue3 } = component;
1279
+ const { componentKey, framework } = component;
1280
1280
  let key;
1281
1281
  const disposableCollection = new _univerjs_core.DisposableCollection();
1282
1282
  if (typeof componentKey === "string") key = componentKey;
1283
1283
  else {
1284
- key = `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1285
- disposableCollection.add(componentManager.register(key, componentKey, { framework: isVue3 ? "vue3" : "react" }));
1284
+ const resolvedFramework = framework !== null && framework !== void 0 ? framework : "react";
1285
+ key = resolvedFramework === "web-component" ? `external-${(0, _univerjs_core.generateRandomId)(6).toLowerCase()}` : `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1286
+ disposableCollection.add(componentManager.register(key, componentKey, { framework: resolvedFramework }));
1286
1287
  }
1287
1288
  return {
1288
1289
  key,
package/lib/cjs/index.js CHANGED
@@ -4064,6 +4064,7 @@ const IMAGE_MIME_TO_EXTENSION = {
4064
4064
  [_univerjs_ui.FILE__WEBP_CLIPBOARD_MIME_TYPE]: "webp",
4065
4065
  [_univerjs_ui.FILE__BMP_CLIPBOARD_MIME_TYPE]: "bmp"
4066
4066
  };
4067
+ const FORMULA_CLIPBOARD_MIME_TYPE = "web application/x-univer-sheets-formula";
4067
4068
  /**
4068
4069
  * This service provide hooks for sheet features to supplement content or modify behavior of clipboard.
4069
4070
  */
@@ -4129,6 +4130,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4129
4130
  return (_h$onBeforeCopy = h.onBeforeCopy) === null || _h$onBeforeCopy === void 0 ? void 0 : _h$onBeforeCopy.call(h, workbookId, worksheetId, range, copyType);
4130
4131
  });
4131
4132
  const copyContent = this._generateCopyContent(workbookId, worksheetId, range, hooks, copyHookType);
4133
+ if (copyContent && copyType === "COPY") copyContent.formulaClipboardPayload = this._generateFormulaClipboardPayload(workbookId, worksheetId, range, copyContent, hooks);
4132
4134
  hooks.forEach((h) => {
4133
4135
  var _h$onAfterCopy;
4134
4136
  return (_h$onAfterCopy = h.onAfterCopy) === null || _h$onAfterCopy === void 0 ? void 0 : _h$onAfterCopy.call(h);
@@ -4149,7 +4151,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4149
4151
  copyHookType
4150
4152
  });
4151
4153
  if (!copyContent) return false;
4152
- const { html, plain, matrixFragment, copyId, discreteRange } = copyContent;
4154
+ const { html, plain, matrixFragment, copyId, discreteRange, formulaClipboardPayload } = copyContent;
4153
4155
  this._copyContentCache.set(copyId, {
4154
4156
  unitId: workbook.getUnitId(),
4155
4157
  subUnitId: worksheet.getSheetId(),
@@ -4157,7 +4159,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4157
4159
  matrix: matrixFragment,
4158
4160
  copyType
4159
4161
  });
4160
- await this._clipboardInterfaceService.write(plain, html);
4162
+ await this._clipboardInterfaceService.write(plain, html, formulaClipboardPayload ? { [FORMULA_CLIPBOARD_MIME_TYPE]: formulaClipboardPayload } : void 0);
4161
4163
  this._markSelectionService.removeAllShapes();
4162
4164
  const style = createCopyPasteSelectionStyle(this._themeService);
4163
4165
  this._copyMarkId = this._markSelectionService.addShape({
@@ -4173,6 +4175,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4173
4175
  const types = item.types;
4174
4176
  const text = types.indexOf(_univerjs_ui.PLAIN_TEXT_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(_univerjs_ui.PLAIN_TEXT_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "";
4175
4177
  const html = types.indexOf(_univerjs_ui.HTML_CLIPBOARD_MIME_TYPE) !== -1 ? await item.getType(_univerjs_ui.HTML_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()) : "";
4178
+ const formulaClipboardPayload = types.indexOf("web application/x-univer-sheets-formula") !== -1 ? await item.getType(FORMULA_CLIPBOARD_MIME_TYPE).then((blob) => blob && blob.text()).catch(() => "") : "";
4176
4179
  const imageIndex = types.findIndex((type) => _univerjs_ui.imageMimeTypeSet.has(type));
4177
4180
  const shouldUseHTMLPaste = imageIndex === -1 || !htmlContainsImage(html);
4178
4181
  if (html && shouldUseHTMLPaste) {
@@ -4181,7 +4184,7 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4181
4184
  title: this._localeService.t("sheets-ui.clipboard.shortCutNotify.title"),
4182
4185
  content: this._localeService.t("sheets-ui.clipboard.shortCutNotify.useShortCutInstead")
4183
4186
  });
4184
- return this._pasteHTML(html, pasteType);
4187
+ return this._pasteHTML(html, pasteType, formulaClipboardPayload);
4185
4188
  }
4186
4189
  if (imageIndex !== -1) {
4187
4190
  const imageMimeType = types[imageIndex];
@@ -4199,10 +4202,10 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4199
4202
  async pasteByCopyId(copyId, pasteType = PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE) {
4200
4203
  return this._pasteInternal(copyId, pasteType);
4201
4204
  }
4202
- async legacyPaste(html, text, files) {
4205
+ async legacyPaste(html, text, files, formulaClipboardPayload) {
4203
4206
  const isFromExcel = htmlIsFromExcel(html !== null && html !== void 0 ? html : "");
4204
4207
  if (files && !isFromExcel) return this._pasteFiles(files, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
4205
- else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
4208
+ else if (html) return this._pasteHTML(html, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE, formulaClipboardPayload);
4206
4209
  else if (text) if (/[\n\t]/.test(text)) return this._pasteHTML(convertTextToTable(text), PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
4207
4210
  else return this._pastePlainText(text, PREDEFINED_HOOK_NAME_PASTE.DEFAULT_PASTE);
4208
4211
  else return this._pasteUnrecognized();
@@ -4309,6 +4312,40 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4309
4312
  discreteRange
4310
4313
  };
4311
4314
  }
4315
+ _generateFormulaClipboardPayload(unitId, subUnitId, range, copyContent, hooks) {
4316
+ if (this._hasFilteredRows(unitId, subUnitId, range, hooks)) return;
4317
+ const { startRow, startColumn, endRow, endColumn } = range;
4318
+ const rowCount = endRow - startRow + 1;
4319
+ const columnCount = endColumn - startColumn + 1;
4320
+ const formulaOnlyHook = hooks.find((hook) => hook.id === PREDEFINED_HOOK_NAME_COPY.SPECIAL_COPY_FORMULA_ONLY);
4321
+ const formulas = [];
4322
+ for (let row = 0; row < rowCount; row++) for (let column = 0; column < columnCount; column++) {
4323
+ var _formulaOnlyHook$onCo, _copyContent$matrixFr;
4324
+ const formula = (formulaOnlyHook === null || formulaOnlyHook === void 0 || (_formulaOnlyHook$onCo = formulaOnlyHook.onCopyCellContent) === null || _formulaOnlyHook$onCo === void 0 ? void 0 : _formulaOnlyHook$onCo.call(formulaOnlyHook, startRow + row, startColumn + column)) || ((_copyContent$matrixFr = copyContent.matrixFragment.getValue(row, column)) === null || _copyContent$matrixFr === void 0 ? void 0 : _copyContent$matrixFr.f);
4325
+ if (typeof formula === "string" && (0, _univerjs_core.isFormulaString)(formula)) formulas.push({
4326
+ row,
4327
+ column,
4328
+ f: formula
4329
+ });
4330
+ }
4331
+ if (!formulas.length) return;
4332
+ return JSON.stringify({
4333
+ rowCount,
4334
+ columnCount,
4335
+ origin: {
4336
+ row: startRow,
4337
+ column: startColumn
4338
+ },
4339
+ formulas
4340
+ });
4341
+ }
4342
+ _hasFilteredRows(unitId, subUnitId, range, hooks) {
4343
+ return hooks.some((hook) => {
4344
+ var _hook$getFilteredOutR;
4345
+ const rows = (_hook$getFilteredOutR = hook.getFilteredOutRows) === null || _hook$getFilteredOutR === void 0 ? void 0 : _hook$getFilteredOutR.call(hook, unitId, subUnitId, range);
4346
+ return !!(rows === null || rows === void 0 ? void 0 : rows.length);
4347
+ });
4348
+ }
4312
4349
  _notifyClipboardHook() {
4313
4350
  this._clipboardHooks$.next(this._clipboardHooks);
4314
4351
  }
@@ -4375,15 +4412,49 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4375
4412
  return (_h$onPasteUnrecognize = h.onPasteUnrecognized) === null || _h$onPasteUnrecognize === void 0 ? void 0 : _h$onPasteUnrecognize.call(h, payload);
4376
4413
  });
4377
4414
  }
4378
- async _pasteHTML(html, pasteType) {
4415
+ async _pasteHTML(html, pasteType, formulaClipboardPayload) {
4379
4416
  const copyId = extractId(html);
4380
4417
  if (copyId && this._copyContentCache.get(copyId)) return this._pasteInternal(copyId, pasteType);
4381
- return this._pasteExternal(html, pasteType);
4418
+ return this._pasteExternal(html, pasteType, formulaClipboardPayload);
4382
4419
  }
4383
- async _pasteExternal(html, pasteType) {
4384
- var _this$_univerInstance;
4420
+ async _pasteExternal(html, pasteType, formulaClipboardPayload) {
4385
4421
  const { rowProperties, colProperties, cellMatrix } = this._htmlToUSM.convert(html);
4386
4422
  if (!cellMatrix) return false;
4423
+ const sourceRange = formulaClipboardPayload ? this._applyFormulaClipboardPayload(cellMatrix, formulaClipboardPayload) : void 0;
4424
+ return this._pasteExternalData({
4425
+ rowProperties,
4426
+ colProperties,
4427
+ cellMatrix
4428
+ }, pasteType, sourceRange);
4429
+ }
4430
+ _applyFormulaClipboardPayload(cellMatrix, text) {
4431
+ let payload;
4432
+ try {
4433
+ payload = JSON.parse(text);
4434
+ } catch {
4435
+ return;
4436
+ }
4437
+ if (!payload || !payload.origin || !Array.isArray(payload.formulas) || payload.rowCount <= 0 || payload.columnCount <= 0) return;
4438
+ cellMatrix.setValue(payload.rowCount - 1, payload.columnCount - 1, {
4439
+ ...(0, _univerjs_core.getEmptyCell)(),
4440
+ ...cellMatrix.getValue(payload.rowCount - 1, payload.columnCount - 1)
4441
+ });
4442
+ payload.formulas.forEach((formula) => {
4443
+ if ((0, _univerjs_core.isFormulaString)(formula.f) && formula.row >= 0 && formula.row < payload.rowCount && formula.column >= 0 && formula.column < payload.columnCount) cellMatrix.setValue(formula.row, formula.column, {
4444
+ ...(0, _univerjs_core.getEmptyCell)(),
4445
+ ...cellMatrix.getValue(formula.row, formula.column),
4446
+ f: formula.f
4447
+ });
4448
+ });
4449
+ return {
4450
+ rows: Array.from({ length: payload.rowCount }, (_, index) => payload.origin.row + index),
4451
+ cols: Array.from({ length: payload.columnCount }, (_, index) => payload.origin.column + index)
4452
+ };
4453
+ }
4454
+ _pasteExternalData(data, pasteType, sourceRange) {
4455
+ var _this$_univerInstance;
4456
+ const { rowProperties, colProperties, cellMatrix } = data;
4457
+ if (!cellMatrix) return false;
4387
4458
  const pasteTarget = this._getPastedRange(cellMatrix);
4388
4459
  if (!pasteTarget) return false;
4389
4460
  const worksheet = (_this$_univerInstance = this._univerInstanceService.getUniverSheetInstance(pasteTarget.unitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getSheetBySheetId(pasteTarget.subUnitId);
@@ -4397,11 +4468,18 @@ let SheetClipboardService = class SheetClipboardService extends _univerjs_core.D
4397
4468
  return false;
4398
4469
  }
4399
4470
  }
4471
+ const source = sourceRange ? {
4472
+ range: sourceRange,
4473
+ unitId: pasteTarget.unitId,
4474
+ subUnitId: pasteTarget.subUnitId,
4475
+ copyType: "COPY",
4476
+ copyId: ""
4477
+ } : void 0;
4400
4478
  return this._pasteUSM({
4401
4479
  rowProperties,
4402
4480
  colProperties,
4403
4481
  cellMatrix
4404
- }, pasteTarget, pasteType);
4482
+ }, pasteTarget, pasteType, source);
4405
4483
  }
4406
4484
  async _pasteInternal(copyId, pasteType) {
4407
4485
  var _this$_univerInstance2, _this$_univerInstance3;
@@ -5033,8 +5111,8 @@ const SheetPasteShortKeyCommand = {
5033
5111
  type: _univerjs_core.CommandType.COMMAND,
5034
5112
  handler: async (accessor, params) => {
5035
5113
  const clipboardService = accessor.get(ISheetClipboardService);
5036
- const { htmlContent, textContent, files } = params;
5037
- clipboardService.legacyPaste(htmlContent, textContent, files);
5114
+ const { htmlContent, textContent, files, formulaClipboardPayload } = params;
5115
+ clipboardService.legacyPaste(htmlContent, textContent, files, formulaClipboardPayload);
5038
5116
  return true;
5039
5117
  }
5040
5118
  };
@@ -9390,6 +9468,7 @@ let SheetCellEditorResizeService = class SheetCellEditorResizeService extends _u
9390
9468
  if (documentDataModel == null) return;
9391
9469
  const documentSkeleton = this._getEditorSkeleton();
9392
9470
  if (!documentSkeleton) return;
9471
+ documentSkeleton.resetInitialWidth();
9393
9472
  const info = this._predictingSize(position, canvasOffset, documentSkeleton, documentLayoutObject, scaleX, scaleY);
9394
9473
  if (!info || info.actualWidth <= 0) return;
9395
9474
  let { actualWidth, actualHeight } = info;
@@ -10814,6 +10893,9 @@ let EditingRenderController = class EditingRenderController extends _univerjs_co
10814
10893
  this._contextService.setContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN, false);
10815
10894
  this._contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, false);
10816
10895
  this._cellEditorManagerService.setState({ show: param.visible });
10896
+ const formulaBarEditor = this._editorService.getEditor(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
10897
+ formulaBarEditor === null || formulaBarEditor === void 0 || formulaBarEditor.setSelectionRanges([], false);
10898
+ formulaBarEditor === null || formulaBarEditor === void 0 || formulaBarEditor.blur();
10817
10899
  const editorObject = this._getEditorObject();
10818
10900
  editorObject === null || editorObject === void 0 || (_editorObject$scene$g = editorObject.scene.getViewport(_univerjs_docs_ui.VIEWPORT_KEY.VIEW_MAIN)) === null || _editorObject$scene$g === void 0 || _editorObject$scene$g.scrollToViewportPos({
10819
10901
  viewportScrollX: 0,
@@ -11412,7 +11494,7 @@ const shouldRemoveShapeIds = [
11412
11494
  _univerjs_sheets.MoveColsMutation.id
11413
11495
  ];
11414
11496
  let SheetClipboardController = class SheetClipboardController extends _univerjs_core.RxDisposable {
11415
- constructor(_injector, _instanceService, _renderManagerService, _commandService, _contextService, _configService, _sheetClipboardService, _messageService, _localService, _uiPartsService) {
11497
+ constructor(_injector, _instanceService, _renderManagerService, _commandService, _contextService, _configService, _sheetClipboardService, _clipboardInterfaceService, _messageService, _localService, _uiPartsService) {
11416
11498
  super();
11417
11499
  this._injector = _injector;
11418
11500
  this._instanceService = _instanceService;
@@ -11421,6 +11503,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
11421
11503
  this._contextService = _contextService;
11422
11504
  this._configService = _configService;
11423
11505
  this._sheetClipboardService = _sheetClipboardService;
11506
+ this._clipboardInterfaceService = _clipboardInterfaceService;
11424
11507
  this._messageService = _messageService;
11425
11508
  this._localService = _localService;
11426
11509
  this._uiPartsService = _uiPartsService;
@@ -11437,7 +11520,7 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
11437
11520
  _pasteWithDoc() {
11438
11521
  var _this$_renderManagerS;
11439
11522
  const sheetPasteShortKeyFn = (docSelectionRenderService) => {
11440
- docSelectionRenderService.onPaste$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe((config) => {
11523
+ docSelectionRenderService.onPaste$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(async (config) => {
11441
11524
  var _clipboardEvent$clipb, _clipboardEvent$clipb2;
11442
11525
  if (!whenSheetEditorFocused(this._contextService)) return;
11443
11526
  config.event.preventDefault();
@@ -11445,10 +11528,12 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
11445
11528
  const htmlContent = (_clipboardEvent$clipb = clipboardEvent.clipboardData) === null || _clipboardEvent$clipb === void 0 ? void 0 : _clipboardEvent$clipb.getData("text/html");
11446
11529
  const textContent = (_clipboardEvent$clipb2 = clipboardEvent.clipboardData) === null || _clipboardEvent$clipb2 === void 0 ? void 0 : _clipboardEvent$clipb2.getData("text/plain");
11447
11530
  const files = this._resolveClipboardFiles(clipboardEvent.clipboardData);
11531
+ const formulaClipboardPayload = await this._readFormulaClipboardPayload();
11448
11532
  this._commandService.executeCommand(SheetPasteShortKeyCommand.id, {
11449
11533
  htmlContent,
11450
11534
  textContent,
11451
- files
11535
+ files,
11536
+ formulaClipboardPayload
11452
11537
  });
11453
11538
  });
11454
11539
  docSelectionRenderService === null || docSelectionRenderService === void 0 || docSelectionRenderService.onKeydown$.subscribe((event) => {
@@ -11470,6 +11555,16 @@ let SheetClipboardController = class SheetClipboardController extends _univerjs_
11470
11555
  const files = Array.from(clipboardData.items).map((item) => item.kind === "file" ? item.getAsFile() : void 0).filter(Boolean);
11471
11556
  return files.length > 0 ? files : void 0;
11472
11557
  }
11558
+ async _readFormulaClipboardPayload() {
11559
+ if (!this._clipboardInterfaceService.supportClipboard) return;
11560
+ try {
11561
+ const item = (await this._clipboardInterfaceService.read()).find((clipboardItem) => clipboardItem.types.includes(FORMULA_CLIPBOARD_MIME_TYPE));
11562
+ if (!item) return;
11563
+ return (await item.getType(FORMULA_CLIPBOARD_MIME_TYPE)).text();
11564
+ } catch {
11565
+ return;
11566
+ }
11567
+ }
11473
11568
  _init() {
11474
11569
  [
11475
11570
  SheetCopyCommand,
@@ -11924,9 +12019,10 @@ SheetClipboardController = __decorate([
11924
12019
  __decorateParam(4, _univerjs_core.IContextService),
11925
12020
  __decorateParam(5, _univerjs_core.IConfigService),
11926
12021
  __decorateParam(6, ISheetClipboardService),
11927
- __decorateParam(7, _univerjs_ui.IMessageService),
11928
- __decorateParam(8, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
11929
- __decorateParam(9, _univerjs_ui.IUIPartsService)
12022
+ __decorateParam(7, _univerjs_ui.IClipboardInterfaceService),
12023
+ __decorateParam(8, _univerjs_ui.IMessageService),
12024
+ __decorateParam(9, (0, _univerjs_core.Inject)(_univerjs_core.LocaleService)),
12025
+ __decorateParam(10, _univerjs_ui.IUIPartsService)
11930
12026
  ], SheetClipboardController);
11931
12027
 
11932
12028
  //#endregion
@@ -12140,7 +12236,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
12140
12236
  if (this._contextService.getContextValue(_univerjs_core.FOCUSING_EDITOR_BUT_HIDDEN) && !this._contextService.getContextValue(_univerjs_core.EDITOR_ACTIVATED)) {
12141
12237
  var _formulaEditorDataMod;
12142
12238
  this._univerInstanceService.setCurrentUnitForType(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12143
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12239
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
12144
12240
  if (this._editorBridgeService.isVisible().visible === false) this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
12145
12241
  visible: true,
12146
12242
  eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown,
@@ -12180,7 +12276,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
12180
12276
  this.disposeWithMe((0, rxjs.combineLatest)([this._formulaEditorManagerService.position$, addFormulaBar$]).subscribe(([position]) => {
12181
12277
  if (!position) return this._clearScheduledCallback();
12182
12278
  const editorObject = getEditorObject(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, this._renderManagerService);
12183
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12279
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
12184
12280
  if (editorObject == null || formulaEditorDataModel == null) return this._clearScheduledCallback();
12185
12281
  const { width, height } = position;
12186
12282
  if (width === 0 || height === 0) return this._clearScheduledCallback();
@@ -12199,7 +12295,7 @@ let FormulaEditorController = class FormulaEditorController extends _univerjs_co
12199
12295
  const position = this._formulaEditorManagerService.getPosition();
12200
12296
  const skeleton = (_this$_renderManagerS = this._renderManagerService.getRenderById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY)) === null || _this$_renderManagerS === void 0 ? void 0 : _this$_renderManagerS.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
12201
12297
  const editorObject = this._renderManagerService.getRenderById(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12202
- const formulaEditorDataModel = this._univerInstanceService.getUniverDocInstance(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
12298
+ const formulaEditorDataModel = this._univerInstanceService.getUnit(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, _univerjs_core.UniverInstanceType.UNIVER_DOC);
12203
12299
  if (skeleton == null || position == null || editorObject == null || formulaEditorDataModel == null) return;
12204
12300
  const { marginTop = 0, marginBottom = 0 } = formulaEditorDataModel.getSnapshot().documentStyle;
12205
12301
  const { scene, mainComponent } = editorObject;
@@ -15202,7 +15298,7 @@ let SheetRenderController = class SheetRenderController extends _univerjs_core.R
15202
15298
  this._renderFrameTags = {};
15203
15299
  }));
15204
15300
  this.disposeWithMe(engine.endFrame$.subscribe(() => {
15205
- if (this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).filter((key) => key.startsWith(_univerjs_engine_render.SHEET_EXTENSION_PREFIX)).length > 0) this._afterRenderMetric$.next({
15301
+ if (this._renderFrameTimeMetric && Object.keys(this._renderFrameTimeMetric).some((key) => key.startsWith(_univerjs_engine_render.SHEET_EXTENSION_PREFIX))) this._afterRenderMetric$.next({
15206
15302
  frameTimeMetric: this._renderFrameTimeMetric,
15207
15303
  tags: this._renderFrameTags
15208
15304
  });
@@ -17993,7 +18089,7 @@ function ShowRowMenuItemFactory(accessor) {
17993
18089
  return {
17994
18090
  id: _univerjs_sheets.SetSelectedRowsVisibleCommand.id,
17995
18091
  type: _univerjs_ui.MenuItemType.BUTTON,
17996
- icon: "EyeOutlineIcon",
18092
+ icon: "EyeIcon",
17997
18093
  title: "sheets-ui.rightClick.showHideRow",
17998
18094
  hidden$: deriveStateFromActiveSheet$(univerInstanceService, true, ({ worksheet }) => new rxjs.Observable((subscriber) => {
17999
18095
  function hasHiddenRowsInSelections() {
@@ -18029,7 +18125,7 @@ function ShowColMenuItemFactory(accessor) {
18029
18125
  return {
18030
18126
  id: _univerjs_sheets.SetSelectedColsVisibleCommand.id,
18031
18127
  type: _univerjs_ui.MenuItemType.BUTTON,
18032
- icon: "EyeOutlineIcon",
18128
+ icon: "EyeIcon",
18033
18129
  title: "sheets-ui.rightClick.showHideColumn",
18034
18130
  hidden$: deriveStateFromActiveSheet$(univerInstanceService, true, ({ worksheet }) => new rxjs.Observable((subscriber) => {
18035
18131
  function hasHiddenColsInSelections() {
@@ -19697,10 +19793,11 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19697
19793
  const definedNamesService = (0, _univerjs_ui.useDependency)(_univerjs_engine_formula.IDefinedNamesService);
19698
19794
  const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
19699
19795
  const sidebarService = (0, _univerjs_ui.useDependency)(_univerjs_ui.ISidebarService);
19796
+ const direction = localeService.getDirection();
19700
19797
  const unitId = univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_SHEET).getUnitId();
19701
19798
  const getDefinedNameMap = () => {
19702
19799
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
19703
- if (definedNameMap) return Array.from(Object.values(definedNameMap));
19800
+ if (definedNameMap) return Object.values(definedNameMap);
19704
19801
  return [];
19705
19802
  };
19706
19803
  const [definedNames, setDefinedNames] = (0, react.useState)(getDefinedNameMap());
@@ -19751,7 +19848,9 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19751
19848
  definedNamesService.focusRange(unitId, id);
19752
19849
  };
19753
19850
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
19754
- className: "univer-w-[300px]",
19851
+ "data-u-comp": "defined-name-overlay",
19852
+ dir: direction,
19853
+ className: "univer-w-[300px] rtl:univer-text-right",
19755
19854
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19756
19855
  ref: listContainerRef,
19757
19856
  className: (0, _univerjs_design.clsx)("univer-max-h-[360px] univer-min-h-0 univer-overflow-y-auto", _univerjs_design.scrollbarClassName, { "univer-min-h-[30px]": filteredDefinedNames.length > 0 }),
@@ -19765,13 +19864,16 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19765
19864
  focusDefinedName(definedName);
19766
19865
  },
19767
19866
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
19768
- className: (0, _univerjs_design.clsx)("univer-flex univer-items-center univer-justify-between univer-gap-2 univer-py-1", _univerjs_design.borderBottomClassName),
19867
+ "data-u-comp": "defined-name-overlay-row",
19868
+ className: (0, _univerjs_design.clsx)("univer-flex univer-items-center univer-gap-2 univer-py-1 rtl:univer-flex-row-reverse", _univerjs_design.borderBottomClassName),
19769
19869
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19770
- className: "univer-w-[50%] univer-flex-shrink-0 univer-truncate univer-text-sm univer-text-gray-600 dark:!univer-text-gray-200",
19870
+ "data-u-comp": "defined-name-overlay-name",
19871
+ className: "univer-min-w-0 univer-flex-1 univer-basis-0 univer-truncate univer-text-sm univer-text-gray-600 rtl:univer-text-right dark:!univer-text-gray-200",
19771
19872
  title: definedName.name,
19772
19873
  children: definedName.name
19773
19874
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19774
- className: "univer-w-[50%] univer-flex-shrink-0 univer-truncate univer-text-xs univer-text-gray-400",
19875
+ "data-u-comp": "defined-name-overlay-reference",
19876
+ className: "univer-min-w-0 univer-flex-1 univer-basis-0 univer-truncate univer-text-xs univer-text-gray-400 rtl:univer-text-right",
19775
19877
  title: definedName.formulaOrRefString,
19776
19878
  children: definedName.formulaOrRefString
19777
19879
  })]
@@ -19780,7 +19882,8 @@ function DefinedNameOverlay({ search, isInputEvent }) {
19780
19882
  })
19781
19883
  })
19782
19884
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
19783
- className: "univer-cursor-pointer univer-p-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:hover:!univer-bg-gray-600",
19885
+ "data-u-comp": "defined-name-overlay-footer",
19886
+ className: "univer-cursor-pointer univer-p-2 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 rtl:univer-text-right dark:hover:!univer-bg-gray-600",
19784
19887
  onClick: openSlider,
19785
19888
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
19786
19889
  className: "univer-mb-2 univer-text-sm univer-font-semibold univer-text-gray-600 dark:!univer-text-gray-200",
@@ -19815,7 +19918,7 @@ function DefinedName({ disable }) {
19815
19918
  const inputRef = (0, react.useRef)(null);
19816
19919
  const getDefinedNameMap = () => {
19817
19920
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
19818
- if (definedNameMap) return Array.from(Object.values(definedNameMap));
19921
+ if (definedNameMap) return Object.values(definedNameMap);
19819
19922
  return [];
19820
19923
  };
19821
19924
  const focusDefinedName = async (definedName) => {
@@ -19968,7 +20071,7 @@ function DefinedName({ disable }) {
19968
20071
  className: "univer-relative univer-box-border univer-flex univer-h-full univer-w-24 univer-border-r-gray-200 univer-py-1.5 univer-transition-all",
19969
20072
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
19970
20073
  ref: inputRef,
19971
- className: (0, _univerjs_design.clsx)("univer-box-border univer-size-full univer-appearance-none univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none dark:!univer-border-r-gray-700 dark:!univer-bg-gray-900 dark:!univer-text-white", _univerjs_design.borderRightClassName, { "univer-cursor-not-allowed": disable }),
20074
+ className: (0, _univerjs_design.clsx)("univer-box-border univer-size-full univer-appearance-none univer-pl-1.5 univer-pr-5 univer-text-gray-900 focus:univer-outline-none rtl:univer-pl-5 rtl:univer-pr-1.5 dark:!univer-border-r-gray-700 dark:!univer-bg-gray-900 dark:!univer-text-white", _univerjs_design.borderRightClassName, { "univer-cursor-not-allowed": disable }),
19972
20075
  type: "text",
19973
20076
  value: inputValue,
19974
20077
  onChange: handleChangeSelection,
@@ -19987,7 +20090,7 @@ function DefinedName({ disable }) {
19987
20090
  onOpenChange: setOpen,
19988
20091
  onOpenAutoFocus: (e) => e.preventDefault(),
19989
20092
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
19990
- className: (0, _univerjs_design.clsx)("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 dark:!univer-text-white dark:hover:!univer-bg-gray-800", { "univer-cursor-not-allowed univer-text-gray-300 hover:univer-bg-transparent dark:!univer-text-gray-700": disable }),
20093
+ className: (0, _univerjs_design.clsx)("univer-absolute univer-right-0 univer-top-0 univer-flex univer-h-full univer-cursor-pointer univer-items-center univer-justify-center univer-px-1 univer-transition-colors univer-duration-200 hover:univer-bg-gray-100 rtl:univer-left-0 rtl:univer-right-auto dark:!univer-text-white dark:hover:!univer-bg-gray-800", { "univer-cursor-not-allowed univer-text-gray-300 hover:univer-bg-transparent dark:!univer-text-gray-700": disable }),
19991
20094
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreDownIcon, {})
19992
20095
  })
19993
20096
  })]
@@ -21769,15 +21872,16 @@ const SheetBar = () => {
21769
21872
  }),
21770
21873
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetBarTabs, {}),
21771
21874
  (!leftScrollState || !rightScrollState) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
21772
- className: "univer-relative univer-flex univer-items-center univer-px-2 after:univer-absolute after:univer-right-0 after:univer-top-1/2 after:univer-h-4 after:univer-w-px after:-univer-translate-y-1/2 after:univer-bg-gray-200 after:univer-content-[\"\"]",
21875
+ "data-u-comp": "sheet-bar-scroll-buttons",
21876
+ className: "univer-relative univer-flex univer-items-center univer-px-2 after:univer-absolute after:univer-right-0 after:univer-top-1/2 after:univer-h-4 after:univer-w-px after:-univer-translate-y-1/2 after:univer-bg-gray-200 after:univer-content-[\"\"] rtl:univer-flex-row-reverse rtl:after:univer-left-0 rtl:after:univer-right-auto",
21773
21877
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetBarButton, {
21774
21878
  disabled: leftScrollState,
21775
21879
  onClick: handleScrollLeft,
21776
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreIcon, { className: "univer-rotate-180" })
21880
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreLeftIcon, {})
21777
21881
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SheetBarButton, {
21778
21882
  disabled: rightScrollState,
21779
21883
  onClick: handleScrollRight,
21780
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreIcon, {})
21884
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.MoreRightIcon, {})
21781
21885
  })]
21782
21886
  })
21783
21887
  ]
@@ -22675,7 +22779,7 @@ const useHighlightRange = (ranges = []) => {
22675
22779
  //#endregion
22676
22780
  //#region package.json
22677
22781
  var name = "@univerjs/sheets-ui";
22678
- var version = "1.0.0-alpha.0";
22782
+ var version = "1.0.0-alpha.2";
22679
22783
 
22680
22784
  //#endregion
22681
22785
  //#region src/controllers/cell-alert.controller.ts
@@ -24086,7 +24190,9 @@ function BorderPanel(props) {
24086
24190
  var _value$color;
24087
24191
  const iconManager = (0, _univerjs_ui.useDependency)(_univerjs_ui.IconManager);
24088
24192
  const borderStyleManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.BorderStyleManagerService);
24089
- const { isAllValuesSame, value: currentValue } = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService).getCellStylesProperty("bd");
24193
+ const selectionManagerService = (0, _univerjs_ui.useDependency)(_univerjs_sheets.SheetsSelectionsService);
24194
+ const { direction } = (0, react.useContext)(_univerjs_design.ConfigContext);
24195
+ const { isAllValuesSame, value: currentValue } = selectionManagerService.getCellStylesProperty("bd");
24090
24196
  const color = isAllValuesSame ? getBorderColor(currentValue) : void 0;
24091
24197
  const type = isAllValuesSame ? getBorderStyle(currentValue) : void 0;
24092
24198
  const { onChange, value } = props;
@@ -24101,6 +24207,7 @@ function BorderPanel(props) {
24101
24207
  return Icon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "univer-fill-primary-600" });
24102
24208
  }
24103
24209
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
24210
+ dir: direction,
24104
24211
  className: "univer-box-border univer-grid univer-gap-2 univer-p-1.5",
24105
24212
  children: [
24106
24213
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -24495,7 +24602,7 @@ const DefinedNameContainer = () => {
24495
24602
  const getDefinedNameMap = () => {
24496
24603
  if (!unitId) return [];
24497
24604
  const definedNameMap = definedNamesService.getDefinedNameMap(unitId);
24498
- if (definedNameMap) return Array.from(Object.values(definedNameMap));
24605
+ if (definedNameMap) return Object.values(definedNameMap);
24499
24606
  return [];
24500
24607
  };
24501
24608
  const [editState, setEditState] = (0, react.useState)(false);
@@ -25976,7 +26083,7 @@ let ComponentsController = class ComponentsController extends _univerjs_core.Dis
25976
26083
  DeleteRowDoubleIcon: _univerjs_icons.DeleteRowDoubleIcon,
25977
26084
  DownBorderDoubleIcon: _univerjs_icons.DownBorderDoubleIcon,
25978
26085
  DownloadImageIcon: _univerjs_icons.DownloadImageIcon,
25979
- EyeOutlineIcon: _univerjs_icons.EyeOutlineIcon,
26086
+ EyeIcon: _univerjs_icons.EyeIcon,
25980
26087
  FontColorDoubleIcon: _univerjs_icons.FontColorDoubleIcon,
25981
26088
  FontSizeIncreaseIcon: _univerjs_icons.FontSizeIncreaseIcon,
25982
26089
  FontSizeReduceIcon: _univerjs_icons.FontSizeReduceIcon,
@@ -26151,7 +26258,7 @@ const formulaEditorStyle = {
26151
26258
  }
26152
26259
  };
26153
26260
  let EditorDataSyncController = class EditorDataSyncController extends _univerjs_core.Disposable {
26154
- constructor(_univerInstanceService, _renderManagerService, _editorBridgeService, _commandService, _rangeProtectionRuleModel, _worksheetProtectionRuleModel, _formulaEditorController, _formulaEditorManagerService) {
26261
+ constructor(_univerInstanceService, _renderManagerService, _editorBridgeService, _commandService, _rangeProtectionRuleModel, _worksheetProtectionRuleModel, _formulaEditorController, _formulaEditorManagerService, _contextService) {
26155
26262
  super();
26156
26263
  this._univerInstanceService = _univerInstanceService;
26157
26264
  this._renderManagerService = _renderManagerService;
@@ -26161,11 +26268,13 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
26161
26268
  this._worksheetProtectionRuleModel = _worksheetProtectionRuleModel;
26162
26269
  this._formulaEditorController = _formulaEditorController;
26163
26270
  this._formulaEditorManagerService = _formulaEditorManagerService;
26271
+ this._contextService = _contextService;
26164
26272
  this._initialize();
26165
26273
  }
26166
26274
  _initialize() {
26167
26275
  this._syncFormulaEditorContent();
26168
26276
  this._commandExecutedListener();
26277
+ this._syncFormulaRefRenderStyleOnFocusChange();
26169
26278
  }
26170
26279
  _getEditorViewModel(unitId) {
26171
26280
  var _this$_renderManagerS;
@@ -26251,6 +26360,7 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
26251
26360
  unitId,
26252
26361
  syncer: parmas.unitId
26253
26362
  });
26363
+ this._checkAndSetRenderStyleConfig(docDataModel);
26254
26364
  docViewModel.reset(docDataModel);
26255
26365
  skeleton.calculate();
26256
26366
  if (INCLUDE_LIST.includes(unitId)) {
@@ -26282,27 +26392,54 @@ let EditorDataSyncController = class EditorDataSyncController extends _univerjs_
26282
26392
  }
26283
26393
  if (unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
26284
26394
  }
26395
+ _syncFormulaRefRenderStyleOnFocusChange() {
26396
+ this.disposeWithMe(this._contextService.subscribeContextValue$(_univerjs_core.FOCUSING_FX_BAR_EDITOR).subscribe(() => {
26397
+ this._refreshRenderStyleConfig(_univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY);
26398
+ this._refreshRenderStyleConfig(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
26399
+ }));
26400
+ }
26401
+ _refreshRenderStyleConfig(unitId) {
26402
+ var _currentRender$mainCo3;
26403
+ const currentRender = this._renderManagerService.getRenderById(unitId);
26404
+ const skeleton = currentRender === null || currentRender === void 0 ? void 0 : currentRender.with(_univerjs_docs.DocSkeletonManagerService).getSkeleton();
26405
+ const docDataModel = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
26406
+ const docViewModel = this._getEditorViewModel(unitId);
26407
+ if (currentRender == null || skeleton == null || docDataModel == null || docViewModel == null) return;
26408
+ this._checkAndSetRenderStyleConfig(docDataModel);
26409
+ docViewModel.reset(docDataModel);
26410
+ skeleton.calculate();
26411
+ (_currentRender$mainCo3 = currentRender.mainComponent) === null || _currentRender$mainCo3 === void 0 || _currentRender$mainCo3.makeDirty();
26412
+ if (unitId === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) this._formulaEditorController.autoScroll();
26413
+ }
26285
26414
  _checkAndSetRenderStyleConfig(documentDataModel) {
26286
- var _body$dataStream;
26415
+ var _snapshot$body$dataSt, _snapshot$body;
26287
26416
  const snapshot = documentDataModel.getSnapshot();
26288
- const { body } = snapshot;
26289
- if (snapshot.id !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY) return;
26290
- snapshot.documentStyle = formulaEditorStyle;
26417
+ if (snapshot.id !== _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY && snapshot.id !== _univerjs_core.DOCS_NORMAL_EDITOR_UNIT_ID_KEY) return;
26418
+ const isFormulaBar = snapshot.id === _univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;
26419
+ if (isFormulaBar) snapshot.documentStyle = formulaEditorStyle;
26420
+ else {
26421
+ var _snapshot$documentSty;
26422
+ (_snapshot$documentSty = snapshot.documentStyle) !== null && _snapshot$documentSty !== void 0 || (snapshot.documentStyle = {});
26423
+ }
26291
26424
  let renderConfig = snapshot.documentStyle.renderConfig;
26292
26425
  if (renderConfig == null) {
26293
26426
  renderConfig = {};
26294
26427
  snapshot.documentStyle.renderConfig = renderConfig;
26295
26428
  }
26296
- const position = this._formulaEditorManagerService.getPosition();
26297
- if (position) {
26429
+ const position = isFormulaBar ? this._formulaEditorManagerService.getPosition() : null;
26430
+ if (isFormulaBar && position) {
26298
26431
  const width = position.width;
26299
26432
  snapshot.documentStyle.pageSize = {
26300
26433
  width,
26301
26434
  height: Infinity
26302
26435
  };
26303
26436
  }
26304
- if (((_body$dataStream = body === null || body === void 0 ? void 0 : body.dataStream) !== null && _body$dataStream !== void 0 ? _body$dataStream : "").startsWith("=")) renderConfig.isRenderStyle = _univerjs_core.BooleanNumber.TRUE;
26305
- else renderConfig.isRenderStyle = _univerjs_core.BooleanNumber.FALSE;
26437
+ if (!((_snapshot$body$dataSt = (_snapshot$body = snapshot.body) === null || _snapshot$body === void 0 ? void 0 : _snapshot$body.dataStream) !== null && _snapshot$body$dataSt !== void 0 ? _snapshot$body$dataSt : "").startsWith("=")) {
26438
+ renderConfig.isRenderStyle = isFormulaBar ? _univerjs_core.BooleanNumber.FALSE : _univerjs_core.BooleanNumber.TRUE;
26439
+ return;
26440
+ }
26441
+ const isFocusFxBar = this._contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
26442
+ renderConfig.isRenderStyle = isFormulaBar === isFocusFxBar ? _univerjs_core.BooleanNumber.TRUE : _univerjs_core.BooleanNumber.FALSE;
26306
26443
  }
26307
26444
  _clearParagraph(paragraphs) {
26308
26445
  const newParagraphs = _univerjs_core.Tools.deepClone(paragraphs);
@@ -26318,7 +26455,8 @@ EditorDataSyncController = __decorate([
26318
26455
  __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_sheets.RangeProtectionRuleModel)),
26319
26456
  __decorateParam(5, (0, _univerjs_core.Inject)(_univerjs_sheets.WorksheetProtectionRuleModel)),
26320
26457
  __decorateParam(6, (0, _univerjs_core.Inject)(FormulaEditorController)),
26321
- __decorateParam(7, IFormulaEditorManagerService)
26458
+ __decorateParam(7, IFormulaEditorManagerService),
26459
+ __decorateParam(8, _univerjs_core.IContextService)
26322
26460
  ], EditorDataSyncController);
26323
26461
 
26324
26462
  //#endregion
@@ -31085,6 +31223,7 @@ Object.defineProperty(exports, 'EditorBridgeService', {
31085
31223
  }
31086
31224
  });
31087
31225
  exports.ExpandSelectionCommand = ExpandSelectionCommand;
31226
+ exports.FORMULA_CLIPBOARD_MIME_TYPE = FORMULA_CLIPBOARD_MIME_TYPE;
31088
31227
  exports.FormatPainterStatus = FormatPainterStatus;
31089
31228
  Object.defineProperty(exports, 'FormulaEditorController', {
31090
31229
  enumerable: true,
@@ -90,9 +90,16 @@ const locale = { "sheets-ui": {
90
90
  horizontal: "دمج أفقي",
91
91
  cancel: "إلغاء الدمج",
92
92
  overlappingError: "لا يمكن دمج المناطق المتداخلة",
93
- partiallyError: "لا يمكن إجراء هذه العملية على خلايا مدموجة جزئياً"
93
+ partiallyError: "لا يمكن إجراء هذه العملية على خلايا مدموجة جزئياً",
94
+ confirm: {
95
+ warning: "تحذير",
96
+ dismantleMergeCellWarning: "ستؤدي هذه العملية إلى إلغاء دمج الخلايا المدمجة. هل تريد المتابعة؟"
97
+ }
94
98
  },
95
- filter: {},
99
+ filter: { confirm: {
100
+ error: "لا يمكن تنفيذ هذه العملية",
101
+ notAllowedToInsertRange: "هذه العملية غير مسموح بها لأن النطاق يحتوي على صفوف تمت تصفيتها."
102
+ } },
96
103
  textWrap: {
97
104
  overflow: "تجاوز",
98
105
  wrap: "التفاف",
@@ -263,8 +270,8 @@ const locale = { "sheets-ui": {
263
270
  copied: "تم النسخ"
264
271
  },
265
272
  shortcut: {
266
- "sheet-view": "Sheet View",
267
- "sheet-edit": "Sheet Edit",
273
+ "sheet-view": "عرض الورقة",
274
+ "sheet-edit": "تحرير الورقة",
268
275
  sheet: {
269
276
  "zoom-in": "تكبير",
270
277
  "zoom-out": "تصغير",