@univerjs/sheets-ui 0.5.5-experimental.20250123-34738ff → 0.5.5-experimental.20250125-1aa33c0
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 +1 -1
- package/lib/cjs/index.js +6 -6
- package/lib/es/facade.js +47 -2
- package/lib/es/index.js +254 -129
- package/lib/index.css +1 -1
- package/lib/types/commands/commands/headersize-changed.command.d.ts +8 -0
- package/lib/types/controllers/editor/formula-editor.controller.d.ts +0 -1
- package/lib/types/controllers/render-controllers/freeze.render-controller.d.ts +4 -2
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +4 -0
- package/lib/types/facade/f-event.d.ts +3 -0
- package/lib/types/facade/f-univer.d.ts +2 -0
- package/lib/types/facade/f-worksheet.d.ts +83 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/sheet-skeleton-manager.service.d.ts +2 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +6 -6
- package/package.json +11 -11
package/lib/es/facade.js
CHANGED
|
@@ -4,7 +4,7 @@ import { FUniver, ICommandService, IUniverInstanceService, CanceledError, RichTe
|
|
|
4
4
|
import { RichTextEditingMutation } from "@univerjs/docs";
|
|
5
5
|
import { IRenderManagerService, DeviceInputEventType, SHEET_VIEWPORT_KEY, sheetContentViewportKeys } from "@univerjs/engine-render";
|
|
6
6
|
import { SheetsSelectionsService, COMMAND_LISTENER_SKELETON_CHANGE, getSkeletonChangedEffectedRange, SheetInterceptorService, INTERCEPTOR_POINT, InterceptCellContentPriority } from "@univerjs/sheets";
|
|
7
|
-
import { SetCellEditVisibleOperation, IEditorBridgeService, SetZoomRatioCommand, HoverManagerService, DragManagerService, SheetScrollManagerService, SheetPasteShortKeyCommand, ISheetClipboardService, SheetSkeletonManagerService, SHEET_VIEW_KEY, ISheetSelectionRenderService, ChangeZoomRatioCommand, SheetsScrollRenderController, SetWorksheetColAutoWidthCommand, SheetCanvasPopManagerService, CellAlertManagerService, IMarkSelectionService } from "@univerjs/sheets-ui";
|
|
7
|
+
import { SetCellEditVisibleOperation, IEditorBridgeService, SetZoomRatioCommand, HoverManagerService, DragManagerService, SheetScrollManagerService, SheetPasteShortKeyCommand, ISheetClipboardService, SheetSkeletonManagerService, SHEET_VIEW_KEY, ISheetSelectionRenderService, ChangeZoomRatioCommand, SheetsScrollRenderController, SetWorksheetColAutoWidthCommand, SetColumnHeaderHeightCommand, SetRowHeaderWidthCommand, SheetCanvasPopManagerService, CellAlertManagerService, IMarkSelectionService } from "@univerjs/sheets-ui";
|
|
8
8
|
import { FSheetHooks, FWorkbook, FWorksheet, FPermission, FRange } from "@univerjs/sheets/facade";
|
|
9
9
|
import { KeyCode, CutCommand, CopyCommand, PasteCommand, IClipboardInterfaceService, PLAIN_TEXT_CLIPBOARD_MIME_TYPE, HTML_CLIPBOARD_MIME_TYPE, supportClipboardAPI, ISidebarService, IDialogService, ComponentManager } from "@univerjs/ui";
|
|
10
10
|
import { filter, combineLatest } from "rxjs";
|
|
@@ -16,7 +16,7 @@ const _FUniverSheetsUIMixin = class _FUniverSheetsUIMixin extends FUniver {
|
|
|
16
16
|
if (commandInfo.id === SetCellEditVisibleOperation.id) {
|
|
17
17
|
if (!this._eventListend(this.Event.BeforeSheetEditStart) && !this._eventListend(this.Event.BeforeSheetEditEnd))
|
|
18
18
|
return;
|
|
19
|
-
const target = this.
|
|
19
|
+
const target = this.getActiveSheet();
|
|
20
20
|
if (!target)
|
|
21
21
|
return;
|
|
22
22
|
const { workbook, worksheet } = target, editorBridgeService = injector.get(IEditorBridgeService), univerInstanceService = injector.get(IUniverInstanceService), params = commandInfo.params, { visible, keycode, eventType } = params, loc = editorBridgeService.getEditLocation();
|
|
@@ -781,6 +781,51 @@ const _FWorksheetSkeletonMixin = class _FWorksheetSkeletonMixin extends FWorkshe
|
|
|
781
781
|
ranges
|
|
782
782
|
}), this;
|
|
783
783
|
}
|
|
784
|
+
customizeColumnHeader(cfg) {
|
|
785
|
+
var _a, _b;
|
|
786
|
+
const activeSheet = this, unitId = this._fWorkbook.getId(), renderManagerService = this._injector.get(IRenderManagerService), subUnitId = activeSheet.getSheetId(), render = renderManagerService.getRenderById(unitId);
|
|
787
|
+
render && ((_a = cfg.headerStyle) != null && _a.size) && (render.with(SheetSkeletonManagerService).setColumnHeaderSize(render, subUnitId, (_b = cfg.headerStyle) == null ? void 0 : _b.size), activeSheet == null || activeSheet.refreshCanvas());
|
|
788
|
+
const sheetColumn = this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.COLUMN);
|
|
789
|
+
sheetColumn && (sheetColumn.setCustomHeader(cfg), activeSheet == null || activeSheet.refreshCanvas());
|
|
790
|
+
}
|
|
791
|
+
customizeRowHeader(cfg) {
|
|
792
|
+
const unitId = this._fWorkbook.getId();
|
|
793
|
+
this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.ROW).setCustomHeader(cfg);
|
|
794
|
+
}
|
|
795
|
+
setColumnHeaderHeight(height) {
|
|
796
|
+
const activeSheet = this, unitId = this._fWorkbook.getId(), subUnitId = activeSheet.getSheetId();
|
|
797
|
+
return this._commandService.executeCommand(SetColumnHeaderHeightCommand.id, {
|
|
798
|
+
unitId,
|
|
799
|
+
subUnitId,
|
|
800
|
+
size: height
|
|
801
|
+
}), activeSheet == null || activeSheet.refreshCanvas(), this;
|
|
802
|
+
}
|
|
803
|
+
setRowHeaderWidth(width) {
|
|
804
|
+
const activeSheet = this, unitId = this._fWorkbook.getId(), subUnitId = activeSheet.getSheetId();
|
|
805
|
+
this._commandService.executeCommand(SetRowHeaderWidthCommand.id, {
|
|
806
|
+
unitId,
|
|
807
|
+
subUnitId,
|
|
808
|
+
size: width
|
|
809
|
+
});
|
|
810
|
+
const sheetRow = this._getSheetRenderComponent(unitId, SHEET_VIEW_KEY.ROW);
|
|
811
|
+
return sheetRow && sheetRow.setCustomHeader({ headerStyle: { size: width } }), activeSheet == null || activeSheet.refreshCanvas(), this;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Get sheet render component from render by unitId and view key.
|
|
815
|
+
* @private
|
|
816
|
+
* @param {string} unitId The unit id of the spreadsheet.
|
|
817
|
+
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
818
|
+
* @returns {Nullable<RenderComponentType>} The render component.
|
|
819
|
+
*/
|
|
820
|
+
_getSheetRenderComponent(unitId, viewKey) {
|
|
821
|
+
const render = this._injector.get(IRenderManagerService).getRenderById(unitId);
|
|
822
|
+
if (!render)
|
|
823
|
+
throw new Error(`Render Unit with unitId ${unitId} not found`);
|
|
824
|
+
const { components } = render, renderComponent = components.get(viewKey);
|
|
825
|
+
if (!renderComponent)
|
|
826
|
+
throw new Error("Render component not found");
|
|
827
|
+
return renderComponent;
|
|
828
|
+
}
|
|
784
829
|
};
|
|
785
830
|
__name(_FWorksheetSkeletonMixin, "FWorksheetSkeletonMixin");
|
|
786
831
|
let FWorksheetSkeletonMixin = _FWorksheetSkeletonMixin;
|