@masterteam/components 0.0.74 → 0.0.75
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/assets/common.css +1 -1
- package/fesm2022/masterteam-components-date-field.mjs +2 -2
- package/fesm2022/masterteam-components-date-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-formula.mjs +1126 -0
- package/fesm2022/masterteam-components-formula.mjs.map +1 -0
- package/fesm2022/masterteam-components-module-summary-card.mjs +1 -1
- package/fesm2022/masterteam-components-module-summary-card.mjs.map +1 -1
- package/fesm2022/masterteam-components-page-header.mjs +2 -2
- package/fesm2022/masterteam-components-page-header.mjs.map +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs +1 -1
- package/fesm2022/masterteam-components-pick-list-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +3 -4
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/fesm2022/masterteam-components-toggle-field.mjs +20 -5
- package/fesm2022/masterteam-components-toggle-field.mjs.map +1 -1
- package/fesm2022/masterteam-components-topbar.mjs +2 -2
- package/fesm2022/masterteam-components-topbar.mjs.map +1 -1
- package/fesm2022/masterteam-components-tree.mjs +1 -1
- package/fesm2022/masterteam-components-tree.mjs.map +1 -1
- package/fesm2022/masterteam-components.mjs +7 -2
- package/fesm2022/masterteam-components.mjs.map +1 -1
- package/package.json +6 -1
- package/types/masterteam-components-formula.d.ts +500 -0
- package/types/masterteam-components-toggle-field.d.ts +7 -1
- package/types/masterteam-components.d.ts +16 -9
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import { CdkDragStart, CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
4
|
+
import * as _masterteam_components_formula from '@masterteam/components/formula';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Flat Formula Token Model
|
|
8
|
+
*
|
|
9
|
+
* The formula is represented as a FLAT array of tokens.
|
|
10
|
+
* This approach provides:
|
|
11
|
+
* - Better performance (no deep component nesting)
|
|
12
|
+
* - Solid drag-drop behavior (functions move as complete units)
|
|
13
|
+
* - Simple serialization (just join token values)
|
|
14
|
+
*
|
|
15
|
+
* STRUCTURE RULES:
|
|
16
|
+
* - fn-open: "IF(" - function name + opening paren as ONE token
|
|
17
|
+
* - fn-close: ")" - closing paren, belongs to a function
|
|
18
|
+
* - fn-separator: "," - argument separator, belongs to a function
|
|
19
|
+
* - Dragging any structural token moves the ENTIRE function
|
|
20
|
+
* - Content tokens (property, operator, literal) can move individually
|
|
21
|
+
*/
|
|
22
|
+
/** Token types */
|
|
23
|
+
type TokenType = 'fn-open' | 'fn-close' | 'fn-separator' | 'property' | 'operator' | 'literal';
|
|
24
|
+
/** What happens when this token is dragged */
|
|
25
|
+
type DragBehavior = 'function' | 'single';
|
|
26
|
+
/**
|
|
27
|
+
* Formula Token - a single element in the flat formula array
|
|
28
|
+
*/
|
|
29
|
+
interface FormulaToken {
|
|
30
|
+
id: string;
|
|
31
|
+
type: TokenType;
|
|
32
|
+
value: string;
|
|
33
|
+
functionId?: string;
|
|
34
|
+
depth: number;
|
|
35
|
+
argIndex?: number;
|
|
36
|
+
dragBehavior: DragBehavior;
|
|
37
|
+
functionName?: string;
|
|
38
|
+
propertyType?: 'current' | 'children' | 'parent';
|
|
39
|
+
literalType?: 'string' | 'number' | 'boolean';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Function structure info - tracks open/close pairs
|
|
43
|
+
*/
|
|
44
|
+
interface FunctionInfo {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
openIndex: number;
|
|
48
|
+
closeIndex: number;
|
|
49
|
+
argCount: number;
|
|
50
|
+
depth: number;
|
|
51
|
+
}
|
|
52
|
+
/** Generate unique token ID */
|
|
53
|
+
declare function generateTokenId(): string;
|
|
54
|
+
/** Generate unique function ID */
|
|
55
|
+
declare function generateFunctionId(): string;
|
|
56
|
+
/** Parse function signature like "SUM(values)" or "IF(cond, a, b)" */
|
|
57
|
+
declare function parseSignature(signature: string): {
|
|
58
|
+
name: string;
|
|
59
|
+
args: string[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Create a function's tokens from signature
|
|
63
|
+
* e.g., "IF(condition, trueVal, falseVal)" creates:
|
|
64
|
+
* - fn-open: "IF("
|
|
65
|
+
* - fn-separator: "," (x2)
|
|
66
|
+
* - fn-close: ")"
|
|
67
|
+
*/
|
|
68
|
+
declare function createFunctionTokens(signature: string, depth?: number): FormulaToken[];
|
|
69
|
+
/**
|
|
70
|
+
* Create a property token
|
|
71
|
+
*/
|
|
72
|
+
declare function createPropertyToken(propertyKey: string, propertyType?: 'current' | 'children' | 'parent', depth?: number, functionId?: string, argIndex?: number): FormulaToken;
|
|
73
|
+
/**
|
|
74
|
+
* Create an operator token
|
|
75
|
+
*/
|
|
76
|
+
declare function createOperatorToken(symbol: string, depth?: number, functionId?: string, argIndex?: number): FormulaToken;
|
|
77
|
+
/**
|
|
78
|
+
* Create a literal token
|
|
79
|
+
*/
|
|
80
|
+
declare function createLiteralToken(value: string | number | boolean, depth?: number, functionId?: string, argIndex?: number): FormulaToken;
|
|
81
|
+
/**
|
|
82
|
+
* Find the complete range of a function in the token array
|
|
83
|
+
* This includes ALL tokens between fn-open and fn-close (including nested content)
|
|
84
|
+
* Returns [startIndex, endIndex] inclusive
|
|
85
|
+
*/
|
|
86
|
+
declare function findFunctionRange(tokens: FormulaToken[], functionId: string): [number, number] | null;
|
|
87
|
+
/**
|
|
88
|
+
* Get all tokens belonging to a function (including nested content)
|
|
89
|
+
*/
|
|
90
|
+
declare function getFunctionTokens(tokens: FormulaToken[], functionId: string): FormulaToken[];
|
|
91
|
+
/**
|
|
92
|
+
* Validate if a drop position is allowed
|
|
93
|
+
*/
|
|
94
|
+
declare function isValidDropPosition(tokens: FormulaToken[], dropIndex: number, draggedTokens: FormulaToken[]): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Serialize tokens to formula string
|
|
97
|
+
*/
|
|
98
|
+
declare function serializeTokens(tokens: FormulaToken[]): string;
|
|
99
|
+
/**
|
|
100
|
+
* Clone a token with new ID
|
|
101
|
+
*/
|
|
102
|
+
declare function cloneToken(token: FormulaToken): FormulaToken;
|
|
103
|
+
/**
|
|
104
|
+
* Clone multiple tokens with new IDs and new function IDs
|
|
105
|
+
*/
|
|
106
|
+
declare function cloneTokens(tokens: FormulaToken[]): FormulaToken[];
|
|
107
|
+
/**
|
|
108
|
+
* Update depth for all tokens (after move)
|
|
109
|
+
*/
|
|
110
|
+
declare function recalculateDepths(tokens: FormulaToken[]): FormulaToken[];
|
|
111
|
+
/**
|
|
112
|
+
* Find which argument index a position belongs to within a function
|
|
113
|
+
*/
|
|
114
|
+
declare function getArgumentIndexAtPosition(tokens: FormulaToken[], functionId: string, position: number): number;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Smart Formula Block - Types and Factory Functions
|
|
118
|
+
* Defines the block structure and creation helpers
|
|
119
|
+
*/
|
|
120
|
+
/** Block type */
|
|
121
|
+
type BlockType = 'function' | 'property' | 'operator' | 'literal';
|
|
122
|
+
/** Argument slot for functions */
|
|
123
|
+
interface ArgumentSlot {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
blocks: SmartBlock[];
|
|
127
|
+
placeholder?: string;
|
|
128
|
+
}
|
|
129
|
+
/** Smart block structure */
|
|
130
|
+
interface SmartBlock {
|
|
131
|
+
id: string;
|
|
132
|
+
type: BlockType;
|
|
133
|
+
value: string;
|
|
134
|
+
functionName?: string;
|
|
135
|
+
signature?: string;
|
|
136
|
+
arguments?: ArgumentSlot[];
|
|
137
|
+
propertyType?: 'current' | 'children' | 'parent';
|
|
138
|
+
propertyKey?: string;
|
|
139
|
+
operatorSymbol?: string;
|
|
140
|
+
literalValue?: string | number | boolean;
|
|
141
|
+
}
|
|
142
|
+
/** Generate unique block ID */
|
|
143
|
+
declare function generateSmartBlockId(): string;
|
|
144
|
+
/** Create a function block from signature */
|
|
145
|
+
declare function createFunctionBlock(signature: string, name?: string): SmartBlock;
|
|
146
|
+
/** Create a property block */
|
|
147
|
+
declare function createPropertyBlock(propertyKey: string, propertyType?: 'current' | 'children' | 'parent'): SmartBlock;
|
|
148
|
+
/** Create an operator block */
|
|
149
|
+
declare function createOperatorBlock(symbol: string): SmartBlock;
|
|
150
|
+
/** Create a literal block */
|
|
151
|
+
declare function createLiteralBlock(value: string | number | boolean): SmartBlock;
|
|
152
|
+
/** Deep clone a block with new IDs */
|
|
153
|
+
declare function cloneBlock(block: SmartBlock): SmartBlock;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Validation Result Models
|
|
157
|
+
* API response types for formula validation
|
|
158
|
+
*/
|
|
159
|
+
/** Validation error/warning severity */
|
|
160
|
+
type ValidationSeverity = 'Error' | 'Warning';
|
|
161
|
+
/** Validation error or warning */
|
|
162
|
+
interface ValidationError {
|
|
163
|
+
message: string;
|
|
164
|
+
line: number;
|
|
165
|
+
column: number;
|
|
166
|
+
severity: ValidationSeverity;
|
|
167
|
+
}
|
|
168
|
+
/** Validation warning (same structure as error) */
|
|
169
|
+
type ValidationWarning = ValidationError;
|
|
170
|
+
/** Complete validation result from API */
|
|
171
|
+
interface ValidationResult {
|
|
172
|
+
isValid: boolean;
|
|
173
|
+
errors: ValidationError[];
|
|
174
|
+
warnings: ValidationWarning[];
|
|
175
|
+
dependencies: string[];
|
|
176
|
+
complexity: number;
|
|
177
|
+
}
|
|
178
|
+
/** Validation request payload */
|
|
179
|
+
interface ValidationRequest {
|
|
180
|
+
formula: string;
|
|
181
|
+
knownProperties?: string[];
|
|
182
|
+
levelSchemaId?: number;
|
|
183
|
+
templateId?: number;
|
|
184
|
+
}
|
|
185
|
+
/** Autocomplete suggestion */
|
|
186
|
+
interface AutocompleteSuggestion {
|
|
187
|
+
text: string;
|
|
188
|
+
displayText: string;
|
|
189
|
+
type: 'Function' | 'Property' | 'Operator' | 'Context';
|
|
190
|
+
description: string;
|
|
191
|
+
insertText: string;
|
|
192
|
+
category?: string;
|
|
193
|
+
}
|
|
194
|
+
/** Autocomplete context */
|
|
195
|
+
interface AutocompleteContext {
|
|
196
|
+
type: 'None' | 'Function' | 'Property' | 'Operator';
|
|
197
|
+
scope: string;
|
|
198
|
+
prefix: string;
|
|
199
|
+
}
|
|
200
|
+
/** Autocomplete response from API */
|
|
201
|
+
interface AutocompleteResponse {
|
|
202
|
+
suggestions: AutocompleteSuggestion[];
|
|
203
|
+
context: AutocompleteContext;
|
|
204
|
+
}
|
|
205
|
+
/** Autocomplete request payload */
|
|
206
|
+
interface AutocompleteRequest {
|
|
207
|
+
formula: string;
|
|
208
|
+
cursorPosition: number;
|
|
209
|
+
knownProperties?: string[];
|
|
210
|
+
levelSchemaId?: number;
|
|
211
|
+
}
|
|
212
|
+
/** API error response */
|
|
213
|
+
interface ApiErrorResponse {
|
|
214
|
+
error: string;
|
|
215
|
+
message?: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Formula Block Model - Types for formula functions and operators
|
|
220
|
+
*/
|
|
221
|
+
/** Function category types */
|
|
222
|
+
type FunctionCategory = 'Math' | 'Aggregation' | 'Logic' | 'Hierarchy' | 'Date' | 'String' | 'PhaseGate';
|
|
223
|
+
/** Parameter definition for a function */
|
|
224
|
+
interface ParameterDefinition {
|
|
225
|
+
name: string;
|
|
226
|
+
type: string;
|
|
227
|
+
description: string;
|
|
228
|
+
required: boolean;
|
|
229
|
+
defaultValue?: unknown;
|
|
230
|
+
}
|
|
231
|
+
/** Function definition */
|
|
232
|
+
interface FunctionDefinition {
|
|
233
|
+
name: string;
|
|
234
|
+
category: FunctionCategory;
|
|
235
|
+
description: string;
|
|
236
|
+
signature: string;
|
|
237
|
+
parameters: ParameterDefinition[];
|
|
238
|
+
returnType: string;
|
|
239
|
+
examples: string[];
|
|
240
|
+
}
|
|
241
|
+
/** Function category group */
|
|
242
|
+
interface FunctionCategoryGroup {
|
|
243
|
+
name: FunctionCategory;
|
|
244
|
+
displayName: string;
|
|
245
|
+
functions: FunctionDefinition[];
|
|
246
|
+
}
|
|
247
|
+
/** Operator definition */
|
|
248
|
+
interface OperatorDefinition {
|
|
249
|
+
symbol: string;
|
|
250
|
+
name: string;
|
|
251
|
+
type: 'arithmetic' | 'comparison' | 'logical';
|
|
252
|
+
description: string;
|
|
253
|
+
precedence: number;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
declare class FormulaEditor implements ControlValueAccessor {
|
|
257
|
+
readonly placeholder: _angular_core.InputSignal<string>;
|
|
258
|
+
readonly initialTokens: _angular_core.InputSignal<FormulaToken[]>;
|
|
259
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
260
|
+
readonly formulaChange: _angular_core.OutputEmitterRef<string>;
|
|
261
|
+
readonly tokensChange: _angular_core.OutputEmitterRef<FormulaToken[]>;
|
|
262
|
+
readonly onBlur: _angular_core.OutputEmitterRef<void>;
|
|
263
|
+
readonly onFocus: _angular_core.OutputEmitterRef<void>;
|
|
264
|
+
readonly tokens: _angular_core.WritableSignal<FormulaToken[]>;
|
|
265
|
+
/** Index range being dragged [start, end] inclusive */
|
|
266
|
+
private draggedRange;
|
|
267
|
+
/** Is currently dragging */
|
|
268
|
+
readonly isDragging: _angular_core.WritableSignal<boolean>;
|
|
269
|
+
/** Hovered function ID for highlighting */
|
|
270
|
+
readonly hoveredFunctionId: _angular_core.WritableSignal<string | null>;
|
|
271
|
+
/** Is focused */
|
|
272
|
+
readonly isFocused: _angular_core.WritableSignal<boolean>;
|
|
273
|
+
private onChange;
|
|
274
|
+
private onTouched;
|
|
275
|
+
/** Line numbers based on token count */
|
|
276
|
+
readonly lines: _angular_core.Signal<any[]>;
|
|
277
|
+
/** Serialized formula string */
|
|
278
|
+
readonly formulaString: _angular_core.Signal<string>;
|
|
279
|
+
constructor();
|
|
280
|
+
writeValue(value: FormulaToken[] | null): void;
|
|
281
|
+
registerOnChange(fn: (value: FormulaToken[]) => void): void;
|
|
282
|
+
registerOnTouched(fn: () => void): void;
|
|
283
|
+
/**
|
|
284
|
+
* Add a block from toolbar (converts SmartBlock to tokens)
|
|
285
|
+
*/
|
|
286
|
+
addBlock(block: SmartBlock): void;
|
|
287
|
+
/**
|
|
288
|
+
* Add tokens directly
|
|
289
|
+
*/
|
|
290
|
+
addTokens(newTokens: FormulaToken[]): void;
|
|
291
|
+
/**
|
|
292
|
+
* Clear all tokens
|
|
293
|
+
*/
|
|
294
|
+
clear(): void;
|
|
295
|
+
/**
|
|
296
|
+
* Get current formula string
|
|
297
|
+
*/
|
|
298
|
+
serialize(): string;
|
|
299
|
+
/**
|
|
300
|
+
* Get current tokens
|
|
301
|
+
*/
|
|
302
|
+
getTokens(): FormulaToken[];
|
|
303
|
+
handleFocus(): void;
|
|
304
|
+
handleBlur(): void;
|
|
305
|
+
/**
|
|
306
|
+
* Handle drag start - determine what tokens to drag
|
|
307
|
+
*/
|
|
308
|
+
onDragStart(event: CdkDragStart, token: FormulaToken, index: number): void;
|
|
309
|
+
/**
|
|
310
|
+
* Handle drop - reorder tokens in the formula
|
|
311
|
+
*/
|
|
312
|
+
onDrop(event: CdkDragDrop<FormulaToken[]>): void;
|
|
313
|
+
/**
|
|
314
|
+
* Reset drag state
|
|
315
|
+
*/
|
|
316
|
+
private resetDragState;
|
|
317
|
+
/**
|
|
318
|
+
* Handle drag end
|
|
319
|
+
* NOTE: CDK fires cdkDragEnded BEFORE cdkDropListDropped
|
|
320
|
+
* So we don't reset draggedRange here - onDrop handles it
|
|
321
|
+
*/
|
|
322
|
+
onDragEnd(): void;
|
|
323
|
+
/**
|
|
324
|
+
* Remove a token or function
|
|
325
|
+
*/
|
|
326
|
+
removeToken(token: FormulaToken, index: number): void;
|
|
327
|
+
onTokenHover(token: FormulaToken): void;
|
|
328
|
+
onTokenLeave(): void;
|
|
329
|
+
/**
|
|
330
|
+
* Check if token should be highlighted
|
|
331
|
+
* Only structural tokens (fn-open, fn-close, fn-separator) get highlighted
|
|
332
|
+
* Content tokens (property, operator, literal) inside function are NOT highlighted
|
|
333
|
+
*/
|
|
334
|
+
isHighlighted(token: FormulaToken): boolean;
|
|
335
|
+
/** Base token classes */
|
|
336
|
+
private readonly baseTokenClasses;
|
|
337
|
+
/**
|
|
338
|
+
* Get Tailwind classes for a token
|
|
339
|
+
*/
|
|
340
|
+
getTokenClasses(token: FormulaToken): string;
|
|
341
|
+
/**
|
|
342
|
+
* Convert SmartBlock to FormulaTokens
|
|
343
|
+
*/
|
|
344
|
+
private smartBlockToTokens;
|
|
345
|
+
private emit;
|
|
346
|
+
/**
|
|
347
|
+
* Track function for ngFor
|
|
348
|
+
*/
|
|
349
|
+
trackByToken(_index: number, token: FormulaToken): string;
|
|
350
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaEditor, never>;
|
|
351
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaEditor, "mt-formula-editor", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "initialTokens": { "alias": "initialTokens"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "formulaChange": "formulaChange"; "tokensChange": "tokensChange"; "onBlur": "onBlur"; "onFocus": "onFocus"; }, never, never, true, never>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
type ToolbarTab = 'functions' | 'properties' | 'operators';
|
|
355
|
+
interface OperatorGroup {
|
|
356
|
+
type: string;
|
|
357
|
+
operators: OperatorDefinition[];
|
|
358
|
+
}
|
|
359
|
+
declare class FormulaToolbar {
|
|
360
|
+
/** Known properties to show in properties tab */
|
|
361
|
+
readonly knownProperties: _angular_core.InputSignal<string[]>;
|
|
362
|
+
/** Function categories (from API or static data) */
|
|
363
|
+
readonly functionCategories: _angular_core.InputSignal<FunctionCategoryGroup[]>;
|
|
364
|
+
/** Operators list */
|
|
365
|
+
readonly operators: _angular_core.InputSignal<OperatorDefinition[]>;
|
|
366
|
+
/** Initial active tab */
|
|
367
|
+
readonly initialTab: _angular_core.InputSignal<ToolbarTab>;
|
|
368
|
+
/** Placeholder for search input */
|
|
369
|
+
readonly searchPlaceholder: _angular_core.InputSignal<string>;
|
|
370
|
+
/** Labels */
|
|
371
|
+
readonly labels: _angular_core.InputSignal<{
|
|
372
|
+
functions?: string;
|
|
373
|
+
properties?: string;
|
|
374
|
+
operators?: string;
|
|
375
|
+
noFunctionsFound?: string;
|
|
376
|
+
noPropertiesAvailable?: string;
|
|
377
|
+
noOperatorsFound?: string;
|
|
378
|
+
}>;
|
|
379
|
+
/** Insert event - emits SmartBlock for the editor */
|
|
380
|
+
readonly onBlockInsert: _angular_core.OutputEmitterRef<SmartBlock>;
|
|
381
|
+
/** Tab change event */
|
|
382
|
+
readonly onTabChange: _angular_core.OutputEmitterRef<ToolbarTab>;
|
|
383
|
+
/** Active tab */
|
|
384
|
+
readonly activeTab: _angular_core.WritableSignal<ToolbarTab>;
|
|
385
|
+
/** Tab options */
|
|
386
|
+
readonly tabOptions: {
|
|
387
|
+
label: string;
|
|
388
|
+
value: ToolbarTab;
|
|
389
|
+
}[];
|
|
390
|
+
/** Search query */
|
|
391
|
+
readonly searchQuery: _angular_core.WritableSignal<string>;
|
|
392
|
+
/** Custom value input */
|
|
393
|
+
readonly customValue: _angular_core.WritableSignal<string>;
|
|
394
|
+
/** Detected type of custom value */
|
|
395
|
+
readonly customValueType: _angular_core.Signal<"string" | "number" | "text">;
|
|
396
|
+
/** Preview of custom value */
|
|
397
|
+
readonly customValuePreview: _angular_core.Signal<string>;
|
|
398
|
+
/** CSS class for custom value type */
|
|
399
|
+
readonly customValueTypeClass: _angular_core.Signal<"bg-rose-100 text-rose-700 hover:bg-rose-200 dark:bg-rose-900/30 dark:text-rose-300 dark:hover:bg-rose-900/50" | "bg-emerald-100 text-emerald-700 hover:bg-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-300 dark:hover:bg-emerald-900/50" | "bg-slate-100 text-slate-700 hover:bg-slate-200 dark:bg-slate-700 dark:text-slate-300 dark:hover:bg-slate-600">;
|
|
400
|
+
constructor();
|
|
401
|
+
/** Filtered categories based on search */
|
|
402
|
+
readonly filteredCategories: _angular_core.Signal<FunctionCategoryGroup[]>;
|
|
403
|
+
/** Filtered properties based on search */
|
|
404
|
+
readonly filteredProperties: _angular_core.Signal<string[]>;
|
|
405
|
+
/** Filtered operators based on search */
|
|
406
|
+
readonly filteredOperators: _angular_core.Signal<OperatorDefinition[]>;
|
|
407
|
+
/** Count of filtered items per tab */
|
|
408
|
+
readonly filteredFunctionsCount: _angular_core.Signal<number>;
|
|
409
|
+
readonly filteredPropertiesCount: _angular_core.Signal<number>;
|
|
410
|
+
readonly filteredOperatorsCount: _angular_core.Signal<number>;
|
|
411
|
+
/** Smart search effect - switches to tab with results */
|
|
412
|
+
private readonly smartSearchEffect;
|
|
413
|
+
/** Group operators by type */
|
|
414
|
+
readonly operatorGroups: _angular_core.Signal<OperatorGroup[]>;
|
|
415
|
+
/** Total item count for current tab */
|
|
416
|
+
readonly itemCount: _angular_core.Signal<number>;
|
|
417
|
+
readonly labelFunctions: _angular_core.Signal<string>;
|
|
418
|
+
readonly labelProperties: _angular_core.Signal<string>;
|
|
419
|
+
readonly labelOperators: _angular_core.Signal<string>;
|
|
420
|
+
readonly labelNoFunctions: _angular_core.Signal<string>;
|
|
421
|
+
readonly labelNoProperties: _angular_core.Signal<string>;
|
|
422
|
+
readonly labelNoOperators: _angular_core.Signal<string>;
|
|
423
|
+
/** Get count for a specific tab (filtered when searching) */
|
|
424
|
+
getTabCount(tab: ToolbarTab): number;
|
|
425
|
+
/** Check if a tab has results when searching */
|
|
426
|
+
tabHasResults(tab: ToolbarTab): boolean;
|
|
427
|
+
/** Set active tab */
|
|
428
|
+
setActiveTab(tab: ToolbarTab): void;
|
|
429
|
+
/** Emit block insert event */
|
|
430
|
+
insertBlock(block: SmartBlock): void;
|
|
431
|
+
/** Clear search */
|
|
432
|
+
clearSearch(): void;
|
|
433
|
+
/** Insert custom value */
|
|
434
|
+
insertCustomValue(): void;
|
|
435
|
+
/** Clear custom value input */
|
|
436
|
+
clearCustomValue(): void;
|
|
437
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaToolbar, never>;
|
|
438
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaToolbar, "mt-formula-toolbar", never, { "knownProperties": { "alias": "knownProperties"; "required": false; "isSignal": true; }; "functionCategories": { "alias": "functionCategories"; "required": false; "isSignal": true; }; "operators": { "alias": "operators"; "required": false; "isSignal": true; }; "initialTab": { "alias": "initialTab"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "onBlockInsert": "onBlockInsert"; "onTabChange": "onTabChange"; }, never, never, true, never>;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
type ToolbarItemType = 'function' | 'property' | 'operator';
|
|
442
|
+
declare class FormulaToolbarItem {
|
|
443
|
+
/** Item type */
|
|
444
|
+
readonly type: _angular_core.InputSignal<ToolbarItemType>;
|
|
445
|
+
/** Item value (function name, property key, operator symbol) */
|
|
446
|
+
readonly value: _angular_core.InputSignal<string>;
|
|
447
|
+
/** Display value (optional, defaults to value) */
|
|
448
|
+
readonly display: _angular_core.InputSignal<string | undefined>;
|
|
449
|
+
/** Description for tooltip */
|
|
450
|
+
readonly description: _angular_core.InputSignal<string>;
|
|
451
|
+
/** Function signature (for functions only, e.g., "SUM(values)") */
|
|
452
|
+
readonly signature: _angular_core.InputSignal<string | undefined>;
|
|
453
|
+
/** Property type for properties */
|
|
454
|
+
readonly propertyType: _angular_core.InputSignal<"current" | "children" | "parent">;
|
|
455
|
+
/** Insert event - emits SmartBlock */
|
|
456
|
+
readonly onInsert: _angular_core.OutputEmitterRef<SmartBlock>;
|
|
457
|
+
/** Computed display value */
|
|
458
|
+
readonly displayValue: _angular_core.Signal<string>;
|
|
459
|
+
/** Build SmartBlock from item data */
|
|
460
|
+
readonly smartBlock: _angular_core.Signal<SmartBlock>;
|
|
461
|
+
/** Item CSS class based on type */
|
|
462
|
+
readonly itemClass: _angular_core.Signal<"bg-slate-200 text-slate-700 hover:bg-slate-300 dark:bg-slate-700 dark:text-slate-300 dark:hover:bg-slate-600" | "bg-amber-100 text-amber-700 hover:bg-amber-200 dark:bg-amber-900/30 dark:text-amber-300 dark:hover:bg-amber-900/50" | "bg-sky-100 text-sky-700 hover:bg-sky-200 dark:bg-sky-900/30 dark:text-sky-300 dark:hover:bg-sky-900/50" | "bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300">;
|
|
463
|
+
/** Handle click - emit the SmartBlock */
|
|
464
|
+
handleClick(): void;
|
|
465
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaToolbarItem, never>;
|
|
466
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaToolbarItem, "mt-formula-toolbar-item", never, { "type": { "alias": "type"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "display": { "alias": "display"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "signature": { "alias": "signature"; "required": false; "isSignal": true; }; "propertyType": { "alias": "propertyType"; "required": false; "isSignal": true; }; }, { "onInsert": "onInsert"; }, never, never, true, never>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
declare class FormulaStatusBar {
|
|
470
|
+
/** Validation result */
|
|
471
|
+
readonly validation: _angular_core.InputSignal<ValidationResult | null>;
|
|
472
|
+
/** Labels for i18n support */
|
|
473
|
+
readonly labels: _angular_core.InputSignal<{
|
|
474
|
+
valid?: string;
|
|
475
|
+
invalid?: string;
|
|
476
|
+
complexity?: string;
|
|
477
|
+
dependencies?: string;
|
|
478
|
+
}>;
|
|
479
|
+
/** Is formula valid */
|
|
480
|
+
readonly isValid: _angular_core.Signal<boolean>;
|
|
481
|
+
/** Complexity score */
|
|
482
|
+
readonly complexity: _angular_core.Signal<number>;
|
|
483
|
+
/** Dependencies list */
|
|
484
|
+
readonly dependencies: _angular_core.Signal<string[]>;
|
|
485
|
+
/** Dependencies as text */
|
|
486
|
+
readonly dependenciesText: _angular_core.Signal<string>;
|
|
487
|
+
/** First error */
|
|
488
|
+
readonly firstError: _angular_core.Signal<_masterteam_components_formula.ValidationError | null>;
|
|
489
|
+
/** Complexity CSS class */
|
|
490
|
+
readonly complexityClass: _angular_core.Signal<"text-emerald-600 dark:text-emerald-400" | "text-amber-600 dark:text-amber-400" | "text-rose-600 dark:text-rose-400">;
|
|
491
|
+
readonly labelValid: _angular_core.Signal<string>;
|
|
492
|
+
readonly labelInvalid: _angular_core.Signal<string>;
|
|
493
|
+
readonly labelComplexity: _angular_core.Signal<string>;
|
|
494
|
+
readonly labelDependencies: _angular_core.Signal<string>;
|
|
495
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormulaStatusBar, never>;
|
|
496
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormulaStatusBar, "mt-formula-status-bar", never, { "validation": { "alias": "validation"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export { FormulaEditor, FormulaStatusBar, FormulaToolbar, FormulaToolbarItem, cloneBlock, cloneToken, cloneTokens, createFunctionBlock, createFunctionTokens, createLiteralBlock, createLiteralToken, createOperatorBlock, createOperatorToken, createPropertyBlock, createPropertyToken, findFunctionRange, generateFunctionId, generateSmartBlockId, generateTokenId, getArgumentIndexAtPosition, getFunctionTokens, isValidDropPosition, parseSignature, recalculateDepths, serializeTokens };
|
|
500
|
+
export type { ApiErrorResponse, ArgumentSlot, AutocompleteContext, AutocompleteRequest, AutocompleteResponse, AutocompleteSuggestion, BlockType, DragBehavior, FormulaToken, FunctionCategory, FunctionCategoryGroup, FunctionDefinition, FunctionInfo, OperatorDefinition, ParameterDefinition, SmartBlock, TokenType, ToolbarItemType, ToolbarTab, ValidationError, ValidationRequest, ValidationResult, ValidationSeverity, ValidationWarning };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TemplateRef } from '@angular/core';
|
|
2
3
|
import { ControlValueAccessor, NgControl, Validators } from '@angular/forms';
|
|
3
4
|
import { ToggleSwitch, ToggleSwitchChangeEvent } from 'primeng/toggleswitch';
|
|
4
5
|
import { isInvalid } from '@masterteam/components';
|
|
6
|
+
import { MTIcon } from '@masterteam/icons';
|
|
5
7
|
|
|
6
8
|
declare class ToggleField implements ControlValueAccessor {
|
|
7
9
|
toggle: ToggleSwitch;
|
|
@@ -11,6 +13,10 @@ declare class ToggleField implements ControlValueAccessor {
|
|
|
11
13
|
readonly: _angular_core.InputSignal<boolean>;
|
|
12
14
|
pInputs: _angular_core.InputSignal<Partial<ToggleSwitch> | undefined>;
|
|
13
15
|
required: _angular_core.InputSignal<boolean>;
|
|
16
|
+
toggleShape: _angular_core.InputSignal<"toggle" | "card">;
|
|
17
|
+
icon: _angular_core.InputSignal<MTIcon | undefined>;
|
|
18
|
+
descriptionCard: _angular_core.InputSignal<string | undefined>;
|
|
19
|
+
toggleCardBottom: _angular_core.Signal<TemplateRef<unknown> | undefined>;
|
|
14
20
|
onChange: _angular_core.OutputEmitterRef<ToggleSwitchChangeEvent>;
|
|
15
21
|
ngControl: NgControl;
|
|
16
22
|
isInvalid: typeof isInvalid;
|
|
@@ -28,7 +34,7 @@ declare class ToggleField implements ControlValueAccessor {
|
|
|
28
34
|
registerOnTouched(fn: any): void;
|
|
29
35
|
setDisabledState(disabled: boolean): void;
|
|
30
36
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToggleField, never>;
|
|
31
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleField, "mt-toggle-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; },
|
|
37
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ToggleField, "mt-toggle-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "pInputs": { "alias": "pInputs"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "toggleShape": { "alias": "toggleShape"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "descriptionCard": { "alias": "descriptionCard"; "required": false; "isSignal": true; }; }, { "onChange": "onChange"; }, ["toggleCardBottom"], never, true, never>;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
export { ToggleField };
|
|
@@ -348,7 +348,14 @@ declare class CheckboxFieldConfig extends BaseFieldConfig {
|
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
declare class ToggleFieldConfig extends BaseFieldConfig {
|
|
351
|
-
|
|
351
|
+
toggleShape?: 'toggle' | 'card';
|
|
352
|
+
icon?: string;
|
|
353
|
+
descriptionCard?: string;
|
|
354
|
+
constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
|
|
355
|
+
toggleShape?: 'toggle' | 'card';
|
|
356
|
+
icon?: string;
|
|
357
|
+
descriptionCard?: string;
|
|
358
|
+
});
|
|
352
359
|
}
|
|
353
360
|
declare class EditorFieldConfig extends BaseFieldConfig {
|
|
354
361
|
constructor(config: Omit<BaseFieldConstructorConfig, 'type'>);
|
|
@@ -375,7 +382,7 @@ declare class SpacerFieldConfig extends BaseFieldConfig {
|
|
|
375
382
|
});
|
|
376
383
|
}
|
|
377
384
|
type DynamicFieldConfig = {
|
|
378
|
-
[K in keyof (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)]?: (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)[K];
|
|
385
|
+
[K in keyof (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)]?: (TextFieldConfig & TextareaFieldConfig & SelectFieldConfig & DateFieldConfig & NumberFieldConfig & SliderFieldConfig & MultiSelectFieldConfig & PickListFieldConfig & CheckboxFieldConfig & ToggleFieldConfig & ColorPickerFieldConfig & IconFieldConfig & SpacerFieldConfig & BaseFieldConfig)[K];
|
|
379
386
|
};
|
|
380
387
|
interface LayoutConfig {
|
|
381
388
|
containerClass?: string;
|
|
@@ -465,7 +472,7 @@ interface Response<T> {
|
|
|
465
472
|
code: number;
|
|
466
473
|
locale: string;
|
|
467
474
|
message?: string | null;
|
|
468
|
-
errors?:
|
|
475
|
+
errors?: unknown | null;
|
|
469
476
|
data: T;
|
|
470
477
|
cacheSession?: string;
|
|
471
478
|
}
|
|
@@ -522,19 +529,19 @@ declare abstract class CrudStateBase<T, TState extends LoadingStateShape<TLoad>,
|
|
|
522
529
|
/**
|
|
523
530
|
* Load data (single item or array) with config object
|
|
524
531
|
*/
|
|
525
|
-
protected load<TData = T[]>(ctx: StateContext<TState>, config: CrudLoadConfig<T, TState, TData>): Observable<
|
|
532
|
+
protected load<TData = T[]>(ctx: StateContext<TState>, config: CrudLoadConfig<T, TState, TData>): Observable<Response<TData>>;
|
|
526
533
|
/**
|
|
527
534
|
* Create one entity with config object
|
|
528
535
|
*/
|
|
529
|
-
protected create(ctx: StateContext<TState>, config: CrudCreateConfig<T, TState>): Observable<
|
|
536
|
+
protected create(ctx: StateContext<TState>, config: CrudCreateConfig<T, TState>): Observable<Response<T>>;
|
|
530
537
|
/**
|
|
531
538
|
* Update one entity with config object
|
|
532
539
|
*/
|
|
533
|
-
protected update(ctx: StateContext<TState>, config: CrudUpdateConfig<T, TState>): Observable<
|
|
540
|
+
protected update(ctx: StateContext<TState>, config: CrudUpdateConfig<T, TState>): Observable<Response<T>>;
|
|
534
541
|
/**
|
|
535
542
|
* Delete one entity with config object
|
|
536
543
|
*/
|
|
537
|
-
protected delete(ctx: StateContext<TState>, config: CrudDeleteConfig<T, TState>): Observable<
|
|
544
|
+
protected delete(ctx: StateContext<TState>, config: CrudDeleteConfig<T, TState>): Observable<Response<void>>;
|
|
538
545
|
}
|
|
539
546
|
|
|
540
547
|
type TailwindColorPalette = {
|
|
@@ -567,7 +574,7 @@ interface ApiRequestConfig<TState, TResponse> {
|
|
|
567
574
|
onError?: (error: any, state: TState) => Partial<TState> | void;
|
|
568
575
|
errorMessage?: string;
|
|
569
576
|
}
|
|
570
|
-
declare function handleApiRequest<TState extends LoadingStateShape<string>, TResponse>(config: ApiRequestConfig<TState, TResponse>): Observable<
|
|
577
|
+
declare function handleApiRequest<TState extends LoadingStateShape<string>, TResponse>(config: ApiRequestConfig<TState, TResponse>): Observable<TResponse>;
|
|
571
578
|
|
|
572
579
|
interface EntityAdapter<T> {
|
|
573
580
|
addOne(state: T[], entity: T): T[];
|
|
@@ -579,4 +586,4 @@ interface EntityAdapter<T> {
|
|
|
579
586
|
declare function createEntityAdapter<T>(): EntityAdapter<T>;
|
|
580
587
|
|
|
581
588
|
export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DateFieldConfig, EditorFieldConfig, IconFieldConfig, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, RadioButtonFieldConfig, RadioCardsFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTMessages, setLoadingError, startLoading, wrapValidatorWithMessage };
|
|
582
|
-
export type { ApiRequestConfig, BaseFieldConstructorConfig, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, LayoutConfig, LoadingStateShape, MTThemeOptions, PaletteShade, QueryResult, ResponsiveColSpan, SectionConfig, ValidatorType };
|
|
589
|
+
export type { ApiRequestConfig, BaseFieldConstructorConfig, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, LayoutConfig, LoadingStateShape, MTThemeOptions, PaletteShade, QueryResult, Response, ResponsiveColSpan, SectionConfig, ValidatorType };
|