@univerjs/sheets-ui 0.8.3-nightly.202507021607 → 0.8.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.
- package/LICENSE +176 -0
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +7 -7
- package/lib/es/facade.js +105 -126
- package/lib/es/index.js +1184 -1187
- package/lib/facade.js +105 -126
- package/lib/index.js +1184 -1187
- package/lib/types/facade/f-univer.d.ts +14 -2
- package/lib/types/facade/f-workbook.d.ts +1 -61
- package/lib/types/facade/f-worksheet.d.ts +36 -38
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +8 -8
- package/package.json +13 -13
package/lib/facade.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ICommandService as
|
|
1
|
+
import { ICommandService as I, CanceledError as b, IUniverInstanceService as $, RichTextValue as j, DOCS_NORMAL_EDITOR_UNIT_ID_KEY as T, LifecycleService as ie, DisposableCollection as B, LifecycleStages as O, UniverInstanceType as oe, ILogService as U, toDisposable as C, awaitTime as se, InterceptorEffectEnum as ae, generateRandomId as ce } from "@univerjs/core";
|
|
2
2
|
import { FUniver as q, FEventName as de } from "@univerjs/core/facade";
|
|
3
3
|
import { RichTextEditingMutation as he } from "@univerjs/docs";
|
|
4
|
-
import { IRenderManagerService as
|
|
5
|
-
import { SheetsSelectionsService as ue, COMMAND_LISTENER_SKELETON_CHANGE as ve, getSkeletonChangedEffectedRange as Se, SetWorksheetRowIsAutoHeightCommand as
|
|
6
|
-
import { SetCellEditVisibleOperation as f, IEditorBridgeService as R, SetZoomRatioCommand as A, HoverManagerService as p, DragManagerService as M, SheetScrollManagerService as x, SheetPasteShortKeyCommand as L, ISheetClipboardService as Q, SheetSkeletonManagerService as
|
|
7
|
-
import { FSheetHooks as
|
|
4
|
+
import { IRenderManagerService as S, DeviceInputEventType as z, SHEET_VIEWPORT_KEY as le, sheetContentViewportKeys as ge } from "@univerjs/engine-render";
|
|
5
|
+
import { SheetsSelectionsService as ue, COMMAND_LISTENER_SKELETON_CHANGE as ve, getSkeletonChangedEffectedRange as Se, SetWorksheetRowIsAutoHeightCommand as Ce, InterceptCellContentPriority as me, SheetInterceptorService as Ee, INTERCEPTOR_POINT as be } from "@univerjs/sheets";
|
|
6
|
+
import { SetCellEditVisibleOperation as f, IEditorBridgeService as R, SetZoomRatioCommand as A, HoverManagerService as p, DragManagerService as M, SheetScrollManagerService as x, SheetPasteShortKeyCommand as L, ISheetClipboardService as Q, SheetSkeletonManagerService as _, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as y, SheetsScrollRenderController as pe, SetWorksheetColAutoWidthCommand as we, SetColumnHeaderHeightCommand as fe, SetRowHeaderWidthCommand as ke, SheetCanvasPopManagerService as N, CellAlertManagerService as Ie, IMarkSelectionService as _e, ISheetCellDropdownManagerService as Pe } from "@univerjs/sheets-ui";
|
|
7
|
+
import { FSheetHooks as W, FWorkbook as ee, FWorksheet as te, FPermission as re, FRange as ne } from "@univerjs/sheets/facade";
|
|
8
8
|
import { KeyCode as D, CutCommand as F, CopyCommand as V, PasteCommand as Z, IClipboardInterfaceService as Re, PLAIN_TEXT_CLIPBOARD_MIME_TYPE as K, HTML_CLIPBOARD_MIME_TYPE as Y, supportClipboardAPI as X, ISidebarService as He, IDialogService as Me, ComponentManager as J } from "@univerjs/ui";
|
|
9
9
|
import { filter as u, combineLatest as ye } from "rxjs";
|
|
10
10
|
class Ue extends q {
|
|
11
11
|
// eslint-disable-next-line max-lines-per-function
|
|
12
12
|
_initSheetUIEvent(e) {
|
|
13
|
-
const r = e.get(
|
|
13
|
+
const r = e.get(I);
|
|
14
14
|
this.registerEventHandler(
|
|
15
15
|
this.Event.BeforeSheetEditStart,
|
|
16
16
|
() => r.beforeCommandExecuted((t) => {
|
|
@@ -29,7 +29,7 @@ class Ue extends q {
|
|
|
29
29
|
isZenEditor: !1
|
|
30
30
|
};
|
|
31
31
|
if (this.fireEvent(this.Event.BeforeSheetEditStart, c), c.cancel)
|
|
32
|
-
throw new
|
|
32
|
+
throw new b();
|
|
33
33
|
}
|
|
34
34
|
})
|
|
35
35
|
), this.registerEventHandler(
|
|
@@ -38,7 +38,7 @@ class Ue extends q {
|
|
|
38
38
|
if (t.id !== f.id) return;
|
|
39
39
|
const i = this.getActiveSheet();
|
|
40
40
|
if (!i) return;
|
|
41
|
-
const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(
|
|
41
|
+
const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get($), h = t.params, { visible: g, keycode: a, eventType: n } = h, c = d.getEditLocation();
|
|
42
42
|
if (!g) {
|
|
43
43
|
const P = {
|
|
44
44
|
row: c.row,
|
|
@@ -48,11 +48,11 @@ class Ue extends q {
|
|
|
48
48
|
workbook: o,
|
|
49
49
|
worksheet: s,
|
|
50
50
|
isZenEditor: !1,
|
|
51
|
-
value:
|
|
51
|
+
value: j.create(l.getUnit(T).getSnapshot()),
|
|
52
52
|
isConfirm: a !== D.ESC
|
|
53
53
|
};
|
|
54
54
|
if (this.fireEvent(this.Event.BeforeSheetEditEnd, P), P.cancel)
|
|
55
|
-
throw new
|
|
55
|
+
throw new b();
|
|
56
56
|
}
|
|
57
57
|
})
|
|
58
58
|
), this.registerEventHandler(
|
|
@@ -102,7 +102,7 @@ class Ue extends q {
|
|
|
102
102
|
if (t.id !== he.id) return;
|
|
103
103
|
const i = this.getActiveSheet();
|
|
104
104
|
if (!i) return;
|
|
105
|
-
const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get(
|
|
105
|
+
const { workbook: o, worksheet: s } = i, d = e.get(R), l = e.get($), h = t.params;
|
|
106
106
|
if (!d.isVisible().visible) return;
|
|
107
107
|
const { unitId: g } = h;
|
|
108
108
|
if (g === T) {
|
|
@@ -111,7 +111,7 @@ class Ue extends q {
|
|
|
111
111
|
worksheet: s,
|
|
112
112
|
row: a,
|
|
113
113
|
column: n,
|
|
114
|
-
value:
|
|
114
|
+
value: j.create(l.getUnit(T).getSnapshot()),
|
|
115
115
|
isZenEditor: !1
|
|
116
116
|
};
|
|
117
117
|
this.fireEvent(this.Event.SheetEditChanging, c);
|
|
@@ -129,7 +129,7 @@ class Ue extends q {
|
|
|
129
129
|
worksheet: s
|
|
130
130
|
};
|
|
131
131
|
if (this.fireEvent(this.Event.BeforeSheetZoomChange, d), d.cancel)
|
|
132
|
-
throw new
|
|
132
|
+
throw new b();
|
|
133
133
|
})
|
|
134
134
|
), this.registerEventHandler(
|
|
135
135
|
this.Event.SheetZoomChanged,
|
|
@@ -148,7 +148,7 @@ class Ue extends q {
|
|
|
148
148
|
}
|
|
149
149
|
// eslint-disable-next-line max-lines-per-function
|
|
150
150
|
_initObserverListener(e) {
|
|
151
|
-
const r = e.get(
|
|
151
|
+
const r = e.get(S), t = e.get(ie), i = new B();
|
|
152
152
|
this.disposeWithMe(t.lifecycle$.subscribe((l) => {
|
|
153
153
|
if (l !== O.Rendered) return;
|
|
154
154
|
i.dispose();
|
|
@@ -364,51 +364,51 @@ class Ue extends q {
|
|
|
364
364
|
const n = s.with(x), c = s.with(ue);
|
|
365
365
|
g.add(this.registerEventHandler(
|
|
366
366
|
this.Event.Scroll,
|
|
367
|
-
() => n.validViewportScrollInfo$.subscribe((
|
|
368
|
-
|
|
367
|
+
() => n.validViewportScrollInfo$.subscribe((v) => {
|
|
368
|
+
v && this.fireEvent(this.Event.Scroll, {
|
|
369
369
|
workbook: a,
|
|
370
370
|
worksheet: a.getActiveSheet(),
|
|
371
|
-
...
|
|
371
|
+
...v
|
|
372
372
|
});
|
|
373
373
|
})
|
|
374
374
|
)), g.add(this.registerEventHandler(
|
|
375
375
|
this.Event.SelectionMoveStart,
|
|
376
|
-
() => c.selectionMoveStart$.subscribe((
|
|
377
|
-
var
|
|
376
|
+
() => c.selectionMoveStart$.subscribe((v) => {
|
|
377
|
+
var m;
|
|
378
378
|
this.fireEvent(this.Event.SelectionMoveStart, {
|
|
379
379
|
workbook: a,
|
|
380
380
|
worksheet: a.getActiveSheet(),
|
|
381
|
-
selections: (
|
|
381
|
+
selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
|
|
382
382
|
});
|
|
383
383
|
})
|
|
384
384
|
)), g.add(this.registerEventHandler(
|
|
385
385
|
this.Event.SelectionMoving,
|
|
386
|
-
() => c.selectionMoving$.subscribe((
|
|
387
|
-
var
|
|
386
|
+
() => c.selectionMoving$.subscribe((v) => {
|
|
387
|
+
var m;
|
|
388
388
|
this.fireEvent(this.Event.SelectionMoving, {
|
|
389
389
|
workbook: a,
|
|
390
390
|
worksheet: a.getActiveSheet(),
|
|
391
|
-
selections: (
|
|
391
|
+
selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
|
|
392
392
|
});
|
|
393
393
|
})
|
|
394
394
|
)), g.add(this.registerEventHandler(
|
|
395
395
|
this.Event.SelectionMoveEnd,
|
|
396
|
-
() => c.selectionMoveEnd$.subscribe((
|
|
397
|
-
var
|
|
396
|
+
() => c.selectionMoveEnd$.subscribe((v) => {
|
|
397
|
+
var m;
|
|
398
398
|
this.fireEvent(this.Event.SelectionMoveEnd, {
|
|
399
399
|
workbook: a,
|
|
400
400
|
worksheet: a.getActiveSheet(),
|
|
401
|
-
selections: (
|
|
401
|
+
selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
|
|
402
402
|
});
|
|
403
403
|
})
|
|
404
404
|
)), g.add(this.registerEventHandler(
|
|
405
405
|
this.Event.SelectionChanged,
|
|
406
|
-
() => c.selectionChanged$.subscribe((
|
|
407
|
-
var
|
|
406
|
+
() => c.selectionChanged$.subscribe((v) => {
|
|
407
|
+
var m;
|
|
408
408
|
this.fireEvent(this.Event.SelectionChanged, {
|
|
409
409
|
workbook: a,
|
|
410
410
|
worksheet: a.getActiveSheet(),
|
|
411
|
-
selections: (
|
|
411
|
+
selections: (m = v == null ? void 0 : v.map((k) => k.range)) != null ? m : []
|
|
412
412
|
});
|
|
413
413
|
})
|
|
414
414
|
)), s = null, this.disposeWithMe(g);
|
|
@@ -426,7 +426,7 @@ class Ue extends q {
|
|
|
426
426
|
*/
|
|
427
427
|
_initialize(e) {
|
|
428
428
|
this._initSheetUIEvent(e), this._initObserverListener(e);
|
|
429
|
-
const r = e.get(
|
|
429
|
+
const r = e.get(I);
|
|
430
430
|
this.registerEventHandler(
|
|
431
431
|
this.Event.BeforeClipboardChange,
|
|
432
432
|
() => r.beforeCommandExecuted((t) => {
|
|
@@ -513,7 +513,7 @@ class Ue extends q {
|
|
|
513
513
|
_beforeClipboardChange() {
|
|
514
514
|
const e = this._generateClipboardCopyParam();
|
|
515
515
|
if (e && (this.fireEvent(this.Event.BeforeClipboardChange, e), e.cancel))
|
|
516
|
-
throw new
|
|
516
|
+
throw new b();
|
|
517
517
|
}
|
|
518
518
|
_clipboardChanged() {
|
|
519
519
|
const e = this._generateClipboardCopyParam();
|
|
@@ -550,12 +550,12 @@ class Ue extends q {
|
|
|
550
550
|
_beforeClipboardPaste(e) {
|
|
551
551
|
const r = this._generateClipboardPasteParam(e);
|
|
552
552
|
if (r && (this.fireEvent(this.Event.BeforeClipboardPaste, r), r.cancel))
|
|
553
|
-
throw new
|
|
553
|
+
throw new b();
|
|
554
554
|
}
|
|
555
555
|
_clipboardPaste(e) {
|
|
556
556
|
const r = this._generateClipboardPasteParam(e);
|
|
557
557
|
if (r && (this.fireEvent(this.Event.ClipboardPasted, r), r.cancel))
|
|
558
|
-
throw new
|
|
558
|
+
throw new b();
|
|
559
559
|
}
|
|
560
560
|
async _beforeClipboardPasteAsync() {
|
|
561
561
|
if (!X()) {
|
|
@@ -564,7 +564,7 @@ class Ue extends q {
|
|
|
564
564
|
}
|
|
565
565
|
const e = await this._generateClipboardPasteParamAsync();
|
|
566
566
|
if (e && (this.fireEvent(this.Event.BeforeClipboardPaste, e), e.cancel))
|
|
567
|
-
throw new
|
|
567
|
+
throw new b();
|
|
568
568
|
}
|
|
569
569
|
async _clipboardPasteAsync() {
|
|
570
570
|
if (!X()) {
|
|
@@ -573,7 +573,7 @@ class Ue extends q {
|
|
|
573
573
|
}
|
|
574
574
|
const e = await this._generateClipboardPasteParamAsync();
|
|
575
575
|
if (e && (this.fireEvent(this.Event.ClipboardPasted, e), e.cancel))
|
|
576
|
-
throw new
|
|
576
|
+
throw new b();
|
|
577
577
|
}
|
|
578
578
|
customizeColumnHeader(e) {
|
|
579
579
|
var h, g;
|
|
@@ -582,8 +582,8 @@ class Ue extends q {
|
|
|
582
582
|
console.error("WorkBook not exist");
|
|
583
583
|
return;
|
|
584
584
|
}
|
|
585
|
-
const t = r == null ? void 0 : r.getId(), i = this._injector.get(
|
|
586
|
-
d && ((h = e.headerStyle) != null && h.size) && (d.with(
|
|
585
|
+
const t = r == null ? void 0 : r.getId(), i = this._injector.get(S), o = r.getActiveSheet(), s = o.getSheetId(), d = i.getRenderById(t);
|
|
586
|
+
d && ((h = e.headerStyle) != null && h.size) && (d.with(_).setColumnHeaderSize(d, s, (g = e.headerStyle) == null ? void 0 : g.size), o == null || o.refreshCanvas()), this._getSheetRenderComponent(t, w.COLUMN).setCustomHeader(e), o == null || o.refreshCanvas();
|
|
587
587
|
}
|
|
588
588
|
customizeRowHeader(e) {
|
|
589
589
|
const r = this.getActiveWorkbook();
|
|
@@ -596,19 +596,19 @@ class Ue extends q {
|
|
|
596
596
|
}
|
|
597
597
|
registerSheetRowHeaderExtension(e, ...r) {
|
|
598
598
|
const t = this._getSheetRenderComponent(e, w.ROW), i = t.register(...r);
|
|
599
|
-
return
|
|
599
|
+
return C(() => {
|
|
600
600
|
i.dispose(), t.makeDirty(!0);
|
|
601
601
|
});
|
|
602
602
|
}
|
|
603
603
|
registerSheetColumnHeaderExtension(e, ...r) {
|
|
604
604
|
const t = this._getSheetRenderComponent(e, w.COLUMN), i = t.register(...r);
|
|
605
|
-
return
|
|
605
|
+
return C(() => {
|
|
606
606
|
i.dispose(), t.makeDirty(!0);
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
registerSheetMainExtension(e, ...r) {
|
|
610
610
|
const t = this._getSheetRenderComponent(e, w.MAIN), i = t.register(...r);
|
|
611
|
-
return
|
|
611
|
+
return C(() => {
|
|
612
612
|
i.dispose(), t.makeDirty(!0);
|
|
613
613
|
});
|
|
614
614
|
}
|
|
@@ -620,7 +620,7 @@ class Ue extends q {
|
|
|
620
620
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
621
621
|
*/
|
|
622
622
|
_getSheetRenderComponent(e, r) {
|
|
623
|
-
const i = this._injector.get(
|
|
623
|
+
const i = this._injector.get(S).getRenderById(e);
|
|
624
624
|
if (!i)
|
|
625
625
|
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
626
626
|
const { components: o } = i, s = o.get(r);
|
|
@@ -633,7 +633,7 @@ class Ue extends q {
|
|
|
633
633
|
* @returns {FSheetHooks} FSheetHooks instance
|
|
634
634
|
*/
|
|
635
635
|
getSheetHooks() {
|
|
636
|
-
return this._injector.createInstance(
|
|
636
|
+
return this._injector.createInstance(W);
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
q.extend(Ue);
|
|
@@ -651,30 +651,6 @@ class xe extends ee {
|
|
|
651
651
|
});
|
|
652
652
|
return t;
|
|
653
653
|
}
|
|
654
|
-
customizeColumnHeader(e) {
|
|
655
|
-
const r = this._workbook.getUnitId();
|
|
656
|
-
this._getSheetRenderComponent(r, w.COLUMN).setCustomHeader(e);
|
|
657
|
-
}
|
|
658
|
-
customizeRowHeader(e) {
|
|
659
|
-
const r = this._workbook.getUnitId();
|
|
660
|
-
this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e);
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Get sheet render component from render by unitId and view key.
|
|
664
|
-
* @private
|
|
665
|
-
* @param {string} unitId The unit id of the spreadsheet.
|
|
666
|
-
* @param {SHEET_VIEW_KEY} viewKey The view key of the spreadsheet.
|
|
667
|
-
* @returns {Nullable<RenderComponentType>} The render component.
|
|
668
|
-
*/
|
|
669
|
-
_getSheetRenderComponent(e, r) {
|
|
670
|
-
const i = this._injector.get(v).getRenderById(e);
|
|
671
|
-
if (!i)
|
|
672
|
-
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
673
|
-
const { components: o } = i, s = o.get(r);
|
|
674
|
-
if (!s)
|
|
675
|
-
throw new Error("Render component not found");
|
|
676
|
-
return s;
|
|
677
|
-
}
|
|
678
654
|
_logDeprecation(e) {
|
|
679
655
|
this._injector.get(U).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
|
|
680
656
|
}
|
|
@@ -689,7 +665,7 @@ class xe extends ee {
|
|
|
689
665
|
}
|
|
690
666
|
onCellClick(e) {
|
|
691
667
|
const r = this._injector.get(p);
|
|
692
|
-
return
|
|
668
|
+
return C(
|
|
693
669
|
r.currentClickedCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
694
670
|
e(t);
|
|
695
671
|
})
|
|
@@ -697,25 +673,25 @@ class xe extends ee {
|
|
|
697
673
|
}
|
|
698
674
|
onCellHover(e) {
|
|
699
675
|
const r = this._injector.get(p);
|
|
700
|
-
return
|
|
676
|
+
return C(
|
|
701
677
|
r.currentRichText$.pipe(u((t) => !!t)).subscribe(e)
|
|
702
678
|
);
|
|
703
679
|
}
|
|
704
680
|
onCellPointerDown(e) {
|
|
705
681
|
const r = this._injector.get(p);
|
|
706
|
-
return
|
|
682
|
+
return C(
|
|
707
683
|
r.currentPointerDownCell$.subscribe(e)
|
|
708
684
|
);
|
|
709
685
|
}
|
|
710
686
|
onCellPointerUp(e) {
|
|
711
687
|
const r = this._injector.get(p);
|
|
712
|
-
return
|
|
688
|
+
return C(
|
|
713
689
|
r.currentPointerUpCell$.subscribe(e)
|
|
714
690
|
);
|
|
715
691
|
}
|
|
716
692
|
onCellPointerMove(e) {
|
|
717
693
|
const r = this._injector.get(p);
|
|
718
|
-
return
|
|
694
|
+
return C(
|
|
719
695
|
r.currentCellPosWithEvent$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
720
696
|
e(t, t.event);
|
|
721
697
|
})
|
|
@@ -723,7 +699,7 @@ class xe extends ee {
|
|
|
723
699
|
}
|
|
724
700
|
onDragOver(e) {
|
|
725
701
|
const r = this._injector.get(M);
|
|
726
|
-
return
|
|
702
|
+
return C(
|
|
727
703
|
r.currentCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
728
704
|
e(t);
|
|
729
705
|
})
|
|
@@ -731,21 +707,21 @@ class xe extends ee {
|
|
|
731
707
|
}
|
|
732
708
|
onDrop(e) {
|
|
733
709
|
const r = this._injector.get(M);
|
|
734
|
-
return
|
|
710
|
+
return C(
|
|
735
711
|
r.endCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
736
712
|
e(t);
|
|
737
713
|
})
|
|
738
714
|
);
|
|
739
715
|
}
|
|
740
716
|
startEditing() {
|
|
741
|
-
return this._injector.get(
|
|
717
|
+
return this._injector.get(I).syncExecuteCommand(f.id, {
|
|
742
718
|
eventType: z.Dblclick,
|
|
743
719
|
unitId: this._workbook.getUnitId(),
|
|
744
720
|
visible: !0
|
|
745
721
|
});
|
|
746
722
|
}
|
|
747
723
|
async endEditing(e) {
|
|
748
|
-
return this._injector.get(
|
|
724
|
+
return this._injector.get(I).syncExecuteCommand(f.id, {
|
|
749
725
|
eventType: z.Keyboard,
|
|
750
726
|
keycode: e ? D.ENTER : D.ESC,
|
|
751
727
|
visible: !1,
|
|
@@ -768,40 +744,40 @@ class xe extends ee {
|
|
|
768
744
|
* ```
|
|
769
745
|
*/
|
|
770
746
|
getScrollStateBySheetId(e) {
|
|
771
|
-
const r = this._workbook.getUnitId(), i = this._injector.get(
|
|
747
|
+
const r = this._workbook.getUnitId(), i = this._injector.get(S).getRenderById(r);
|
|
772
748
|
return i ? i.with(x).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
|
|
773
749
|
}
|
|
774
750
|
disableSelection() {
|
|
775
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
751
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
|
|
776
752
|
return t && t.with(y).disableSelection(), this;
|
|
777
753
|
}
|
|
778
754
|
enableSelection() {
|
|
779
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
755
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
|
|
780
756
|
return t && t.with(y).enableSelection(), this;
|
|
781
757
|
}
|
|
782
758
|
transparentSelection() {
|
|
783
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
759
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
|
|
784
760
|
return t && t.with(y).transparentSelection(), this;
|
|
785
761
|
}
|
|
786
762
|
showSelection() {
|
|
787
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
763
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
|
|
788
764
|
return t && t.with(y).showSelection(), this;
|
|
789
765
|
}
|
|
790
766
|
}
|
|
791
767
|
ee.extend(xe);
|
|
792
768
|
class De extends te {
|
|
793
769
|
refreshCanvas() {
|
|
794
|
-
const e = this._injector.get(
|
|
770
|
+
const e = this._injector.get(S), r = this._fWorkbook.id, t = e.getRenderById(r);
|
|
795
771
|
if (!t)
|
|
796
772
|
throw new Error(`Render Unit with unitId ${r} not found`);
|
|
797
|
-
t.with(
|
|
773
|
+
t.with(_).reCalculate();
|
|
798
774
|
const i = t.mainComponent;
|
|
799
775
|
if (!i)
|
|
800
776
|
throw new Error("Main component not found");
|
|
801
777
|
return i.makeDirty(), this;
|
|
802
778
|
}
|
|
803
779
|
zoom(e) {
|
|
804
|
-
const r = this._injector.get(
|
|
780
|
+
const r = this._injector.get(I), t = Math.min(Math.max(e, 0.1), 4);
|
|
805
781
|
return r.executeCommand(A.id, {
|
|
806
782
|
unitId: this._workbook.getUnitId(),
|
|
807
783
|
subUnitId: this._worksheet.getSheetId(),
|
|
@@ -812,7 +788,7 @@ class De extends te {
|
|
|
812
788
|
return this._worksheet.getZoomRatio();
|
|
813
789
|
}
|
|
814
790
|
getVisibleRange() {
|
|
815
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
791
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(S).getRenderById(e);
|
|
816
792
|
let i = {
|
|
817
793
|
startColumn: 0,
|
|
818
794
|
startRow: 0,
|
|
@@ -820,7 +796,7 @@ class De extends te {
|
|
|
820
796
|
endRow: 0
|
|
821
797
|
};
|
|
822
798
|
if (!t) return i;
|
|
823
|
-
const s = t.with(
|
|
799
|
+
const s = t.with(_).getCurrentSkeleton();
|
|
824
800
|
if (!s) return i;
|
|
825
801
|
const d = s == null ? void 0 : s.getVisibleRanges();
|
|
826
802
|
if (!d) return i;
|
|
@@ -830,8 +806,8 @@ class De extends te {
|
|
|
830
806
|
return i;
|
|
831
807
|
}
|
|
832
808
|
scrollToCell(e, r) {
|
|
833
|
-
const t = this._workbook.getUnitId(), o = this._injector.get(
|
|
834
|
-
return o && (o == null ? void 0 : o.with(
|
|
809
|
+
const t = this._workbook.getUnitId(), o = this._injector.get(S).getRenderById(t);
|
|
810
|
+
return o && (o == null ? void 0 : o.with(pe)).scrollToCell(e, r), this;
|
|
835
811
|
}
|
|
836
812
|
getScrollState() {
|
|
837
813
|
const e = {
|
|
@@ -839,24 +815,24 @@ class De extends te {
|
|
|
839
815
|
offsetY: 0,
|
|
840
816
|
sheetViewStartColumn: 0,
|
|
841
817
|
sheetViewStartRow: 0
|
|
842
|
-
}, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(
|
|
818
|
+
}, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(S).getRenderById(r);
|
|
843
819
|
return o && o.with(x).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
|
|
844
820
|
}
|
|
845
821
|
onScroll(e) {
|
|
846
822
|
var o;
|
|
847
|
-
const r = this._workbook.getUnitId(), i = (o = this._injector.get(
|
|
823
|
+
const r = this._workbook.getUnitId(), i = (o = this._injector.get(S).getRenderById(r)) == null ? void 0 : o.with(x);
|
|
848
824
|
if (i) {
|
|
849
825
|
const s = i.validViewportScrollInfo$.subscribe((d) => {
|
|
850
826
|
e(d);
|
|
851
827
|
});
|
|
852
|
-
return
|
|
828
|
+
return C(s);
|
|
853
829
|
}
|
|
854
|
-
return
|
|
830
|
+
return C(() => {
|
|
855
831
|
});
|
|
856
832
|
}
|
|
857
833
|
getSkeleton() {
|
|
858
834
|
var r, t;
|
|
859
|
-
const e = (r = this._injector.get(
|
|
835
|
+
const e = (r = this._injector.get(S).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(_);
|
|
860
836
|
return (t = e == null ? void 0 : e.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : t.skeleton;
|
|
861
837
|
}
|
|
862
838
|
autoResizeColumn(e) {
|
|
@@ -871,7 +847,7 @@ class De extends te {
|
|
|
871
847
|
endRow: this._worksheet.getRowCount() - 1
|
|
872
848
|
}
|
|
873
849
|
];
|
|
874
|
-
return this._commandService.syncExecuteCommand(
|
|
850
|
+
return this._commandService.syncExecuteCommand(we.id, {
|
|
875
851
|
unitId: t,
|
|
876
852
|
subUnitId: i,
|
|
877
853
|
ranges: o
|
|
@@ -889,37 +865,40 @@ class De extends te {
|
|
|
889
865
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
890
866
|
}
|
|
891
867
|
];
|
|
892
|
-
return this._commandService.syncExecuteCommand(
|
|
868
|
+
return this._commandService.syncExecuteCommand(Ce.id, {
|
|
893
869
|
unitId: t,
|
|
894
870
|
subUnitId: i,
|
|
895
871
|
ranges: o
|
|
896
872
|
}), this;
|
|
897
873
|
}
|
|
898
874
|
customizeColumnHeader(e) {
|
|
899
|
-
var
|
|
900
|
-
const r = this
|
|
901
|
-
|
|
875
|
+
var l, h;
|
|
876
|
+
const r = this, t = this._fWorkbook.getId(), i = this._injector.get(S), o = r.getSheetId(), s = i.getRenderById(t);
|
|
877
|
+
s && ((l = e.headerStyle) != null && l.size) && (s.with(_).setColumnHeaderSize(s, o, (h = e.headerStyle) == null ? void 0 : h.size), r == null || r.refreshCanvas());
|
|
878
|
+
const d = this._getSheetRenderComponent(t, w.COLUMN);
|
|
879
|
+
d && (d.setCustomHeader(e), r == null || r.refreshCanvas());
|
|
902
880
|
}
|
|
903
881
|
customizeRowHeader(e) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
o && ((d = e.headerStyle) != null && d.size) && o.with(I).setRowHeaderSize(o, t, (l = e.headerStyle) == null ? void 0 : l.size), this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e, t);
|
|
882
|
+
const r = this._fWorkbook.getId();
|
|
883
|
+
this._getSheetRenderComponent(r, w.ROW).setCustomHeader(e);
|
|
907
884
|
}
|
|
908
885
|
setColumnHeaderHeight(e) {
|
|
909
|
-
const r = this.
|
|
886
|
+
const r = this, t = this._fWorkbook.getId(), i = r.getSheetId();
|
|
910
887
|
return this._commandService.executeCommand(fe.id, {
|
|
911
|
-
unitId:
|
|
912
|
-
subUnitId:
|
|
888
|
+
unitId: t,
|
|
889
|
+
subUnitId: i,
|
|
913
890
|
size: e
|
|
914
|
-
}), this;
|
|
891
|
+
}), r == null || r.refreshCanvas(), this;
|
|
915
892
|
}
|
|
916
893
|
setRowHeaderWidth(e) {
|
|
917
|
-
const r = this.
|
|
918
|
-
|
|
919
|
-
unitId:
|
|
920
|
-
subUnitId:
|
|
894
|
+
const r = this, t = this._fWorkbook.getId(), i = r.getSheetId();
|
|
895
|
+
this._commandService.executeCommand(ke.id, {
|
|
896
|
+
unitId: t,
|
|
897
|
+
subUnitId: i,
|
|
921
898
|
size: e
|
|
922
|
-
})
|
|
899
|
+
});
|
|
900
|
+
const o = this._getSheetRenderComponent(t, w.ROW);
|
|
901
|
+
return o && o.setCustomHeader({ headerStyle: { size: e } }), r == null || r.refreshCanvas(), this;
|
|
923
902
|
}
|
|
924
903
|
/**
|
|
925
904
|
* Get sheet render component from render by unitId and view key.
|
|
@@ -929,7 +908,7 @@ class De extends te {
|
|
|
929
908
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
930
909
|
*/
|
|
931
910
|
_getSheetRenderComponent(e, r) {
|
|
932
|
-
const i = this._injector.get(
|
|
911
|
+
const i = this._injector.get(S).getRenderById(e);
|
|
933
912
|
if (!i)
|
|
934
913
|
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
935
914
|
const { components: o } = i, s = o.get(r);
|
|
@@ -945,40 +924,40 @@ class Te extends re {
|
|
|
945
924
|
}
|
|
946
925
|
}
|
|
947
926
|
re.extend(Te);
|
|
948
|
-
class Be extends
|
|
927
|
+
class Be extends W {
|
|
949
928
|
onCellPointerMove(e) {
|
|
950
|
-
return
|
|
929
|
+
return C(this._injector.get(p).currentPosition$.subscribe(e));
|
|
951
930
|
}
|
|
952
931
|
onCellPointerOver(e) {
|
|
953
|
-
return
|
|
932
|
+
return C(this._injector.get(p).currentCell$.subscribe(e));
|
|
954
933
|
}
|
|
955
934
|
onCellDragOver(e) {
|
|
956
|
-
return
|
|
935
|
+
return C(this._injector.get(M).currentCell$.subscribe(e));
|
|
957
936
|
}
|
|
958
937
|
onCellDrop(e) {
|
|
959
|
-
return
|
|
938
|
+
return C(this._injector.get(M).endCell$.subscribe(e));
|
|
960
939
|
}
|
|
961
|
-
onCellRender(e, r = ae.Style, t =
|
|
962
|
-
return this._injector.get(
|
|
940
|
+
onCellRender(e, r = ae.Style, t = me.DATA_VALIDATION) {
|
|
941
|
+
return this._injector.get(Ee).intercept(be.CELL_CONTENT, {
|
|
963
942
|
effect: r,
|
|
964
943
|
handler: (i, o, s) => (i && !i.customRender && e && (i.customRender = [...e]), s(i)),
|
|
965
944
|
priority: t
|
|
966
945
|
});
|
|
967
946
|
}
|
|
968
947
|
onBeforeCellEdit(e) {
|
|
969
|
-
return this._injector.get(
|
|
948
|
+
return this._injector.get(I).beforeCommandExecuted((r) => {
|
|
970
949
|
const t = r.params;
|
|
971
950
|
r.id === f.id && t.visible && e(t);
|
|
972
951
|
});
|
|
973
952
|
}
|
|
974
953
|
onAfterCellEdit(e) {
|
|
975
|
-
return this._injector.get(
|
|
954
|
+
return this._injector.get(I).onCommandExecuted((r) => {
|
|
976
955
|
const t = r.params;
|
|
977
956
|
r.id === f.id && !t.visible && e(t);
|
|
978
957
|
});
|
|
979
958
|
}
|
|
980
959
|
}
|
|
981
|
-
|
|
960
|
+
W.extend(Be);
|
|
982
961
|
const H = {
|
|
983
962
|
CellClicked: "CellClicked",
|
|
984
963
|
CellPointerDown: "CellPointerDown",
|
|
@@ -1085,10 +1064,10 @@ class Ae {
|
|
|
1085
1064
|
}
|
|
1086
1065
|
}
|
|
1087
1066
|
de.extend(Ae);
|
|
1088
|
-
class
|
|
1067
|
+
class We extends ne {
|
|
1089
1068
|
getCell() {
|
|
1090
1069
|
var d;
|
|
1091
|
-
const e = this._injector.get(
|
|
1070
|
+
const e = this._injector.get(S), r = this._injector.get(U), t = this._workbook.getUnitId(), i = this._worksheet.getSheetId(), o = e.getRenderById(t), s = (d = o == null ? void 0 : o.with(_).getSkeletonParam(i)) == null ? void 0 : d.skeleton;
|
|
1092
1071
|
if (!s)
|
|
1093
1072
|
throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
|
|
1094
1073
|
return s.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
|
|
@@ -1163,7 +1142,7 @@ class $e extends ne {
|
|
|
1163
1142
|
const t = this._injector.get(_e), i = t.addShape({ range: this._range, style: e, primary: r });
|
|
1164
1143
|
if (!i)
|
|
1165
1144
|
throw new Error("Failed to highlight current range");
|
|
1166
|
-
return
|
|
1145
|
+
return C(() => {
|
|
1167
1146
|
t.removeShape(i);
|
|
1168
1147
|
});
|
|
1169
1148
|
}
|
|
@@ -1171,9 +1150,9 @@ class $e extends ne {
|
|
|
1171
1150
|
return this._injector.get(Pe).showDropdown(e);
|
|
1172
1151
|
}
|
|
1173
1152
|
}
|
|
1174
|
-
ne.extend(
|
|
1175
|
-
function G(
|
|
1176
|
-
const { componentKey: r, isVue3: t } =
|
|
1153
|
+
ne.extend(We);
|
|
1154
|
+
function G(E, e) {
|
|
1155
|
+
const { componentKey: r, isVue3: t } = E;
|
|
1177
1156
|
let i;
|
|
1178
1157
|
const o = new B();
|
|
1179
1158
|
return typeof r == "string" ? i = r : (i = `External_${ce(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
|