@univerjs/core 0.22.1 → 0.23.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/index.js +47 -10
- package/lib/es/index.js +47 -10
- package/lib/index.js +47 -10
- package/lib/types/services/command/command.service.d.ts +1 -0
- package/lib/types/services/locale/locale.service.d.ts +4 -0
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/index.js +4 -4
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -481,16 +481,17 @@ function createInterceptorKey(key) {
|
|
|
481
481
|
const composeInterceptors = (interceptors) => function(initialValue, context) {
|
|
482
482
|
let index = -1;
|
|
483
483
|
let value = initialValue;
|
|
484
|
-
|
|
484
|
+
let nextCalled = false;
|
|
485
|
+
const next = (nextValue) => {
|
|
486
|
+
nextCalled = true;
|
|
487
|
+
return nextValue;
|
|
488
|
+
};
|
|
489
|
+
for (let i = 0; i < interceptors.length; i++) {
|
|
485
490
|
if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
|
|
486
491
|
index = i;
|
|
487
|
-
if (i === interceptors.length) return value;
|
|
488
492
|
const interceptor = interceptors[i];
|
|
489
|
-
|
|
490
|
-
value = interceptor.handler(value, context,
|
|
491
|
-
nextCalled = true;
|
|
492
|
-
return nextValue;
|
|
493
|
-
});
|
|
493
|
+
nextCalled = false;
|
|
494
|
+
value = interceptor.handler(value, context, next);
|
|
494
495
|
if (!nextCalled) break;
|
|
495
496
|
}
|
|
496
497
|
return value;
|
|
@@ -3337,6 +3338,9 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3337
3338
|
disposed() {
|
|
3338
3339
|
return this._disposed;
|
|
3339
3340
|
}
|
|
3341
|
+
_warnCommandSkippedAfterDisposed(id) {
|
|
3342
|
+
this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
|
|
3343
|
+
}
|
|
3340
3344
|
hasCommand(commandId) {
|
|
3341
3345
|
return this._commandRegistry.hasCommand(commandId);
|
|
3342
3346
|
}
|
|
@@ -3382,6 +3386,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3382
3386
|
throw new Error("[CommandService]: could not add a collab mutation listener twice.");
|
|
3383
3387
|
}
|
|
3384
3388
|
async executeCommand(id, params, options) {
|
|
3389
|
+
if (this._disposed) {
|
|
3390
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3391
|
+
return false;
|
|
3392
|
+
}
|
|
3385
3393
|
try {
|
|
3386
3394
|
const item = this._commandRegistry.getCommand(id);
|
|
3387
3395
|
if (item) {
|
|
@@ -3394,6 +3402,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3394
3402
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3395
3403
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3396
3404
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3405
|
+
if (this._disposed) {
|
|
3406
|
+
stackItemDisposable.dispose();
|
|
3407
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3408
|
+
return false;
|
|
3409
|
+
}
|
|
3397
3410
|
const result = await this._execute(command, params, _options);
|
|
3398
3411
|
if (_options.syncOnly) {
|
|
3399
3412
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3411,6 +3424,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3411
3424
|
}
|
|
3412
3425
|
}
|
|
3413
3426
|
syncExecuteCommand(id, params, options) {
|
|
3427
|
+
if (this._disposed) {
|
|
3428
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3429
|
+
return false;
|
|
3430
|
+
}
|
|
3414
3431
|
try {
|
|
3415
3432
|
const item = this._commandRegistry.getCommand(id);
|
|
3416
3433
|
if (item) {
|
|
@@ -3431,6 +3448,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3431
3448
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3432
3449
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3433
3450
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3451
|
+
if (this._disposed) {
|
|
3452
|
+
stackItemDisposable.dispose();
|
|
3453
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3454
|
+
return false;
|
|
3455
|
+
}
|
|
3434
3456
|
const result = this._syncExecute(command, params, _options);
|
|
3435
3457
|
if (_options.syncOnly) {
|
|
3436
3458
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3602,7 +3624,12 @@ function afterTime(ms) {
|
|
|
3602
3624
|
}
|
|
3603
3625
|
function convertObservableToBehaviorSubject(observable, initValue) {
|
|
3604
3626
|
const subject = new rxjs.BehaviorSubject(initValue);
|
|
3605
|
-
observable.subscribe(subject);
|
|
3627
|
+
const subscription = observable.subscribe(subject);
|
|
3628
|
+
const originalComplete = subject.complete.bind(subject);
|
|
3629
|
+
subject.complete = () => {
|
|
3630
|
+
subscription.unsubscribe();
|
|
3631
|
+
originalComplete();
|
|
3632
|
+
};
|
|
3606
3633
|
return subject;
|
|
3607
3634
|
}
|
|
3608
3635
|
|
|
@@ -14758,7 +14785,7 @@ const IURLImageService = (0, _wendellhu_redi.createIdentifier)("core.url-image.s
|
|
|
14758
14785
|
//#endregion
|
|
14759
14786
|
//#region package.json
|
|
14760
14787
|
var name = "@univerjs/core";
|
|
14761
|
-
var version = "0.
|
|
14788
|
+
var version = "0.23.0";
|
|
14762
14789
|
|
|
14763
14790
|
//#endregion
|
|
14764
14791
|
//#region src/sheets/empty-snapshot.ts
|
|
@@ -17641,6 +17668,8 @@ var LocaleService = class extends Disposable {
|
|
|
17641
17668
|
super();
|
|
17642
17669
|
_defineProperty(this, "_currentLocale$", new rxjs.BehaviorSubject("zhCN"));
|
|
17643
17670
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17671
|
+
_defineProperty(this, "_direction$", new rxjs.BehaviorSubject("ltr"));
|
|
17672
|
+
_defineProperty(this, "direction$", this._direction$.asObservable());
|
|
17644
17673
|
_defineProperty(this, "_locales", null);
|
|
17645
17674
|
_defineProperty(this, "localeChanged$", new rxjs.Subject());
|
|
17646
17675
|
_defineProperty(
|
|
@@ -17687,6 +17716,7 @@ var LocaleService = class extends Disposable {
|
|
|
17687
17716
|
this.disposeWithMe(toDisposable(() => {
|
|
17688
17717
|
this._locales = null;
|
|
17689
17718
|
this._currentLocale$.complete();
|
|
17719
|
+
this._direction$.complete();
|
|
17690
17720
|
this.localeChanged$.complete();
|
|
17691
17721
|
}));
|
|
17692
17722
|
}
|
|
@@ -17710,6 +17740,12 @@ var LocaleService = class extends Disposable {
|
|
|
17710
17740
|
getCurrentLocale() {
|
|
17711
17741
|
return this._currentLocale;
|
|
17712
17742
|
}
|
|
17743
|
+
setDirection(direction) {
|
|
17744
|
+
this._direction$.next(direction);
|
|
17745
|
+
}
|
|
17746
|
+
getDirection() {
|
|
17747
|
+
return this._direction$.value;
|
|
17748
|
+
}
|
|
17713
17749
|
resolveKeyPath(obj, keys) {
|
|
17714
17750
|
const currentKey = keys.shift();
|
|
17715
17751
|
if (currentKey && obj && currentKey in obj) {
|
|
@@ -19891,11 +19927,12 @@ var Univer = class {
|
|
|
19891
19927
|
_defineProperty(this, "_injector", void 0);
|
|
19892
19928
|
_defineProperty(this, "_disposingCallbacks", new DisposableCollection());
|
|
19893
19929
|
const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
|
|
19894
|
-
const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
|
|
19930
|
+
const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
|
|
19895
19931
|
if (theme) this._injector.get(ThemeService).setTheme(theme);
|
|
19896
19932
|
if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
|
|
19897
19933
|
if (locales) this._injector.get(LocaleService).load(locales);
|
|
19898
19934
|
if (locale) this._injector.get(LocaleService).setLocale(locale);
|
|
19935
|
+
if (direction) this._injector.get(LocaleService).setDirection(direction);
|
|
19899
19936
|
if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
|
|
19900
19937
|
if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
|
|
19901
19938
|
this._init(injector);
|
package/lib/es/index.js
CHANGED
|
@@ -447,16 +447,17 @@ function createInterceptorKey(key) {
|
|
|
447
447
|
const composeInterceptors = (interceptors) => function(initialValue, context) {
|
|
448
448
|
let index = -1;
|
|
449
449
|
let value = initialValue;
|
|
450
|
-
|
|
450
|
+
let nextCalled = false;
|
|
451
|
+
const next = (nextValue) => {
|
|
452
|
+
nextCalled = true;
|
|
453
|
+
return nextValue;
|
|
454
|
+
};
|
|
455
|
+
for (let i = 0; i < interceptors.length; i++) {
|
|
451
456
|
if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
|
|
452
457
|
index = i;
|
|
453
|
-
if (i === interceptors.length) return value;
|
|
454
458
|
const interceptor = interceptors[i];
|
|
455
|
-
|
|
456
|
-
value = interceptor.handler(value, context,
|
|
457
|
-
nextCalled = true;
|
|
458
|
-
return nextValue;
|
|
459
|
-
});
|
|
459
|
+
nextCalled = false;
|
|
460
|
+
value = interceptor.handler(value, context, next);
|
|
460
461
|
if (!nextCalled) break;
|
|
461
462
|
}
|
|
462
463
|
return value;
|
|
@@ -3303,6 +3304,9 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3303
3304
|
disposed() {
|
|
3304
3305
|
return this._disposed;
|
|
3305
3306
|
}
|
|
3307
|
+
_warnCommandSkippedAfterDisposed(id) {
|
|
3308
|
+
this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
|
|
3309
|
+
}
|
|
3306
3310
|
hasCommand(commandId) {
|
|
3307
3311
|
return this._commandRegistry.hasCommand(commandId);
|
|
3308
3312
|
}
|
|
@@ -3348,6 +3352,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3348
3352
|
throw new Error("[CommandService]: could not add a collab mutation listener twice.");
|
|
3349
3353
|
}
|
|
3350
3354
|
async executeCommand(id, params, options) {
|
|
3355
|
+
if (this._disposed) {
|
|
3356
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3357
|
+
return false;
|
|
3358
|
+
}
|
|
3351
3359
|
try {
|
|
3352
3360
|
const item = this._commandRegistry.getCommand(id);
|
|
3353
3361
|
if (item) {
|
|
@@ -3360,6 +3368,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3360
3368
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3361
3369
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3362
3370
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3371
|
+
if (this._disposed) {
|
|
3372
|
+
stackItemDisposable.dispose();
|
|
3373
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3374
|
+
return false;
|
|
3375
|
+
}
|
|
3363
3376
|
const result = await this._execute(command, params, _options);
|
|
3364
3377
|
if (_options.syncOnly) {
|
|
3365
3378
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3377,6 +3390,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3377
3390
|
}
|
|
3378
3391
|
}
|
|
3379
3392
|
syncExecuteCommand(id, params, options) {
|
|
3393
|
+
if (this._disposed) {
|
|
3394
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3395
|
+
return false;
|
|
3396
|
+
}
|
|
3380
3397
|
try {
|
|
3381
3398
|
const item = this._commandRegistry.getCommand(id);
|
|
3382
3399
|
if (item) {
|
|
@@ -3397,6 +3414,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3397
3414
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3398
3415
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3399
3416
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3417
|
+
if (this._disposed) {
|
|
3418
|
+
stackItemDisposable.dispose();
|
|
3419
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3400
3422
|
const result = this._syncExecute(command, params, _options);
|
|
3401
3423
|
if (_options.syncOnly) {
|
|
3402
3424
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3568,7 +3590,12 @@ function afterTime(ms) {
|
|
|
3568
3590
|
}
|
|
3569
3591
|
function convertObservableToBehaviorSubject(observable, initValue) {
|
|
3570
3592
|
const subject = new BehaviorSubject(initValue);
|
|
3571
|
-
observable.subscribe(subject);
|
|
3593
|
+
const subscription = observable.subscribe(subject);
|
|
3594
|
+
const originalComplete = subject.complete.bind(subject);
|
|
3595
|
+
subject.complete = () => {
|
|
3596
|
+
subscription.unsubscribe();
|
|
3597
|
+
originalComplete();
|
|
3598
|
+
};
|
|
3572
3599
|
return subject;
|
|
3573
3600
|
}
|
|
3574
3601
|
|
|
@@ -14724,7 +14751,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
14724
14751
|
//#endregion
|
|
14725
14752
|
//#region package.json
|
|
14726
14753
|
var name = "@univerjs/core";
|
|
14727
|
-
var version = "0.
|
|
14754
|
+
var version = "0.23.0";
|
|
14728
14755
|
|
|
14729
14756
|
//#endregion
|
|
14730
14757
|
//#region src/sheets/empty-snapshot.ts
|
|
@@ -17607,6 +17634,8 @@ var LocaleService = class extends Disposable {
|
|
|
17607
17634
|
super();
|
|
17608
17635
|
_defineProperty(this, "_currentLocale$", new BehaviorSubject("zhCN"));
|
|
17609
17636
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17637
|
+
_defineProperty(this, "_direction$", new BehaviorSubject("ltr"));
|
|
17638
|
+
_defineProperty(this, "direction$", this._direction$.asObservable());
|
|
17610
17639
|
_defineProperty(this, "_locales", null);
|
|
17611
17640
|
_defineProperty(this, "localeChanged$", new Subject());
|
|
17612
17641
|
_defineProperty(
|
|
@@ -17653,6 +17682,7 @@ var LocaleService = class extends Disposable {
|
|
|
17653
17682
|
this.disposeWithMe(toDisposable(() => {
|
|
17654
17683
|
this._locales = null;
|
|
17655
17684
|
this._currentLocale$.complete();
|
|
17685
|
+
this._direction$.complete();
|
|
17656
17686
|
this.localeChanged$.complete();
|
|
17657
17687
|
}));
|
|
17658
17688
|
}
|
|
@@ -17676,6 +17706,12 @@ var LocaleService = class extends Disposable {
|
|
|
17676
17706
|
getCurrentLocale() {
|
|
17677
17707
|
return this._currentLocale;
|
|
17678
17708
|
}
|
|
17709
|
+
setDirection(direction) {
|
|
17710
|
+
this._direction$.next(direction);
|
|
17711
|
+
}
|
|
17712
|
+
getDirection() {
|
|
17713
|
+
return this._direction$.value;
|
|
17714
|
+
}
|
|
17679
17715
|
resolveKeyPath(obj, keys) {
|
|
17680
17716
|
const currentKey = keys.shift();
|
|
17681
17717
|
if (currentKey && obj && currentKey in obj) {
|
|
@@ -19857,11 +19893,12 @@ var Univer = class {
|
|
|
19857
19893
|
_defineProperty(this, "_injector", void 0);
|
|
19858
19894
|
_defineProperty(this, "_disposingCallbacks", new DisposableCollection());
|
|
19859
19895
|
const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
|
|
19860
|
-
const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
|
|
19896
|
+
const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
|
|
19861
19897
|
if (theme) this._injector.get(ThemeService).setTheme(theme);
|
|
19862
19898
|
if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
|
|
19863
19899
|
if (locales) this._injector.get(LocaleService).load(locales);
|
|
19864
19900
|
if (locale) this._injector.get(LocaleService).setLocale(locale);
|
|
19901
|
+
if (direction) this._injector.get(LocaleService).setDirection(direction);
|
|
19865
19902
|
if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
|
|
19866
19903
|
if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
|
|
19867
19904
|
this._init(injector);
|
package/lib/index.js
CHANGED
|
@@ -447,16 +447,17 @@ function createInterceptorKey(key) {
|
|
|
447
447
|
const composeInterceptors = (interceptors) => function(initialValue, context) {
|
|
448
448
|
let index = -1;
|
|
449
449
|
let value = initialValue;
|
|
450
|
-
|
|
450
|
+
let nextCalled = false;
|
|
451
|
+
const next = (nextValue) => {
|
|
452
|
+
nextCalled = true;
|
|
453
|
+
return nextValue;
|
|
454
|
+
};
|
|
455
|
+
for (let i = 0; i < interceptors.length; i++) {
|
|
451
456
|
if (i <= index) throw new Error("[SheetInterceptorService]: next() called multiple times!");
|
|
452
457
|
index = i;
|
|
453
|
-
if (i === interceptors.length) return value;
|
|
454
458
|
const interceptor = interceptors[i];
|
|
455
|
-
|
|
456
|
-
value = interceptor.handler(value, context,
|
|
457
|
-
nextCalled = true;
|
|
458
|
-
return nextValue;
|
|
459
|
-
});
|
|
459
|
+
nextCalled = false;
|
|
460
|
+
value = interceptor.handler(value, context, next);
|
|
460
461
|
if (!nextCalled) break;
|
|
461
462
|
}
|
|
462
463
|
return value;
|
|
@@ -3303,6 +3304,9 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3303
3304
|
disposed() {
|
|
3304
3305
|
return this._disposed;
|
|
3305
3306
|
}
|
|
3307
|
+
_warnCommandSkippedAfterDisposed(id) {
|
|
3308
|
+
this._logService.warn("[CommandService]", `command "${id}" skipped because CommandService is disposed.`);
|
|
3309
|
+
}
|
|
3306
3310
|
hasCommand(commandId) {
|
|
3307
3311
|
return this._commandRegistry.hasCommand(commandId);
|
|
3308
3312
|
}
|
|
@@ -3348,6 +3352,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3348
3352
|
throw new Error("[CommandService]: could not add a collab mutation listener twice.");
|
|
3349
3353
|
}
|
|
3350
3354
|
async executeCommand(id, params, options) {
|
|
3355
|
+
if (this._disposed) {
|
|
3356
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3357
|
+
return false;
|
|
3358
|
+
}
|
|
3351
3359
|
try {
|
|
3352
3360
|
const item = this._commandRegistry.getCommand(id);
|
|
3353
3361
|
if (item) {
|
|
@@ -3360,6 +3368,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3360
3368
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3361
3369
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3362
3370
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3371
|
+
if (this._disposed) {
|
|
3372
|
+
stackItemDisposable.dispose();
|
|
3373
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3374
|
+
return false;
|
|
3375
|
+
}
|
|
3363
3376
|
const result = await this._execute(command, params, _options);
|
|
3364
3377
|
if (_options.syncOnly) {
|
|
3365
3378
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3377,6 +3390,10 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3377
3390
|
}
|
|
3378
3391
|
}
|
|
3379
3392
|
syncExecuteCommand(id, params, options) {
|
|
3393
|
+
if (this._disposed) {
|
|
3394
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3395
|
+
return false;
|
|
3396
|
+
}
|
|
3380
3397
|
try {
|
|
3381
3398
|
const item = this._commandRegistry.getCommand(id);
|
|
3382
3399
|
if (item) {
|
|
@@ -3397,6 +3414,11 @@ let CommandService = class CommandService extends Disposable {
|
|
|
3397
3414
|
const stackItemDisposable = this._pushCommandExecutionStack(commandInfo);
|
|
3398
3415
|
const _options = options !== null && options !== void 0 ? options : {};
|
|
3399
3416
|
this._beforeCommandExecutionListeners.forEach((listener) => listener(commandInfo, _options));
|
|
3417
|
+
if (this._disposed) {
|
|
3418
|
+
stackItemDisposable.dispose();
|
|
3419
|
+
this._warnCommandSkippedAfterDisposed(id);
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3400
3422
|
const result = this._syncExecute(command, params, _options);
|
|
3401
3423
|
if (_options.syncOnly) {
|
|
3402
3424
|
if (command.type === 2) this._collabMutationListeners.forEach((listener) => listener(commandInfo, _options));
|
|
@@ -3568,7 +3590,12 @@ function afterTime(ms) {
|
|
|
3568
3590
|
}
|
|
3569
3591
|
function convertObservableToBehaviorSubject(observable, initValue) {
|
|
3570
3592
|
const subject = new BehaviorSubject(initValue);
|
|
3571
|
-
observable.subscribe(subject);
|
|
3593
|
+
const subscription = observable.subscribe(subject);
|
|
3594
|
+
const originalComplete = subject.complete.bind(subject);
|
|
3595
|
+
subject.complete = () => {
|
|
3596
|
+
subscription.unsubscribe();
|
|
3597
|
+
originalComplete();
|
|
3598
|
+
};
|
|
3572
3599
|
return subject;
|
|
3573
3600
|
}
|
|
3574
3601
|
|
|
@@ -14724,7 +14751,7 @@ const IURLImageService = createIdentifier("core.url-image.service");
|
|
|
14724
14751
|
//#endregion
|
|
14725
14752
|
//#region package.json
|
|
14726
14753
|
var name = "@univerjs/core";
|
|
14727
|
-
var version = "0.
|
|
14754
|
+
var version = "0.23.0";
|
|
14728
14755
|
|
|
14729
14756
|
//#endregion
|
|
14730
14757
|
//#region src/sheets/empty-snapshot.ts
|
|
@@ -17607,6 +17634,8 @@ var LocaleService = class extends Disposable {
|
|
|
17607
17634
|
super();
|
|
17608
17635
|
_defineProperty(this, "_currentLocale$", new BehaviorSubject("zhCN"));
|
|
17609
17636
|
_defineProperty(this, "currentLocale$", this._currentLocale$.asObservable());
|
|
17637
|
+
_defineProperty(this, "_direction$", new BehaviorSubject("ltr"));
|
|
17638
|
+
_defineProperty(this, "direction$", this._direction$.asObservable());
|
|
17610
17639
|
_defineProperty(this, "_locales", null);
|
|
17611
17640
|
_defineProperty(this, "localeChanged$", new Subject());
|
|
17612
17641
|
_defineProperty(
|
|
@@ -17653,6 +17682,7 @@ var LocaleService = class extends Disposable {
|
|
|
17653
17682
|
this.disposeWithMe(toDisposable(() => {
|
|
17654
17683
|
this._locales = null;
|
|
17655
17684
|
this._currentLocale$.complete();
|
|
17685
|
+
this._direction$.complete();
|
|
17656
17686
|
this.localeChanged$.complete();
|
|
17657
17687
|
}));
|
|
17658
17688
|
}
|
|
@@ -17676,6 +17706,12 @@ var LocaleService = class extends Disposable {
|
|
|
17676
17706
|
getCurrentLocale() {
|
|
17677
17707
|
return this._currentLocale;
|
|
17678
17708
|
}
|
|
17709
|
+
setDirection(direction) {
|
|
17710
|
+
this._direction$.next(direction);
|
|
17711
|
+
}
|
|
17712
|
+
getDirection() {
|
|
17713
|
+
return this._direction$.value;
|
|
17714
|
+
}
|
|
17679
17715
|
resolveKeyPath(obj, keys) {
|
|
17680
17716
|
const currentKey = keys.shift();
|
|
17681
17717
|
if (currentKey && obj && currentKey in obj) {
|
|
@@ -19857,11 +19893,12 @@ var Univer = class {
|
|
|
19857
19893
|
_defineProperty(this, "_injector", void 0);
|
|
19858
19894
|
_defineProperty(this, "_disposingCallbacks", new DisposableCollection());
|
|
19859
19895
|
const injector = this._injector = createUniverInjector(parentInjector, config === null || config === void 0 ? void 0 : config.override);
|
|
19860
|
-
const { theme, darkMode, locale, locales, logLevel, logCommandExecution } = config;
|
|
19896
|
+
const { theme, darkMode, locale, locales, direction, logLevel, logCommandExecution } = config;
|
|
19861
19897
|
if (theme) this._injector.get(ThemeService).setTheme(theme);
|
|
19862
19898
|
if (darkMode) this._injector.get(ThemeService).setDarkMode(darkMode);
|
|
19863
19899
|
if (locales) this._injector.get(LocaleService).load(locales);
|
|
19864
19900
|
if (locale) this._injector.get(LocaleService).setLocale(locale);
|
|
19901
|
+
if (direction) this._injector.get(LocaleService).setDirection(direction);
|
|
19865
19902
|
if (logLevel) this._injector.get(ILogService).setLogLevel(logLevel);
|
|
19866
19903
|
if (logCommandExecution !== void 0) this._injector.get(IConfigService).setConfig(COMMAND_LOG_EXECUTION_CONFIG_KEY, logCommandExecution);
|
|
19867
19904
|
this._init(injector);
|
|
@@ -271,6 +271,7 @@ export declare class CommandService extends Disposable implements ICommandServic
|
|
|
271
271
|
constructor(_injector: Injector, _logService: ILogService, _configService: IConfigService);
|
|
272
272
|
dispose(): void;
|
|
273
273
|
disposed(): boolean;
|
|
274
|
+
private _warnCommandSkippedAfterDisposed;
|
|
274
275
|
hasCommand(commandId: string): boolean;
|
|
275
276
|
registerCommand(command: ICommand): IDisposable;
|
|
276
277
|
unregisterCommand(commandId: string): void;
|
|
@@ -24,6 +24,8 @@ export declare class LocaleService extends Disposable {
|
|
|
24
24
|
private _currentLocale$;
|
|
25
25
|
readonly currentLocale$: import("rxjs").Observable<LocaleType>;
|
|
26
26
|
private get _currentLocale();
|
|
27
|
+
private _direction$;
|
|
28
|
+
readonly direction$: import("rxjs").Observable<"ltr" | "rtl">;
|
|
27
29
|
private _locales;
|
|
28
30
|
localeChanged$: Subject<void>;
|
|
29
31
|
constructor();
|
|
@@ -62,5 +64,7 @@ export declare class LocaleService extends Disposable {
|
|
|
62
64
|
setLocale(locale: LocaleType): void;
|
|
63
65
|
getLocales(): ILanguagePack | undefined;
|
|
64
66
|
getCurrentLocale(): LocaleType;
|
|
67
|
+
setDirection(direction: 'ltr' | 'rtl'): void;
|
|
68
|
+
getDirection(): "ltr" | "rtl";
|
|
65
69
|
resolveKeyPath(obj: ILanguagePack, keys: string[]): LanguageValue | null;
|
|
66
70
|
}
|
package/lib/types/univer.d.ts
CHANGED