@univerjs-pro/engine-formula 1.0.0-alpha.7 → 1.0.0-alpha.8

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.
Files changed (38) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/es/facade.js +1 -1
  4. package/lib/es/index.js +1 -1
  5. package/lib/facade.js +1 -1
  6. package/lib/index.js +1 -1
  7. package/lib/types/commands/commands/host-external-reference.command.d.ts +43 -0
  8. package/lib/types/commands/commands/persist-formula-last-values.command.d.ts +6 -0
  9. package/lib/types/commands/mutations/set-host-external-reference.mutation.d.ts +7 -0
  10. package/lib/types/controllers/formula-last-value-persistence.controller.d.ts +9 -0
  11. package/lib/types/controllers/host-external-reference-active-dirty.controller.d.ts +5 -0
  12. package/lib/types/controllers/host-external-reference-calculation.controller.d.ts +9 -0
  13. package/lib/types/controllers/host-external-reference.controller.d.ts +5 -0
  14. package/lib/types/engine/dependency-engine/dependency-engine.d.ts +6 -5
  15. package/lib/types/engine/dependency-engine/formula-cell-index.d.ts +3 -2
  16. package/lib/types/engine/dependency-engine/helpers.d.ts +7 -6
  17. package/lib/types/engine/dependency-engine/point-subscription-index.d.ts +3 -2
  18. package/lib/types/engine/dependency-engine/range-index.d.ts +5 -4
  19. package/lib/types/engine/dependency-engine/types.d.ts +3 -20
  20. package/lib/types/engine/formula-dependency.d.ts +2 -2
  21. package/lib/types/facade/f-enum.d.ts +12 -2
  22. package/lib/types/facade/f-formula.d.ts +110 -60
  23. package/lib/types/index.d.ts +16 -1
  24. package/lib/types/models/formula-last-value.d.ts +14 -0
  25. package/lib/types/models/host-external-reference.model.d.ts +61 -0
  26. package/lib/types/services/calculate-formula.service.d.ts +8 -14
  27. package/lib/types/services/dependency-manager.service.d.ts +4 -4
  28. package/lib/types/services/formula-cache-eligibility.service.d.ts +18 -0
  29. package/lib/types/services/formula-last-value-persistence.service.d.ts +18 -0
  30. package/lib/types/services/formula-reference-data.service.d.ts +11 -1
  31. package/lib/types/services/formula-reference-unit.service.d.ts +70 -10
  32. package/lib/types/services/formula-result-presentation.d.ts +22 -0
  33. package/lib/types/services/host-external-reference-data-loader.service.d.ts +31 -0
  34. package/lib/types/services/host-formula-binding.service.d.ts +15 -0
  35. package/lib/types/services/main-formula-reference-data.service.d.ts +1 -0
  36. package/lib/umd/facade.js +1 -1
  37. package/lib/umd/index.js +1 -1
  38. package/package.json +6 -6
@@ -0,0 +1,61 @@
1
+ import type { FormulaUnitType } from '@univerjs/engine-formula';
2
+ import { Disposable } from '@univerjs/core';
3
+ /**
4
+ * Snapshot resource key shared by Sheet, Document, Slide, Board, and Base Hosts.
5
+ * The resource stores identity mappings only; it never stores Source formula data.
6
+ */
7
+ export declare const UNIVER_EXTERNAL_REFERENCE_PLUGIN = "UNIVER_EXTERNAL_REFERENCE_PLUGIN";
8
+ export declare const HOST_EXTERNAL_REFERENCE_SCHEMA_VERSION: 1;
9
+ /** One Host-owned mapping from a public formula qualifier to a stable Source Unit. */
10
+ export interface IHostExternalReference {
11
+ /** Source name used in formula text, without brackets or quotes. */
12
+ qualifier: string;
13
+ /** Stable Source Unit ID used for external data reads. */
14
+ sourceUnitId: string;
15
+ /** Sheet or Base Source type. */
16
+ sourceUnitType: FormulaUnitType;
17
+ }
18
+ /**
19
+ * Value persisted under {@link UNIVER_EXTERNAL_REFERENCE_PLUGIN}.
20
+ *
21
+ * `references` is keyed by an opaque Host-local reference ID. Callers should use
22
+ * Facade/command APIs for runtime writes instead of constructing those IDs.
23
+ */
24
+ export interface IHostExternalReferenceResource {
25
+ schemaVersion: typeof HOST_EXTERNAL_REFERENCE_SCHEMA_VERSION;
26
+ references: Record<string, IHostExternalReference>;
27
+ }
28
+ export type HostExternalReferenceBindingResult = {
29
+ status: 'resolved';
30
+ referenceId: string;
31
+ reference: IHostExternalReference;
32
+ } | {
33
+ status: 'missing' | 'ambiguous';
34
+ };
35
+ export type HostExternalReferenceLoadError = 'invalid-resource' | 'unsupported-version';
36
+ export declare function createEmptyHostExternalReferenceResource(): IHostExternalReferenceResource;
37
+ export declare function isReservedExternalReferenceQualifier(qualifier: string): boolean;
38
+ export declare function normalizeHostExternalReferenceQualifier(qualifier: string): string;
39
+ export declare function isHostExternalReference(value: unknown): value is IHostExternalReference;
40
+ export declare class HostExternalReferenceModel extends Disposable {
41
+ private readonly _resources;
42
+ private readonly _rawResources;
43
+ private readonly _loadErrors;
44
+ private readonly _revisions;
45
+ load(hostUnitId: string, value: unknown): boolean;
46
+ set(hostUnitId: string, resource: IHostExternalReferenceResource): boolean;
47
+ serialize(hostUnitId: string): unknown;
48
+ get(hostUnitId: string): IHostExternalReferenceResource | undefined;
49
+ getAll(): Record<string, IHostExternalReferenceResource>;
50
+ getLoadError(hostUnitId: string): HostExternalReferenceLoadError | undefined;
51
+ /**
52
+ * Runtime revision used by derived Formula cache compare-and-set mutations.
53
+ * It is intentionally not serialized into the Host resource.
54
+ */
55
+ getRevision(hostUnitId: string): number;
56
+ resolveBinding(hostUnitId: string, qualifier: string): HostExternalReferenceBindingResult;
57
+ remove(hostUnitId: string): void;
58
+ dispose(): void;
59
+ private _preserveInvalid;
60
+ private _bumpRevision;
61
+ }
@@ -1,17 +1,13 @@
1
1
  import type { IFormulaDatasetConfig } from '@univerjs/engine-formula';
2
- import type { CalcNodeIndex, DynamicResolver, ICalculationOrderResult } from '../engine/dependency-engine/types';
2
+ import type { CalcNodeIndex, ICalculationOrderResult, IDynamicResolver } from '../engine/dependency-engine/types';
3
3
  import type { IFormulaCalculationTree } from '../engine/formula-dependency';
4
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
+ import { AstTreeBuilder, CalculateFormulaService, IFormulaCurrentConfigService, IFormulaDependencyGenerator, IFormulaExternalReferenceDataLoader, IFormulaRuntimeService, Interpreter, Lexer } from '@univerjs/engine-formula';
8
6
  export declare class CalculateFormulaProService extends CalculateFormulaService {
9
- private readonly _externalPrefetchPlanner;
10
- private readonly _externalPrefetchService;
7
+ private readonly _externalReferenceDataLoader;
11
8
  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);
9
+ private _runtimeExternalDataLoaded;
10
+ constructor(configService: IConfigService, lexer: Lexer, currentConfigService: IFormulaCurrentConfigService, runtimeService: IFormulaRuntimeService, formulaDependencyGenerator: IFormulaDependencyGenerator, interpreter: Interpreter, astTreeBuilder: AstTreeBuilder, _externalReferenceDataLoader: IFormulaExternalReferenceDataLoader);
15
11
  execute(formulaDatasetConfig: IFormulaDatasetConfig): Promise<void>;
16
12
  protected _executeStep(cycleReferenceCount?: number): Promise<true | undefined>;
17
13
  protected _apply(isArrayFormulaState?: boolean, cycleReferenceCount?: number): Promise<import("@univerjs/engine-formula").IAllRuntimeData | undefined>;
@@ -21,15 +17,13 @@ export declare class CalculateFormulaProService extends CalculateFormulaService
21
17
  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>;
22
18
  private _calculationPlanHasSelfReference;
23
19
  protected _getCalculationPlanTreeCount(calculationOrderResult: Pick<ICalculationOrderResult, 'calculationForest'>, dependencyTree: Map<CalcNodeIndex, IFormulaCalculationTree>, cycleReferenceCount: number): number;
24
- protected _getDynamicResolver(): DynamicResolver | undefined;
20
+ protected _getDynamicResolver(): IDynamicResolver | undefined;
25
21
  private _refreshDynamicDepsAfterCalculate;
26
- private _collectAddressFunctionRuntimeRanges;
27
- private _collectAddressFunctionRuntimeRangesInternal;
22
+ private _collectAddressFunctionRuntimeReferences;
23
+ private _collectAddressFunctionRuntimeReferencesInternal;
28
24
  private _getRangeSignature;
29
25
  private _waitForExecutionSlot;
30
26
  private _calculateDependencyTree;
31
- private _prefetchDynamicExternalReferences;
32
- private _collectAddressFunctionRuntimeReferences;
33
27
  private _setFunctionRefInfoForTree;
34
28
  private _formulaReferencesTreeCell;
35
29
  private _isReferenceMetadataFunctionArgument;
@@ -1,6 +1,6 @@
1
1
  import type { IUnitRange } from '@univerjs/core';
2
2
  import type { FormulaDependencyTree, IDirtyUnitFeatureMap, IDirtyUnitOtherFormulaMap, IDirtyUnitSheetNameMap, IFormulaDependencyTree } from '@univerjs/engine-formula';
3
- import type { DynamicResolver, ICalcNodeRef, ICompressedSharedFormulaGroup } from '../engine/dependency-engine/types';
3
+ import type { ICalcNodeRef, ICompressedSharedFormulaGroup, IDynamicResolver } from '../engine/dependency-engine/types';
4
4
  import { DependencyManagerBaseService } from '@univerjs/engine-formula';
5
5
  export declare class DependencyManagerProService extends DependencyManagerBaseService {
6
6
  private _dependencyEngineCache;
@@ -42,12 +42,12 @@ export declare class DependencyManagerProService extends DependencyManagerBaseSe
42
42
  clearCalculatedDirty(indices: number[]): void;
43
43
  hasDynamicDeps(node: ICalcNodeRef): boolean;
44
44
  hasDynamicDepsByIndex(nodeIndex: number): boolean;
45
- refreshDynamicDeps(node: ICalcNodeRef, resolver: DynamicResolver): boolean;
46
- refreshDynamicDepsByIndex(nodeIndex: number, resolver: DynamicResolver): boolean;
45
+ refreshDynamicDeps(node: ICalcNodeRef, resolver: IDynamicResolver): boolean;
46
+ refreshDynamicDepsByIndex(nodeIndex: number, resolver: IDynamicResolver): boolean;
47
47
  hasUncalculatedDirtyPrecedentByIndex(nodeIndex: number, calculatedNodeIndices: ReadonlySet<number>): boolean;
48
48
  forEachPrecedentNodeByIndex(nodeIndex: number, cb: (precedentNodeIndex: number) => void): void;
49
49
  forEachDependentNodeByIndex(nodeIndex: number, cb: (dependentNodeIndex: number) => void): void;
50
- prepareDynamicDependencies(resolver: DynamicResolver): boolean;
50
+ prepareDynamicDependencies(resolver: IDynamicResolver): boolean;
51
51
  getCalculationOrder(options?: {
52
52
  detectCycles?: boolean;
53
53
  }): import("../engine/dependency-engine/types").ICalculationOrderResult;
@@ -0,0 +1,18 @@
1
+ import type { IOtherFormulaResult } from '@univerjs/engine-formula';
2
+ import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
+ export type FormulaCacheIneligibleReason = 'not-successful' | 'volatile';
4
+ export interface IFormulaCacheEligibility {
5
+ eligible: boolean;
6
+ reason?: FormulaCacheIneligibleReason;
7
+ }
8
+ /**
9
+ * Central Formula-engine authority for last-value cache eligibility.
10
+ *
11
+ * Volatility is derived from parsed Formula nodes, never function-name substrings
12
+ * or rendered error text. Availability is represented by the structured result status.
13
+ */
14
+ export declare class FormulaCacheEligibilityService {
15
+ private readonly _lexerTreeBuilder;
16
+ constructor(_lexerTreeBuilder: LexerTreeBuilder);
17
+ assess(formula: string, result: IOtherFormulaResult | undefined): IFormulaCacheEligibility;
18
+ }
@@ -0,0 +1,18 @@
1
+ import type { IDisposable, IMutationInfo } from '@univerjs/core';
2
+ import { Disposable } from '@univerjs/core';
3
+ /**
4
+ * A Formula host contributes compare-and-set mutations for successful scalar results.
5
+ *
6
+ * Providers omit unavailable, failed, non-scalar, and volatile results. Every returned
7
+ * mutation revalidates its captured Formula source before writing, so a late result cannot
8
+ * overwrite a newer edit.
9
+ */
10
+ export interface IFormulaLastValuePersistenceProvider {
11
+ collectMutations(sessionId: number): readonly IMutationInfo[];
12
+ }
13
+ export declare class FormulaLastValuePersistenceService extends Disposable {
14
+ private readonly _providers;
15
+ registerProvider(provider: IFormulaLastValuePersistenceProvider): IDisposable;
16
+ collectMutations(sessionId: number): IMutationInfo[];
17
+ dispose(): void;
18
+ }
@@ -13,11 +13,13 @@ export interface IFormulaReferenceDataRequest {
13
13
  requestId: string;
14
14
  calculationId: string;
15
15
  hostUnitId: string;
16
- bindingSlot: number;
16
+ bindingSlot?: number;
17
+ referenceId?: string;
17
18
  syntheticUnitId: string;
18
19
  target: {
19
20
  name: string;
20
21
  unitType: FormulaUnitType;
22
+ sourceUnitId?: string;
21
23
  uri?: string;
22
24
  liveUnitId?: string;
23
25
  };
@@ -38,6 +40,13 @@ export interface IFormulaReferenceDataSheet {
38
40
  coverage: IRange[];
39
41
  cells: IFormulaReferenceDataCell[];
40
42
  }
43
+ export interface IFormulaReferenceDataTable {
44
+ name: string;
45
+ sheetId: string;
46
+ range: IRange;
47
+ columns: string[];
48
+ showHeader?: boolean;
49
+ }
41
50
  export interface IFormulaReferenceDataResponse {
42
51
  requestId: string;
43
52
  calculationId: string;
@@ -45,6 +54,7 @@ export interface IFormulaReferenceDataResponse {
45
54
  freshness: FormulaReferenceDataFreshness;
46
55
  revision?: string;
47
56
  sheets: IFormulaReferenceDataSheet[];
57
+ tables?: IFormulaReferenceDataTable[];
48
58
  error?: '#N/A' | '#REF!' | '#CYCLE!';
49
59
  }
50
60
  export interface IFormulaReferenceDataService {
@@ -1,43 +1,103 @@
1
1
  import type { IRange } from '@univerjs/core';
2
- /** The kind of reference text produced by {@link buildFormulaReference}. */
2
+ /** Reference syntax produced by {@link buildFormulaReference} and `FFormula.buildReference()`. */
3
3
  export declare enum FormulaReferenceType {
4
+ /** A worksheet A1 range such as `Sheet1!A1:B10` or `'[Sales]Data'!A1:B10`. */
4
5
  SHEET_RANGE = "sheet-range",
6
+ /** A Base structured reference such as `Orders[Amount]` or `[Sales]!Orders[Amount]`. */
5
7
  TABLE_COLUMN = "table-column"
6
8
  }
7
- /** Explicit Unit identity supplied by the caller when serializing a formula reference. */
9
+ /**
10
+ * Explicit Unit identity supplied by the caller when serializing a formula reference.
11
+ * Always use the stable Unit ID; never infer it from `formulaQualifier`.
12
+ */
8
13
  export interface IFormulaReferenceUnit {
9
- /** Name written into a formula unit qualifier. */
14
+ /**
15
+ * Display name written into the formula qualifier. Supply the name only, without
16
+ * surrounding brackets or quotes; the builder applies formula escaping.
17
+ */
10
18
  formulaQualifier: string;
11
- /** Stable Unit identifier used to detect a current-Unit reference. */
12
- unitId?: string;
19
+ /**
20
+ * Stable Sheet or Base Unit ID. When it equals `hostUnitId`, the builder emits
21
+ * a Host-local reference; otherwise it emits a cross-Unit qualifier.
22
+ */
23
+ unitId: string;
13
24
  }
14
25
  /** Sheet-range reference target accepted by {@link buildFormulaReference}. */
15
26
  export interface IFormulaSheetRangeReferenceTarget {
16
27
  kind: FormulaReferenceType.SHEET_RANGE;
28
+ /** Source worksheet name, without formula quotes. */
17
29
  sheetName: string;
30
+ /** Zero-based inclusive source range. */
18
31
  range: IRange;
19
32
  }
20
33
  /** Base/structured-table reference target accepted by {@link buildFormulaReference}. */
21
34
  export interface IFormulaTableColumnReferenceTarget {
22
35
  kind: FormulaReferenceType.TABLE_COLUMN;
36
+ /** Source Base table name, without formula quotes. */
23
37
  tableName: string;
38
+ /** First source field name. */
24
39
  columnName: string;
25
40
  /** Optional final column for a contiguous structured-reference range. */
26
41
  endColumnName?: string;
27
42
  }
28
43
  /** A Sheet range or Base structured-reference target serialized by {@link buildFormulaReference}. */
29
44
  export type FormulaReferenceTarget = IFormulaSheetRangeReferenceTarget | IFormulaTableColumnReferenceTarget;
30
- /** Input used to serialize a formula reference fragment. */
45
+ /**
46
+ * Input used to serialize one formula reference fragment.
47
+ *
48
+ * `hostUnitId === unit.unitId` produces Host-local syntax. Different IDs produce
49
+ * cross-Unit syntax using `unit.formulaQualifier`.
50
+ */
31
51
  export interface IBuildFormulaReferenceOptions {
32
- /** Unit that owns the formula. */
52
+ /** Stable ID of the Unit that will own the formula. */
33
53
  hostUnitId: string;
34
- /** Unit identity supplied explicitly by the caller. */
54
+ /** Stable identity and public qualifier of the referenced Sheet or Base Unit. */
35
55
  unit: IFormulaReferenceUnit;
36
56
  /** Sheet range or structured-table column to serialize. */
37
57
  target: FormulaReferenceTarget;
38
58
  }
39
59
  /**
40
- * Serializes a formula reference fragment without discovering, mutating, or loading a Unit.
41
- * The returned text does not include a leading `=` or a wrapping function.
60
+ * Purely serializes a Sheet-range or Base-table reference fragment.
61
+ *
62
+ * This low-level helper never persists a Host External Reference, loads a Unit, or
63
+ * starts calculation. Use `univerAPI.getFormula().buildReference()` for normal
64
+ * Facade authoring because that method also synchronizes cross-Unit bindings.
65
+ * The returned fragment has no leading `=` and is intended to be embedded in a
66
+ * complete formula.
67
+ *
68
+ * @example Serialize a Host-local Sheet range
69
+ * ```ts
70
+ * const reference = buildFormulaReference({
71
+ * hostUnitId: 'host-workbook',
72
+ * unit: {
73
+ * unitId: 'host-workbook',
74
+ * formulaQualifier: 'Host Workbook',
75
+ * },
76
+ * target: {
77
+ * kind: FormulaReferenceType.SHEET_RANGE,
78
+ * sheetName: 'Data',
79
+ * range: { startRow: 0, endRow: 9, startColumn: 1, endColumn: 1 },
80
+ * },
81
+ * });
82
+ * // reference === 'Data!B1:B10'
83
+ * ```
84
+ *
85
+ * @example Serialize a cross-Unit Base column
86
+ * ```ts
87
+ * const reference = buildFormulaReference({
88
+ * hostUnitId: 'host-document',
89
+ * unit: {
90
+ * unitId: 'sales-base',
91
+ * formulaQualifier: 'Sales Base',
92
+ * },
93
+ * target: {
94
+ * kind: FormulaReferenceType.TABLE_COLUMN,
95
+ * tableName: 'Orders',
96
+ * columnName: 'Amount',
97
+ * },
98
+ * });
99
+ * // reference === '[Sales Base]!Orders[Amount]'
100
+ * // The caller must persist the Host External Reference separately.
101
+ * ```
42
102
  */
43
103
  export declare function buildFormulaReference(options: IBuildFormulaReferenceOptions): string;
@@ -0,0 +1,22 @@
1
+ import type { ICellData } from '@univerjs/core';
2
+ import type { IOtherFormulaResult } from '@univerjs/engine-formula';
3
+ import type { IFormulaLastValue } from '../models/formula-last-value';
4
+ export interface IFormulaResultPresentation {
5
+ text: string;
6
+ color?: string;
7
+ pattern: string;
8
+ cell?: ICellData;
9
+ source: 'persisted' | 'calculated';
10
+ stale: boolean;
11
+ }
12
+ export interface IResolveFormulaResultPresentationOptions {
13
+ numberFormat?: {
14
+ pattern: string;
15
+ };
16
+ lastValue?: IFormulaLastValue;
17
+ result?: IOtherFormulaResult;
18
+ }
19
+ export declare function resolveFormulaResultPresentation(options: IResolveFormulaResultPresentationOptions): IFormulaResultPresentation;
20
+ export declare function getFormulaResultCell(result: IOtherFormulaResult | undefined): ICellData | undefined;
21
+ export declare function getScalarFormulaResultCell(result: IOtherFormulaResult | undefined): ICellData | undefined;
22
+ export declare function toFormulaLastValue(cell: ICellData): IFormulaLastValue | null;
@@ -0,0 +1,31 @@
1
+ import type { IRange } from '@univerjs/core';
2
+ import type { IFormulaExternalReferenceDataLoader, IFormulaExternalReferenceLoadInput } from '@univerjs/engine-formula';
3
+ import { ErrorType, IFormulaCurrentConfigService, ISuperTableService } from '@univerjs/engine-formula';
4
+ import { ExternalReferenceModel } from '../models/external-reference.model';
5
+ import { IFormulaReferenceDataService } from './formula-reference-data.service';
6
+ export declare class HostExternalReferenceDataLoader implements IFormulaExternalReferenceDataLoader {
7
+ private readonly _currentConfigService;
8
+ private readonly _referenceDataService;
9
+ private readonly _excelExternalReferenceModel;
10
+ private readonly _superTableService;
11
+ private _requestCounter;
12
+ private _generation;
13
+ private readonly _inflight;
14
+ private readonly _completed;
15
+ constructor(_currentConfigService: IFormulaCurrentConfigService, _referenceDataService: IFormulaReferenceDataService, _excelExternalReferenceModel: ExternalReferenceModel, _superTableService: ISuperTableService);
16
+ load(input: IFormulaExternalReferenceLoadInput): Promise<ErrorType | void>;
17
+ loadRuntimeRange(input: {
18
+ hostUnitId: string;
19
+ unitId: string;
20
+ sheetId: string;
21
+ sheetName?: string;
22
+ range: IRange;
23
+ }): Promise<ErrorType | boolean | void>;
24
+ private _resolveRuntimeRange;
25
+ private _runtimeRangeSheetName;
26
+ private _createRequest;
27
+ private _createA1RangeRequest;
28
+ private _loadRequest;
29
+ private _materialize;
30
+ private _materializeSheet;
31
+ }
@@ -0,0 +1,15 @@
1
+ import type { FormulaSequenceNode } from '@univerjs/engine-formula';
2
+ import type { HostExternalReferenceBindingResult, IHostExternalReference } from '../models/host-external-reference.model';
3
+ export type HostFormulaExternalReferenceResolution = {
4
+ status: 'resolved';
5
+ references: readonly IHostExternalReference[];
6
+ } | {
7
+ status: 'missing' | 'ambiguous';
8
+ qualifier: string;
9
+ };
10
+ export declare function collectFormulaExternalReferenceQualifiers(sequenceNodes: FormulaSequenceNode[]): string[];
11
+ export declare function resolveHostFormulaExternalReferences(options: {
12
+ qualifiers: readonly string[];
13
+ explicitReferences: readonly IHostExternalReference[];
14
+ resolveBinding: (qualifier: string) => HostExternalReferenceBindingResult;
15
+ }): HostFormulaExternalReferenceResolution;
@@ -7,6 +7,7 @@ export declare class MainFormulaReferenceDataService implements IFormulaReferenc
7
7
  private readonly _providerRegistry;
8
8
  constructor(_formulaDataModel: FormulaDataModel, _superTableService: ISuperTableService, _providerRegistry: IFormulaReferenceDataProviderRegistry);
9
9
  readData(request: IFormulaReferenceDataRequest): Promise<IFormulaReferenceDataResponse>;
10
+ private _readLiveTables;
10
11
  private _readLiveSheets;
11
12
  private _resolveLiveRange;
12
13
  }
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- function _0x360e(_0x234ce7,_0x2ae612){_0x234ce7=_0x234ce7-0x174;var _0x59feb1=_0x59fe();var _0x360e2b=_0x59feb1[_0x234ce7];return _0x360e2b;}(function(_0x5c6164,_0x40bb74){var _0x5122ab=_0x360e,_0x1e6079=_0x5c6164();while(!![]){try{var _0x289760=parseInt(_0x5122ab(0x17a))/0x1*(parseInt(_0x5122ab(0x179))/0x2)+-parseInt(_0x5122ab(0x18c))/0x3*(-parseInt(_0x5122ab(0x183))/0x4)+-parseInt(_0x5122ab(0x182))/0x5*(-parseInt(_0x5122ab(0x187))/0x6)+parseInt(_0x5122ab(0x18a))/0x7+parseInt(_0x5122ab(0x176))/0x8+parseInt(_0x5122ab(0x175))/0x9*(-parseInt(_0x5122ab(0x17c))/0xa)+-parseInt(_0x5122ab(0x180))/0xb;if(_0x289760===_0x40bb74)break;else _0x1e6079['push'](_0x1e6079['shift']());}catch(_0xc3f200){_0x1e6079['push'](_0x1e6079['shift']());}}}(_0x59fe,0x985e0),function(_0x557913,_0x16f5d3){var _0x26273d=_0x360e;typeof exports==_0x26273d(0x18f)&&typeof module<'u'?_0x16f5d3(exports,require('@univerjs/engine-formula/facade'),require('@univerjs-pro/engine-formula'),require('@univerjs/core/facade')):typeof define==_0x26273d(0x186)&&define[_0x26273d(0x174)]?define([_0x26273d(0x188),'@univerjs/engine-formula/facade',_0x26273d(0x17f),_0x26273d(0x178)],_0x16f5d3):(_0x557913=typeof globalThis<'u'?globalThis:_0x557913||self,_0x16f5d3(_0x557913[_0x26273d(0x185)]={},_0x557913[_0x26273d(0x18d)],_0x557913[_0x26273d(0x177)],_0x557913[_0x26273d(0x18e)]));}(this,function(_0x40992c,_0x5d11bb,_0x370b12,_0x17a016){var _0x3ff4da=_0x360e;Object[_0x3ff4da(0x17e)](_0x40992c,Symbol[_0x3ff4da(0x17b)],{'value':_0x3ff4da(0x189)});var _0x5235e5=class extends _0x17a016[_0x3ff4da(0x181)]{get[_0x3ff4da(0x184)](){return _0x370b12['FormulaReferenceType'];}};_0x17a016[_0x3ff4da(0x181)]['extend'](_0x5235e5);var _0x2cebcb=class extends _0x5d11bb['FFormula']{[_0x3ff4da(0x17d)](_0x533eb6){return(0x0,_0x370b12['buildFormulaReference'])(_0x533eb6);}};_0x5d11bb['FFormula']['extend'](_0x2cebcb),Object[_0x3ff4da(0x17e)](_0x40992c,_0x3ff4da(0x18b),{'enumerable':!0x0,'get':function(){var _0x22a97e=_0x3ff4da;return _0x5d11bb[_0x22a97e(0x18b)];}});}));function _0x59fe(){var _0x887e35=['Module','6458144QOocmH','FFormula','51KyLhxT','UniverEngineFormulaFacade','UniverCoreFacade','object','amd','3576411jnpOKF','9319768vIRcNv','UniverProEngineFormula','@univerjs/core/facade','1439978XYSlxI','1ZXtbNY','toStringTag','30RmRCok','buildReference','defineProperty','@univerjs-pro/engine-formula','27556463jBYGdI','FEnum','1534325HxfwuH','283988NkoEyw','FormulaReferenceType','UniverProEngineFormulaFacade','function','6ekqkjF','exports'];_0x59fe=function(){return _0x887e35;};return _0x59fe();}
1
+ (function(_0x2b4e62,_0x504782){var _0xff5d77=_0x579a,_0x237ec5=_0x2b4e62();while(!![]){try{var _0x389e22=-parseInt(_0xff5d77(0x1c9))/0x1+parseInt(_0xff5d77(0x1e0))/0x2*(parseInt(_0xff5d77(0x1ec))/0x3)+-parseInt(_0xff5d77(0x1dd))/0x4*(parseInt(_0xff5d77(0x1de))/0x5)+-parseInt(_0xff5d77(0x1e5))/0x6+parseInt(_0xff5d77(0x1cd))/0x7*(-parseInt(_0xff5d77(0x1cc))/0x8)+-parseInt(_0xff5d77(0x1ca))/0x9*(-parseInt(_0xff5d77(0x1ea))/0xa)+parseInt(_0xff5d77(0x1e3))/0xb;if(_0x389e22===_0x504782)break;else _0x237ec5['push'](_0x237ec5['shift']());}catch(_0x8448f6){_0x237ec5['push'](_0x237ec5['shift']());}}}(_0x148c,0x44240),function(_0x331042,_0x3f4d11){var _0x157715=_0x579a;typeof exports==_0x157715(0x1c6)&&typeof module<'u'?_0x3f4d11(exports,require('@univerjs/engine-formula/facade'),require('@univerjs-pro/engine-formula'),require('@univerjs/core/facade'),require('@univerjs/core')):typeof define==_0x157715(0x1dc)&&define['amd']?define([_0x157715(0x1e1),_0x157715(0x1e8),_0x157715(0x1c7),_0x157715(0x1d2),_0x157715(0x1db)],_0x3f4d11):(_0x331042=typeof globalThis<'u'?globalThis:_0x331042||self,_0x3f4d11(_0x331042['UniverProEngineFormulaFacade']={},_0x331042[_0x157715(0x1ce)],_0x331042[_0x157715(0x1df)],_0x331042[_0x157715(0x1cb)],_0x331042[_0x157715(0x1e4)]));}(this,function(_0xc7e3ad,_0x19e3dc,_0x1921b7,_0x3fab13,_0x5de9cf){var _0x59805f=_0x579a;Object[_0x59805f(0x1e6)](_0xc7e3ad,Symbol[_0x59805f(0x1e2)],{'value':'Module'});var _0x1f4e43=class extends _0x3fab13[_0x59805f(0x1eb)]{get['FormulaReferenceType'](){var _0x48c21d=_0x59805f;return _0x1921b7[_0x48c21d(0x1d4)];}};_0x3fab13[_0x59805f(0x1eb)]['extend'](_0x1f4e43);var _0x2b013c=class extends _0x19e3dc[_0x59805f(0x1e9)]{[_0x59805f(0x1d1)](_0x2e9086){var _0x337139=_0x59805f;let {hostUnitId:_0x2d1634,unit:_0x40ff1a,target:_0x445c3b}=_0x2e9086;if(!_0x2d1634||!_0x40ff1a[_0x337139(0x1c4)])throw Error('Formula\x20reference\x20authoring\x20requires\x20stable\x20Host\x20and\x20Source\x20Unit\x20IDs.');if(_0x40ff1a[_0x337139(0x1c4)]!==_0x2d1634&&!this[_0x337139(0x1c8)][_0x337139(0x1cf)](_0x1921b7[_0x337139(0x1d5)]['id'],{'unitId':_0x2d1634,'qualifier':_0x40ff1a[_0x337139(0x1d6)],'sourceUnitId':_0x40ff1a[_0x337139(0x1c4)],'sourceUnitType':_0x445c3b[_0x337139(0x1d8)]===_0x1921b7[_0x337139(0x1d4)][_0x337139(0x1d9)]?_0x5de9cf[_0x337139(0x1d0)][_0x337139(0x1d3)]:_0x5de9cf[_0x337139(0x1d0)]['UNIVER_BASE']}))throw Error('Failed\x20to\x20bind\x20external\x20formula\x20reference\x20\x22'+_0x40ff1a['formulaQualifier']+'\x22.');return(0x0,_0x1921b7[_0x337139(0x1da)])(_0x2e9086);}[_0x59805f(0x1c5)](_0x181d84){var _0x4dbf2d=_0x59805f;return this[_0x4dbf2d(0x1c8)]['syncExecuteCommand'](_0x1921b7[_0x4dbf2d(0x1d5)]['id'],_0x181d84);}[_0x59805f(0x1e7)](_0x3a6141){var _0x5b5391=_0x59805f;return this['_commandService'][_0x5b5391(0x1cf)](_0x1921b7[_0x5b5391(0x1d7)]['id'],_0x3a6141);}};_0x19e3dc[_0x59805f(0x1e9)]['extend'](_0x2b013c),Object[_0x59805f(0x1e6)](_0xc7e3ad,_0x59805f(0x1e9),{'enumerable':!0x0,'get':function(){var _0x175dc2=_0x59805f;return _0x19e3dc[_0x175dc2(0x1e9)];}});}));function _0x579a(_0x23a05e,_0xcbfb5a){_0x23a05e=_0x23a05e-0x1c4;var _0x148c22=_0x148c();var _0x579ab4=_0x148c22[_0x23a05e];return _0x579ab4;}function _0x148c(){var _0x37e7de=['479284usfwZn','27DqdcsX','UniverCoreFacade','1250168bmOOtL','21fXkheW','UniverEngineFormulaFacade','syncExecuteCommand','UniverInstanceType','buildReference','@univerjs/core/facade','UNIVER_SHEET','FormulaReferenceType','UpsertHostExternalReferenceCommand','formulaQualifier','RemoveHostExternalReferenceCommand','kind','SHEET_RANGE','buildFormulaReference','@univerjs/core','function','8848iadoWV','5cbLPem','UniverProEngineFormula','6OFIBgd','exports','toStringTag','13672516ctQIqF','UniverCore','2619510Tnfqic','defineProperty','removeExternalReference','@univerjs/engine-formula/facade','FFormula','670nzNHqU','FEnum','422841lvOpAc','unitId','upsertExternalReference','object','@univerjs-pro/engine-formula','_commandService'];_0x148c=function(){return _0x37e7de;};return _0x148c();}