@masterteam/formula-builder 0.0.22 → 0.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/formula-builder",
3
- "version": "0.0.22",
3
+ "version": "0.0.23",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/formula-builder",
6
6
  "linkDirectory": true,
@@ -19,7 +19,7 @@
19
19
  "rxjs": "^7.8.2",
20
20
  "tailwindcss": "^4.2.2",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
- "@masterteam/components": "^0.0.207",
22
+ "@masterteam/components": "^0.0.208",
23
23
  "@masterteam/icons": "^0.0.17"
24
24
  },
25
25
  "sideEffects": false,
@@ -80,6 +80,11 @@ interface FormulaBuilderNextTokensResponse {
80
80
  version?: string;
81
81
  generatedAt?: string;
82
82
  }
83
+ /** A single selectable value of a lookup / status / lookup-matrix property. */
84
+ interface FormulaPropertyItem {
85
+ key: string;
86
+ name: string;
87
+ }
83
88
 
84
89
  interface FormulaBuilderValue {
85
90
  expression: string;
@@ -155,6 +160,7 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
155
160
  readonly resolvedContextEntityTypeKey: _angular_core.Signal<string | undefined>;
156
161
  readonly isModuleContext: _angular_core.Signal<boolean>;
157
162
  readonly autocompleteProvider: (request: AutocompleteRequest) => Observable<AutocompleteResponse | null>;
163
+ private fetchAutocomplete$;
158
164
  /** Editor mode */
159
165
  readonly editorMode: _angular_core.WritableSignal<"builder" | "code">;
160
166
  readonly isCodeMode: _angular_core.Signal<boolean>;
@@ -255,11 +261,24 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
255
261
  readonly propertyOptions: _angular_core.Signal<{
256
262
  key: string;
257
263
  name: any;
264
+ viewType: string | undefined;
258
265
  }[]>;
259
266
  readonly selectedProperty: _angular_core.Signal<{
260
267
  key: string;
261
268
  name: any;
269
+ viewType: string | undefined;
262
270
  } | null>;
271
+ /** Selectable values of the chosen lookup/status/lookup-matrix property. */
272
+ readonly lookupItems: _angular_core.WritableSignal<FormulaPropertyItem[]>;
273
+ /** Whether the property-items request is in flight. */
274
+ readonly isLookupItemsLoading: _angular_core.WritableSignal<boolean>;
275
+ /** Currently selected lookup value key (the form inserted into the formula). */
276
+ readonly lookupValueKey: _angular_core.WritableSignal<string>;
277
+ private lookupItemsRequestId;
278
+ /** True when the selected field draws its values from a fixed lookup set. */
279
+ readonly isLookupProperty: _angular_core.Signal<boolean>;
280
+ /** Insert-value action is enabled once a lookup value has been picked. */
281
+ readonly canInsertLookupValue: _angular_core.Signal<boolean>;
263
282
  readonly canInsertProperty: _angular_core.Signal<boolean>;
264
283
  setPropertyScope(scope: string): void;
265
284
  setPathSegmentValue(index: number, value: string | null): void;
@@ -273,6 +292,32 @@ declare class FormulaBuilder implements ControlValueAccessor, OnDestroy {
273
292
  name: string;
274
293
  }[];
275
294
  insertSelectedProperty(insertBlock: (block: SmartBlock) => void): void;
295
+ /**
296
+ * Insert the picked lookup value as a string literal. The executable form
297
+ * carries the stable lookup KEY (locale-independent) while the chip shows
298
+ * the friendly NAME — e.g. `… == "completed"` rendered as `… == Completed`.
299
+ */
300
+ insertSelectedLookupValue(insertBlock: (block: SmartBlock) => void): void;
301
+ /**
302
+ * Detect that the cursor (in the code editor) is positioned to type the
303
+ * right-hand value of a comparison against a property, e.g.
304
+ * `@Current::task_status == "in_`. Returns the compared property key, whether
305
+ * an opening quote was already typed, and the partial value typed so far.
306
+ */
307
+ private detectLookupValueContext;
308
+ /**
309
+ * Avoid a wasted request for properties we already know aren't lookups; for
310
+ * keys whose view type isn't loaded yet, let property-items be the authority.
311
+ */
312
+ private shouldFetchLookupItems;
313
+ private findLoadedPropertyViewType;
314
+ /**
315
+ * Build an autocomplete response from a lookup property's values. The inserted
316
+ * text carries the stable key wrapped in quotes (the opening quote is dropped
317
+ * when the user already typed one), matching the key-as-value contract used by
318
+ * the toolbar Value row.
319
+ */
320
+ private buildLookupValueResponse;
276
321
  getOperatorDisplayName(token: string): string;
277
322
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaBuilder, never>;
278
323
  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>;
@@ -287,9 +332,17 @@ declare class FormulaContextService {
287
332
  private readonly contextCache;
288
333
  private readonly propertiesCache;
289
334
  private readonly nextTokensCache;
335
+ private readonly propertyItemsCache;
290
336
  loadContext(schemaId: number, moduleId?: number, contextEntityTypeKey?: string, mode?: FormulaApiMode$1): Observable<FormulaBuilderContextResponse | null>;
291
337
  getScopeProperties(schemaId: number, component: string | undefined, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1): Observable<FormulaPropertyDescriptor[]>;
292
338
  getNextTokens(schemaId: number, component: string, tablePath: string, moduleId?: number, mode?: FormulaApiMode$1): Observable<FormulaBuilderNextTokensResponse | null>;
339
+ /**
340
+ * Selectable values for a lookup / status / lookup-matrix property.
341
+ * The backend responds 400 (VAL_001) for any non-lookup property, which we
342
+ * swallow into an empty list — callers gate the value picker on a known
343
+ * lookup view type, so an empty result simply means "no picker".
344
+ */
345
+ getPropertyItems(propertyKey: string, mode?: FormulaApiMode$1): Observable<FormulaPropertyItem[]>;
293
346
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaContextService, never>;
294
347
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormulaContextService>;
295
348
  }