@univerjs/sheets-ui 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (114) hide show
  1. package/lib/cjs/facade.js +51 -40
  2. package/lib/cjs/index.js +1187 -287
  3. package/lib/cjs/locale/ar-SA.js +7 -2
  4. package/lib/cjs/locale/ca-ES.js +7 -2
  5. package/lib/cjs/locale/de-DE.js +7 -2
  6. package/lib/cjs/locale/en-US.js +5 -0
  7. package/lib/cjs/locale/es-ES.js +8 -3
  8. package/lib/cjs/locale/fa-IR.js +7 -2
  9. package/lib/cjs/locale/fr-FR.js +7 -2
  10. package/lib/cjs/locale/id-ID.js +7 -2
  11. package/lib/cjs/locale/it-IT.js +7 -2
  12. package/lib/cjs/locale/ja-JP.js +5 -0
  13. package/lib/cjs/locale/ko-KR.js +5 -0
  14. package/lib/cjs/locale/pl-PL.js +7 -2
  15. package/lib/cjs/locale/pt-BR.js +7 -2
  16. package/lib/cjs/locale/ru-RU.js +7 -2
  17. package/lib/cjs/locale/sk-SK.js +7 -2
  18. package/lib/cjs/locale/vi-VN.js +7 -2
  19. package/lib/cjs/locale/zh-CN.js +5 -0
  20. package/lib/cjs/locale/zh-HK.js +5 -0
  21. package/lib/cjs/locale/zh-TW.js +5 -0
  22. package/lib/es/facade.js +51 -40
  23. package/lib/es/index.js +1168 -264
  24. package/lib/es/locale/ar-SA.js +7 -2
  25. package/lib/es/locale/ca-ES.js +7 -2
  26. package/lib/es/locale/de-DE.js +7 -2
  27. package/lib/es/locale/en-US.js +5 -0
  28. package/lib/es/locale/es-ES.js +8 -3
  29. package/lib/es/locale/fa-IR.js +7 -2
  30. package/lib/es/locale/fr-FR.js +7 -2
  31. package/lib/es/locale/id-ID.js +7 -2
  32. package/lib/es/locale/it-IT.js +7 -2
  33. package/lib/es/locale/ja-JP.js +5 -0
  34. package/lib/es/locale/ko-KR.js +5 -0
  35. package/lib/es/locale/pl-PL.js +7 -2
  36. package/lib/es/locale/pt-BR.js +7 -2
  37. package/lib/es/locale/ru-RU.js +7 -2
  38. package/lib/es/locale/sk-SK.js +7 -2
  39. package/lib/es/locale/vi-VN.js +7 -2
  40. package/lib/es/locale/zh-CN.js +5 -0
  41. package/lib/es/locale/zh-HK.js +5 -0
  42. package/lib/es/locale/zh-TW.js +5 -0
  43. package/lib/facade.js +51 -40
  44. package/lib/index.css +42 -4
  45. package/lib/index.js +1168 -264
  46. package/lib/locale/ar-SA.js +7 -2
  47. package/lib/locale/ca-ES.js +7 -2
  48. package/lib/locale/de-DE.js +7 -2
  49. package/lib/locale/en-US.js +5 -0
  50. package/lib/locale/es-ES.js +8 -3
  51. package/lib/locale/fa-IR.js +7 -2
  52. package/lib/locale/fr-FR.js +7 -2
  53. package/lib/locale/id-ID.js +7 -2
  54. package/lib/locale/it-IT.js +7 -2
  55. package/lib/locale/ja-JP.js +5 -0
  56. package/lib/locale/ko-KR.js +5 -0
  57. package/lib/locale/pl-PL.js +7 -2
  58. package/lib/locale/pt-BR.js +7 -2
  59. package/lib/locale/ru-RU.js +7 -2
  60. package/lib/locale/sk-SK.js +7 -2
  61. package/lib/locale/vi-VN.js +7 -2
  62. package/lib/locale/zh-CN.js +5 -0
  63. package/lib/locale/zh-HK.js +5 -0
  64. package/lib/locale/zh-TW.js +5 -0
  65. package/lib/types/commands/commands/set-scroll.command.d.ts +3 -0
  66. package/lib/types/controllers/editor/editing.render-controller.d.ts +1 -0
  67. package/lib/types/controllers/editor/formula-editor.controller.d.ts +1 -0
  68. package/lib/types/controllers/render-controllers/contextmenu.render-controller.d.ts +7 -2
  69. package/lib/types/controllers/render-controllers/editor-bridge.render-controller.d.ts +7 -1
  70. package/lib/types/controllers/render-controllers/header-unhide.render-controller.d.ts +0 -1
  71. package/lib/types/embed-tab-anchor.d.ts +23 -0
  72. package/lib/types/facade/f-range.d.ts +5 -4
  73. package/lib/types/facade/f-univer.d.ts +1 -0
  74. package/lib/types/index.d.ts +16 -3
  75. package/lib/types/locale/en-US.d.ts +5 -0
  76. package/lib/types/services/canvas-pop-manager.service.d.ts +9 -0
  77. package/lib/types/services/cell-popup-manager.service.d.ts +1 -0
  78. package/lib/types/services/editor/cell-editor-resize.service.d.ts +4 -1
  79. package/lib/types/services/editor-bridge.service.d.ts +2 -0
  80. package/lib/types/services/print-interceptor.service.d.ts +8 -0
  81. package/lib/types/services/selection/base-selection-render.service.d.ts +1 -0
  82. package/lib/types/services/sheet-embed-integration.service.d.ts +126 -0
  83. package/lib/types/services/sheet-embed-runtime.service.d.ts +26 -0
  84. package/lib/types/services/sheet-host-chrome-override.service.d.ts +25 -0
  85. package/lib/types/services/sheet-skeleton-manager.service.d.ts +2 -0
  86. package/lib/types/views/border-panel/interface.d.ts +63 -2
  87. package/lib/types/views/editor-container/EditorContainer.d.ts +7 -5
  88. package/lib/types/{menu/mobile-menu.d.ts → views/editor-container/EditorContainer.spec.d.ts} +1 -1
  89. package/lib/types/views/editor-container/focus-editor.d.ts +25 -0
  90. package/lib/types/views/sheet-bar/sheet-bar-tabs/SheetBarItem.d.ts +2 -1
  91. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/sheet-tab-drag-sort.d.ts +1 -0
  92. package/lib/types/views/sheet-bar/sheet-bar-tabs/utils/slide-tab-bar.d.ts +2 -1
  93. package/lib/umd/facade.js +1 -1
  94. package/lib/umd/index.js +12 -12
  95. package/lib/umd/locale/ar-SA.js +1 -1
  96. package/lib/umd/locale/ca-ES.js +1 -1
  97. package/lib/umd/locale/de-DE.js +1 -1
  98. package/lib/umd/locale/en-US.js +1 -1
  99. package/lib/umd/locale/es-ES.js +1 -1
  100. package/lib/umd/locale/fa-IR.js +1 -1
  101. package/lib/umd/locale/fr-FR.js +1 -1
  102. package/lib/umd/locale/id-ID.js +1 -1
  103. package/lib/umd/locale/it-IT.js +1 -1
  104. package/lib/umd/locale/ja-JP.js +1 -1
  105. package/lib/umd/locale/ko-KR.js +1 -1
  106. package/lib/umd/locale/pl-PL.js +1 -1
  107. package/lib/umd/locale/pt-BR.js +1 -1
  108. package/lib/umd/locale/ru-RU.js +1 -1
  109. package/lib/umd/locale/sk-SK.js +1 -1
  110. package/lib/umd/locale/vi-VN.js +1 -1
  111. package/lib/umd/locale/zh-CN.js +1 -1
  112. package/lib/umd/locale/zh-HK.js +1 -1
  113. package/lib/umd/locale/zh-TW.js +1 -1
  114. package/package.json +16 -16
package/lib/cjs/facade.js CHANGED
@@ -449,7 +449,7 @@ var FUniverSheetsUIMixin = class extends _univerjs_core_facade.FUniver {
449
449
  if (!workbook) return;
450
450
  combined$Disposable.dispose();
451
451
  const scrollManagerService = sheetRenderUnit.with(_univerjs_sheets_ui.SheetScrollManagerService);
452
- const selectionService = sheetRenderUnit.with(_univerjs_sheets.SheetsSelectionsService);
452
+ const selectionService = this._tryGetRenderDependency(sheetRenderUnit, _univerjs_sheets.SheetsSelectionsService);
453
453
  combined$Disposable.add(this.registerEventHandler(this.Event.Scroll, () => scrollManagerService.validViewportScrollInfo$.subscribe((params) => {
454
454
  if (!params) return;
455
455
  const eventParams = {
@@ -459,46 +459,56 @@ var FUniverSheetsUIMixin = class extends _univerjs_core_facade.FUniver {
459
459
  };
460
460
  this.fireEvent(this.Event.Scroll, eventParams);
461
461
  })));
462
- combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveStart, () => selectionService.selectionMoveStart$.subscribe((selections) => {
463
- var _selections$map;
464
- const eventParams = {
465
- workbook,
466
- worksheet: workbook.getActiveSheet(),
467
- selections: (_selections$map = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map !== void 0 ? _selections$map : []
468
- };
469
- this.fireEvent(this.Event.SelectionMoveStart, eventParams);
470
- })));
471
- combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoving, () => selectionService.selectionMoving$.subscribe((selections) => {
472
- var _selections$map2;
473
- const eventParams = {
474
- workbook,
475
- worksheet: workbook.getActiveSheet(),
476
- selections: (_selections$map2 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map2 !== void 0 ? _selections$map2 : []
477
- };
478
- this.fireEvent(this.Event.SelectionMoving, eventParams);
479
- })));
480
- combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveEnd, () => selectionService.selectionMoveEnd$.subscribe((selections) => {
481
- var _selections$map3;
482
- const eventParams = {
483
- workbook,
484
- worksheet: workbook.getActiveSheet(),
485
- selections: (_selections$map3 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map3 !== void 0 ? _selections$map3 : []
486
- };
487
- this.fireEvent(this.Event.SelectionMoveEnd, eventParams);
488
- })));
489
- combined$Disposable.add(this.registerEventHandler(this.Event.SelectionChanged, () => selectionService.selectionChanged$.subscribe((selections) => {
490
- var _selections$map4;
491
- const eventParams = {
492
- workbook,
493
- worksheet: workbook.getActiveSheet(),
494
- selections: (_selections$map4 = selections === null || selections === void 0 ? void 0 : selections.map((s) => s.range)) !== null && _selections$map4 !== void 0 ? _selections$map4 : []
495
- };
496
- this.fireEvent(this.Event.SelectionChanged, eventParams);
497
- })));
462
+ if (selectionService) {
463
+ combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveStart, () => selectionService.selectionMoveStart$.subscribe((selections) => {
464
+ var _selections$map;
465
+ const eventParams = {
466
+ workbook,
467
+ 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 : []
469
+ };
470
+ this.fireEvent(this.Event.SelectionMoveStart, eventParams);
471
+ })));
472
+ combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoving, () => selectionService.selectionMoving$.subscribe((selections) => {
473
+ var _selections$map2;
474
+ const eventParams = {
475
+ workbook,
476
+ 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 : []
478
+ };
479
+ this.fireEvent(this.Event.SelectionMoving, eventParams);
480
+ })));
481
+ combined$Disposable.add(this.registerEventHandler(this.Event.SelectionMoveEnd, () => selectionService.selectionMoveEnd$.subscribe((selections) => {
482
+ var _selections$map3;
483
+ const eventParams = {
484
+ workbook,
485
+ 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 : []
487
+ };
488
+ this.fireEvent(this.Event.SelectionMoveEnd, eventParams);
489
+ })));
490
+ combined$Disposable.add(this.registerEventHandler(this.Event.SelectionChanged, () => selectionService.selectionChanged$.subscribe((selections) => {
491
+ var _selections$map4;
492
+ const eventParams = {
493
+ workbook,
494
+ 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 : []
496
+ };
497
+ this.fireEvent(this.Event.SelectionChanged, eventParams);
498
+ })));
499
+ }
498
500
  sheetRenderUnit = null;
499
501
  this.disposeWithMe(combined$Disposable);
500
502
  }));
501
503
  }
504
+ _tryGetRenderDependency(render, dependency) {
505
+ try {
506
+ return render.with(dependency);
507
+ } catch (error) {
508
+ if (error instanceof Error && (error.message.includes("DependencyNotFoundError") || error.message.includes("Cannot find"))) return null;
509
+ throw error;
510
+ }
511
+ }
502
512
  /**
503
513
  * @ignore
504
514
  */
@@ -1276,13 +1286,14 @@ _univerjs_sheets_facade.FRange.extend(FRangeSheetsUIMixin);
1276
1286
  * @returns {string} The transformed component key.
1277
1287
  */
1278
1288
  function transformComponentKey(component, componentManager) {
1279
- const { componentKey, isVue3 } = component;
1289
+ const { componentKey, framework } = component;
1280
1290
  let key;
1281
1291
  const disposableCollection = new _univerjs_core.DisposableCollection();
1282
1292
  if (typeof componentKey === "string") key = componentKey;
1283
1293
  else {
1284
- key = `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1285
- disposableCollection.add(componentManager.register(key, componentKey, { framework: isVue3 ? "vue3" : "react" }));
1294
+ const resolvedFramework = framework !== null && framework !== void 0 ? framework : "react";
1295
+ key = resolvedFramework === "web-component" ? `external-${(0, _univerjs_core.generateRandomId)(6).toLowerCase()}` : `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1296
+ disposableCollection.add(componentManager.register(key, componentKey, { framework: resolvedFramework }));
1286
1297
  }
1287
1298
  return {
1288
1299
  key,