@univerjs/sheets-ui 1.0.0-alpha.7 → 1.0.0-beta.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.
Files changed (100) hide show
  1. package/lib/cjs/facade.js +14 -41
  2. package/lib/cjs/index.js +736 -838
  3. package/lib/cjs/locale/ar-SA.js +0 -2
  4. package/lib/cjs/locale/ca-ES.js +1 -3
  5. package/lib/cjs/locale/de-DE.js +0 -2
  6. package/lib/cjs/locale/en-US.js +0 -2
  7. package/lib/cjs/locale/es-ES.js +1 -3
  8. package/lib/cjs/locale/fa-IR.js +0 -2
  9. package/lib/cjs/locale/fr-FR.js +0 -2
  10. package/lib/cjs/locale/id-ID.js +1 -3
  11. package/lib/cjs/locale/it-IT.js +0 -2
  12. package/lib/cjs/locale/ja-JP.js +0 -2
  13. package/lib/cjs/locale/ko-KR.js +9 -11
  14. package/lib/cjs/locale/pl-PL.js +0 -2
  15. package/lib/cjs/locale/pt-BR.js +1 -3
  16. package/lib/cjs/locale/ru-RU.js +0 -2
  17. package/lib/cjs/locale/sk-SK.js +0 -2
  18. package/lib/cjs/locale/vi-VN.js +0 -2
  19. package/lib/cjs/locale/zh-CN.js +1 -3
  20. package/lib/cjs/locale/zh-HK.js +3 -5
  21. package/lib/cjs/locale/zh-TW.js +3 -5
  22. package/lib/es/facade.js +15 -42
  23. package/lib/es/index.js +743 -845
  24. package/lib/es/locale/ar-SA.js +0 -2
  25. package/lib/es/locale/ca-ES.js +1 -3
  26. package/lib/es/locale/de-DE.js +0 -2
  27. package/lib/es/locale/en-US.js +0 -2
  28. package/lib/es/locale/es-ES.js +1 -3
  29. package/lib/es/locale/fa-IR.js +0 -2
  30. package/lib/es/locale/fr-FR.js +0 -2
  31. package/lib/es/locale/id-ID.js +1 -3
  32. package/lib/es/locale/it-IT.js +0 -2
  33. package/lib/es/locale/ja-JP.js +0 -2
  34. package/lib/es/locale/ko-KR.js +9 -11
  35. package/lib/es/locale/pl-PL.js +0 -2
  36. package/lib/es/locale/pt-BR.js +1 -3
  37. package/lib/es/locale/ru-RU.js +0 -2
  38. package/lib/es/locale/sk-SK.js +0 -2
  39. package/lib/es/locale/vi-VN.js +0 -2
  40. package/lib/es/locale/zh-CN.js +1 -3
  41. package/lib/es/locale/zh-HK.js +3 -5
  42. package/lib/es/locale/zh-TW.js +3 -5
  43. package/lib/facade.js +15 -42
  44. package/lib/index.css +6 -5
  45. package/lib/index.js +743 -845
  46. package/lib/locale/ar-SA.js +0 -2
  47. package/lib/locale/ca-ES.js +1 -3
  48. package/lib/locale/de-DE.js +0 -2
  49. package/lib/locale/en-US.js +0 -2
  50. package/lib/locale/es-ES.js +1 -3
  51. package/lib/locale/fa-IR.js +0 -2
  52. package/lib/locale/fr-FR.js +0 -2
  53. package/lib/locale/id-ID.js +1 -3
  54. package/lib/locale/it-IT.js +0 -2
  55. package/lib/locale/ja-JP.js +0 -2
  56. package/lib/locale/ko-KR.js +9 -11
  57. package/lib/locale/pl-PL.js +0 -2
  58. package/lib/locale/pt-BR.js +1 -3
  59. package/lib/locale/ru-RU.js +0 -2
  60. package/lib/locale/sk-SK.js +0 -2
  61. package/lib/locale/vi-VN.js +0 -2
  62. package/lib/locale/zh-CN.js +1 -3
  63. package/lib/locale/zh-HK.js +3 -5
  64. package/lib/locale/zh-TW.js +3 -5
  65. package/lib/types/commands/operations/cell-edit.operation.d.ts +0 -2
  66. package/lib/types/config/config.d.ts +0 -4
  67. package/lib/types/controllers/editor/editing.render-controller.d.ts +0 -1
  68. package/lib/types/facade/f-workbook.d.ts +1 -63
  69. package/lib/types/facade/f-worksheet.d.ts +6 -35
  70. package/lib/types/locale/en-US.d.ts +0 -2
  71. package/lib/types/services/clipboard/type.d.ts +0 -1
  72. package/lib/types/services/editor-bridge.service.d.ts +1 -1
  73. package/lib/types/services/selection/base-selection-render.service.d.ts +0 -17
  74. package/lib/types/services/selection/selection-control.d.ts +0 -12
  75. package/lib/types/services/selection/selection-render-model.d.ts +1 -1
  76. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +0 -1
  77. package/lib/types/views/sheet-container/SheetContainer.d.ts +1 -1
  78. package/lib/umd/facade.js +1 -1
  79. package/lib/umd/index.js +11 -11
  80. package/lib/umd/locale/ar-SA.js +1 -1
  81. package/lib/umd/locale/ca-ES.js +1 -1
  82. package/lib/umd/locale/de-DE.js +1 -1
  83. package/lib/umd/locale/en-US.js +1 -1
  84. package/lib/umd/locale/es-ES.js +1 -1
  85. package/lib/umd/locale/fa-IR.js +1 -1
  86. package/lib/umd/locale/fr-FR.js +1 -1
  87. package/lib/umd/locale/id-ID.js +1 -1
  88. package/lib/umd/locale/it-IT.js +1 -1
  89. package/lib/umd/locale/ja-JP.js +1 -1
  90. package/lib/umd/locale/ko-KR.js +1 -1
  91. package/lib/umd/locale/pl-PL.js +1 -1
  92. package/lib/umd/locale/pt-BR.js +1 -1
  93. package/lib/umd/locale/ru-RU.js +1 -1
  94. package/lib/umd/locale/sk-SK.js +1 -1
  95. package/lib/umd/locale/vi-VN.js +1 -1
  96. package/lib/umd/locale/zh-CN.js +1 -1
  97. package/lib/umd/locale/zh-HK.js +1 -1
  98. package/lib/umd/locale/zh-TW.js +1 -1
  99. package/package.json +15 -15
  100. package/lib/types/views/editor-container/EditorContainer.spec.d.ts +0 -16
package/lib/cjs/facade.js CHANGED
@@ -461,38 +461,34 @@ var FUniverSheetsUIMixin = class extends _univerjs_core_facade.FUniver {
461
461
  })));
462
462
  if (selectionService) {
463
463
  combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveStart, () => selectionService.selectionMoveStart$.subscribe((selections) => {
464
- var _selections$map;
465
464
  const eventParams = {
466
465
  workbook,
467
466
  worksheet: workbook.getActiveSheet(),
468
- selections: (_selections$map = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map !== void 0 ? _selections$map : []
467
+ selections: (selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) ?? []
469
468
  };
470
469
  this.fireEvent(this.Event.SelectionMoveStart, eventParams);
471
470
  })));
472
471
  combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoving, () => selectionService.selectionMoving$.subscribe((selections) => {
473
- var _selections$map2;
474
472
  const eventParams = {
475
473
  workbook,
476
474
  worksheet: workbook.getActiveSheet(),
477
- selections: (_selections$map2 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map2 !== void 0 ? _selections$map2 : []
475
+ selections: (selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) ?? []
478
476
  };
479
477
  this.fireEvent(this.Event.SelectionMoving, eventParams);
480
478
  })));
481
479
  combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveEnd, () => selectionService.selectionMoveEnd$.subscribe((selections) => {
482
- var _selections$map3;
483
480
  const eventParams = {
484
481
  workbook,
485
482
  worksheet: workbook.getActiveSheet(),
486
- selections: (_selections$map3 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map3 !== void 0 ? _selections$map3 : []
483
+ selections: (selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) ?? []
487
484
  };
488
485
  this.fireEvent(this.Event.SelectionMoveEnd, eventParams);
489
486
  })));
490
487
  combined$Disposable.add(this.registerEventHandler(this.Event.SelectionChanged, () => selectionService.selectionChanged$.subscribe((selections) => {
491
- var _selections$map4;
492
488
  const eventParams = {
493
489
  workbook,
494
490
  worksheet: workbook.getActiveSheet(),
495
- selections: (_selections$map4 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map4 !== void 0 ? _selections$map4 : []
491
+ selections: (selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) ?? []
496
492
  };
497
493
  this.fireEvent(this.Event.SelectionChanged, eventParams);
498
494
  })));
@@ -737,20 +733,6 @@ _univerjs_core_facade.FUniver.extend(FUniverSheetsUIMixin);
737
733
  //#endregion
738
734
  //#region src/facade/f-workbook.ts
739
735
  var FWorkbookSheetsUIMixin = class extends _univerjs_sheets_facade.FWorkbook {
740
- openSiderbar(params) {
741
- this._logDeprecation("openSiderbar");
742
- return this._injector.get(_univerjs_ui.ISidebarService).open(params);
743
- }
744
- openDialog(dialog) {
745
- this._logDeprecation("openDialog");
746
- const disposable = this._injector.get(_univerjs_ui.IDialogService).open({
747
- ...dialog,
748
- onClose: () => {
749
- disposable.dispose();
750
- }
751
- });
752
- return disposable;
753
- }
754
736
  customizeColumnHeader(cfg) {
755
737
  const unitId = this._workbook.getUnitId();
756
738
  this._getSheetRenderComponent(unitId, _univerjs_sheets_ui.SHEET_VIEW_KEY.COLUMN).setCustomHeader(cfg);
@@ -931,10 +913,7 @@ var FWorksheetUIMixin = class extends _univerjs_sheets_facade.FWorksheet {
931
913
  const service = (_this$_injector$get$g = this._injector.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(this._workbook.getUnitId())) === null || _this$_injector$get$g === void 0 ? void 0 : _this$_injector$get$g.with(_univerjs_sheets_ui.SheetSkeletonManagerService);
932
914
  return service === null || service === void 0 ? void 0 : service.getSkeleton(this._worksheet.getSheetId());
933
915
  }
934
- autoResizeColumn(columnPosition) {
935
- return this.autoResizeColumns(columnPosition, 1);
936
- }
937
- autoResizeColumns(startColumn, numColumns) {
916
+ autoResizeColumns(startColumn, numColumns = 1) {
938
917
  const unitId = this._workbook.getUnitId();
939
918
  const subUnitId = this._worksheet.getSheetId();
940
919
  const ranges = [{
@@ -950,10 +929,7 @@ var FWorksheetUIMixin = class extends _univerjs_sheets_facade.FWorksheet {
950
929
  });
951
930
  return this;
952
931
  }
953
- setColumnAutoWidth(columnPosition, numColumn) {
954
- return this.autoResizeColumns(columnPosition, numColumn);
955
- }
956
- autoResizeRows(startRow, numRows) {
932
+ autoResizeRows(startRow, numRows = 1) {
957
933
  const unitId = this._workbook.getUnitId();
958
934
  const subUnitId = this._worksheet.getSheetId();
959
935
  const ranges = [{
@@ -1190,15 +1166,13 @@ var FRangeSheetsUIMixin = class extends _univerjs_sheets_facade.FRange {
1190
1166
  };
1191
1167
  }
1192
1168
  generateHTML() {
1193
- var _copyContent$html;
1194
1169
  const copyContent = this._injector.get(_univerjs_sheets_ui.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(), this._worksheet.getSheetId(), this._range);
1195
- return (_copyContent$html = copyContent === null || copyContent === void 0 ? void 0 : copyContent.html) !== null && _copyContent$html !== void 0 ? _copyContent$html : "";
1170
+ return (copyContent === null || copyContent === void 0 ? void 0 : copyContent.html) ?? "";
1196
1171
  }
1197
1172
  attachPopup(popup) {
1198
- var _popup$direction, _popup$extraProps, _popup$offset;
1199
- popup.direction = (_popup$direction = popup.direction) !== null && _popup$direction !== void 0 ? _popup$direction : "horizontal";
1200
- popup.extraProps = (_popup$extraProps = popup.extraProps) !== null && _popup$extraProps !== void 0 ? _popup$extraProps : {};
1201
- popup.offset = (_popup$offset = popup.offset) !== null && _popup$offset !== void 0 ? _popup$offset : [0, 0];
1173
+ popup.direction = popup.direction ?? "horizontal";
1174
+ popup.extraProps = popup.extraProps ?? {};
1175
+ popup.offset = popup.offset ?? [0, 0];
1202
1176
  const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(_univerjs_ui.ComponentManager));
1203
1177
  const disposePopup = this._injector.get(_univerjs_sheets_ui.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow, this._range.startColumn, {
1204
1178
  ...popup,
@@ -1246,10 +1220,9 @@ var FRangeSheetsUIMixin = class extends _univerjs_sheets_facade.FRange {
1246
1220
  * ```
1247
1221
  */
1248
1222
  attachRangePopup(popup) {
1249
- var _popup$direction2, _popup$extraProps2, _popup$offset2;
1250
- popup.direction = (_popup$direction2 = popup.direction) !== null && _popup$direction2 !== void 0 ? _popup$direction2 : "top-center";
1251
- popup.extraProps = (_popup$extraProps2 = popup.extraProps) !== null && _popup$extraProps2 !== void 0 ? _popup$extraProps2 : {};
1252
- popup.offset = (_popup$offset2 = popup.offset) !== null && _popup$offset2 !== void 0 ? _popup$offset2 : [0, 0];
1223
+ popup.direction = popup.direction ?? "top-center";
1224
+ popup.extraProps = popup.extraProps ?? {};
1225
+ popup.offset = popup.offset ?? [0, 0];
1253
1226
  const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(_univerjs_ui.ComponentManager));
1254
1227
  const disposePopup = this._injector.get(_univerjs_sheets_ui.SheetCanvasPopManagerService).attachRangePopup(this._range, {
1255
1228
  ...popup,
@@ -1291,7 +1264,7 @@ function transformComponentKey(component, componentManager) {
1291
1264
  const disposableCollection = new _univerjs_core.DisposableCollection();
1292
1265
  if (typeof componentKey === "string") key = componentKey;
1293
1266
  else {
1294
- const resolvedFramework = framework !== null && framework !== void 0 ? framework : "react";
1267
+ const resolvedFramework = framework ?? "react";
1295
1268
  key = resolvedFramework === "web-component" ? `external-${(0, _univerjs_core.generateRandomId)(6).toLowerCase()}` : `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1296
1269
  disposableCollection.add(componentManager.register(key, componentKey, { framework: resolvedFramework }));
1297
1270
  }