@masterteam/formula-builder 0.0.7 → 0.0.9

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.
@@ -4,14 +4,20 @@ import { OnDestroy } from '@angular/core';
4
4
  import { ControlValueAccessor } from '@angular/forms';
5
5
  import { RadioItem } from '@masterteam/components/radio-cards';
6
6
  import { Observable } from 'rxjs';
7
- import { FunctionCategoryGroup, FormulaToken, ToolbarTab, ValidationResult, AutocompleteRequest, AutocompleteResponse, SmartBlock } from '@masterteam/components/formula';
7
+ import { FunctionCategoryGroup, AutocompleteRequest as AutocompleteRequest$1, AutocompleteResponse as AutocompleteResponse$1, ValidationResult as ValidationResult$1, FormulaToken, ToolbarTab, SmartBlock } from '@masterteam/components/formula';
8
8
  export { ArgumentSlot, BlockType, DragBehavior, FormulaToken, FunctionCategoryGroup, FunctionDefinition, OperatorDefinition, SmartBlock, TokenType, ValidationError, ValidationResult, createFunctionBlock, createLiteralBlock, createOperatorBlock, createPropertyBlock } from '@masterteam/components/formula';
9
9
 
10
+ type ValidationResult = ValidationResult$1;
11
+ type AutocompleteResponse = AutocompleteResponse$1;
12
+ interface AutocompleteRequest extends AutocompleteRequest$1 {
13
+ moduleId?: number;
14
+ }
10
15
  /** Validation request payload (for API calls) */
11
16
  interface ValidationRequest {
12
17
  formula: string;
13
18
  knownProperties?: string[];
14
19
  levelSchemaId?: number;
20
+ moduleId?: number;
15
21
  templateId?: number;
16
22
  }
17
23
  /** Function catalog response from API */
@@ -108,6 +114,8 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
108
114
  }[]>>;
109
115
  /** Level schema ID for validation context */
110
116
  readonly levelSchemaId: _angular_core.InputSignal<number | undefined>;
117
+ /** Optional module ID when the formula is scoped inside a level-linked module */
118
+ readonly moduleId: _angular_core.InputSignal<number | undefined>;
111
119
  /** Optional current context entity key, e.g. LevelData or Risk */
112
120
  readonly contextEntityTypeKey: _angular_core.InputSignal<string | undefined>;
113
121
  /** Template ID for validation context */
@@ -125,7 +133,7 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
125
133
  /** Use Process Builder current-only Formula Engine endpoints */
126
134
  readonly isProcessBuilder: _angular_core.InputSignal<boolean>;
127
135
  /** Emits validation result on change */
128
- readonly validationChange: _angular_core.OutputEmitterRef<ValidationResult>;
136
+ readonly validationChange: _angular_core.OutputEmitterRef<_masterteam_formula_builder.ValidationResult>;
129
137
  /** Emits when tokens change */
130
138
  readonly tokensChange: _angular_core.OutputEmitterRef<FormulaToken[]>;
131
139
  /** Editor focus state */
@@ -137,6 +145,7 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
137
145
  readonly tokens: _angular_core.WritableSignal<FormulaToken[]>;
138
146
  readonly expression: _angular_core.Signal<string>;
139
147
  readonly resolvedContextEntityTypeKey: _angular_core.Signal<string | undefined>;
148
+ readonly isModuleContext: _angular_core.Signal<boolean>;
140
149
  readonly autocompleteProvider: (request: AutocompleteRequest) => Observable<AutocompleteResponse | null>;
141
150
  /** Track last synced builder JSON to avoid loops */
142
151
  private lastBuilderJson;
@@ -155,7 +164,7 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
155
164
  /** Disabled state */
156
165
  private readonly isDisabled;
157
166
  /** Validation result from service */
158
- readonly validation: _angular_core.Signal<ValidationResult>;
167
+ readonly validation: _angular_core.Signal<_masterteam_formula_builder.ValidationResult>;
159
168
  /** Is validation in progress */
160
169
  readonly isValidating: _angular_core.Signal<boolean>;
161
170
  /** Builder context from API */
@@ -248,8 +257,9 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
248
257
  name: string;
249
258
  }[];
250
259
  insertSelectedProperty(insertBlock: (block: SmartBlock) => void): void;
260
+ getOperatorDisplayName(token: string): string;
251
261
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaBuilder, never>;
252
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "required": false; "isSignal": true; }; "contextEntityTypeKey": { "alias": "contextEntityTypeKey"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hideToolbar": { "alias": "hideToolbar"; "required": false; "isSignal": true; }; "hideStatusBar": { "alias": "hideStatusBar"; "required": false; "isSignal": true; }; "toolbarTabs": { "alias": "toolbarTabs"; "required": false; "isSignal": true; }; "codeOnly": { "alias": "codeOnly"; "required": false; "isSignal": true; }; "isProcessBuilder": { "alias": "isProcessBuilder"; "required": false; "isSignal": true; }; }, { "validationChange": "validationChange"; "tokensChange": "tokensChange"; }, never, never, true, never>;
262
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "required": false; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "contextEntityTypeKey": { "alias": "contextEntityTypeKey"; "required": false; "isSignal": true; }; "templateId": { "alias": "templateId"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hideToolbar": { "alias": "hideToolbar"; "required": false; "isSignal": true; }; "hideStatusBar": { "alias": "hideStatusBar"; "required": false; "isSignal": true; }; "toolbarTabs": { "alias": "toolbarTabs"; "required": false; "isSignal": true; }; "codeOnly": { "alias": "codeOnly"; "required": false; "isSignal": true; }; "isProcessBuilder": { "alias": "isProcessBuilder"; "required": false; "isSignal": true; }; }, { "validationChange": "validationChange"; "tokensChange": "tokensChange"; }, never, never, true, never>;
253
263
  }
254
264
 
255
265
  type FormulaApiMode$1 = 'default' | 'current-only';
@@ -261,9 +271,9 @@ declare class FormulaContextService {
261
271
  private readonly contextCache;
262
272
  private readonly propertiesCache;
263
273
  private readonly nextTokensCache;
264
- loadContext(schemaId: number, contextEntityTypeKey?: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderContextResponse | null>;
265
- getScopeProperties(schemaId: number, component: string, tablePath: string, mode?: FormulaApiMode$1): Observable<FormulaPropertyDescriptor[]>;
266
- getNextTokens(schemaId: number, component: string, tablePath: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderNextTokensResponse | null>;
274
+ loadContext(schemaId: number, moduleId?: number, contextEntityTypeKey?: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderContextResponse | null>;
275
+ getScopeProperties(schemaId: number, component: string | undefined, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1): Observable<FormulaPropertyDescriptor[]>;
276
+ getNextTokens(schemaId: number, component: string, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1): Observable<FormulaBuilderNextTokensResponse | null>;
267
277
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaContextService, never>;
268
278
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormulaContextService>;
269
279
  }
@@ -283,15 +293,15 @@ declare class FormulaValidatorService {
283
293
  private readonly validateSubject;
284
294
  private unwrapResponse;
285
295
  /** Public signals */
286
- readonly validation: _angular_core.Signal<ValidationResult>;
296
+ readonly validation: _angular_core.Signal<_masterteam_formula_builder.ValidationResult>;
287
297
  readonly isValidating: _angular_core.Signal<boolean>;
288
298
  constructor();
289
299
  /** Setup debounced validation stream */
290
300
  private setupValidationStream;
291
301
  /** Validate formula (debounced) */
292
- validate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number, apiMode?: FormulaApiMode): void;
302
+ validate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode): void;
293
303
  /** Validate formula immediately (no debounce) */
294
- validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number, apiMode?: FormulaApiMode): Observable<ValidationResult>;
304
+ validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, moduleId?: number, templateId?: number, apiMode?: FormulaApiMode): Observable<ValidationResult>;
295
305
  /** Call validation API */
296
306
  private callValidateApi;
297
307
  /** Reset validation state */