@univerjs/sheets-ui 1.0.0-alpha.8 → 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.
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
  })));
@@ -1170,15 +1166,13 @@ var FRangeSheetsUIMixin = class extends _univerjs_sheets_facade.FRange {
1170
1166
  };
1171
1167
  }
1172
1168
  generateHTML() {
1173
- var _copyContent$html;
1174
1169
  const copyContent = this._injector.get(_univerjs_sheets_ui.ISheetClipboardService).generateCopyContent(this._workbook.getUnitId(), this._worksheet.getSheetId(), this._range);
1175
- 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) ?? "";
1176
1171
  }
1177
1172
  attachPopup(popup) {
1178
- var _popup$direction, _popup$extraProps, _popup$offset;
1179
- popup.direction = (_popup$direction = popup.direction) !== null && _popup$direction !== void 0 ? _popup$direction : "horizontal";
1180
- popup.extraProps = (_popup$extraProps = popup.extraProps) !== null && _popup$extraProps !== void 0 ? _popup$extraProps : {};
1181
- 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];
1182
1176
  const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(_univerjs_ui.ComponentManager));
1183
1177
  const disposePopup = this._injector.get(_univerjs_sheets_ui.SheetCanvasPopManagerService).attachPopupToCell(this._range.startRow, this._range.startColumn, {
1184
1178
  ...popup,
@@ -1226,10 +1220,9 @@ var FRangeSheetsUIMixin = class extends _univerjs_sheets_facade.FRange {
1226
1220
  * ```
1227
1221
  */
1228
1222
  attachRangePopup(popup) {
1229
- var _popup$direction2, _popup$extraProps2, _popup$offset2;
1230
- popup.direction = (_popup$direction2 = popup.direction) !== null && _popup$direction2 !== void 0 ? _popup$direction2 : "top-center";
1231
- popup.extraProps = (_popup$extraProps2 = popup.extraProps) !== null && _popup$extraProps2 !== void 0 ? _popup$extraProps2 : {};
1232
- 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];
1233
1226
  const { key, disposableCollection } = transformComponentKey(popup, this._injector.get(_univerjs_ui.ComponentManager));
1234
1227
  const disposePopup = this._injector.get(_univerjs_sheets_ui.SheetCanvasPopManagerService).attachRangePopup(this._range, {
1235
1228
  ...popup,
@@ -1271,7 +1264,7 @@ function transformComponentKey(component, componentManager) {
1271
1264
  const disposableCollection = new _univerjs_core.DisposableCollection();
1272
1265
  if (typeof componentKey === "string") key = componentKey;
1273
1266
  else {
1274
- const resolvedFramework = framework !== null && framework !== void 0 ? framework : "react";
1267
+ const resolvedFramework = framework ?? "react";
1275
1268
  key = resolvedFramework === "web-component" ? `external-${(0, _univerjs_core.generateRandomId)(6).toLowerCase()}` : `External_${(0, _univerjs_core.generateRandomId)(6)}`;
1276
1269
  disposableCollection.add(componentManager.register(key, componentKey, { framework: resolvedFramework }));
1277
1270
  }