@univerjs/core 0.6.6 → 0.6.7
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 +2 -2
- package/lib/es/facade.js +170 -159
- package/lib/es/index.js +16 -13
- package/lib/types/docs/data-model/document-data-model.d.ts +2 -0
- package/lib/types/docs/data-model/text-x/build-utils/text-x-utils.d.ts +1 -1
- package/lib/types/facade/f-enum.d.ts +10 -1
- package/lib/types/sheets/worksheet.d.ts +5 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +2 -2
- package/package.json +6 -6
package/lib/es/index.js
CHANGED
|
@@ -10783,6 +10783,12 @@ class hm extends ti {
|
|
|
10783
10783
|
zoomRatio: n
|
|
10784
10784
|
} : this.snapshot.settings.zoomRatio = 1;
|
|
10785
10785
|
}
|
|
10786
|
+
setDisabled(n) {
|
|
10787
|
+
this.snapshot.disabled = n;
|
|
10788
|
+
}
|
|
10789
|
+
getDisabled() {
|
|
10790
|
+
return this.snapshot.disabled;
|
|
10791
|
+
}
|
|
10786
10792
|
}
|
|
10787
10793
|
class Te extends hm {
|
|
10788
10794
|
constructor(n) {
|
|
@@ -13678,7 +13684,7 @@ class Jm extends ne {
|
|
|
13678
13684
|
this._error$.next({ errorKey: n });
|
|
13679
13685
|
}
|
|
13680
13686
|
}
|
|
13681
|
-
const Zm = "0.6.
|
|
13687
|
+
const Zm = "0.6.7", Qm = {
|
|
13682
13688
|
version: Zm
|
|
13683
13689
|
};
|
|
13684
13690
|
function t_(t = "", e = Fr.ZH_CN, n = "") {
|
|
@@ -13723,6 +13729,7 @@ class e_ {
|
|
|
13723
13729
|
toJSON() {
|
|
13724
13730
|
return this._styles;
|
|
13725
13731
|
}
|
|
13732
|
+
// TODO: this should be `deReuseStyle` to be more accurate.
|
|
13726
13733
|
getStyleByCell(e) {
|
|
13727
13734
|
let n;
|
|
13728
13735
|
e && rt.isObject(e.s) ? n = e.s : n = (e == null ? void 0 : e.s) && this.get(e.s);
|
|
@@ -14529,12 +14536,6 @@ class Dr {
|
|
|
14529
14536
|
setStyleData(e) {
|
|
14530
14537
|
return this._styles.setValue(e);
|
|
14531
14538
|
}
|
|
14532
|
-
/**
|
|
14533
|
-
* Get the style of the column.
|
|
14534
|
-
* @param {number} column The column index
|
|
14535
|
-
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
14536
|
-
* @returns {Nullable<IStyleData>|string} The style of the column
|
|
14537
|
-
*/
|
|
14538
14539
|
getColumnStyle(e, n = !1) {
|
|
14539
14540
|
return n ? this._columnManager.getColumnStyle(e) : this._styles.get(this._columnManager.getColumnStyle(e));
|
|
14540
14541
|
}
|
|
@@ -14546,12 +14547,6 @@ class Dr {
|
|
|
14546
14547
|
setColumnStyle(e, n) {
|
|
14547
14548
|
this._columnManager.setColumnStyle(e, n);
|
|
14548
14549
|
}
|
|
14549
|
-
/**
|
|
14550
|
-
* Get the style of the row.
|
|
14551
|
-
* @param {number} row The row index
|
|
14552
|
-
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
14553
|
-
* @returns {Nullable<IStyleData>} The style of the row
|
|
14554
|
-
*/
|
|
14555
14550
|
getRowStyle(e, n = !1) {
|
|
14556
14551
|
return n ? this._rowManager.getRowStyle(e) : this._styles.get(this._rowManager.getRowStyle(e));
|
|
14557
14552
|
}
|
|
@@ -14597,6 +14592,14 @@ class Dr {
|
|
|
14597
14592
|
setDefaultCellStyle(e) {
|
|
14598
14593
|
this._snapshot.defaultStyle = e;
|
|
14599
14594
|
}
|
|
14595
|
+
getCellStyle(e, n) {
|
|
14596
|
+
const r = this.getCell(e, n);
|
|
14597
|
+
if (r) {
|
|
14598
|
+
const s = r.s;
|
|
14599
|
+
return typeof s == "string" ? this._styles.get(s) : s;
|
|
14600
|
+
}
|
|
14601
|
+
return null;
|
|
14602
|
+
}
|
|
14600
14603
|
/**
|
|
14601
14604
|
* Returns WorkSheet Cell Data Matrix
|
|
14602
14605
|
* @returns WorkSheet Cell Data Matrix
|
|
@@ -41,6 +41,8 @@ declare class DocumentDataModelSimple extends UnitModel<IDocumentData, UniverIns
|
|
|
41
41
|
updateDocumentDataPageSize(width?: number, height?: number): void;
|
|
42
42
|
updateDrawing(id: string, config: IDrawingUpdateConfig): void;
|
|
43
43
|
setZoomRatio(zoomRatio?: number): void;
|
|
44
|
+
setDisabled(disabled: boolean): void;
|
|
45
|
+
getDisabled(): boolean | undefined;
|
|
44
46
|
}
|
|
45
47
|
export declare class DocumentDataModel extends DocumentDataModelSimple {
|
|
46
48
|
private _unitId;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { Nullable } from '../../../../shared';
|
|
1
2
|
import { ITextRange, ITextRangeParam } from '../../../../sheets/typedef';
|
|
2
3
|
import { CustomRangeType, IDocumentBody } from '../../../../types/interfaces';
|
|
3
4
|
import { DocumentDataModel } from '../../document-data-model';
|
|
4
5
|
import { TextXAction } from '../action-types';
|
|
5
6
|
import { TextXSelection, TextX } from '../text-x';
|
|
6
|
-
import { Nullable } from '../../../../shared';
|
|
7
7
|
export interface IDeleteCustomRangeParam {
|
|
8
8
|
rangeId: string;
|
|
9
9
|
segmentId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, HorizontalAlign, InterpolationPointType, LifecycleStages, LocaleType, MentionType, ProtectionType, RelativeDate, SheetTypes, TextDecoration, TextDirection, ThemeColorType, UniverInstanceType, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
1
|
+
import { AbsoluteRefType, AutoFillSeries, BaselineOffset, BooleanNumber, BorderStyleTypes, BorderType, ColorType, CommandType, CommonHideTypes, CopyPasteType, DataValidationErrorStyle, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DeleteDirection, DeveloperMetadataVisibility, Dimension, Direction, HorizontalAlign, InterpolationPointType, LifecycleStages, LocaleType, MentionType, ProtectionType, RelativeDate, SheetTypes, TextDecoration, TextDirection, ThemeColorType, UniverInstanceType, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
2
2
|
/**
|
|
3
3
|
* @hideconstructor
|
|
4
4
|
*/
|
|
@@ -13,6 +13,15 @@ export declare class FEnum {
|
|
|
13
13
|
*/
|
|
14
14
|
static extend(source: any): void;
|
|
15
15
|
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Defines different types of absolute references
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* console.log(univerAPI.Enum.AbsoluteRefType);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
get AbsoluteRefType(): typeof AbsoluteRefType;
|
|
16
25
|
/**
|
|
17
26
|
* Defines different types of Univer instances
|
|
18
27
|
*
|
|
@@ -68,7 +68,8 @@ export declare class Worksheet {
|
|
|
68
68
|
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
69
69
|
* @returns {Nullable<IStyleData>|string} The style of the column
|
|
70
70
|
*/
|
|
71
|
-
getColumnStyle(column: number, keepRaw
|
|
71
|
+
getColumnStyle(column: number, keepRaw: true): string | Nullable<IStyleData>;
|
|
72
|
+
getColumnStyle(column: number): Nullable<IStyleData>;
|
|
72
73
|
/**
|
|
73
74
|
* Set the style of the column.
|
|
74
75
|
* @param {number} column The column index
|
|
@@ -81,7 +82,8 @@ export declare class Worksheet {
|
|
|
81
82
|
* @param {boolean} [keepRaw] If true, return the raw style data, otherwise return the style data object
|
|
82
83
|
* @returns {Nullable<IStyleData>} The style of the row
|
|
83
84
|
*/
|
|
84
|
-
getRowStyle(row: number, keepRaw
|
|
85
|
+
getRowStyle(row: number, keepRaw: true): string | Nullable<IStyleData>;
|
|
86
|
+
getRowStyle(row: number): Nullable<IStyleData>;
|
|
85
87
|
/**
|
|
86
88
|
* Set the style of the row.
|
|
87
89
|
* @param {number} row
|
|
@@ -107,6 +109,7 @@ export declare class Worksheet {
|
|
|
107
109
|
* @param {Nullable<IStyleData>} style The style to be set as default style
|
|
108
110
|
*/
|
|
109
111
|
setDefaultCellStyle(style: Nullable<IStyleData> | string): void;
|
|
112
|
+
getCellStyle(row: number, col: number): Nullable<IStyleData>;
|
|
110
113
|
/**
|
|
111
114
|
* Returns WorkSheet Cell Data Matrix
|
|
112
115
|
* @returns WorkSheet Cell Data Matrix
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.UniverCoreFacade={},c.UniverCore,c.rxjs))})(this,function(c,n,p){"use strict";var N=Object.defineProperty;var A=(c,n,p)=>n in c?N(c,n,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[n]=p;var h=(c,n,p)=>A(c,typeof n!="symbol"?n+"":n,p);class v extends n.Disposable{static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}const S=Symbol("initializers");class j extends n.Disposable{constructor(t){super(),this._injector=t;const e=this,i=Object.getPrototypeOf(this)[S];i&&i.forEach(function(r){r.apply(e,[t])})}_initialize(t){}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{if(e==="_initialize"){let i=this.prototype[S];i||(i=[],this.prototype[S]=i),i.push(t.prototype._initialize)}else e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}var B=Object.getOwnPropertyDescriptor,U=(a,t,e,i)=>{for(var r=i>1?void 0:i?B(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},O=(a,t)=>(e,i)=>t(e,i,a);c.FBlob=class extends v{constructor(t,e){super(),this._blob=t,this._injector=e}copyBlob(){return this._injector.createInstance(c.FBlob,this._blob)}getAs(t){const e=this.copyBlob();return e.setContentType(t),e}getDataAsString(t){return this._blob===null?Promise.resolve(""):t===void 0?this._blob.text():new Promise((e,i)=>{this._blob.arrayBuffer().then(r=>{const s=new TextDecoder(t).decode(r);e(s)}).catch(r=>{i(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(t=>new Uint8Array(t)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(t){return this._blob=new Blob([t]),this}setDataFromString(t,e){const i=e!=null?e:"text/plain",r=new Blob([t],{type:i});return this._blob=r,this}getContentType(){var t;return(t=this._blob)==null?void 0:t.type}setContentType(t){var e;return this._blob=(e=this._blob)==null?void 0:e.slice(0,this._blob.size,t),this}},c.FBlob=U([O(1,n.Inject(n.Injector))],c.FBlob);const y=class y{static get(){if(this._instance)return this._instance;const t=new y;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in y.prototype)this[t]=y.prototype[t]}get UniverInstanceType(){return n.UniverInstanceType}get LifecycleStages(){return n.LifecycleStages}get DataValidationType(){return n.DataValidationType}get DataValidationErrorStyle(){return n.DataValidationErrorStyle}get DataValidationRenderMode(){return n.DataValidationRenderMode}get DataValidationOperator(){return n.DataValidationOperator}get DataValidationStatus(){return n.DataValidationStatus}get CommandType(){return n.CommandType}get BaselineOffset(){return n.BaselineOffset}get BooleanNumber(){return n.BooleanNumber}get HorizontalAlign(){return n.HorizontalAlign}get TextDecoration(){return n.TextDecoration}get TextDirection(){return n.TextDirection}get VerticalAlign(){return n.VerticalAlign}get WrapStrategy(){return n.WrapStrategy}get BorderType(){return n.BorderType}get BorderStyleTypes(){return n.BorderStyleTypes}get AutoFillSeries(){return n.AutoFillSeries}get ColorType(){return n.ColorType}get CommonHideTypes(){return n.CommonHideTypes}get CopyPasteType(){return n.CopyPasteType}get DeleteDirection(){return n.DeleteDirection}get DeveloperMetadataVisibility(){return n.DeveloperMetadataVisibility}get Dimension(){return n.Dimension}get Direction(){return n.Direction}get InterpolationPointType(){return n.InterpolationPointType}get LocaleType(){return n.LocaleType}get MentionType(){return n.MentionType}get ProtectionType(){return n.ProtectionType}get RelativeDate(){return n.RelativeDate}get SheetTypes(){return n.SheetTypes}get ThemeColorType(){return n.ThemeColorType}};h(y,"_instance");let f=y;const g=class g{static get(){if(this._instance)return this._instance;const t=new g;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in g.prototype)this[t]=g.prototype[t]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};h(g,"_instance");let m=g;var P=Object.getOwnPropertyDescriptor,I=(a,t,e,i)=>{for(var r=i>1?void 0:i?P(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},R=(a,t)=>(e,i)=>t(e,i,a);c.FHooks=class extends v{constructor(t,e){super(),this._injector=t,this._lifecycleService=e}onStarting(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Starting)).subscribe(t))}onReady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Ready)).subscribe(t))}onRendered(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Rendered)).subscribe(t))}onSteady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Steady)).subscribe(t))}onBeforeUndo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onUndo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onBeforeRedo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}onRedo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}},c.FHooks=I([R(0,n.Inject(n.Injector)),R(1,n.Inject(n.LifecycleService))],c.FHooks);var x=Object.getOwnPropertyDescriptor,H=(a,t,e,i)=>{for(var r=i>1?void 0:i?x(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},F=(a,t)=>(e,i)=>t(e,i,a);let C=class extends j{constructor(a,t){super(t),this.doc=a}};C=H([F(1,n.Inject(n.Injector))],C);class V{constructor(){h(this,"_eventRegistry",new Map);h(this,"_eventHandlerMap",new Map);h(this,"_eventHandlerRegisted",new Map)}_ensureEventRegistry(t){return this._eventRegistry.has(t)||this._eventRegistry.set(t,new n.Registry),this._eventRegistry.get(t)}registerEventHandler(t,e){const i=this._eventHandlerMap.get(t);return i?i.add(e):this._eventHandlerMap.set(t,new Set([e])),this._ensureEventRegistry(t).getData().length&&this._initEventHandler(t),n.toDisposable(()=>{var r,s,o,d;(r=this._eventHandlerMap.get(t))==null||r.delete(e),(o=(s=this._eventHandlerRegisted.get(t))==null?void 0:s.get(e))==null||o.dispose(),(d=this._eventHandlerRegisted.get(t))==null||d.delete(e)})}removeEvent(t,e){const i=this._ensureEventRegistry(t);if(i.delete(e),i.getData().length===0){const r=this._eventHandlerRegisted.get(t);r==null||r.forEach(s=>s.dispose()),this._eventHandlerRegisted.delete(t)}}_initEventHandler(t){let e=this._eventHandlerRegisted.get(t);const i=this._eventHandlerMap.get(t);i&&(e||(e=new Map,this._eventHandlerRegisted.set(t,e),i==null||i.forEach(r=>{e==null||e.set(r,n.toDisposable(r()))})))}addEvent(t,e){return this._ensureEventRegistry(t).add(e),this._initEventHandler(t),n.toDisposable(()=>this.removeEvent(t,e))}fireEvent(t,e){var i;return(i=this._eventRegistry.get(t))==null||i.getData().forEach(r=>{r(e)}),e.cancel}}var M=Object.getOwnPropertyDescriptor,$=(a,t,e,i)=>{for(var r=i>1?void 0:i?M(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},w=(a,t)=>(e,i)=>t(e,i,a);let D=class extends v{constructor(a,t){super(),this._injector=a,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};D=$([w(0,n.Inject(n.Injector)),w(1,n.Inject(n.UserManagerService))],D);const b=class b{static get(){if(this._instance)return this._instance;const t=new b;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}get rectangle(){return n.Rectangle}get numfmt(){return n.numfmt}get tools(){return n.Tools}};h(b,"_instance");let _=b;var z=Object.getOwnPropertyDescriptor,L=(a,t,e,i)=>{for(var r=i>1?void 0:i?z(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},E=(a,t)=>(e,i)=>t(e,i,a);const T=Symbol("initializers");c.FUniver=class extends n.Disposable{constructor(e,i,r,s){super();h(this,"_eventRegistry",new V);h(this,"registerEventHandler",(e,i)=>this._eventRegistry.registerEventHandler(e,i));this._injector=e,this._commandService=i,this._univerInstanceService=r,this._lifecycleService=s,this.registerEventHandler(this.Event.LifeCycleChanged,()=>n.toDisposable(this._lifecycleService.lifecycle$.subscribe(d=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:d})}))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});const o=Object.getPrototypeOf(this)[T];if(o){const d=this;o.forEach(function(u){u.apply(d,[e])})}}static newAPI(e){return(e instanceof n.Univer?e.__getInjector():e).createInstance(c.FUniver)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(i=>{if(i==="_initialize"){let r=this.prototype[T];r||(r=[],this.prototype[T]=r),r.push(e.prototype._initialize)}else i!=="constructor"&&(this.prototype[i]=e.prototype[i])}),Object.getOwnPropertyNames(e).forEach(i=>{i!=="prototype"&&i!=="name"&&i!=="length"&&(this[i]=e[i])})}_initCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.Redo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Redo,l)}})),this.registerEventHandler(this.Event.Undo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Undo,l)}})),this.registerEventHandler(this.Event.CommandExecuted,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.CommandExecuted,l)}}))}_initBeforeCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.BeforeRedo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeRedo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeUndo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeUndo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommandExecute,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeCommandExecute,l),l.cancel)throw new n.CanceledError}}))}_initUnitEvent(e){const i=e.get(n.IUniverInstanceService);this.registerEventHandler(this.Event.DocDisposed,()=>i.unitDisposed$.subscribe(r=>{r.type===n.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:r.getUnitId(),unitType:r.type,snapshot:r.getSnapshot()})})),this.registerEventHandler(this.Event.DocCreated,()=>i.unitAdded$.subscribe(r=>{if(r.type===n.UniverInstanceType.UNIVER_DOC){const s=r,o=e.createInstance(C,s);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:o,unit:o})}}))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(n.LifecycleService).stage}undo(){return this._commandService.executeCommand(n.UndoCommand.id)}redo(){return this._commandService.executeCommand(n.RedoCommand.id)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((i,r)=>{e(i,r)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((i,r)=>{e(i,r)})}executeCommand(e,i,r){return this._commandService.executeCommand(e,i,r)}syncExecuteCommand(e,i,r){return this._commandService.syncExecuteCommand(e,i,r)}getHooks(){return this._injector.createInstance(c.FHooks)}get Enum(){return f.get()}get Event(){return m.get()}get Util(){return _.get()}addEvent(e,i){if(!e||!i)throw new Error("Cannot add empty event");return this._eventRegistry.addEvent(e,i)}fireEvent(e,i){return this._eventRegistry.fireEvent(e,i)}getUserManager(){return this._injector.createInstance(D)}newBlob(){return this._injector.createInstance(c.FBlob)}newColor(){return new n.ColorBuilder}newRichText(e){return n.RichTextBuilder.create(e)}newRichTextValue(e){return n.RichTextValue.create(e)}newParagraphStyle(e){return n.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return n.ParagraphStyleValue.create(e)}newTextStyle(e){return n.TextStyleBuilder.create(e)}newTextStyleValue(e){return n.TextStyleValue.create(e)}newTextDecoration(e){return new n.TextDecorationBuilder(e)}},c.FUniver=L([E(0,n.Inject(n.Injector)),E(1,n.ICommandService),E(2,n.IUniverInstanceService),E(3,n.Inject(n.LifecycleService))],c.FUniver),c.FBase=v,c.FBaseInitialable=j,c.FEnum=f,c.FEventName=m,c.FUtil=_,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("@univerjs/core"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","rxjs"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.UniverCoreFacade={},c.UniverCore,c.rxjs))})(this,function(c,n,p){"use strict";var N=Object.defineProperty;var A=(c,n,p)=>n in c?N(c,n,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[n]=p;var u=(c,n,p)=>A(c,typeof n!="symbol"?n+"":n,p);class v extends n.Disposable{static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}const S=Symbol("initializers");class R extends n.Disposable{constructor(t){super(),this._injector=t;const e=this,i=Object.getPrototypeOf(this)[S];i&&i.forEach(function(r){r.apply(e,[t])})}_initialize(t){}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{if(e==="_initialize"){let i=this.prototype[S];i||(i=[],this.prototype[S]=i),i.push(t.prototype._initialize)}else e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}}var B=Object.getOwnPropertyDescriptor,U=(a,t,e,i)=>{for(var r=i>1?void 0:i?B(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},O=(a,t)=>(e,i)=>t(e,i,a);c.FBlob=class extends v{constructor(t,e){super(),this._blob=t,this._injector=e}copyBlob(){return this._injector.createInstance(c.FBlob,this._blob)}getAs(t){const e=this.copyBlob();return e.setContentType(t),e}getDataAsString(t){return this._blob===null?Promise.resolve(""):t===void 0?this._blob.text():new Promise((e,i)=>{this._blob.arrayBuffer().then(r=>{const s=new TextDecoder(t).decode(r);e(s)}).catch(r=>{i(new Error(`Failed to read Blob as ArrayBuffer: ${r.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(t=>new Uint8Array(t)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(t){return this._blob=new Blob([t]),this}setDataFromString(t,e){const i=e!=null?e:"text/plain",r=new Blob([t],{type:i});return this._blob=r,this}getContentType(){var t;return(t=this._blob)==null?void 0:t.type}setContentType(t){var e;return this._blob=(e=this._blob)==null?void 0:e.slice(0,this._blob.size,t),this}},c.FBlob=U([O(1,n.Inject(n.Injector))],c.FBlob);const y=class y{static get(){if(this._instance)return this._instance;const t=new y;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in y.prototype)this[t]=y.prototype[t]}get AbsoluteRefType(){return n.AbsoluteRefType}get UniverInstanceType(){return n.UniverInstanceType}get LifecycleStages(){return n.LifecycleStages}get DataValidationType(){return n.DataValidationType}get DataValidationErrorStyle(){return n.DataValidationErrorStyle}get DataValidationRenderMode(){return n.DataValidationRenderMode}get DataValidationOperator(){return n.DataValidationOperator}get DataValidationStatus(){return n.DataValidationStatus}get CommandType(){return n.CommandType}get BaselineOffset(){return n.BaselineOffset}get BooleanNumber(){return n.BooleanNumber}get HorizontalAlign(){return n.HorizontalAlign}get TextDecoration(){return n.TextDecoration}get TextDirection(){return n.TextDirection}get VerticalAlign(){return n.VerticalAlign}get WrapStrategy(){return n.WrapStrategy}get BorderType(){return n.BorderType}get BorderStyleTypes(){return n.BorderStyleTypes}get AutoFillSeries(){return n.AutoFillSeries}get ColorType(){return n.ColorType}get CommonHideTypes(){return n.CommonHideTypes}get CopyPasteType(){return n.CopyPasteType}get DeleteDirection(){return n.DeleteDirection}get DeveloperMetadataVisibility(){return n.DeveloperMetadataVisibility}get Dimension(){return n.Dimension}get Direction(){return n.Direction}get InterpolationPointType(){return n.InterpolationPointType}get LocaleType(){return n.LocaleType}get MentionType(){return n.MentionType}get ProtectionType(){return n.ProtectionType}get RelativeDate(){return n.RelativeDate}get SheetTypes(){return n.SheetTypes}get ThemeColorType(){return n.ThemeColorType}};u(y,"_instance");let f=y;const g=class g{static get(){if(this._instance)return this._instance;const t=new g;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}constructor(){for(const t in g.prototype)this[t]=g.prototype[t]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};u(g,"_instance");let m=g;var P=Object.getOwnPropertyDescriptor,I=(a,t,e,i)=>{for(var r=i>1?void 0:i?P(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},j=(a,t)=>(e,i)=>t(e,i,a);c.FHooks=class extends v{constructor(t,e){super(),this._injector=t,this._lifecycleService=e}onStarting(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Starting)).subscribe(t))}onReady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Ready)).subscribe(t))}onRendered(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Rendered)).subscribe(t))}onSteady(t){return n.toDisposable(this._lifecycleService.lifecycle$.pipe(p.filter(e=>e===n.LifecycleStages.Steady)).subscribe(t))}onBeforeUndo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onUndo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.UndoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopUndoElement();s&&t(s)}})}onBeforeRedo(t){return this._injector.get(n.ICommandService).beforeCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}onRedo(t){return this._injector.get(n.ICommandService).onCommandExecuted(i=>{if(i.id===n.RedoCommand.id){const s=this._injector.get(n.IUndoRedoService).pitchTopRedoElement();s&&t(s)}})}},c.FHooks=I([j(0,n.Inject(n.Injector)),j(1,n.Inject(n.LifecycleService))],c.FHooks);var x=Object.getOwnPropertyDescriptor,H=(a,t,e,i)=>{for(var r=i>1?void 0:i?x(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},F=(a,t)=>(e,i)=>t(e,i,a);let C=class extends R{constructor(a,t){super(t),this.doc=a}};C=H([F(1,n.Inject(n.Injector))],C);class V{constructor(){u(this,"_eventRegistry",new Map);u(this,"_eventHandlerMap",new Map);u(this,"_eventHandlerRegisted",new Map)}_ensureEventRegistry(t){return this._eventRegistry.has(t)||this._eventRegistry.set(t,new n.Registry),this._eventRegistry.get(t)}registerEventHandler(t,e){const i=this._eventHandlerMap.get(t);return i?i.add(e):this._eventHandlerMap.set(t,new Set([e])),this._ensureEventRegistry(t).getData().length&&this._initEventHandler(t),n.toDisposable(()=>{var r,s,o,d;(r=this._eventHandlerMap.get(t))==null||r.delete(e),(o=(s=this._eventHandlerRegisted.get(t))==null?void 0:s.get(e))==null||o.dispose(),(d=this._eventHandlerRegisted.get(t))==null||d.delete(e)})}removeEvent(t,e){const i=this._ensureEventRegistry(t);if(i.delete(e),i.getData().length===0){const r=this._eventHandlerRegisted.get(t);r==null||r.forEach(s=>s.dispose()),this._eventHandlerRegisted.delete(t)}}_initEventHandler(t){let e=this._eventHandlerRegisted.get(t);const i=this._eventHandlerMap.get(t);i&&(e||(e=new Map,this._eventHandlerRegisted.set(t,e),i==null||i.forEach(r=>{e==null||e.set(r,n.toDisposable(r()))})))}addEvent(t,e){return this._ensureEventRegistry(t).add(e),this._initEventHandler(t),n.toDisposable(()=>this.removeEvent(t,e))}fireEvent(t,e){var i;return(i=this._eventRegistry.get(t))==null||i.getData().forEach(r=>{r(e)}),e.cancel}}var M=Object.getOwnPropertyDescriptor,$=(a,t,e,i)=>{for(var r=i>1?void 0:i?M(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},w=(a,t)=>(e,i)=>t(e,i,a);let D=class extends v{constructor(a,t){super(),this._injector=a,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};D=$([w(0,n.Inject(n.Injector)),w(1,n.Inject(n.UserManagerService))],D);const b=class b{static get(){if(this._instance)return this._instance;const t=new b;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(e=>{e!=="constructor"&&(this.prototype[e]=t.prototype[e])}),Object.getOwnPropertyNames(t).forEach(e=>{e!=="prototype"&&e!=="name"&&e!=="length"&&(this[e]=t[e])})}get rectangle(){return n.Rectangle}get numfmt(){return n.numfmt}get tools(){return n.Tools}};u(b,"_instance");let _=b;var z=Object.getOwnPropertyDescriptor,L=(a,t,e,i)=>{for(var r=i>1?void 0:i?z(t,e):t,s=a.length-1,o;s>=0;s--)(o=a[s])&&(r=o(r)||r);return r},E=(a,t)=>(e,i)=>t(e,i,a);const T=Symbol("initializers");c.FUniver=class extends n.Disposable{constructor(e,i,r,s){super();u(this,"_eventRegistry",new V);u(this,"registerEventHandler",(e,i)=>this._eventRegistry.registerEventHandler(e,i));this._injector=e,this._commandService=i,this._univerInstanceService=r,this._lifecycleService=s,this.registerEventHandler(this.Event.LifeCycleChanged,()=>n.toDisposable(this._lifecycleService.lifecycle$.subscribe(d=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:d})}))),this._initUnitEvent(this._injector),this._initBeforeCommandEvent(this._injector),this._initCommandEvent(this._injector),this._injector.onDispose(()=>{this.dispose()});const o=Object.getPrototypeOf(this)[T];if(o){const d=this;o.forEach(function(h){h.apply(d,[e])})}}static newAPI(e){return(e instanceof n.Univer?e.__getInjector():e).createInstance(c.FUniver)}_initialize(e){}static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(i=>{if(i==="_initialize"){let r=this.prototype[T];r||(r=[],this.prototype[T]=r),r.push(e.prototype._initialize)}else i!=="constructor"&&(this.prototype[i]=e.prototype[i])}),Object.getOwnPropertyNames(e).forEach(i=>{i!=="prototype"&&i!=="name"&&i!=="length"&&(this[i]=e[i])})}_initCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.Redo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Redo,l)}})),this.registerEventHandler(this.Event.Undo,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.Undo,l)}})),this.registerEventHandler(this.Event.CommandExecuted,()=>i.onCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const l={id:s,type:o,params:d};this.fireEvent(this.Event.CommandExecuted,l)}}))}_initBeforeCommandEvent(e){const i=e.get(n.ICommandService);this.registerEventHandler(this.Event.BeforeRedo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.RedoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeRedo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeUndo,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id===n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeUndo,l),l.cancel)throw new n.CanceledError}})),this.registerEventHandler(this.Event.BeforeCommandExecute,()=>i.beforeCommandExecuted(r=>{const{id:s,type:o,params:d}=r;if(r.id!==n.RedoCommand.id&&r.id!==n.UndoCommand.id){const l={id:s,type:o,params:d};if(this.fireEvent(this.Event.BeforeCommandExecute,l),l.cancel)throw new n.CanceledError}}))}_initUnitEvent(e){const i=e.get(n.IUniverInstanceService);this.registerEventHandler(this.Event.DocDisposed,()=>i.unitDisposed$.subscribe(r=>{r.type===n.UniverInstanceType.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:r.getUnitId(),unitType:r.type,snapshot:r.getSnapshot()})})),this.registerEventHandler(this.Event.DocCreated,()=>i.unitAdded$.subscribe(r=>{if(r.type===n.UniverInstanceType.UNIVER_DOC){const s=r,o=e.createInstance(C,s);this.fireEvent(this.Event.DocCreated,{unitId:r.getUnitId(),type:r.type,doc:o,unit:o})}}))}disposeUnit(e){return this._univerInstanceService.disposeUnit(e)}getCurrentLifecycleStage(){return this._injector.get(n.LifecycleService).stage}undo(){return this._commandService.executeCommand(n.UndoCommand.id)}redo(){return this._commandService.executeCommand(n.RedoCommand.id)}onBeforeCommandExecute(e){return this._commandService.beforeCommandExecuted((i,r)=>{e(i,r)})}onCommandExecuted(e){return this._commandService.onCommandExecuted((i,r)=>{e(i,r)})}executeCommand(e,i,r){return this._commandService.executeCommand(e,i,r)}syncExecuteCommand(e,i,r){return this._commandService.syncExecuteCommand(e,i,r)}getHooks(){return this._injector.createInstance(c.FHooks)}get Enum(){return f.get()}get Event(){return m.get()}get Util(){return _.get()}addEvent(e,i){if(!e||!i)throw new Error("Cannot add empty event");return this._eventRegistry.addEvent(e,i)}fireEvent(e,i){return this._eventRegistry.fireEvent(e,i)}getUserManager(){return this._injector.createInstance(D)}newBlob(){return this._injector.createInstance(c.FBlob)}newColor(){return new n.ColorBuilder}newRichText(e){return n.RichTextBuilder.create(e)}newRichTextValue(e){return n.RichTextValue.create(e)}newParagraphStyle(e){return n.ParagraphStyleBuilder.create(e)}newParagraphStyleValue(e){return n.ParagraphStyleValue.create(e)}newTextStyle(e){return n.TextStyleBuilder.create(e)}newTextStyleValue(e){return n.TextStyleValue.create(e)}newTextDecoration(e){return new n.TextDecorationBuilder(e)}},c.FUniver=L([E(0,n.Inject(n.Injector)),E(1,n.ICommandService),E(2,n.IUniverInstanceService),E(3,n.Inject(n.LifecycleService))],c.FUniver),c.FBase=v,c.FBaseInitialable=R,c.FEnum=f,c.FEventName=m,c.FUtil=_,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|