@univerjs-pro/engine-formula 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +1 -1
- package/lib/es/facade.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/facade.js +1 -1
- package/lib/index.js +1 -1
- package/lib/types/controllers/external-reference-data-providers.controller.d.ts +6 -0
- package/lib/types/controllers/external-reference-rename.controller.d.ts +9 -0
- package/lib/types/controllers/external-reference-resource.controller.d.ts +6 -0
- package/lib/types/controllers/formula-reference-data-rpc.controller.d.ts +7 -0
- package/lib/types/index.d.ts +18 -1
- package/lib/types/models/external-reference-overlay.model.d.ts +41 -0
- package/lib/types/models/external-reference.model.d.ts +91 -0
- package/lib/types/plugin.d.ts +8 -0
- package/lib/types/services/calculate-formula.service.d.ts +13 -1
- package/lib/types/services/external-cache-reference-data.provider.d.ts +10 -0
- package/lib/types/services/external-reference-prefetch-planner.d.ts +18 -0
- package/lib/types/services/external-reference-prefetch.service.d.ts +38 -0
- package/lib/types/services/external-unit-reference-resolver.service.d.ts +8 -0
- package/lib/types/services/formula-reference-data.service.d.ts +71 -0
- package/lib/types/services/main-formula-reference-data.service.d.ts +12 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { ExternalCacheReferenceDataProvider } from '../services/external-cache-reference-data.provider';
|
|
3
|
+
import { IFormulaReferenceDataProviderRegistry } from '../services/formula-reference-data.service';
|
|
4
|
+
export declare class ExternalReferenceDataProvidersController extends Disposable {
|
|
5
|
+
constructor(registry: IFormulaReferenceDataProviderRegistry, cacheProvider: ExternalCacheReferenceDataProvider);
|
|
6
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
2
|
+
import { ExternalReferenceOverlayModel } from '../models/external-reference-overlay.model';
|
|
3
|
+
import { ExternalReferenceModel } from '../models/external-reference.model';
|
|
4
|
+
export declare class ExternalReferenceRenameController extends Disposable {
|
|
5
|
+
private readonly _univerInstanceService;
|
|
6
|
+
private readonly _names;
|
|
7
|
+
constructor(_univerInstanceService: IUniverInstanceService, externalReferenceModel: ExternalReferenceModel, externalReferenceOverlayModel: ExternalReferenceOverlayModel);
|
|
8
|
+
private _watch;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Disposable, IResourceManagerService } from '@univerjs/core';
|
|
2
|
+
import { ExternalReferenceOverlayModel } from '../models/external-reference-overlay.model';
|
|
3
|
+
import { ExternalReferenceModel } from '../models/external-reference.model';
|
|
4
|
+
export declare class ExternalReferenceResourceController extends Disposable {
|
|
5
|
+
constructor(resourceManagerService: IResourceManagerService, externalReferenceModel: ExternalReferenceModel, externalReferenceOverlayModel: ExternalReferenceOverlayModel);
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Disposable } from '@univerjs/core';
|
|
2
|
+
import { IRPCChannelService } from '@univerjs/rpc';
|
|
3
|
+
import { IFormulaReferenceDataService } from '../services/formula-reference-data.service';
|
|
4
|
+
export declare const FORMULA_REFERENCE_DATA_RPC_CHANNEL = "univer-pro.formula.reference-data";
|
|
5
|
+
export declare class FormulaReferenceDataRpcController extends Disposable {
|
|
6
|
+
constructor(rpcChannelService: IRPCChannelService, referenceDataService: IFormulaReferenceDataService);
|
|
7
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
export { ExternalReferenceDataProvidersController } from './controllers/external-reference-data-providers.controller';
|
|
2
|
+
export { ExternalReferenceRenameController } from './controllers/external-reference-rename.controller';
|
|
3
|
+
export { ExternalReferenceResourceController } from './controllers/external-reference-resource.controller';
|
|
4
|
+
export { FORMULA_REFERENCE_DATA_RPC_CHANNEL, FormulaReferenceDataRpcController } from './controllers/formula-reference-data-rpc.controller';
|
|
5
|
+
export { ExternalReferenceOverlayModel } from './models/external-reference-overlay.model';
|
|
6
|
+
export type { IExternalOverlayCellState } from './models/external-reference-overlay.model';
|
|
7
|
+
export { createEmptyExternalReferenceResource, createExternalSyntheticUnitId, EXTERNAL_REFERENCE_SCHEMA_VERSION, ExternalReferenceModel, SHEET_EXTERNAL_DATA_PLUGIN, } from './models/external-reference.model';
|
|
8
|
+
export type { ExternalReferenceBindingResult, IExternalReferenceCachedCell, IExternalReferenceCachedSheet, IExternalReferenceCoverage, IExternalReferenceLink, IExternalReferenceResource, IExternalReferenceTable, IExternalReferenceTableColumn, } from './models/external-reference.model';
|
|
1
9
|
export { UniverProFormulaEnginePlugin } from './plugin';
|
|
2
|
-
export {
|
|
10
|
+
export { ExternalCacheReferenceDataProvider } from './services/external-cache-reference-data.provider';
|
|
11
|
+
export { ExternalReferencePrefetchPlanner } from './services/external-reference-prefetch-planner';
|
|
12
|
+
export { ExternalReferencePrefetchService } from './services/external-reference-prefetch.service';
|
|
13
|
+
export type { IExternalReferencePrefetchLimits, IExternalReferencePrefetchResult, } from './services/external-reference-prefetch.service';
|
|
14
|
+
export { ExternalFormulaUnitReferenceResolver } from './services/external-unit-reference-resolver.service';
|
|
15
|
+
export { createUnavailableReferenceDataResponse, FormulaReferenceDataProviderRegistry, IFormulaReferenceDataProviderRegistry, IFormulaReferenceDataService, } from './services/formula-reference-data.service';
|
|
16
|
+
export type { FormulaReferenceDataFreshness, FormulaReferenceDataSource, IFormulaReferenceDataCell, IFormulaReferenceDataProvider, IFormulaReferenceDataRangeRequest, IFormulaReferenceDataRequest, IFormulaReferenceDataResponse, IFormulaReferenceDataSheet, } from './services/formula-reference-data.service';
|
|
17
|
+
export { MainFormulaReferenceDataService } from './services/main-formula-reference-data.service';
|
|
18
|
+
export { RemoveSuperTableMutation, SetFormulaCalculationResultMutation, SetFormulaCalculationStartMutation, SetSuperTableMutation, SetTriggerFormulaCalculationStartMutation, } from '@univerjs/engine-formula';
|
|
3
19
|
export type { ISetFormulaCalculationResultMutation, ISetFormulaCalculationStartMutation, ISuperTable, } from '@univerjs/engine-formula';
|
|
4
20
|
export { SetFormulaDataMutation } from '@univerjs/engine-formula';
|
|
21
|
+
export { refactorFormulaUnitQualifier } from '@univerjs/engine-formula';
|
|
5
22
|
export type { IUniverEngineFormulaConfig } from '@univerjs/engine-formula';
|
|
6
23
|
export { FormulaCalculationTriggerService, FormulaDataModel, IActiveDirtyManagerService, ISuperTableService, } from '@univerjs/engine-formula';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IRange, IUnitRange } from '@univerjs/core';
|
|
2
|
+
import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
|
|
3
|
+
import type { IFormulaReferenceDataRequest, IFormulaReferenceDataResponse } from '../services/formula-reference-data.service';
|
|
4
|
+
import { Disposable } from '@univerjs/core';
|
|
5
|
+
import { ISuperTableService } from '@univerjs/engine-formula';
|
|
6
|
+
import { ExternalReferenceModel } from './external-reference.model';
|
|
7
|
+
export interface IExternalOverlayCellState {
|
|
8
|
+
covered: boolean;
|
|
9
|
+
value: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare class ExternalReferenceOverlayModel extends Disposable {
|
|
12
|
+
private readonly _externalReferenceModel;
|
|
13
|
+
private readonly _superTableService;
|
|
14
|
+
private readonly _units;
|
|
15
|
+
private readonly _pendingDirtyRanges;
|
|
16
|
+
constructor(_externalReferenceModel: ExternalReferenceModel, _superTableService: ISuperTableService);
|
|
17
|
+
apply(request: IFormulaReferenceDataRequest, response: IFormulaReferenceDataResponse): Array<{
|
|
18
|
+
sheetId: string;
|
|
19
|
+
range: IRange;
|
|
20
|
+
}>;
|
|
21
|
+
materialize(config: IFormulaDatasetConfig): void;
|
|
22
|
+
getCellState(unitId: string, sheetId: string, row: number, column: number): IExternalOverlayCellState;
|
|
23
|
+
isRangeCovered(unitId: string, sheetNameOrId: string | undefined, range: IRange): boolean;
|
|
24
|
+
enforceLimits(maxCells: number, maxBytes: number): number;
|
|
25
|
+
invalidateHost(hostUnitId: string): IUnitRange[];
|
|
26
|
+
invalidateSyntheticUnit(unitId: string): IUnitRange[];
|
|
27
|
+
invalidateSourceRange(targetUnitIdOrName: string, sheetNameOrId: string, range: IRange): IUnitRange[];
|
|
28
|
+
invalidateSourceMetadata(targetUnitIdOrName: string): IUnitRange[];
|
|
29
|
+
drainDirtyRanges(): IUnitRange[];
|
|
30
|
+
getUnitCount(): number;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private _unitRanges;
|
|
33
|
+
private _queueDirty;
|
|
34
|
+
private _mergeSheet;
|
|
35
|
+
private _oldestCoverage;
|
|
36
|
+
private _coveredCellCount;
|
|
37
|
+
private _estimatedBytes;
|
|
38
|
+
private _writeCoverageMisses;
|
|
39
|
+
private _createUnavailableSheets;
|
|
40
|
+
private _registerTables;
|
|
41
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FormulaUnitType } from '@univerjs/engine-formula';
|
|
2
|
+
import { Disposable } from '@univerjs/core';
|
|
3
|
+
export declare const SHEET_EXTERNAL_DATA_PLUGIN = "SHEET_EXTERNAL_DATA_PLUGIN";
|
|
4
|
+
export declare const EXTERNAL_REFERENCE_SCHEMA_VERSION: 1;
|
|
5
|
+
export interface IExternalReferenceCoverage {
|
|
6
|
+
startRow: number;
|
|
7
|
+
endRow: number;
|
|
8
|
+
startColumn: number;
|
|
9
|
+
endColumn: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IExternalReferenceCachedCell {
|
|
12
|
+
row: number;
|
|
13
|
+
column: number;
|
|
14
|
+
value: unknown;
|
|
15
|
+
valueType?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface IExternalReferenceCachedSheet {
|
|
18
|
+
name: string;
|
|
19
|
+
sheetId?: string;
|
|
20
|
+
rowCount?: number;
|
|
21
|
+
columnCount?: number;
|
|
22
|
+
coverage: IExternalReferenceCoverage[];
|
|
23
|
+
cells: IExternalReferenceCachedCell[];
|
|
24
|
+
}
|
|
25
|
+
export interface IExternalReferenceTableColumn {
|
|
26
|
+
id?: string;
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IExternalReferenceTable {
|
|
30
|
+
id?: string;
|
|
31
|
+
name: string;
|
|
32
|
+
sheetName?: string;
|
|
33
|
+
columns: IExternalReferenceTableColumn[];
|
|
34
|
+
range?: IExternalReferenceCoverage;
|
|
35
|
+
/** Base virtual tables start with records at row 0; Sheet tables default to a physical header. */
|
|
36
|
+
showHeader?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface IExternalReferenceLink {
|
|
39
|
+
/** Host-local OOXML slot. Slots are one-based and order is preserved. */
|
|
40
|
+
slot: number;
|
|
41
|
+
name: string;
|
|
42
|
+
target: {
|
|
43
|
+
name: string;
|
|
44
|
+
unitType: FormulaUnitType;
|
|
45
|
+
uri?: string;
|
|
46
|
+
liveUnitId?: string;
|
|
47
|
+
};
|
|
48
|
+
sheetNames: Array<{
|
|
49
|
+
name: string;
|
|
50
|
+
sheetId?: string;
|
|
51
|
+
}>;
|
|
52
|
+
definedNames: Array<{
|
|
53
|
+
name: string;
|
|
54
|
+
formulaOrRefString: string;
|
|
55
|
+
}>;
|
|
56
|
+
tables: IExternalReferenceTable[];
|
|
57
|
+
cache?: {
|
|
58
|
+
revision?: string;
|
|
59
|
+
freshness: 'fresh' | 'stale';
|
|
60
|
+
complete: boolean;
|
|
61
|
+
sheets: IExternalReferenceCachedSheet[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export interface IExternalReferenceResource {
|
|
65
|
+
schemaVersion: typeof EXTERNAL_REFERENCE_SCHEMA_VERSION;
|
|
66
|
+
links: IExternalReferenceLink[];
|
|
67
|
+
}
|
|
68
|
+
export type ExternalReferenceBindingResult = {
|
|
69
|
+
status: 'resolved';
|
|
70
|
+
link: IExternalReferenceLink;
|
|
71
|
+
} | {
|
|
72
|
+
status: 'missing' | 'ambiguous';
|
|
73
|
+
};
|
|
74
|
+
export declare function createEmptyExternalReferenceResource(): IExternalReferenceResource;
|
|
75
|
+
export declare function createExternalSyntheticUnitId(hostUnitId: string, slot: number): string;
|
|
76
|
+
export declare class ExternalReferenceModel extends Disposable {
|
|
77
|
+
private readonly _resources;
|
|
78
|
+
private readonly _loadErrors;
|
|
79
|
+
load(hostUnitId: string, value: unknown): boolean;
|
|
80
|
+
set(hostUnitId: string, resource: IExternalReferenceResource): boolean;
|
|
81
|
+
serialize(hostUnitId: string): IExternalReferenceResource;
|
|
82
|
+
get(hostUnitId: string): IExternalReferenceResource | undefined;
|
|
83
|
+
getLoadError(hostUnitId: string): 'invalid-resource' | 'unsupported-version' | undefined;
|
|
84
|
+
resolveBinding(hostUnitId: string, qualifier: string): ExternalReferenceBindingResult;
|
|
85
|
+
renameLiveTarget(unitId: string, oldName: string, newName: string): Array<{
|
|
86
|
+
hostUnitId: string;
|
|
87
|
+
slot: number;
|
|
88
|
+
}>;
|
|
89
|
+
remove(hostUnitId: string): void;
|
|
90
|
+
dispose(): void;
|
|
91
|
+
}
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import type { Dependency } from '@univerjs/core';
|
|
1
2
|
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
|
|
2
3
|
export declare class UniverProFormulaEnginePlugin extends UniverFormulaEnginePlugin {
|
|
3
4
|
static packageName: string;
|
|
4
5
|
static version: string;
|
|
6
|
+
/**
|
|
7
|
+
* Allows execution backends to replace individual formula services before
|
|
8
|
+
* they are registered. Keeping one registration pass avoids duplicate DI
|
|
9
|
+
* bindings when a backend only swaps the calculator.
|
|
10
|
+
*/
|
|
11
|
+
protected _extendFormulaExecutionDependencies(_dependencies: Dependency[]): void;
|
|
5
12
|
protected _initializeWithOverride(): void;
|
|
13
|
+
onReady(): void;
|
|
6
14
|
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
|
|
2
2
|
import type { CalcNodeIndex, DynamicResolver, ICalculationOrderResult } from '../engine/dependency-engine/types';
|
|
3
3
|
import type { IFormulaCalculationTree } from '../engine/formula-dependency';
|
|
4
|
-
import {
|
|
4
|
+
import { IConfigService } from '@univerjs/core';
|
|
5
|
+
import { AstTreeBuilder, CalculateFormulaService, IFormulaCurrentConfigService, IFormulaDependencyGenerator, IFormulaRuntimeService, Interpreter, Lexer } from '@univerjs/engine-formula';
|
|
6
|
+
import { ExternalReferencePrefetchPlanner } from './external-reference-prefetch-planner';
|
|
7
|
+
import { ExternalReferencePrefetchService } from './external-reference-prefetch.service';
|
|
5
8
|
export declare class CalculateFormulaProService extends CalculateFormulaService {
|
|
9
|
+
private readonly _externalPrefetchPlanner;
|
|
10
|
+
private readonly _externalPrefetchService;
|
|
6
11
|
private _dynamicRuntimeRanges;
|
|
12
|
+
private _externalFormulaDatasetConfig;
|
|
13
|
+
private _externalPrefetchedNodes;
|
|
14
|
+
constructor(configService: IConfigService, lexer: Lexer, currentConfigService: IFormulaCurrentConfigService, runtimeService: IFormulaRuntimeService, formulaDependencyGenerator: IFormulaDependencyGenerator, interpreter: Interpreter, astTreeBuilder: AstTreeBuilder, _externalPrefetchPlanner: ExternalReferencePrefetchPlanner, _externalPrefetchService: ExternalReferencePrefetchService);
|
|
7
15
|
execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
|
|
8
16
|
protected _executeStep(cycleReferenceCount?: number): Promise<true | undefined>;
|
|
9
17
|
protected _apply(isArrayFormulaState?: boolean, cycleReferenceCount?: number): Promise<import("@univerjs/engine-formula").IAllRuntimeData | undefined>;
|
|
18
|
+
private _setFormulaExecuteStage;
|
|
19
|
+
private _setTotalFormulasToCalculate;
|
|
10
20
|
private _shouldRescheduleAfterDynamicChange;
|
|
11
21
|
protected _forEachCalculationPlanTree(calculationOrderResult: Pick<ICalculationOrderResult, 'calculationForest'>, dependencyTree: Map<CalcNodeIndex, IFormulaCalculationTree>, cycleReferenceCount: number, visitor: (tree: IFormulaCalculationTree, nodeIndex: CalcNodeIndex, cycleIndex?: number, shouldPreserveCycleTree?: boolean) => Promise<boolean | void>): Promise<void>;
|
|
12
22
|
private _calculationPlanHasSelfReference;
|
|
@@ -18,6 +28,8 @@ export declare class CalculateFormulaProService extends CalculateFormulaService
|
|
|
18
28
|
private _getRangeSignature;
|
|
19
29
|
private _waitForExecutionSlot;
|
|
20
30
|
private _calculateDependencyTree;
|
|
31
|
+
private _prefetchDynamicExternalReferences;
|
|
32
|
+
private _collectAddressFunctionRuntimeReferences;
|
|
21
33
|
private _setFunctionRefInfoForTree;
|
|
22
34
|
private _formulaReferencesTreeCell;
|
|
23
35
|
private _isReferenceMetadataFunctionArgument;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IFormulaReferenceDataProvider, IFormulaReferenceDataRequest, IFormulaReferenceDataResponse } from './formula-reference-data.service';
|
|
2
|
+
import { ExternalReferenceModel } from '../models/external-reference.model';
|
|
3
|
+
export declare class ExternalCacheReferenceDataProvider implements IFormulaReferenceDataProvider {
|
|
4
|
+
private readonly _externalReferenceModel;
|
|
5
|
+
readonly id = "ooxml-external-cache";
|
|
6
|
+
readonly priority = -100;
|
|
7
|
+
constructor(_externalReferenceModel: ExternalReferenceModel);
|
|
8
|
+
canRead(request: IFormulaReferenceDataRequest): boolean;
|
|
9
|
+
readData(request: IFormulaReferenceDataRequest): Promise<IFormulaReferenceDataResponse | undefined>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
|
|
2
|
+
import type { IFormulaReferenceDataRangeRequest, IFormulaReferenceDataRequest } from './formula-reference-data.service';
|
|
3
|
+
import { ExternalReferenceModel } from '../models/external-reference.model';
|
|
4
|
+
export declare class ExternalReferencePrefetchPlanner {
|
|
5
|
+
private readonly _externalReferenceModel;
|
|
6
|
+
private _calculationCounter;
|
|
7
|
+
private _requestCounter;
|
|
8
|
+
constructor(_externalReferenceModel: ExternalReferenceModel);
|
|
9
|
+
plan(config: IFormulaDatasetConfig): IFormulaReferenceDataRequest[];
|
|
10
|
+
planDynamic(hostUnitId: string, references: Array<{
|
|
11
|
+
unitId: string;
|
|
12
|
+
sheetName: string;
|
|
13
|
+
range: IFormulaReferenceDataRangeRequest['range'];
|
|
14
|
+
}>): IFormulaReferenceDataRequest[];
|
|
15
|
+
private _collectA1;
|
|
16
|
+
private _collectTables;
|
|
17
|
+
private _addRange;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { IUnitRange } from '@univerjs/core';
|
|
2
|
+
import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
|
|
3
|
+
import type { IFormulaReferenceDataRequest, IFormulaReferenceDataResponse } from './formula-reference-data.service';
|
|
4
|
+
import { Disposable } from '@univerjs/core';
|
|
5
|
+
import { FormulaDataModel } from '@univerjs/engine-formula';
|
|
6
|
+
import { ExternalReferenceOverlayModel } from '../models/external-reference-overlay.model';
|
|
7
|
+
import { IFormulaReferenceDataService } from './formula-reference-data.service';
|
|
8
|
+
export interface IExternalReferencePrefetchLimits {
|
|
9
|
+
maxCells: number;
|
|
10
|
+
maxBytes: number;
|
|
11
|
+
concurrency: number;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
export interface IExternalReferencePrefetchResult {
|
|
15
|
+
responses: IFormulaReferenceDataResponse[];
|
|
16
|
+
dirtyRanges: Array<{
|
|
17
|
+
unitId: string;
|
|
18
|
+
sheetId: string;
|
|
19
|
+
range: NonNullable<IFormulaReferenceDataRequest['ranges'][number]['range']>;
|
|
20
|
+
}>;
|
|
21
|
+
discarded: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class ExternalReferencePrefetchService extends Disposable {
|
|
24
|
+
private readonly _referenceDataService;
|
|
25
|
+
private readonly _overlayModel;
|
|
26
|
+
private readonly _formulaDataModel;
|
|
27
|
+
private readonly _inflight;
|
|
28
|
+
private readonly _latestCalculation;
|
|
29
|
+
constructor(_referenceDataService: IFormulaReferenceDataService, _overlayModel: ExternalReferenceOverlayModel, _formulaDataModel: FormulaDataModel);
|
|
30
|
+
prefetch(requests: IFormulaReferenceDataRequest[], config: IFormulaDatasetConfig, limits?: Partial<IExternalReferencePrefetchLimits>): Promise<IExternalReferencePrefetchResult>;
|
|
31
|
+
cancelHost(hostUnitId: string, nextCalculationId: string): void;
|
|
32
|
+
getInflightCount(): number;
|
|
33
|
+
drainDirtyRanges(): IUnitRange[];
|
|
34
|
+
dispose(): void;
|
|
35
|
+
private _hydrateLiveUnits;
|
|
36
|
+
private _hasWorkerLiveUnit;
|
|
37
|
+
private _readWithInflight;
|
|
38
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IFormulaUnitReferenceResolution, IFormulaUnitReferenceResolveInput } from '@univerjs/engine-formula';
|
|
2
|
+
import { ErrorType, FormulaUnitReferenceResolver, IFormulaCurrentConfigService } from '@univerjs/engine-formula';
|
|
3
|
+
import { ExternalReferenceModel } from '../models/external-reference.model';
|
|
4
|
+
export declare class ExternalFormulaUnitReferenceResolver extends FormulaUnitReferenceResolver {
|
|
5
|
+
private readonly _externalReferenceModel;
|
|
6
|
+
constructor(currentConfigService: IFormulaCurrentConfigService, _externalReferenceModel: ExternalReferenceModel);
|
|
7
|
+
resolve(input: IFormulaUnitReferenceResolveInput): IFormulaUnitReferenceResolution | ErrorType;
|
|
8
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ICellData, IDisposable, IRange } from '@univerjs/core';
|
|
2
|
+
import type { FormulaUnitType } from '@univerjs/engine-formula';
|
|
3
|
+
import { Disposable } from '@univerjs/core';
|
|
4
|
+
export type FormulaReferenceDataSource = 'worker-live' | 'main-live' | 'provider' | 'ooxml-cache' | 'unavailable';
|
|
5
|
+
export type FormulaReferenceDataFreshness = 'fresh' | 'stale' | 'unavailable';
|
|
6
|
+
export interface IFormulaReferenceDataRangeRequest {
|
|
7
|
+
sheetName?: string;
|
|
8
|
+
sheetId?: string;
|
|
9
|
+
tableName?: string;
|
|
10
|
+
range?: IRange;
|
|
11
|
+
}
|
|
12
|
+
export interface IFormulaReferenceDataRequest {
|
|
13
|
+
requestId: string;
|
|
14
|
+
calculationId: string;
|
|
15
|
+
hostUnitId: string;
|
|
16
|
+
bindingSlot: number;
|
|
17
|
+
syntheticUnitId: string;
|
|
18
|
+
target: {
|
|
19
|
+
name: string;
|
|
20
|
+
unitType: FormulaUnitType;
|
|
21
|
+
uri?: string;
|
|
22
|
+
liveUnitId?: string;
|
|
23
|
+
};
|
|
24
|
+
ranges: IFormulaReferenceDataRangeRequest[];
|
|
25
|
+
/** Defaults to true. Set false only when the caller explicitly accepts cached stale values. */
|
|
26
|
+
requireFresh?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface IFormulaReferenceDataCell {
|
|
29
|
+
row: number;
|
|
30
|
+
column: number;
|
|
31
|
+
cell: ICellData;
|
|
32
|
+
}
|
|
33
|
+
export interface IFormulaReferenceDataSheet {
|
|
34
|
+
name: string;
|
|
35
|
+
sheetId: string;
|
|
36
|
+
rowCount: number;
|
|
37
|
+
columnCount: number;
|
|
38
|
+
coverage: IRange[];
|
|
39
|
+
cells: IFormulaReferenceDataCell[];
|
|
40
|
+
}
|
|
41
|
+
export interface IFormulaReferenceDataResponse {
|
|
42
|
+
requestId: string;
|
|
43
|
+
calculationId: string;
|
|
44
|
+
source: FormulaReferenceDataSource;
|
|
45
|
+
freshness: FormulaReferenceDataFreshness;
|
|
46
|
+
revision?: string;
|
|
47
|
+
sheets: IFormulaReferenceDataSheet[];
|
|
48
|
+
error?: '#N/A' | '#REF!' | '#CYCLE!';
|
|
49
|
+
}
|
|
50
|
+
export interface IFormulaReferenceDataService {
|
|
51
|
+
readData(request: IFormulaReferenceDataRequest): Promise<IFormulaReferenceDataResponse>;
|
|
52
|
+
}
|
|
53
|
+
export declare const IFormulaReferenceDataService: import("@wendellhu/redi").IdentifierDecorator<IFormulaReferenceDataService>;
|
|
54
|
+
export interface IFormulaReferenceDataProvider {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly priority?: number;
|
|
57
|
+
canRead(request: IFormulaReferenceDataRequest): boolean;
|
|
58
|
+
readData(request: IFormulaReferenceDataRequest): Promise<IFormulaReferenceDataResponse | undefined>;
|
|
59
|
+
}
|
|
60
|
+
export interface IFormulaReferenceDataProviderRegistry {
|
|
61
|
+
register(provider: IFormulaReferenceDataProvider): IDisposable;
|
|
62
|
+
getProviders(request: IFormulaReferenceDataRequest): IFormulaReferenceDataProvider[];
|
|
63
|
+
}
|
|
64
|
+
export declare const IFormulaReferenceDataProviderRegistry: import("@wendellhu/redi").IdentifierDecorator<IFormulaReferenceDataProviderRegistry>;
|
|
65
|
+
export declare class FormulaReferenceDataProviderRegistry extends Disposable implements IFormulaReferenceDataProviderRegistry {
|
|
66
|
+
private readonly _providers;
|
|
67
|
+
register(provider: IFormulaReferenceDataProvider): IDisposable;
|
|
68
|
+
getProviders(request: IFormulaReferenceDataRequest): IFormulaReferenceDataProvider[];
|
|
69
|
+
dispose(): void;
|
|
70
|
+
}
|
|
71
|
+
export declare function createUnavailableReferenceDataResponse(request: IFormulaReferenceDataRequest, error?: '#N/A' | '#REF!' | '#CYCLE!'): IFormulaReferenceDataResponse;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IFormulaReferenceDataRequest, IFormulaReferenceDataResponse, IFormulaReferenceDataService } from './formula-reference-data.service';
|
|
2
|
+
import { FormulaDataModel, ISuperTableService } from '@univerjs/engine-formula';
|
|
3
|
+
import { IFormulaReferenceDataProviderRegistry } from './formula-reference-data.service';
|
|
4
|
+
export declare class MainFormulaReferenceDataService implements IFormulaReferenceDataService {
|
|
5
|
+
private readonly _formulaDataModel;
|
|
6
|
+
private readonly _superTableService;
|
|
7
|
+
private readonly _providerRegistry;
|
|
8
|
+
constructor(_formulaDataModel: FormulaDataModel, _superTableService: ISuperTableService, _providerRegistry: IFormulaReferenceDataProviderRegistry);
|
|
9
|
+
readData(request: IFormulaReferenceDataRequest): Promise<IFormulaReferenceDataResponse>;
|
|
10
|
+
private _readLiveSheets;
|
|
11
|
+
private _resolveLiveRange;
|
|
12
|
+
}
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x16c4e4,_0x3a3bf9){var _0x3b437c=_0x2d6e,_0x44aba5=_0x16c4e4();while(!![]){try{var _0x2010ab=parseInt(_0x3b437c(0x17e))/0x1+parseInt(_0x3b437c(0x179))/0x2+parseInt(_0x3b437c(0x185))/0x3+-parseInt(_0x3b437c(0x17c))/0x4+parseInt(_0x3b437c(0x183))/0x5+-parseInt(_0x3b437c(0x17b))/0x6+parseInt(_0x3b437c(0x181))/0x7*(-parseInt(_0x3b437c(0x17d))/0x8);if(_0x2010ab===_0x3a3bf9)break;else _0x44aba5['push'](_0x44aba5['shift']());}catch(_0x428874){_0x44aba5['push'](_0x44aba5['shift']());}}}(_0xc795,0xc2696),function(_0x5e078f,_0x1b5a2d){var _0x382ade=_0x2d6e;typeof exports==_0x382ade(0x187)&&typeof module<'u'?_0x1b5a2d(exports,require('@univerjs/engine-formula/facade')):typeof define=='function'&&define[_0x382ade(0x188)]?define([_0x382ade(0x180),_0x382ade(0x178)],_0x1b5a2d):(_0x5e078f=typeof globalThis<'u'?globalThis:_0x5e078f||self,_0x1b5a2d(_0x5e078f[_0x382ade(0x189)]={},_0x5e078f[_0x382ade(0x186)]));}(this,function(_0x4f230a,_0x282d1f){var _0x32e62b=_0x2d6e;Object[_0x32e62b(0x17f)](_0x4f230a,Symbol[_0x32e62b(0x184)],{'value':_0x32e62b(0x17a)}),Object[_0x32e62b(0x17f)](_0x4f230a,_0x32e62b(0x182),{'enumerable':!0x0,'get':function(){var _0x433b7b=_0x32e62b;return _0x282d1f[_0x433b7b(0x182)];}});}));function _0x2d6e(_0x523be4,_0x9ffecc){_0x523be4=_0x523be4-0x178;var _0xc795ee=_0xc795();var _0x2d6e81=_0xc795ee[_0x523be4];return _0x2d6e81;}function _0xc795(){var _0x2ae03f=['Module','4485144BcKjvv','4392088XtdjWP','16qjjBny','1466527YmcSte','defineProperty','exports','1405348ECRQLw','FFormula','397885AXPZmd','toStringTag','1774896WMSwCZ','UniverEngineFormulaFacade','object','amd','UniverProEngineFormulaFacade','@univerjs/engine-formula/facade','1811296gtymde'];_0xc795=function(){return _0x2ae03f;};return _0xc795();}
|