@masterteam/formula-builder 0.0.2 → 0.0.4
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,7 +4,7 @@ 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, ValidationResult, AutocompleteRequest, AutocompleteResponse, SmartBlock } from '@masterteam/components/formula';
|
|
7
|
+
import { FunctionCategoryGroup, FormulaToken, ToolbarTab, ValidationResult, AutocompleteRequest, AutocompleteResponse, 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
10
|
/** Validation request payload (for API calls) */
|
|
@@ -86,6 +86,13 @@ type SegmentMeta = PathSegment & {
|
|
|
86
86
|
canRemove: boolean;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
interface FormulaBuilderUiConfig {
|
|
90
|
+
toolbarTabs?: readonly ToolbarTab[];
|
|
91
|
+
codeOnly?: boolean;
|
|
92
|
+
hideToolbar?: boolean;
|
|
93
|
+
hideStatusBar?: boolean;
|
|
94
|
+
isProcessBuilder?: boolean;
|
|
95
|
+
}
|
|
89
96
|
declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
90
97
|
private readonly validatorService;
|
|
91
98
|
private readonly contextService;
|
|
@@ -108,6 +115,12 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
108
115
|
readonly hideToolbar: _angular_core.InputSignal<boolean>;
|
|
109
116
|
/** Hide the status bar */
|
|
110
117
|
readonly hideStatusBar: _angular_core.InputSignal<boolean>;
|
|
118
|
+
/** Visible toolbar tabs */
|
|
119
|
+
readonly toolbarTabs: _angular_core.InputSignal<readonly ToolbarTab[]>;
|
|
120
|
+
/** Force code editor mode and hide the mode toggle */
|
|
121
|
+
readonly codeOnly: _angular_core.InputSignal<boolean>;
|
|
122
|
+
/** Use Process Builder current-only Formula Engine endpoints */
|
|
123
|
+
readonly isProcessBuilder: _angular_core.InputSignal<boolean>;
|
|
111
124
|
/** Emits validation result on change */
|
|
112
125
|
readonly validationChange: _angular_core.OutputEmitterRef<ValidationResult>;
|
|
113
126
|
/** Emits when tokens change */
|
|
@@ -127,6 +140,9 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
127
140
|
readonly editorMode: _angular_core.WritableSignal<"builder" | "code">;
|
|
128
141
|
readonly isCodeMode: _angular_core.Signal<boolean>;
|
|
129
142
|
readonly isCodeModeLocked: _angular_core.WritableSignal<boolean>;
|
|
143
|
+
readonly showModeToggle: _angular_core.Signal<boolean>;
|
|
144
|
+
readonly formulaApiMode: _angular_core.Signal<"default" | "current-only">;
|
|
145
|
+
readonly resolvedToolbarTabs: _angular_core.Signal<readonly ToolbarTab[]>;
|
|
130
146
|
private codeModeSnapshotTokens;
|
|
131
147
|
private codeModeSnapshotExpression;
|
|
132
148
|
/** ControlValueAccessor callbacks */
|
|
@@ -173,6 +189,8 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
173
189
|
private clearBuilderTokens;
|
|
174
190
|
/** Clear the formula */
|
|
175
191
|
clear(): void;
|
|
192
|
+
private resolveExpressionValue;
|
|
193
|
+
private applyFormulaValue;
|
|
176
194
|
readonly propertyScope: _angular_core.WritableSignal<string>;
|
|
177
195
|
readonly propertyPathSegments: _angular_core.WritableSignal<PathSegment[]>;
|
|
178
196
|
readonly propertyFieldKey: _angular_core.WritableSignal<string>;
|
|
@@ -227,26 +245,30 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
|
|
|
227
245
|
}[];
|
|
228
246
|
insertSelectedProperty(insertBlock: (block: SmartBlock) => void): void;
|
|
229
247
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaBuilder, never>;
|
|
230
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "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; }; }, { "validationChange": "validationChange"; "tokensChange": "tokensChange"; }, never, never, true, never>;
|
|
248
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaBuilder, "mt-formula-builder", never, { "propertiesByPath": { "alias": "propertiesByPath"; "required": false; "isSignal": true; }; "levelSchemaId": { "alias": "levelSchemaId"; "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>;
|
|
231
249
|
}
|
|
232
250
|
|
|
251
|
+
type FormulaApiMode$1 = 'default' | 'current-only';
|
|
233
252
|
declare class FormulaContextService {
|
|
234
253
|
private readonly http;
|
|
235
254
|
private readonly apiUrl;
|
|
255
|
+
private getBaseUrl;
|
|
236
256
|
private unwrapResponse;
|
|
237
257
|
private readonly contextCache;
|
|
238
258
|
private readonly propertiesCache;
|
|
239
259
|
private readonly nextTokensCache;
|
|
240
|
-
loadContext(schemaId: number, contextEntityTypeKey?: string): Observable<FormulaBuilderContextResponse | null>;
|
|
241
|
-
getScopeProperties(schemaId: number, component: string, tablePath: string): Observable<FormulaPropertyDescriptor[]>;
|
|
242
|
-
getNextTokens(schemaId: number, component: string, tablePath: string): Observable<FormulaBuilderNextTokensResponse | null>;
|
|
260
|
+
loadContext(schemaId: number, contextEntityTypeKey?: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderContextResponse | null>;
|
|
261
|
+
getScopeProperties(schemaId: number, component: string, tablePath: string, mode?: FormulaApiMode$1): Observable<FormulaPropertyDescriptor[]>;
|
|
262
|
+
getNextTokens(schemaId: number, component: string, tablePath: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderNextTokensResponse | null>;
|
|
243
263
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaContextService, never>;
|
|
244
264
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormulaContextService>;
|
|
245
265
|
}
|
|
246
266
|
|
|
267
|
+
type FormulaApiMode = 'default' | 'current-only';
|
|
247
268
|
declare class FormulaValidatorService {
|
|
248
269
|
private readonly http;
|
|
249
270
|
private readonly apiUrl;
|
|
271
|
+
private getBaseUrl;
|
|
250
272
|
/** Debounce time in ms */
|
|
251
273
|
private readonly DEBOUNCE_MS;
|
|
252
274
|
/** Current validation result */
|
|
@@ -263,9 +285,9 @@ declare class FormulaValidatorService {
|
|
|
263
285
|
/** Setup debounced validation stream */
|
|
264
286
|
private setupValidationStream;
|
|
265
287
|
/** Validate formula (debounced) */
|
|
266
|
-
validate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number): void;
|
|
288
|
+
validate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number, apiMode?: FormulaApiMode): void;
|
|
267
289
|
/** Validate formula immediately (no debounce) */
|
|
268
|
-
validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number): Observable<ValidationResult>;
|
|
290
|
+
validateImmediate(formula: string, knownProperties?: string[], levelSchemaId?: number, templateId?: number, apiMode?: FormulaApiMode): Observable<ValidationResult>;
|
|
269
291
|
/** Call validation API */
|
|
270
292
|
private callValidateApi;
|
|
271
293
|
/** Reset validation state */
|
|
@@ -287,4 +309,4 @@ declare class FormulaValidatorService {
|
|
|
287
309
|
}
|
|
288
310
|
|
|
289
311
|
export { FormulaBuilder, FormulaContextService, FormulaValidatorService };
|
|
290
|
-
export type { ApiErrorResponse, FormulaBuilderContextResponse, FormulaBuilderValue, FormulaEngineSchemaDescriptor, FormulaPropertyDescriptor, FunctionCatalogResponse, NextTokenRule, OperatorDescriptor, ValidationRequest };
|
|
312
|
+
export type { ApiErrorResponse, FormulaBuilderContextResponse, FormulaBuilderUiConfig, FormulaBuilderValue, FormulaEngineSchemaDescriptor, FormulaPropertyDescriptor, FunctionCatalogResponse, NextTokenRule, OperatorDescriptor, ValidationRequest };
|