@univerjs/sheets-ui 0.8.3 → 0.9.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 +1 -1
- package/lib/cjs/index.js +7 -7
- package/lib/es/facade.js +126 -105
- package/lib/es/index.js +1279 -1276
- package/lib/facade.js +126 -105
- package/lib/index.js +1279 -1276
- package/lib/types/facade/f-univer.d.ts +2 -14
- package/lib/types/facade/f-workbook.d.ts +61 -1
- package/lib/types/facade/f-worksheet.d.ts +38 -36
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +8 -8
- package/package.json +14 -14
package/lib/facade.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ICommandService as
|
|
1
|
+
import { ICommandService as _, CanceledError as E, IUniverInstanceService as j, RichTextValue as W, 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 m, 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 v, 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 me, InterceptCellContentPriority as Ce, SheetInterceptorService as we, 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 I, SHEET_VIEW_KEY as w, ISheetSelectionRenderService as y, SheetsScrollRenderController as Ee, SetWorksheetColAutoWidthCommand as pe, 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 $, 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(_);
|
|
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 E();
|
|
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(j), 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: W.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 E();
|
|
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(j), 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: W.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 E();
|
|
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(v), 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((S) => {
|
|
368
|
+
S && this.fireEvent(this.Event.Scroll, {
|
|
369
369
|
workbook: a,
|
|
370
370
|
worksheet: a.getActiveSheet(),
|
|
371
|
-
...
|
|
371
|
+
...S
|
|
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((S) => {
|
|
377
|
+
var C;
|
|
378
378
|
this.fireEvent(this.Event.SelectionMoveStart, {
|
|
379
379
|
workbook: a,
|
|
380
380
|
worksheet: a.getActiveSheet(),
|
|
381
|
-
selections: (
|
|
381
|
+
selections: (C = S == null ? void 0 : S.map((k) => k.range)) != null ? C : []
|
|
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((S) => {
|
|
387
|
+
var C;
|
|
388
388
|
this.fireEvent(this.Event.SelectionMoving, {
|
|
389
389
|
workbook: a,
|
|
390
390
|
worksheet: a.getActiveSheet(),
|
|
391
|
-
selections: (
|
|
391
|
+
selections: (C = S == null ? void 0 : S.map((k) => k.range)) != null ? C : []
|
|
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((S) => {
|
|
397
|
+
var C;
|
|
398
398
|
this.fireEvent(this.Event.SelectionMoveEnd, {
|
|
399
399
|
workbook: a,
|
|
400
400
|
worksheet: a.getActiveSheet(),
|
|
401
|
-
selections: (
|
|
401
|
+
selections: (C = S == null ? void 0 : S.map((k) => k.range)) != null ? C : []
|
|
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((S) => {
|
|
407
|
+
var C;
|
|
408
408
|
this.fireEvent(this.Event.SelectionChanged, {
|
|
409
409
|
workbook: a,
|
|
410
410
|
worksheet: a.getActiveSheet(),
|
|
411
|
-
selections: (
|
|
411
|
+
selections: (C = S == null ? void 0 : S.map((k) => k.range)) != null ? C : []
|
|
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(_);
|
|
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 E();
|
|
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 E();
|
|
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 E();
|
|
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 E();
|
|
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 E();
|
|
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(v), o = r.getActiveSheet(), s = o.getSheetId(), d = i.getRenderById(t);
|
|
586
|
+
d && ((h = e.headerStyle) != null && h.size) && (d.with(I).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 m(() => {
|
|
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 m(() => {
|
|
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 m(() => {
|
|
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(v).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($);
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
q.extend(Ue);
|
|
@@ -651,6 +651,30 @@ 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
|
+
}
|
|
654
678
|
_logDeprecation(e) {
|
|
655
679
|
this._injector.get(U).warn("[FWorkbook]", `${e} is deprecated. Please use the function of the same name on "FUniver".`);
|
|
656
680
|
}
|
|
@@ -665,7 +689,7 @@ class xe extends ee {
|
|
|
665
689
|
}
|
|
666
690
|
onCellClick(e) {
|
|
667
691
|
const r = this._injector.get(p);
|
|
668
|
-
return
|
|
692
|
+
return m(
|
|
669
693
|
r.currentClickedCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
670
694
|
e(t);
|
|
671
695
|
})
|
|
@@ -673,25 +697,25 @@ class xe extends ee {
|
|
|
673
697
|
}
|
|
674
698
|
onCellHover(e) {
|
|
675
699
|
const r = this._injector.get(p);
|
|
676
|
-
return
|
|
700
|
+
return m(
|
|
677
701
|
r.currentRichText$.pipe(u((t) => !!t)).subscribe(e)
|
|
678
702
|
);
|
|
679
703
|
}
|
|
680
704
|
onCellPointerDown(e) {
|
|
681
705
|
const r = this._injector.get(p);
|
|
682
|
-
return
|
|
706
|
+
return m(
|
|
683
707
|
r.currentPointerDownCell$.subscribe(e)
|
|
684
708
|
);
|
|
685
709
|
}
|
|
686
710
|
onCellPointerUp(e) {
|
|
687
711
|
const r = this._injector.get(p);
|
|
688
|
-
return
|
|
712
|
+
return m(
|
|
689
713
|
r.currentPointerUpCell$.subscribe(e)
|
|
690
714
|
);
|
|
691
715
|
}
|
|
692
716
|
onCellPointerMove(e) {
|
|
693
717
|
const r = this._injector.get(p);
|
|
694
|
-
return
|
|
718
|
+
return m(
|
|
695
719
|
r.currentCellPosWithEvent$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
696
720
|
e(t, t.event);
|
|
697
721
|
})
|
|
@@ -699,7 +723,7 @@ class xe extends ee {
|
|
|
699
723
|
}
|
|
700
724
|
onDragOver(e) {
|
|
701
725
|
const r = this._injector.get(M);
|
|
702
|
-
return
|
|
726
|
+
return m(
|
|
703
727
|
r.currentCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
704
728
|
e(t);
|
|
705
729
|
})
|
|
@@ -707,21 +731,21 @@ class xe extends ee {
|
|
|
707
731
|
}
|
|
708
732
|
onDrop(e) {
|
|
709
733
|
const r = this._injector.get(M);
|
|
710
|
-
return
|
|
734
|
+
return m(
|
|
711
735
|
r.endCell$.pipe(u((t) => !!t)).subscribe((t) => {
|
|
712
736
|
e(t);
|
|
713
737
|
})
|
|
714
738
|
);
|
|
715
739
|
}
|
|
716
740
|
startEditing() {
|
|
717
|
-
return this._injector.get(
|
|
741
|
+
return this._injector.get(_).syncExecuteCommand(f.id, {
|
|
718
742
|
eventType: z.Dblclick,
|
|
719
743
|
unitId: this._workbook.getUnitId(),
|
|
720
744
|
visible: !0
|
|
721
745
|
});
|
|
722
746
|
}
|
|
723
747
|
async endEditing(e) {
|
|
724
|
-
return this._injector.get(
|
|
748
|
+
return this._injector.get(_).syncExecuteCommand(f.id, {
|
|
725
749
|
eventType: z.Keyboard,
|
|
726
750
|
keycode: e ? D.ENTER : D.ESC,
|
|
727
751
|
visible: !1,
|
|
@@ -744,40 +768,40 @@ class xe extends ee {
|
|
|
744
768
|
* ```
|
|
745
769
|
*/
|
|
746
770
|
getScrollStateBySheetId(e) {
|
|
747
|
-
const r = this._workbook.getUnitId(), i = this._injector.get(
|
|
771
|
+
const r = this._workbook.getUnitId(), i = this._injector.get(v).getRenderById(r);
|
|
748
772
|
return i ? i.with(x).getScrollStateByParam({ unitId: r, sheetId: e }) : null;
|
|
749
773
|
}
|
|
750
774
|
disableSelection() {
|
|
751
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
775
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
752
776
|
return t && t.with(y).disableSelection(), this;
|
|
753
777
|
}
|
|
754
778
|
enableSelection() {
|
|
755
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
779
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
756
780
|
return t && t.with(y).enableSelection(), this;
|
|
757
781
|
}
|
|
758
782
|
transparentSelection() {
|
|
759
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
783
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
760
784
|
return t && t.with(y).transparentSelection(), this;
|
|
761
785
|
}
|
|
762
786
|
showSelection() {
|
|
763
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
787
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
764
788
|
return t && t.with(y).showSelection(), this;
|
|
765
789
|
}
|
|
766
790
|
}
|
|
767
791
|
ee.extend(xe);
|
|
768
792
|
class De extends te {
|
|
769
793
|
refreshCanvas() {
|
|
770
|
-
const e = this._injector.get(
|
|
794
|
+
const e = this._injector.get(v), r = this._fWorkbook.id, t = e.getRenderById(r);
|
|
771
795
|
if (!t)
|
|
772
796
|
throw new Error(`Render Unit with unitId ${r} not found`);
|
|
773
|
-
t.with(
|
|
797
|
+
t.with(I).reCalculate();
|
|
774
798
|
const i = t.mainComponent;
|
|
775
799
|
if (!i)
|
|
776
800
|
throw new Error("Main component not found");
|
|
777
801
|
return i.makeDirty(), this;
|
|
778
802
|
}
|
|
779
803
|
zoom(e) {
|
|
780
|
-
const r = this._injector.get(
|
|
804
|
+
const r = this._injector.get(_), t = Math.min(Math.max(e, 0.1), 4);
|
|
781
805
|
return r.executeCommand(A.id, {
|
|
782
806
|
unitId: this._workbook.getUnitId(),
|
|
783
807
|
subUnitId: this._worksheet.getSheetId(),
|
|
@@ -788,7 +812,7 @@ class De extends te {
|
|
|
788
812
|
return this._worksheet.getZoomRatio();
|
|
789
813
|
}
|
|
790
814
|
getVisibleRange() {
|
|
791
|
-
const e = this._workbook.getUnitId(), t = this._injector.get(
|
|
815
|
+
const e = this._workbook.getUnitId(), t = this._injector.get(v).getRenderById(e);
|
|
792
816
|
let i = {
|
|
793
817
|
startColumn: 0,
|
|
794
818
|
startRow: 0,
|
|
@@ -796,7 +820,7 @@ class De extends te {
|
|
|
796
820
|
endRow: 0
|
|
797
821
|
};
|
|
798
822
|
if (!t) return i;
|
|
799
|
-
const s = t.with(
|
|
823
|
+
const s = t.with(I).getCurrentSkeleton();
|
|
800
824
|
if (!s) return i;
|
|
801
825
|
const d = s == null ? void 0 : s.getVisibleRanges();
|
|
802
826
|
if (!d) return i;
|
|
@@ -806,8 +830,8 @@ class De extends te {
|
|
|
806
830
|
return i;
|
|
807
831
|
}
|
|
808
832
|
scrollToCell(e, r) {
|
|
809
|
-
const t = this._workbook.getUnitId(), o = this._injector.get(
|
|
810
|
-
return o && (o == null ? void 0 : o.with(
|
|
833
|
+
const t = this._workbook.getUnitId(), o = this._injector.get(v).getRenderById(t);
|
|
834
|
+
return o && (o == null ? void 0 : o.with(Ee)).scrollToCell(e, r), this;
|
|
811
835
|
}
|
|
812
836
|
getScrollState() {
|
|
813
837
|
const e = {
|
|
@@ -815,24 +839,24 @@ class De extends te {
|
|
|
815
839
|
offsetY: 0,
|
|
816
840
|
sheetViewStartColumn: 0,
|
|
817
841
|
sheetViewStartRow: 0
|
|
818
|
-
}, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(
|
|
842
|
+
}, r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
819
843
|
return o && o.with(x).getScrollStateByParam({ unitId: r, sheetId: t }) || e;
|
|
820
844
|
}
|
|
821
845
|
onScroll(e) {
|
|
822
846
|
var o;
|
|
823
|
-
const r = this._workbook.getUnitId(), i = (o = this._injector.get(
|
|
847
|
+
const r = this._workbook.getUnitId(), i = (o = this._injector.get(v).getRenderById(r)) == null ? void 0 : o.with(x);
|
|
824
848
|
if (i) {
|
|
825
849
|
const s = i.validViewportScrollInfo$.subscribe((d) => {
|
|
826
850
|
e(d);
|
|
827
851
|
});
|
|
828
|
-
return
|
|
852
|
+
return m(s);
|
|
829
853
|
}
|
|
830
|
-
return
|
|
854
|
+
return m(() => {
|
|
831
855
|
});
|
|
832
856
|
}
|
|
833
857
|
getSkeleton() {
|
|
834
858
|
var r, t;
|
|
835
|
-
const e = (r = this._injector.get(
|
|
859
|
+
const e = (r = this._injector.get(v).getRenderById(this._workbook.getUnitId())) == null ? void 0 : r.with(I);
|
|
836
860
|
return (t = e == null ? void 0 : e.getWorksheetSkeleton(this._worksheet.getSheetId())) == null ? void 0 : t.skeleton;
|
|
837
861
|
}
|
|
838
862
|
autoResizeColumn(e) {
|
|
@@ -847,7 +871,7 @@ class De extends te {
|
|
|
847
871
|
endRow: this._worksheet.getRowCount() - 1
|
|
848
872
|
}
|
|
849
873
|
];
|
|
850
|
-
return this._commandService.syncExecuteCommand(
|
|
874
|
+
return this._commandService.syncExecuteCommand(pe.id, {
|
|
851
875
|
unitId: t,
|
|
852
876
|
subUnitId: i,
|
|
853
877
|
ranges: o
|
|
@@ -865,40 +889,37 @@ class De extends te {
|
|
|
865
889
|
endColumn: this._worksheet.getColumnCount() - 1
|
|
866
890
|
}
|
|
867
891
|
];
|
|
868
|
-
return this._commandService.syncExecuteCommand(
|
|
892
|
+
return this._commandService.syncExecuteCommand(me.id, {
|
|
869
893
|
unitId: t,
|
|
870
894
|
subUnitId: i,
|
|
871
895
|
ranges: o
|
|
872
896
|
}), this;
|
|
873
897
|
}
|
|
874
898
|
customizeColumnHeader(e) {
|
|
875
|
-
var
|
|
876
|
-
const r = this, t = this.
|
|
877
|
-
|
|
878
|
-
const d = this._getSheetRenderComponent(t, w.COLUMN);
|
|
879
|
-
d && (d.setCustomHeader(e), r == null || r.refreshCanvas());
|
|
899
|
+
var d, l;
|
|
900
|
+
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
901
|
+
o && ((d = e.headerStyle) != null && d.size) && o.with(I).setColumnHeaderSize(o, t, (l = e.headerStyle) == null ? void 0 : l.size), this._getSheetRenderComponent(r, w.COLUMN).setCustomHeader(e, t);
|
|
880
902
|
}
|
|
881
903
|
customizeRowHeader(e) {
|
|
882
|
-
|
|
883
|
-
this.
|
|
904
|
+
var d, l;
|
|
905
|
+
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId(), o = this._injector.get(v).getRenderById(r);
|
|
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);
|
|
884
907
|
}
|
|
885
908
|
setColumnHeaderHeight(e) {
|
|
886
|
-
const r = this
|
|
909
|
+
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
887
910
|
return this._commandService.executeCommand(fe.id, {
|
|
888
|
-
unitId:
|
|
889
|
-
subUnitId:
|
|
911
|
+
unitId: r,
|
|
912
|
+
subUnitId: t,
|
|
890
913
|
size: e
|
|
891
|
-
}),
|
|
914
|
+
}), this;
|
|
892
915
|
}
|
|
893
916
|
setRowHeaderWidth(e) {
|
|
894
|
-
const r = this
|
|
895
|
-
this._commandService.executeCommand(ke.id, {
|
|
896
|
-
unitId:
|
|
897
|
-
subUnitId:
|
|
917
|
+
const r = this._workbook.getUnitId(), t = this._worksheet.getSheetId();
|
|
918
|
+
return this._commandService.executeCommand(ke.id, {
|
|
919
|
+
unitId: r,
|
|
920
|
+
subUnitId: t,
|
|
898
921
|
size: e
|
|
899
|
-
});
|
|
900
|
-
const o = this._getSheetRenderComponent(t, w.ROW);
|
|
901
|
-
return o && o.setCustomHeader({ headerStyle: { size: e } }), r == null || r.refreshCanvas(), this;
|
|
922
|
+
}), this;
|
|
902
923
|
}
|
|
903
924
|
/**
|
|
904
925
|
* Get sheet render component from render by unitId and view key.
|
|
@@ -908,7 +929,7 @@ class De extends te {
|
|
|
908
929
|
* @returns {Nullable<RenderComponentType>} The render component.
|
|
909
930
|
*/
|
|
910
931
|
_getSheetRenderComponent(e, r) {
|
|
911
|
-
const i = this._injector.get(
|
|
932
|
+
const i = this._injector.get(v).getRenderById(e);
|
|
912
933
|
if (!i)
|
|
913
934
|
throw new Error(`Render Unit with unitId ${e} not found`);
|
|
914
935
|
const { components: o } = i, s = o.get(r);
|
|
@@ -924,40 +945,40 @@ class Te extends re {
|
|
|
924
945
|
}
|
|
925
946
|
}
|
|
926
947
|
re.extend(Te);
|
|
927
|
-
class Be extends
|
|
948
|
+
class Be extends $ {
|
|
928
949
|
onCellPointerMove(e) {
|
|
929
|
-
return
|
|
950
|
+
return m(this._injector.get(p).currentPosition$.subscribe(e));
|
|
930
951
|
}
|
|
931
952
|
onCellPointerOver(e) {
|
|
932
|
-
return
|
|
953
|
+
return m(this._injector.get(p).currentCell$.subscribe(e));
|
|
933
954
|
}
|
|
934
955
|
onCellDragOver(e) {
|
|
935
|
-
return
|
|
956
|
+
return m(this._injector.get(M).currentCell$.subscribe(e));
|
|
936
957
|
}
|
|
937
958
|
onCellDrop(e) {
|
|
938
|
-
return
|
|
959
|
+
return m(this._injector.get(M).endCell$.subscribe(e));
|
|
939
960
|
}
|
|
940
|
-
onCellRender(e, r = ae.Style, t =
|
|
941
|
-
return this._injector.get(
|
|
961
|
+
onCellRender(e, r = ae.Style, t = Ce.DATA_VALIDATION) {
|
|
962
|
+
return this._injector.get(we).intercept(be.CELL_CONTENT, {
|
|
942
963
|
effect: r,
|
|
943
964
|
handler: (i, o, s) => (i && !i.customRender && e && (i.customRender = [...e]), s(i)),
|
|
944
965
|
priority: t
|
|
945
966
|
});
|
|
946
967
|
}
|
|
947
968
|
onBeforeCellEdit(e) {
|
|
948
|
-
return this._injector.get(
|
|
969
|
+
return this._injector.get(_).beforeCommandExecuted((r) => {
|
|
949
970
|
const t = r.params;
|
|
950
971
|
r.id === f.id && t.visible && e(t);
|
|
951
972
|
});
|
|
952
973
|
}
|
|
953
974
|
onAfterCellEdit(e) {
|
|
954
|
-
return this._injector.get(
|
|
975
|
+
return this._injector.get(_).onCommandExecuted((r) => {
|
|
955
976
|
const t = r.params;
|
|
956
977
|
r.id === f.id && !t.visible && e(t);
|
|
957
978
|
});
|
|
958
979
|
}
|
|
959
980
|
}
|
|
960
|
-
|
|
981
|
+
$.extend(Be);
|
|
961
982
|
const H = {
|
|
962
983
|
CellClicked: "CellClicked",
|
|
963
984
|
CellPointerDown: "CellPointerDown",
|
|
@@ -1064,10 +1085,10 @@ class Ae {
|
|
|
1064
1085
|
}
|
|
1065
1086
|
}
|
|
1066
1087
|
de.extend(Ae);
|
|
1067
|
-
class
|
|
1088
|
+
class $e extends ne {
|
|
1068
1089
|
getCell() {
|
|
1069
1090
|
var d;
|
|
1070
|
-
const e = this._injector.get(
|
|
1091
|
+
const e = this._injector.get(v), 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(I).getSkeletonParam(i)) == null ? void 0 : d.skeleton;
|
|
1071
1092
|
if (!s)
|
|
1072
1093
|
throw r.error("[Facade]: `FRange.getCell` can only be called in current worksheet"), new Error("`FRange.getCell` can only be called in current worksheet");
|
|
1073
1094
|
return s.getCellWithCoordByIndex(this._range.startRow, this._range.startColumn);
|
|
@@ -1142,7 +1163,7 @@ class We extends ne {
|
|
|
1142
1163
|
const t = this._injector.get(_e), i = t.addShape({ range: this._range, style: e, primary: r });
|
|
1143
1164
|
if (!i)
|
|
1144
1165
|
throw new Error("Failed to highlight current range");
|
|
1145
|
-
return
|
|
1166
|
+
return m(() => {
|
|
1146
1167
|
t.removeShape(i);
|
|
1147
1168
|
});
|
|
1148
1169
|
}
|
|
@@ -1150,9 +1171,9 @@ class We extends ne {
|
|
|
1150
1171
|
return this._injector.get(Pe).showDropdown(e);
|
|
1151
1172
|
}
|
|
1152
1173
|
}
|
|
1153
|
-
ne.extend(
|
|
1154
|
-
function G(
|
|
1155
|
-
const { componentKey: r, isVue3: t } =
|
|
1174
|
+
ne.extend($e);
|
|
1175
|
+
function G(b, e) {
|
|
1176
|
+
const { componentKey: r, isVue3: t } = b;
|
|
1156
1177
|
let i;
|
|
1157
1178
|
const o = new B();
|
|
1158
1179
|
return typeof r == "string" ? i = r : (i = `External_${ce(6)}`, o.add(e.register(i, r, { framework: t ? "vue3" : "react" }))), {
|