@univerjs/core 1.0.0-alpha.7 → 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +7 -139
- package/lib/cjs/index.js +832 -929
- package/lib/es/facade.js +9 -135
- package/lib/es/index.js +826 -932
- package/lib/facade.js +9 -135
- package/lib/index.js +826 -932
- package/lib/types/bases/index.d.ts +3 -2
- package/lib/types/bases/record-identity.d.ts +22 -0
- package/lib/types/bases/typedef.d.ts +255 -23
- package/lib/types/docs/data-model/index.d.ts +1 -1
- package/lib/types/docs/data-model/paragraph-style.d.ts +7 -1
- package/lib/types/docs/data-model/rich-text-builder.d.ts +28 -9
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +1 -1
- package/lib/types/docs/data-model/text-x/utils.d.ts +1 -0
- package/lib/types/docs/data-model/types.d.ts +0 -2
- package/lib/types/facade/f-event.d.ts +9 -9
- package/lib/types/facade/f-univer.d.ts +1 -22
- package/lib/types/facade/index.d.ts +0 -1
- package/lib/types/services/context/context.d.ts +0 -2
- package/lib/types/services/instance/instance.service.d.ts +0 -8
- package/lib/types/shared/cache/image-cache.d.ts +1 -1
- package/lib/types/shared/common.d.ts +0 -5
- package/lib/types/shared/object-matrix.d.ts +0 -14
- package/lib/types/shared/rectangle.d.ts +0 -15
- package/lib/types/shared/tools.d.ts +0 -2
- package/lib/types/sheets/sheet-skeleton.d.ts +3 -7
- package/lib/types/sheets/typedef.d.ts +0 -14
- package/lib/types/sheets/workbook.d.ts +0 -2
- package/lib/types/sheets/worksheet.d.ts +0 -6
- package/lib/types/types/const/page-size.d.ts +2 -0
- package/lib/types/types/enum/text-style.d.ts +3 -1
- package/lib/types/types/enum/theme-color-type.d.ts +0 -4
- package/lib/types/types/interfaces/i-cell-custom-render.d.ts +0 -2
- package/lib/types/types/interfaces/i-document-data.d.ts +113 -12
- package/lib/types/types/interfaces/i-need-check-disposable.d.ts +1 -1
- package/lib/types/types/interfaces/i-style-data.d.ts +43 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +22 -21
- package/package.json +4 -4
- package/lib/types/facade/f-hooks.d.ts +0 -74
package/lib/cjs/facade.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _univerjs_core = require("@univerjs/core");
|
|
3
|
-
let rxjs = require("rxjs");
|
|
4
3
|
|
|
5
4
|
//#region src/facade/f-base.ts
|
|
6
5
|
/**
|
|
@@ -82,7 +81,7 @@ var FBaseInitialable = class extends _univerjs_core.Disposable {
|
|
|
82
81
|
};
|
|
83
82
|
|
|
84
83
|
//#endregion
|
|
85
|
-
//#region \0@oxc-project+runtime@0.
|
|
84
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorateParam.js
|
|
86
85
|
function __decorateParam(paramIndex, decorator) {
|
|
87
86
|
return function(target, key) {
|
|
88
87
|
decorator(target, key, paramIndex);
|
|
@@ -90,7 +89,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
90
89
|
}
|
|
91
90
|
|
|
92
91
|
//#endregion
|
|
93
|
-
//#region \0@oxc-project+runtime@0.
|
|
92
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/decorate.js
|
|
94
93
|
function __decorate(decorators, target, key, desc) {
|
|
95
94
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
96
95
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -177,7 +176,7 @@ let FBlob = _FBlob = class FBlob extends FBase {
|
|
|
177
176
|
return this;
|
|
178
177
|
}
|
|
179
178
|
setDataFromString(data, contentType) {
|
|
180
|
-
const blob = new Blob([data], { type: contentType
|
|
179
|
+
const blob = new Blob([data], { type: contentType ?? "text/plain" });
|
|
181
180
|
this._blob = blob;
|
|
182
181
|
return this;
|
|
183
182
|
}
|
|
@@ -214,7 +213,7 @@ let FBlob = _FBlob = class FBlob extends FBase {
|
|
|
214
213
|
FBlob = _FBlob = __decorate([__decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector))], FBlob);
|
|
215
214
|
|
|
216
215
|
//#endregion
|
|
217
|
-
//#region \0@oxc-project+runtime@0.
|
|
216
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
|
|
218
217
|
function _typeof(o) {
|
|
219
218
|
"@babel/helpers - typeof";
|
|
220
219
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -225,7 +224,7 @@ function _typeof(o) {
|
|
|
225
224
|
}
|
|
226
225
|
|
|
227
226
|
//#endregion
|
|
228
|
-
//#region \0@oxc-project+runtime@0.
|
|
227
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
|
|
229
228
|
function toPrimitive(t, r) {
|
|
230
229
|
if ("object" != _typeof(t) || !t) return t;
|
|
231
230
|
var e = t[Symbol.toPrimitive];
|
|
@@ -238,14 +237,14 @@ function toPrimitive(t, r) {
|
|
|
238
237
|
}
|
|
239
238
|
|
|
240
239
|
//#endregion
|
|
241
|
-
//#region \0@oxc-project+runtime@0.
|
|
240
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
|
|
242
241
|
function toPropertyKey(t) {
|
|
243
242
|
var i = toPrimitive(t, "string");
|
|
244
243
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
//#endregion
|
|
248
|
-
//#region \0@oxc-project+runtime@0.
|
|
247
|
+
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
|
|
249
248
|
function _defineProperty(e, r, t) {
|
|
250
249
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
251
250
|
value: t,
|
|
@@ -891,101 +890,6 @@ var FEventName = class FEventName {
|
|
|
891
890
|
};
|
|
892
891
|
_defineProperty(FEventName, "_instance", void 0);
|
|
893
892
|
|
|
894
|
-
//#endregion
|
|
895
|
-
//#region src/facade/f-hooks.ts
|
|
896
|
-
let FHooks = class FHooks extends FBase {
|
|
897
|
-
constructor(_injector, _lifecycleService) {
|
|
898
|
-
super();
|
|
899
|
-
this._injector = _injector;
|
|
900
|
-
this._lifecycleService = _lifecycleService;
|
|
901
|
-
}
|
|
902
|
-
/**
|
|
903
|
-
* @param callback
|
|
904
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
905
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
906
|
-
*/
|
|
907
|
-
onStarting(callback) {
|
|
908
|
-
return (0, _univerjs_core.toDisposable)(this._lifecycleService.lifecycle$.pipe((0, rxjs.filter)((lifecycle) => lifecycle === _univerjs_core.LifecycleStages.Starting)).subscribe(callback));
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* @param callback
|
|
912
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
913
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
914
|
-
*/
|
|
915
|
-
onReady(callback) {
|
|
916
|
-
return (0, _univerjs_core.toDisposable)(this._lifecycleService.lifecycle$.pipe((0, rxjs.filter)((lifecycle) => lifecycle === _univerjs_core.LifecycleStages.Ready)).subscribe(callback));
|
|
917
|
-
}
|
|
918
|
-
/**
|
|
919
|
-
* @param callback
|
|
920
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
921
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
922
|
-
*/
|
|
923
|
-
onRendered(callback) {
|
|
924
|
-
return (0, _univerjs_core.toDisposable)(this._lifecycleService.lifecycle$.pipe((0, rxjs.filter)((lifecycle) => lifecycle === _univerjs_core.LifecycleStages.Rendered)).subscribe(callback));
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* @param callback
|
|
928
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
929
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, ({ stage }) => {})` as instead
|
|
930
|
-
*/
|
|
931
|
-
onSteady(callback) {
|
|
932
|
-
return (0, _univerjs_core.toDisposable)(this._lifecycleService.lifecycle$.pipe((0, rxjs.filter)((lifecycle) => lifecycle === _univerjs_core.LifecycleStages.Steady)).subscribe(callback));
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* @param callback
|
|
936
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
937
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeUndo, (event) => {})` as instead
|
|
938
|
-
*/
|
|
939
|
-
onBeforeUndo(callback) {
|
|
940
|
-
return this._injector.get(_univerjs_core.ICommandService).beforeCommandExecuted((command) => {
|
|
941
|
-
if (command.id === _univerjs_core.UndoCommand.id) {
|
|
942
|
-
const action = this._injector.get(_univerjs_core.IUndoRedoService).pitchTopUndoElement();
|
|
943
|
-
if (action) callback(action);
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* @param callback
|
|
949
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
950
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Undo, (event) => {})` as instead
|
|
951
|
-
*/
|
|
952
|
-
onUndo(callback) {
|
|
953
|
-
return this._injector.get(_univerjs_core.ICommandService).onCommandExecuted((command) => {
|
|
954
|
-
if (command.id === _univerjs_core.UndoCommand.id) {
|
|
955
|
-
const action = this._injector.get(_univerjs_core.IUndoRedoService).pitchTopUndoElement();
|
|
956
|
-
if (action) callback(action);
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* @param callback
|
|
962
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
963
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeRedo, (event) => {})` as instead
|
|
964
|
-
*/
|
|
965
|
-
onBeforeRedo(callback) {
|
|
966
|
-
return this._injector.get(_univerjs_core.ICommandService).beforeCommandExecuted((command) => {
|
|
967
|
-
if (command.id === _univerjs_core.RedoCommand.id) {
|
|
968
|
-
const action = this._injector.get(_univerjs_core.IUndoRedoService).pitchTopRedoElement();
|
|
969
|
-
if (action) callback(action);
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* @param callback
|
|
975
|
-
* @returns {IDisposable} A disposable used to remove the listener.
|
|
976
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.Redo, (event) => {})` as instead
|
|
977
|
-
*/
|
|
978
|
-
onRedo(callback) {
|
|
979
|
-
return this._injector.get(_univerjs_core.ICommandService).onCommandExecuted((command) => {
|
|
980
|
-
if (command.id === _univerjs_core.RedoCommand.id) {
|
|
981
|
-
const action = this._injector.get(_univerjs_core.IUndoRedoService).pitchTopRedoElement();
|
|
982
|
-
if (action) callback(action);
|
|
983
|
-
}
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
};
|
|
987
|
-
FHooks = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_core.Injector)), __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.LifecycleService))], FHooks);
|
|
988
|
-
|
|
989
893
|
//#endregion
|
|
990
894
|
//#region src/facade/f-doc.ts
|
|
991
895
|
let FDoc = class FDoc extends FBaseInitialable {
|
|
@@ -1469,28 +1373,6 @@ let FUniver = _FUniver = class FUniver extends _univerjs_core.Disposable {
|
|
|
1469
1373
|
return this._injector.get(_univerjs_core.LocaleService).getLocales();
|
|
1470
1374
|
}
|
|
1471
1375
|
/**
|
|
1472
|
-
* Register a callback that will be triggered before invoking a command.
|
|
1473
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) => {})` instead.
|
|
1474
|
-
* @param {CommandListener} callback The callback.
|
|
1475
|
-
* @returns {IDisposable} The disposable instance.
|
|
1476
|
-
*/
|
|
1477
|
-
onBeforeCommandExecute(callback) {
|
|
1478
|
-
return this._commandService.beforeCommandExecuted((command, options) => {
|
|
1479
|
-
callback(command, options);
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
/**
|
|
1483
|
-
* Register a callback that will be triggered when a command is invoked.
|
|
1484
|
-
* @deprecated use `univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {})` instead.
|
|
1485
|
-
* @param {CommandListener} callback The callback.
|
|
1486
|
-
* @returns {IDisposable} The disposable instance.
|
|
1487
|
-
*/
|
|
1488
|
-
onCommandExecuted(callback) {
|
|
1489
|
-
return this._commandService.onCommandExecuted((command, options) => {
|
|
1490
|
-
callback(command, options);
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
/**
|
|
1494
1376
|
* Execute a command with the given id and parameters.
|
|
1495
1377
|
* @param id Identifier of the command.
|
|
1496
1378
|
* @param params Parameters of this execution.
|
|
@@ -1526,14 +1408,6 @@ let FUniver = _FUniver = class FUniver extends _univerjs_core.Disposable {
|
|
|
1526
1408
|
syncExecuteCommand(id, params, options) {
|
|
1527
1409
|
return this._commandService.syncExecuteCommand(id, params, options);
|
|
1528
1410
|
}
|
|
1529
|
-
/**
|
|
1530
|
-
* Get hooks.
|
|
1531
|
-
* @deprecated use `addEvent` instead.
|
|
1532
|
-
* @returns {FHooks} FHooks instance
|
|
1533
|
-
*/
|
|
1534
|
-
getHooks() {
|
|
1535
|
-
return this._injector.createInstance(FHooks);
|
|
1536
|
-
}
|
|
1537
1411
|
get Enum() {
|
|
1538
1412
|
return FEnum.get();
|
|
1539
1413
|
}
|
|
@@ -1710,12 +1584,6 @@ Object.defineProperty(exports, 'FBlob', {
|
|
|
1710
1584
|
});
|
|
1711
1585
|
exports.FEnum = FEnum;
|
|
1712
1586
|
exports.FEventName = FEventName;
|
|
1713
|
-
Object.defineProperty(exports, 'FHooks', {
|
|
1714
|
-
enumerable: true,
|
|
1715
|
-
get: function () {
|
|
1716
|
-
return FHooks;
|
|
1717
|
-
}
|
|
1718
|
-
});
|
|
1719
1587
|
Object.defineProperty(exports, 'FUniver', {
|
|
1720
1588
|
enumerable: true,
|
|
1721
1589
|
get: function () {
|