xt-components 0.6.4 → 0.7.0
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/fesm2022/xt-components.mjs +866 -269
- package/fesm2022/xt-components.mjs.map +1 -1
- package/package.json +15 -14
- package/types/xt-components.d.ts +1367 -0
- package/index.d.ts +0 -670
|
@@ -0,0 +1,1367 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Signal, WritableSignal, InputSignal, OutputEmitterRef, ModelSignal, Type, InjectionToken, AfterViewInit, OnInit } from '@angular/core';
|
|
3
|
+
import { FormGroup, AbstractControl, FormBuilder } from '@angular/forms';
|
|
4
|
+
import { XtTypeInfo, XtTypeReference, XtTypeResolver, XtTypeHandler, MappingHelper } from 'xt-type';
|
|
5
|
+
import * as xt_components from 'xt-components';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import { NgComponentOutlet } from '@angular/common';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Just declare a type marker for Workflows
|
|
11
|
+
*/
|
|
12
|
+
type XtWorkflow = {};
|
|
13
|
+
|
|
14
|
+
/** Information about a registered component plugin */
|
|
15
|
+
type XtComponentInfo<T> = {
|
|
16
|
+
componentName: string;
|
|
17
|
+
componentClass: T;
|
|
18
|
+
typesHandled: string[];
|
|
19
|
+
outputs?: XtOutputType[];
|
|
20
|
+
};
|
|
21
|
+
/** Information about a registered workflow plugin */
|
|
22
|
+
type XtWorkflowInfo<T extends XtWorkflow> = {
|
|
23
|
+
name: string;
|
|
24
|
+
class: T;
|
|
25
|
+
workflowsHandled: string[];
|
|
26
|
+
};
|
|
27
|
+
/** Information about a registered type handler plugin */
|
|
28
|
+
type XtTypeHandlerInfo<T> = {
|
|
29
|
+
typesHandled: string[];
|
|
30
|
+
handlerClass: T;
|
|
31
|
+
};
|
|
32
|
+
/** Information about a registered action */
|
|
33
|
+
type XtActionInfo<T> = {
|
|
34
|
+
description: string;
|
|
35
|
+
visible: boolean;
|
|
36
|
+
handlerClass: any;
|
|
37
|
+
iconUrl?: string;
|
|
38
|
+
};
|
|
39
|
+
/** Information about a registered action handler that groups actions by type */
|
|
40
|
+
type XtActionHandlerInfo<T> = {
|
|
41
|
+
types: string[];
|
|
42
|
+
actions: {
|
|
43
|
+
[name: string]: XtActionInfo<T>;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
/** Information about a registered plugin containing components, workflows, types, and action handlers */
|
|
47
|
+
type XtPluginInfo = {
|
|
48
|
+
name: string;
|
|
49
|
+
uriLogo?: string;
|
|
50
|
+
components?: XtComponentInfo<any>[];
|
|
51
|
+
workflows?: XtWorkflowInfo<any>[];
|
|
52
|
+
types?: XtTypeInfo;
|
|
53
|
+
typeHandlers?: XtTypeHandlerInfo<any>[];
|
|
54
|
+
actionHandlers?: XtActionHandlerInfo<any>[];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Represents a registered action with its metadata and enabled state */
|
|
58
|
+
declare class XtAction<T> {
|
|
59
|
+
/** The unique name of the action */
|
|
60
|
+
name: string;
|
|
61
|
+
/** Metadata describing the action */
|
|
62
|
+
info: XtActionInfo<T>;
|
|
63
|
+
/** Signal indicating whether the action is currently enabled */
|
|
64
|
+
enabled: _angular_core.WritableSignal<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Creates a new XtAction instance
|
|
67
|
+
* @param name - The unique name of the action
|
|
68
|
+
* @param info - Metadata describing the action
|
|
69
|
+
* @param enabled - Whether the action is initially enabled (defaults to false)
|
|
70
|
+
*/
|
|
71
|
+
constructor(name: string, info: XtActionInfo<T>, enabled?: boolean);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A XtContext provides all the necessary information for an ng-extended component to operate. It is passed from parent to child component and pass
|
|
76
|
+
* - The display mode - View, Inline view or Edit
|
|
77
|
+
* - The value, either directly as a signal or in a formgroup when editing.
|
|
78
|
+
* - The valueType, necessary to find the right ng-extended component to display
|
|
79
|
+
*
|
|
80
|
+
* To do this, it maintains a hierarchy of context and subContexts by name.
|
|
81
|
+
*/
|
|
82
|
+
type XtContext<T> = {
|
|
83
|
+
displayMode: XtDisplayMode;
|
|
84
|
+
subName?: string;
|
|
85
|
+
parentFormGroup?: FormGroup;
|
|
86
|
+
localFormGroup?: FormGroup;
|
|
87
|
+
/**
|
|
88
|
+
* When the value in the context is a reference to another type
|
|
89
|
+
*/
|
|
90
|
+
reference?: XtTypeReference;
|
|
91
|
+
/**
|
|
92
|
+
* If it's a reference, we keep the context referenced
|
|
93
|
+
*/
|
|
94
|
+
referencedContext?: XtContext<any>;
|
|
95
|
+
/**
|
|
96
|
+
* creates the referencedContext by using this referenced value
|
|
97
|
+
* @param val
|
|
98
|
+
*
|
|
99
|
+
updateReferencedContext(val: any, valueType?:string): void;*/
|
|
100
|
+
/**
|
|
101
|
+
* Signal when all the asynchronously defined subreferences are resolved.
|
|
102
|
+
*
|
|
103
|
+
subReferencesResolved: WritableSignal<boolean>;
|
|
104
|
+
*/
|
|
105
|
+
parentContext?: XtContext<any>;
|
|
106
|
+
isInForm(): boolean;
|
|
107
|
+
formGroup(): FormGroup | undefined;
|
|
108
|
+
formControlNameOrNull(): string | null;
|
|
109
|
+
formControlValue(): any | null;
|
|
110
|
+
subValue(subName?: string): T | null | undefined;
|
|
111
|
+
subContext(subName: string | undefined | null, subType?: string, typeResolver?: XtTypeResolver | null): XtContext<any>;
|
|
112
|
+
elementSetContext(subElement: any): XtContext<any>;
|
|
113
|
+
displayValue: Signal<T | null>;
|
|
114
|
+
setDisplayValue(newValue: T | null | undefined, type?: string): XtContext<T>;
|
|
115
|
+
setFormValue(newValue: T | null | undefined, markAsDirty?: boolean): boolean;
|
|
116
|
+
value(): T | null | undefined;
|
|
117
|
+
valueType?: string;
|
|
118
|
+
toString(): string;
|
|
119
|
+
listActions: WritableSignal<XtAction<T>[] | null>;
|
|
120
|
+
isReference(): boolean;
|
|
121
|
+
setReferenceInfo(ref: XtTypeReference): void;
|
|
122
|
+
};
|
|
123
|
+
/** Display modes controlling how a value is presented: inline, full view, editable, or list. */
|
|
124
|
+
type XtDisplayMode = 'INLINE_VIEW' | 'FULL_VIEW' | 'FULL_EDITABLE' | 'LIST_VIEW';
|
|
125
|
+
/**
|
|
126
|
+
* Base implementation of the XtContext interface.
|
|
127
|
+
* Manages display mode, form integration, child context hierarchy, and value tracking
|
|
128
|
+
* for an ng-extended component.
|
|
129
|
+
*/
|
|
130
|
+
declare class XtBaseContext<T> implements XtContext<T> {
|
|
131
|
+
/** The current display mode for this context. Defaults to FULL_VIEW. */
|
|
132
|
+
displayMode: XtDisplayMode;
|
|
133
|
+
/**
|
|
134
|
+
* When editable, the value is stored in a parent formGroup
|
|
135
|
+
*/
|
|
136
|
+
subName?: string;
|
|
137
|
+
/** The parent FormGroup when this context is a child within a reactive form. */
|
|
138
|
+
parentFormGroup?: FormGroup<any>;
|
|
139
|
+
/**
|
|
140
|
+
* When the context is a child, it potentially needs to update its parent value
|
|
141
|
+
*/
|
|
142
|
+
parentContext?: XtBaseContext<any>;
|
|
143
|
+
/**
|
|
144
|
+
* All child contexts are kept in this map
|
|
145
|
+
*/
|
|
146
|
+
protected childContexts?: Map<string, XtBaseContext<any>>;
|
|
147
|
+
/**
|
|
148
|
+
* localFormGroup exists only for composite components: it's children are all gathered in a form group
|
|
149
|
+
*/
|
|
150
|
+
localFormGroup?: FormGroup<any>;
|
|
151
|
+
/**
|
|
152
|
+
* When not managed by a form, the value is here
|
|
153
|
+
*/
|
|
154
|
+
nonFormValue?: WritableSignal<T | null>;
|
|
155
|
+
/** The type identifier for the value contained in this context. */
|
|
156
|
+
valueType?: string;
|
|
157
|
+
/**
|
|
158
|
+
* When the value in the context is a reference to another type
|
|
159
|
+
*/
|
|
160
|
+
reference?: XtTypeReference;
|
|
161
|
+
/**
|
|
162
|
+
* If it's a reference, we keep the context referenced
|
|
163
|
+
*
|
|
164
|
+
referencedContext?:XtContext<any>;*/
|
|
165
|
+
/**
|
|
166
|
+
* Keeps track of all the possible actions for this context
|
|
167
|
+
* @protected
|
|
168
|
+
*/
|
|
169
|
+
listActions: WritableSignal<XtAction<T>[] | null>;
|
|
170
|
+
/**
|
|
171
|
+
* Creates a new XtBaseContext instance.
|
|
172
|
+
* @param displayMode - The display mode for this context
|
|
173
|
+
* @param subName - Optional sub-name used within a parent form group
|
|
174
|
+
* @param parentGroup - Optional parent FormGroup for reactive form integration
|
|
175
|
+
* @param parentContext - Optional parent context for hierarchy management
|
|
176
|
+
*/
|
|
177
|
+
constructor(displayMode: XtDisplayMode, subName?: string, parentGroup?: FormGroup, parentContext?: XtBaseContext<any>);
|
|
178
|
+
/**
|
|
179
|
+
* Sets the display value for this context when not managed by a reactive form.
|
|
180
|
+
* Propagates changes to child contexts and optionally notifies the parent context.
|
|
181
|
+
* @param newValue - The new value to set
|
|
182
|
+
* @param type - Optional type identifier to assign
|
|
183
|
+
* @param updateParent - Whether to propagate the change to the parent context (default true)
|
|
184
|
+
* @returns This context instance for chaining
|
|
185
|
+
*/
|
|
186
|
+
setDisplayValue(newValue: T | null | undefined, type?: string, updateParent?: boolean): XtBaseContext<T>;
|
|
187
|
+
/** Computed signal that returns the current display value from non-form storage. */
|
|
188
|
+
displayValue: Signal<T | null>;
|
|
189
|
+
/**
|
|
190
|
+
* Checks whether this context is bound to a reactive form group.
|
|
191
|
+
* @returns True if a form group exists
|
|
192
|
+
*/
|
|
193
|
+
isInForm(): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Returns the sub-name used as the form control name, or null if not in a form.
|
|
196
|
+
* @returns The sub-name or null
|
|
197
|
+
*/
|
|
198
|
+
formControlNameOrNull(): string | null;
|
|
199
|
+
/**
|
|
200
|
+
* Returns the current value from either the non-form signal or the form control.
|
|
201
|
+
* @returns The current value, or null/undefined
|
|
202
|
+
*/
|
|
203
|
+
value(): T | null | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Returns a sub-value by name from the current value object.
|
|
206
|
+
* @param subsubName - Optional sub-key to retrieve from the value object
|
|
207
|
+
* @returns The sub-value or the full value if no key is given
|
|
208
|
+
*/
|
|
209
|
+
subValue(subsubName?: string): any | null | undefined;
|
|
210
|
+
/**
|
|
211
|
+
* Enable child contexts to update its own value in the parent context whenever it's value changes
|
|
212
|
+
*/
|
|
213
|
+
protected updateSubDisplayValue(subName: string, subValue: any): void;
|
|
214
|
+
/**
|
|
215
|
+
* Retrieves the value from the parent form group for this context's sub-name.
|
|
216
|
+
* @returns The form control value, or undefined if not in a form
|
|
217
|
+
*/
|
|
218
|
+
formControlValue(): T | null | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* Sets the value in the parent form group for this context's sub-name.
|
|
221
|
+
* @param newValue - The new value to set on the form control
|
|
222
|
+
* @param markAsDirty - Whether to mark the control as dirty (default false)
|
|
223
|
+
* @returns True if the value was successfully set
|
|
224
|
+
*/
|
|
225
|
+
setFormValue(newValue: T | null | undefined, markAsDirty?: boolean): boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Returns the context associated with a specific element in a set.
|
|
228
|
+
* Value must be an array.
|
|
229
|
+
* @param elementIndex
|
|
230
|
+
*/
|
|
231
|
+
elementSetContext(elementIndex: number): XtContext<any>;
|
|
232
|
+
/**
|
|
233
|
+
* Returns or creates a child context for the given sub-name.
|
|
234
|
+
* Resolves type information and references when a typeResolver is provided.
|
|
235
|
+
* @param subName - The sub-name for the child context
|
|
236
|
+
* @param subType - Optional type hint for the child
|
|
237
|
+
* @param typeResolver - Optional type resolver for resolving sub-types and references
|
|
238
|
+
* @returns The child XtContext
|
|
239
|
+
*/
|
|
240
|
+
subContext(subName: string | undefined | null, subType?: string, typeResolver?: XtTypeResolver | null): XtContext<any>;
|
|
241
|
+
/**
|
|
242
|
+
* Returns the available form group, preferring localFormGroup over parentFormGroup.
|
|
243
|
+
* @returns The form group or undefined
|
|
244
|
+
*/
|
|
245
|
+
formGroup(): FormGroup | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* Checks whether this context holds a reference to another type.
|
|
248
|
+
* @returns True if a reference is set
|
|
249
|
+
*/
|
|
250
|
+
isReference(): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Sets the type reference information for this context.
|
|
253
|
+
* @param reference - The type reference to set
|
|
254
|
+
*/
|
|
255
|
+
setReferenceInfo(reference: XtTypeReference): void;
|
|
256
|
+
/**
|
|
257
|
+
* creates the referencedContext by using this referenced value
|
|
258
|
+
* @param val
|
|
259
|
+
*
|
|
260
|
+
updateReferencedContext(val: any, valueType?:string): void {
|
|
261
|
+
if (!this.isReference()) throw new Error ('This context '+this.toString()+' is not a reference.');
|
|
262
|
+
|
|
263
|
+
if( this.referencedContext==null) {
|
|
264
|
+
let refDisplayMode = 'INLINE_VIEW' as XtDisplayMode;
|
|
265
|
+
if (this.displayMode=='FULL_VIEW') refDisplayMode = 'FULL_VIEW';
|
|
266
|
+
this.referencedContext = new XtBaseContext(refDisplayMode);
|
|
267
|
+
}
|
|
268
|
+
this.referencedContext.setDisplayValue(val);
|
|
269
|
+
if( valueType!=null) this.referencedContext.valueType=valueType;
|
|
270
|
+
}*/
|
|
271
|
+
/**
|
|
272
|
+
* Returns a string representation of this context, including its name, type, value, and reference info.
|
|
273
|
+
* @returns A human-readable description of the context
|
|
274
|
+
*/
|
|
275
|
+
toString(): string;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Interface for ng-extended components. Defines the contract all XtComponents must implement,
|
|
280
|
+
* including context handling, input/output bindings, and form integration.
|
|
281
|
+
*/
|
|
282
|
+
type XtComponent<T = any> = {
|
|
283
|
+
context: InputSignal<XtContext<T>>;
|
|
284
|
+
inputsObject?: XtComponentInput;
|
|
285
|
+
outputsObject?: XtComponentOutput;
|
|
286
|
+
modelsObject?: XtComponentModel;
|
|
287
|
+
models?: InputSignal<XtComponentModel | undefined>;
|
|
288
|
+
inputs?: InputSignal<XtComponentInput>;
|
|
289
|
+
outputs?: OutputEmitterRef<XtComponentOutput>;
|
|
290
|
+
isInForm(): boolean;
|
|
291
|
+
formControlName(): string | undefined;
|
|
292
|
+
formGroup(): FormGroup;
|
|
293
|
+
formGroupIfAny(): FormGroup | undefined;
|
|
294
|
+
};
|
|
295
|
+
/** Possible output types emitted by an XtComponent. */
|
|
296
|
+
type XtOutputType = 'valueSelected';
|
|
297
|
+
/** Possible input types accepted by an XtComponent. */
|
|
298
|
+
type XtInputType = 'valueSelected';
|
|
299
|
+
/** Possible model types for two-way binding on an XtComponent. */
|
|
300
|
+
type XtModelType = 'valueSelected' | 'sortBy' | 'filterBy';
|
|
301
|
+
/** Defines the model signals available for two-way binding on a component. */
|
|
302
|
+
type XtComponentModel = {
|
|
303
|
+
[key in XtModelType]?: ModelSignal<any> | undefined;
|
|
304
|
+
};
|
|
305
|
+
/** Defines the output emitter map for a component. */
|
|
306
|
+
type XtComponentOutput = {
|
|
307
|
+
[key in XtOutputType]: OutputEmitterRef<any> | undefined;
|
|
308
|
+
};
|
|
309
|
+
/** Defines the input signal map for a component. */
|
|
310
|
+
type XtComponentInput = {
|
|
311
|
+
[key in XtInputType]: InputSignal<any> | undefined;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Represents a resolved component with its name, class reference, and output capability.
|
|
316
|
+
* Created by the resolver to indicate which XtComponent should be used for a given context.
|
|
317
|
+
*/
|
|
318
|
+
declare class XtResolvedComponent {
|
|
319
|
+
/** The registered name of the resolved component. */
|
|
320
|
+
componentName: string;
|
|
321
|
+
/** The Angular component class reference. */
|
|
322
|
+
componentClass: any;
|
|
323
|
+
/** Whether the component emits any outputs. */
|
|
324
|
+
outputs: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Creates a new XtResolvedComponent instance.
|
|
327
|
+
* @param componentName - The registered component name
|
|
328
|
+
* @param componentClass - The Angular component class
|
|
329
|
+
* @param outputs - Whether the component has outputs (default false)
|
|
330
|
+
*/
|
|
331
|
+
constructor(componentName: string, componentClass: any, outputs?: boolean);
|
|
332
|
+
/**
|
|
333
|
+
* Creates an XtResolvedComponent from an XtComponentInfo.
|
|
334
|
+
* @param info - The component info from the plugin registry
|
|
335
|
+
* @returns A new XtResolvedComponent instance
|
|
336
|
+
*/
|
|
337
|
+
static from(info: XtComponentInfo<any>): XtResolvedComponent;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** Interface for component resolvers that find the best component to render for a given context */
|
|
341
|
+
type XtResolver = {
|
|
342
|
+
resolve<T>(baseContext: XtContext<T>, subName?: string): XtResolvedComponent | null;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Maintain the list of plugins loaded, with their components and actions
|
|
347
|
+
*
|
|
348
|
+
*/
|
|
349
|
+
declare class XtPluginRegistry {
|
|
350
|
+
/** Map of all registered plugins by name */
|
|
351
|
+
pluginRegistry: Map<string, XtPluginInfo>;
|
|
352
|
+
/** Map of all registered components by component name */
|
|
353
|
+
componentRegistry: Map<string, XtComponentInfo<any>>;
|
|
354
|
+
/** Cache of components found by value type */
|
|
355
|
+
componentByTypeCache: Map<string, XtComponentInfo<any>[]>;
|
|
356
|
+
/** Map of all registered workflows by name */
|
|
357
|
+
protected workflowRegistry: Map<string, XtWorkflowInfo<any>>;
|
|
358
|
+
/** Map of actions registered by type, then by action name */
|
|
359
|
+
protected actionByTypeRegistry: Map<string, Map<string, XtActionInfo<any>>>;
|
|
360
|
+
/** Signal listing all registered component infos */
|
|
361
|
+
listComponents: _angular_core.WritableSignal<XtComponentInfo<any>[]>;
|
|
362
|
+
/** Signal listing all registered plugin infos */
|
|
363
|
+
listPlugins: _angular_core.WritableSignal<XtPluginInfo[]>;
|
|
364
|
+
/**
|
|
365
|
+
* The component can manage any standard javascript primitives types. That's usually the default whenever we don't know any particular type
|
|
366
|
+
* string
|
|
367
|
+
* number
|
|
368
|
+
* bigint
|
|
369
|
+
* boolean
|
|
370
|
+
* undefined
|
|
371
|
+
* null
|
|
372
|
+
* symbol is not managed
|
|
373
|
+
* Date, while an object and not a primitive, is managed
|
|
374
|
+
*/
|
|
375
|
+
static readonly ANY_PRIMITIVE_TYPE = "ANY_PRIMITIVE_TYPE";
|
|
376
|
+
/**
|
|
377
|
+
* The components can manage any composite javascript type. Default when no type has been defined and it's a user defined javascript object (not a data type)
|
|
378
|
+
*/
|
|
379
|
+
static readonly ANY_OBJECT_TYPE = "ANY_OBJECT_TYPE";
|
|
380
|
+
/** Components can manage any set of primitive types */
|
|
381
|
+
static readonly ANY_PRIMITIVE_SET = "ANY_PRIMITIVE_SET";
|
|
382
|
+
/** Components can manage any set of object types */
|
|
383
|
+
static readonly ANY_OBJECT_SET = "ANY_OBJECT_SET";
|
|
384
|
+
/**
|
|
385
|
+
* Whenever a component can handle any type of reference to a single entity or to multiple entities.
|
|
386
|
+
*/
|
|
387
|
+
static readonly ANY_SINGLE_REFERENCE = "ANY_SINGLE_REFERENCE";
|
|
388
|
+
/** Whenever a component can handle any type of reference to multiple entities */
|
|
389
|
+
static readonly ANY_MULTIPLE_REFERENCE = "ANY_MULTIPLE_REFERENCE";
|
|
390
|
+
/**
|
|
391
|
+
* Registers a plugin with its components, actions, and workflows
|
|
392
|
+
* @param info - The plugin information to register
|
|
393
|
+
*/
|
|
394
|
+
registerPlugin(info: XtPluginInfo): void;
|
|
395
|
+
/**
|
|
396
|
+
* Registers a workflow component
|
|
397
|
+
* @param info - The workflow information to register
|
|
398
|
+
*/
|
|
399
|
+
registerWorkflow<T extends XtWorkflow>(info: XtWorkflowInfo<T>): void;
|
|
400
|
+
/**
|
|
401
|
+
* Registers a component in the component registry
|
|
402
|
+
* @param info - The component information to register
|
|
403
|
+
*/
|
|
404
|
+
registerComponent<T>(info: XtComponentInfo<T>): void;
|
|
405
|
+
/**
|
|
406
|
+
* Finds components that can handle the given value type
|
|
407
|
+
* @param valueType - The value type to search for, or null/undefined to infer from the value
|
|
408
|
+
* @param value - The optional value to infer the type from
|
|
409
|
+
* @returns An array of matching component infos
|
|
410
|
+
*/
|
|
411
|
+
findComponentsForType<T>(valueType: string | null | undefined, value?: T): XtComponentInfo<any>[];
|
|
412
|
+
/**
|
|
413
|
+
* Returns the global singleton plugin registry
|
|
414
|
+
* @returns The global XtPluginRegistry instance
|
|
415
|
+
*/
|
|
416
|
+
static registry(): XtPluginRegistry;
|
|
417
|
+
/**
|
|
418
|
+
* Finds component info for the given component class type
|
|
419
|
+
* @param type - The component class type to search for
|
|
420
|
+
* @returns The component info or null if not found
|
|
421
|
+
*/
|
|
422
|
+
findComponentInfo(type: Type<XtComponent<any>>): XtComponentInfo<any> | null;
|
|
423
|
+
/**
|
|
424
|
+
* Gets component info for the given component class type, throwing if not found
|
|
425
|
+
* @param type - The component class type to search for
|
|
426
|
+
* @returns The component info
|
|
427
|
+
* @throws Error if no component is found with the given class
|
|
428
|
+
*/
|
|
429
|
+
getComponentInfo(type: Type<XtComponent<any>>): XtComponentInfo<any>;
|
|
430
|
+
/**
|
|
431
|
+
* Finds all the workflow components that can handle the given workflow type
|
|
432
|
+
* @param type
|
|
433
|
+
*/
|
|
434
|
+
listWorkflowsForType(type: string): XtWorkflowInfo<any>[];
|
|
435
|
+
/**
|
|
436
|
+
* Finds workflow info by name
|
|
437
|
+
* @param name - The workflow name to search for
|
|
438
|
+
* @returns The workflow info or undefined if not found
|
|
439
|
+
*/
|
|
440
|
+
findWorkflowInfo(name: string): XtWorkflowInfo<any> | undefined;
|
|
441
|
+
/**
|
|
442
|
+
* Registers action handlers grouped by type
|
|
443
|
+
* @param handlerInfo - The action handler information to register
|
|
444
|
+
*/
|
|
445
|
+
registerActionHandler<T>(handlerInfo: XtActionHandlerInfo<T>): void;
|
|
446
|
+
/**
|
|
447
|
+
* Finds action info for the given type and action name
|
|
448
|
+
* @param type - The type to look up
|
|
449
|
+
* @param actionName - The action name to find
|
|
450
|
+
* @returns The action info or undefined if not found
|
|
451
|
+
*/
|
|
452
|
+
findActionInfo<T>(type: string, actionName: string): XtActionInfo<T> | undefined;
|
|
453
|
+
/**
|
|
454
|
+
* Lists all action infos registered for the given type
|
|
455
|
+
* @param type - The type to list actions for
|
|
456
|
+
* @returns An array of action name and info pairs
|
|
457
|
+
*/
|
|
458
|
+
listActionInfos<T>(type: string): {
|
|
459
|
+
name: string;
|
|
460
|
+
info: XtActionInfo<T>;
|
|
461
|
+
}[];
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Wrapper around xt-store manager: You can use it to check if xt-store is included or not, and decide what to do
|
|
466
|
+
*
|
|
467
|
+
* This allows plugins to potentially use xt-store whenever included in the applications running the plugin
|
|
468
|
+
*/
|
|
469
|
+
|
|
470
|
+
declare class StoreSupport {
|
|
471
|
+
/** Optional test store manager override for testing */
|
|
472
|
+
protected static testStoreManager?: IStoreManager;
|
|
473
|
+
/**
|
|
474
|
+
* Checks if a store manager is available (either test or global)
|
|
475
|
+
* @returns true if a store manager is available
|
|
476
|
+
*/
|
|
477
|
+
static isStoreManagerAvailable(): boolean;
|
|
478
|
+
/**
|
|
479
|
+
* Gets the current store manager (test or global)
|
|
480
|
+
* @returns The IStoreManager instance
|
|
481
|
+
*/
|
|
482
|
+
static getStoreManager(): IStoreManager;
|
|
483
|
+
/**
|
|
484
|
+
* Sets a test store manager for testing purposes
|
|
485
|
+
* @param testStoreManager - The test store manager to use
|
|
486
|
+
*/
|
|
487
|
+
static setTestStoreManager(testStoreManager: IStoreManager): void;
|
|
488
|
+
/**
|
|
489
|
+
* Creates a new store criteria for filtering
|
|
490
|
+
* @param name - The property name to filter on
|
|
491
|
+
* @param value - The value to filter by
|
|
492
|
+
* @param operator - The comparison operator (defaults to '=')
|
|
493
|
+
* @returns A new IStoreCriteria instance
|
|
494
|
+
*/
|
|
495
|
+
static newStoreCriteria<T = any>(name: keyof T, value: any, operator?: IStoreCriteriaOperator): IStoreCriteria<T>;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Interface definition for xt-store component.
|
|
499
|
+
* We re-define them here to avoid importing xt-store in all plugins that don't need it.
|
|
500
|
+
*/
|
|
501
|
+
/** Interface for transforming data after it has been loaded from the store */
|
|
502
|
+
interface IDataTransformer<T> {
|
|
503
|
+
/**
|
|
504
|
+
* Enable transformation of data right after it has been loaded from the store
|
|
505
|
+
* @param source
|
|
506
|
+
*/
|
|
507
|
+
postLoadingTransformation(source: any[]): T[];
|
|
508
|
+
}
|
|
509
|
+
/** Information about a stored document */
|
|
510
|
+
interface IDocumentInfo {
|
|
511
|
+
/** The name of the document */
|
|
512
|
+
documentName: string;
|
|
513
|
+
/** Whether the document is accessible via URL */
|
|
514
|
+
isUrl: boolean;
|
|
515
|
+
/** Optional document identifier */
|
|
516
|
+
documentId?: string;
|
|
517
|
+
}
|
|
518
|
+
/** Supported operators for store criteria comparisons */
|
|
519
|
+
type IStoreCriteriaOperator = '=' | '<' | '<=';
|
|
520
|
+
/** Criteria for filtering store queries */
|
|
521
|
+
interface IStoreCriteria<T> {
|
|
522
|
+
/** The property name to filter on */
|
|
523
|
+
name: keyof T;
|
|
524
|
+
/** The value to filter by */
|
|
525
|
+
value: any;
|
|
526
|
+
/** The comparison operator */
|
|
527
|
+
operator: IStoreCriteriaOperator;
|
|
528
|
+
}
|
|
529
|
+
/** Sort criteria for store queries */
|
|
530
|
+
type ISortBy<T> = {
|
|
531
|
+
by: keyof T;
|
|
532
|
+
direction: ISortByDirection;
|
|
533
|
+
};
|
|
534
|
+
/** Sort direction options */
|
|
535
|
+
declare enum ISortByDirection {
|
|
536
|
+
/** No sorting */
|
|
537
|
+
None = "None",
|
|
538
|
+
/** Sort in ascending order */
|
|
539
|
+
Ascending = "Ascending",
|
|
540
|
+
/** Sort in descending order */
|
|
541
|
+
Descending = "Descending"
|
|
542
|
+
}
|
|
543
|
+
/** Interface for a store provider that handles CRUD operations on entities */
|
|
544
|
+
interface IStoreProvider<T> {
|
|
545
|
+
/**
|
|
546
|
+
* Stores an entity in the data store
|
|
547
|
+
* @param name - The entity/collection name
|
|
548
|
+
* @param entity - The entity to store
|
|
549
|
+
* @returns A promise that resolves to the stored entity
|
|
550
|
+
*/
|
|
551
|
+
storeEntity(name: string, entity: T): Promise<T>;
|
|
552
|
+
/**
|
|
553
|
+
* Rejects the promise if the entity is not found
|
|
554
|
+
* @param name
|
|
555
|
+
* @param key
|
|
556
|
+
*/
|
|
557
|
+
/**
|
|
558
|
+
* Rejects the promise if the entity is not found
|
|
559
|
+
* @param name - The entity/collection name
|
|
560
|
+
* @param key - The entity key/ID
|
|
561
|
+
*/
|
|
562
|
+
safeLoadEntity(name: string, key: any): Promise<T>;
|
|
563
|
+
/**
|
|
564
|
+
* Loads an entity from the data store
|
|
565
|
+
* @param name - The entity/collection name
|
|
566
|
+
* @param key - The entity key/ID
|
|
567
|
+
* @returns A promise that resolves to the entity or undefined if not found
|
|
568
|
+
*/
|
|
569
|
+
loadEntity(name: string, key: any): Promise<T | undefined>;
|
|
570
|
+
/**
|
|
571
|
+
* Deletes an entity from the data store
|
|
572
|
+
* @param name - The entity/collection name
|
|
573
|
+
* @param key - The entity key/ID
|
|
574
|
+
* @returns A promise that resolves to true if deletion was successful
|
|
575
|
+
*/
|
|
576
|
+
deleteEntity(name: string, key: any): Promise<boolean>;
|
|
577
|
+
/**
|
|
578
|
+
* Searches for entities matching the given criteria
|
|
579
|
+
* @param name - The entity/collection name
|
|
580
|
+
* @param criteria - Filter criteria to apply
|
|
581
|
+
* @returns An observable emitting matching entities
|
|
582
|
+
*/
|
|
583
|
+
searchEntities(name: string, ...criteria: IStoreCriteria<T>[]): Observable<Array<T>>;
|
|
584
|
+
/**
|
|
585
|
+
* Searches for entities and optionally sorts, groups, and transforms the results
|
|
586
|
+
* @param name - The entity/collection name
|
|
587
|
+
* @param sort - Optional sort criteria
|
|
588
|
+
* @param groupBy - Optional grouping configuration
|
|
589
|
+
* @param transformer - Optional data transformer
|
|
590
|
+
* @param criteria - Additional filter criteria
|
|
591
|
+
* @returns An observable emitting the processed results
|
|
592
|
+
*/
|
|
593
|
+
searchAndPrepareEntities(name: string, sort?: ISortBy<T>, groupBy?: any, transformer?: IDataTransformer<T>, ...criteria: any[]): Observable<any>;
|
|
594
|
+
/**
|
|
595
|
+
* Checks whether this provider can store documents
|
|
596
|
+
* @returns true if document storage is supported
|
|
597
|
+
*/
|
|
598
|
+
canStoreDocument(): boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Upload one document to a server store and returns the url or the id needed to retrieve them.
|
|
601
|
+
* @param toStore - The file to upload
|
|
602
|
+
*/
|
|
603
|
+
storeDocument(toStore: File): Promise<IDocumentInfo>;
|
|
604
|
+
/**
|
|
605
|
+
* Upload documents to a server store and returns the url or the id needed to retrieve them.
|
|
606
|
+
* @param toStore - The files to upload
|
|
607
|
+
*/
|
|
608
|
+
storeDocuments(toStore: File[]): Observable<IDocumentInfo>;
|
|
609
|
+
}
|
|
610
|
+
/** Interface for a store manager that provides access to store providers */
|
|
611
|
+
interface IStoreManager {
|
|
612
|
+
/**
|
|
613
|
+
* Gets a store provider by name
|
|
614
|
+
* @param name - Optional provider name (defaults to the default provider)
|
|
615
|
+
* @returns The store provider or undefined if not found
|
|
616
|
+
*/
|
|
617
|
+
getProvider<T = never>(name?: string): IStoreProvider<T> | undefined;
|
|
618
|
+
/**
|
|
619
|
+
* Gets a store provider by name, throwing if not found
|
|
620
|
+
* @param name - Optional provider name (defaults to the default provider)
|
|
621
|
+
* @returns The store provider
|
|
622
|
+
* @throws Error if no provider is found
|
|
623
|
+
*/
|
|
624
|
+
getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
|
|
625
|
+
/**
|
|
626
|
+
* Gets the default store provider
|
|
627
|
+
* @returns The default provider or undefined if none is set
|
|
628
|
+
*/
|
|
629
|
+
getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
|
|
630
|
+
/**
|
|
631
|
+
* Gets the default store provider, throwing if not found
|
|
632
|
+
* @returns The default store provider
|
|
633
|
+
* @throws Error if no default provider is set
|
|
634
|
+
*/
|
|
635
|
+
getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
|
|
636
|
+
/**
|
|
637
|
+
* Creates a new store criteria instance
|
|
638
|
+
* @param name - The property name to filter on
|
|
639
|
+
* @param value - The value to filter by
|
|
640
|
+
* @param operator - The comparison operator
|
|
641
|
+
* @returns A new IStoreCriteria instance
|
|
642
|
+
*/
|
|
643
|
+
newStoreCriteria<T = never>(name: keyof T, value: any, operator: IStoreCriteriaOperator): IStoreCriteria<T>;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* An all in one helper class, enabling manipulation of the context, with data and type associated with it.
|
|
648
|
+
*/
|
|
649
|
+
declare class XtResolverService {
|
|
650
|
+
/** Injected plugin registry for component and type registration. */
|
|
651
|
+
pluginRegistry: xt_components.XtPluginRegistry;
|
|
652
|
+
/** Optional base resolver injected via DI token. */
|
|
653
|
+
protected baseResolver: XtResolver | null;
|
|
654
|
+
/** Optional base type resolver injected via DI token. */
|
|
655
|
+
protected baseTypeResolver: XtTypeResolver | null;
|
|
656
|
+
/** The resolver used to find components for a given context. */
|
|
657
|
+
resolver: XtResolver;
|
|
658
|
+
/** The type resolver for type hierarchy and reference resolution. */
|
|
659
|
+
typeResolver: XtTypeResolver;
|
|
660
|
+
constructor();
|
|
661
|
+
/**
|
|
662
|
+
* Finds the best matching component for the given context and optional sub-name.
|
|
663
|
+
* @param baseContext - The context to resolve against
|
|
664
|
+
* @param subName - Optional sub-name for nested resolution
|
|
665
|
+
* @returns The resolved component descriptor
|
|
666
|
+
*/
|
|
667
|
+
findBestComponent<T>(baseContext: XtContext<T>, subName?: string): XtResolvedComponent;
|
|
668
|
+
/**
|
|
669
|
+
* Resolves the type name for the given context and optional sub-name.
|
|
670
|
+
* @param baseContext - The context to query
|
|
671
|
+
* @param subName - Optional sub-name for nested type resolution
|
|
672
|
+
* @param value - Optional value for type inference
|
|
673
|
+
* @returns The type name, or null/undefined
|
|
674
|
+
*/
|
|
675
|
+
findTypeOf<T>(baseContext: XtContext<T>, subName?: string, value?: T): string | null | undefined;
|
|
676
|
+
/**
|
|
677
|
+
* Finds the type handler for the given context, resolving references if necessary.
|
|
678
|
+
* @param baseContext - The context to query
|
|
679
|
+
* @param subName - Optional sub-name for nested resolution
|
|
680
|
+
* @param value - Optional value for handler inference
|
|
681
|
+
* @returns An object with the type name and its handler
|
|
682
|
+
*/
|
|
683
|
+
findTypeHandlerOf<T>(baseContext: XtContext<T>, subName?: string, value?: T): {
|
|
684
|
+
typeName?: string | null;
|
|
685
|
+
handler?: XtTypeHandler<any>;
|
|
686
|
+
};
|
|
687
|
+
/**
|
|
688
|
+
* Lists the sub-names defined by the type of the given context.
|
|
689
|
+
* @param baseContext - The context to query
|
|
690
|
+
* @param value - Optional value for type inference
|
|
691
|
+
* @returns An array of sub-name strings
|
|
692
|
+
*/
|
|
693
|
+
listSubNamesOf<T>(baseContext: XtContext<T>, value?: T): string[];
|
|
694
|
+
/**
|
|
695
|
+
* Lists the sub-names defined by a given value type string.
|
|
696
|
+
* @param valueType - The type string to query
|
|
697
|
+
* @param value - Optional value for type inference
|
|
698
|
+
* @returns An array of sub-name strings
|
|
699
|
+
*/
|
|
700
|
+
listSubNamesOfType<T>(valueType: string, value?: T): string[];
|
|
701
|
+
/**
|
|
702
|
+
* Registers a full plugin including its types and type handlers.
|
|
703
|
+
* @param info - The plugin information to register
|
|
704
|
+
*/
|
|
705
|
+
registerPlugin(info: XtPluginInfo): void;
|
|
706
|
+
/**
|
|
707
|
+
* Registers type definitions and optional type handlers with the type resolver.
|
|
708
|
+
* @param types - The type definitions to register
|
|
709
|
+
* @param handlers - Optional type handler definitions
|
|
710
|
+
*/
|
|
711
|
+
registerTypes(types: XtTypeInfo | undefined, handlers?: XtTypeHandlerInfo<any>[]): void;
|
|
712
|
+
/**
|
|
713
|
+
* Calculates all the possible actions for a given context
|
|
714
|
+
* @param context
|
|
715
|
+
* @param onlyVisible
|
|
716
|
+
*/
|
|
717
|
+
possibleActions<T>(context: XtContext<T>, onlyVisible?: boolean): Array<XtAction<T>>;
|
|
718
|
+
/**
|
|
719
|
+
* Finds the possible action with the given name for the current type, and runs it in the current value.
|
|
720
|
+
* If the action is not possible in this context, try a parent context
|
|
721
|
+
* @param actionName
|
|
722
|
+
*/
|
|
723
|
+
runAction<T>(context: XtContext<T>, actionName: string, storeMgr?: any): Promise<XtActionResult<any>>;
|
|
724
|
+
/**
|
|
725
|
+
* Checks if a handler is defined for the given type among the provided handler infos.
|
|
726
|
+
* @param newType - The type to check
|
|
727
|
+
* @param handlers - The handler definitions to search
|
|
728
|
+
* @returns A handler instance or null
|
|
729
|
+
*/
|
|
730
|
+
protected handlerDefinedFor(newType: string, handlers: XtTypeHandlerInfo<any>[] | undefined): any;
|
|
731
|
+
/**
|
|
732
|
+
* Gets the resolved component info for a given component type.
|
|
733
|
+
* @param type - The component type class
|
|
734
|
+
* @returns The resolved component descriptor
|
|
735
|
+
*/
|
|
736
|
+
getComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent;
|
|
737
|
+
/**
|
|
738
|
+
* Finds the resolved component info for a given component type, returning null if not found.
|
|
739
|
+
* @param type - The component type class
|
|
740
|
+
* @returns The resolved component descriptor or null
|
|
741
|
+
*/
|
|
742
|
+
findComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent | null;
|
|
743
|
+
/** Computed signal that lists all registered components. */
|
|
744
|
+
listComponents: _angular_core.Signal<XtComponentInfo<any>[]>;
|
|
745
|
+
/** Computed signal that lists all registered plugins. */
|
|
746
|
+
listPlugins: _angular_core.Signal<XtPluginInfo[]>;
|
|
747
|
+
/**
|
|
748
|
+
* Dynamically load a register a plugin from the given url
|
|
749
|
+
* The plugin must export at least a Register entrypoint that will be called right after loading..
|
|
750
|
+
* @returns a Promise with the module loaded and already registered.
|
|
751
|
+
* @param module
|
|
752
|
+
*/
|
|
753
|
+
registerPluginModule(module: {
|
|
754
|
+
registerPlugin: (resolver: XtResolverService) => string;
|
|
755
|
+
}, url: URL | string): boolean;
|
|
756
|
+
/**
|
|
757
|
+
* Based on the type & value of the element, find which property is on its type and returns it's value
|
|
758
|
+
* @param context
|
|
759
|
+
* @param subPropertyType
|
|
760
|
+
* @param value
|
|
761
|
+
*/
|
|
762
|
+
findSubPropertyWithType<T>(context: XtContext<T>, subPropertyType: string, value: T): any;
|
|
763
|
+
/**
|
|
764
|
+
* Creates a duplicate of an object, using our knowledge on its type given by the context
|
|
765
|
+
* @param context
|
|
766
|
+
* @param value
|
|
767
|
+
*/
|
|
768
|
+
safeDuplicate<T>(context: XtContext<T>, value: T): T;
|
|
769
|
+
/**
|
|
770
|
+
* Resolves a mapping helper from the context's value type to a target type.
|
|
771
|
+
* @param context - The source context
|
|
772
|
+
* @param targetType - The target type to map to
|
|
773
|
+
* @param value - Optional value for handler inference
|
|
774
|
+
* @returns A MappingHelper if a mapping exists, otherwise undefined
|
|
775
|
+
*/
|
|
776
|
+
resolveMappingOf<U, T>(context: XtContext<T>, targetType: string, value?: T): MappingHelper<U, T> | undefined;
|
|
777
|
+
/**
|
|
778
|
+
* Resolves the referenced value for a context that holds a type reference, using the provided store manager.
|
|
779
|
+
* @param context - The context with a reference to resolve
|
|
780
|
+
* @param storeMgr - The store manager for entity lookup
|
|
781
|
+
* @returns The resolved referenced value(s), or null/undefined
|
|
782
|
+
*/
|
|
783
|
+
resolveReferencedValue<T, U>(context: XtContext<T>, storeMgr: IStoreManager): Promise<U | U[] | null | undefined>;
|
|
784
|
+
/**
|
|
785
|
+
* Resolves all pending type references in the type resolver.
|
|
786
|
+
*/
|
|
787
|
+
resolvePendingReferences(): void;
|
|
788
|
+
/**
|
|
789
|
+
* Calculates the values that can be referenced by the reference & value of this context
|
|
790
|
+
* @param context
|
|
791
|
+
*/
|
|
792
|
+
findPossibleReferences<T, U>(context: XtContext<T>): Observable<U[]>;
|
|
793
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtResolverService, never>;
|
|
794
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtResolverService>;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/** Result of executing an action on an item */
|
|
798
|
+
type XtActionResult<Type> = {
|
|
799
|
+
status: 'success' | 'error' | 'none';
|
|
800
|
+
warnings?: string[];
|
|
801
|
+
errors?: string[];
|
|
802
|
+
value?: Type | null;
|
|
803
|
+
};
|
|
804
|
+
/** Defines an action handler that can run actions on items under a given context */
|
|
805
|
+
type XtActionHandler<Type> = {
|
|
806
|
+
/**
|
|
807
|
+
* Runs an action on a item under the context
|
|
808
|
+
* @param context
|
|
809
|
+
* @param actionName
|
|
810
|
+
* @param resolver
|
|
811
|
+
* @param storeMgr
|
|
812
|
+
*/
|
|
813
|
+
runAction(context: XtContext<Type>, actionName: string, resolver: XtResolverService, storeMgr?: any): Promise<XtActionResult<Type>>;
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* The global plugin registry.
|
|
818
|
+
* Plugins will register to this when loaded.
|
|
819
|
+
*/
|
|
820
|
+
|
|
821
|
+
declare global {
|
|
822
|
+
var XT_REGISTRY: XtPluginRegistry;
|
|
823
|
+
}
|
|
824
|
+
declare function initXtPluginRegistry(): void;
|
|
825
|
+
declare function xtPluginRegistry(): XtPluginRegistry;
|
|
826
|
+
|
|
827
|
+
/** Injection token for providing a custom component resolver */
|
|
828
|
+
declare const XT_RESOLVER_TOKEN: InjectionToken<XtResolver>;
|
|
829
|
+
/** Injection token for providing a custom type resolver */
|
|
830
|
+
declare const XT_TYPE_RESOLVER_TOKEN: InjectionToken<XtTypeResolver>;
|
|
831
|
+
/** Injection token for providing the plugin registry with a default factory */
|
|
832
|
+
declare const XT_REGISTRY_TOKEN: InjectionToken<XtPluginRegistry>;
|
|
833
|
+
|
|
834
|
+
/** Default implementation of XtComponentOutput */
|
|
835
|
+
declare class XtBaseOutput implements XtComponentOutput {
|
|
836
|
+
/** Output emitter for when a value is selected */
|
|
837
|
+
valueSelected: OutputEmitterRef<any> | undefined;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/** Default implementation of XtComponentInput */
|
|
841
|
+
declare class XtBaseInput implements XtComponentInput {
|
|
842
|
+
/** Input signal for the value selected by the user */
|
|
843
|
+
valueSelected: InputSignal<any> | undefined;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Offers a nice and easy to dynamically embed a component.
|
|
848
|
+
* You set the type, the display mode, and either the value or the formgroup & subName to use.
|
|
849
|
+
* XtRender will then instantiate the component, bind it to the value or form, and display it.
|
|
850
|
+
*/
|
|
851
|
+
declare class XtRenderComponent<T> implements AfterViewInit {
|
|
852
|
+
/** Injected resolver service for finding the best component */
|
|
853
|
+
resolverService: XtResolverService;
|
|
854
|
+
/** Optional explicit component type to render */
|
|
855
|
+
componentType: _angular_core.InputSignal<Type<XtComponent<T>> | undefined>;
|
|
856
|
+
/** The display mode (e.g. EDIT, VIEW, etc.) */
|
|
857
|
+
displayMode: _angular_core.InputSignal<XtDisplayMode>;
|
|
858
|
+
/** The value type identifier used for component resolution */
|
|
859
|
+
valueType: _angular_core.InputSignal<string | undefined>;
|
|
860
|
+
/** The value to display/edit (used when not inside a form) */
|
|
861
|
+
value: _angular_core.ModelSignal<T | undefined>;
|
|
862
|
+
/** The parent form group (used when inside a form) */
|
|
863
|
+
formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
|
|
864
|
+
/** The sub-name within the form group */
|
|
865
|
+
subName: _angular_core.InputSignal<string | undefined>;
|
|
866
|
+
/** Object holding the output emitters from the rendered component */
|
|
867
|
+
outputsObject: XtBaseOutput;
|
|
868
|
+
/** Inputs to pass through to the rendered component */
|
|
869
|
+
inputs: _angular_core.InputSignal<XtBaseInput | undefined>;
|
|
870
|
+
/** Emits the outputs from the rendered component */
|
|
871
|
+
outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
|
|
872
|
+
/** Model signals to pass through to the rendered component */
|
|
873
|
+
models: _angular_core.InputSignal<XtComponentModel | undefined>;
|
|
874
|
+
/** Reference to the NgComponentOutlet used to dynamically render the component */
|
|
875
|
+
outlet: Signal<NgComponentOutlet<any>>;
|
|
876
|
+
constructor();
|
|
877
|
+
/** Computed context derived from display mode, form group, value, and value type */
|
|
878
|
+
context: Signal<XtContext<any>>;
|
|
879
|
+
/** Computed context that resolves references (if any) */
|
|
880
|
+
realContext: Signal<XtContext<any>>;
|
|
881
|
+
/** Computed component type to render, resolved from the context if not explicitly set */
|
|
882
|
+
type: Signal<Type<XtComponent<T>> | null>;
|
|
883
|
+
/**
|
|
884
|
+
* Transfers the input and outputs from the host to the rendered component
|
|
885
|
+
*/
|
|
886
|
+
ngAfterViewInit(): void;
|
|
887
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtRenderComponent<any>, never>;
|
|
888
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtRenderComponent<any>, "xt-render", never, { "componentType": { "alias": "componentType"; "required": false; "isSignal": true; }; "displayMode": { "alias": "displayMode"; "required": true; "isSignal": true; }; "valueType": { "alias": "valueType"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; "subName": { "alias": "subName"; "required": false; "isSignal": true; }; "inputs": { "alias": "inputs"; "required": false; "isSignal": true; }; "models": { "alias": "models"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "outputs": "outputs"; }, never, never, true, never>;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Dynamically render a component that will display the given subValue.
|
|
893
|
+
* To be used only inside an XtSimpleComponent or XtCompositeComponent
|
|
894
|
+
*/
|
|
895
|
+
declare class XtRenderSubComponent<T> implements AfterViewInit {
|
|
896
|
+
/** The context containing display mode, form group, and value for the sub-component */
|
|
897
|
+
context: _angular_core.InputSignal<XtContext<T>>;
|
|
898
|
+
/** Optional explicit component type to render */
|
|
899
|
+
componentType: _angular_core.InputSignal<Type<XtComponent<T>> | undefined>;
|
|
900
|
+
/** Object holding the output emitters from the rendered sub-component */
|
|
901
|
+
outputsObject: XtBaseOutput;
|
|
902
|
+
/** Inputs to pass through to the rendered sub-component */
|
|
903
|
+
inputs: _angular_core.InputSignal<XtBaseInput | undefined>;
|
|
904
|
+
/** Emits the outputs from the rendered sub-component */
|
|
905
|
+
outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
|
|
906
|
+
/** Model signals to pass through to the rendered sub-component */
|
|
907
|
+
models: _angular_core.InputSignal<XtComponentModel | undefined>;
|
|
908
|
+
/** Reference to the NgComponentOutlet used to dynamically render the sub-component */
|
|
909
|
+
outlet: Signal<NgComponentOutlet<any>>;
|
|
910
|
+
/** Injected resolver service for finding the best component */
|
|
911
|
+
resolverService: XtResolverService;
|
|
912
|
+
/** Computed context that resolves references (if any) */
|
|
913
|
+
realContext: Signal<XtContext<T>>;
|
|
914
|
+
/** Computed component type to render, resolved from the context if not explicitly set */
|
|
915
|
+
type: Signal<Type<XtComponent<T>> | null>;
|
|
916
|
+
/**
|
|
917
|
+
* Transfers the input and outputs from the host to the rendered component
|
|
918
|
+
*/
|
|
919
|
+
ngAfterViewInit(): void;
|
|
920
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtRenderSubComponent<any>, never>;
|
|
921
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtRenderSubComponent<any>, "xt-render-sub", never, { "context": { "alias": "context"; "required": true; "isSignal": true; }; "componentType": { "alias": "componentType"; "required": false; "isSignal": true; }; "inputs": { "alias": "inputs"; "required": false; "isSignal": true; }; "models": { "alias": "models"; "required": false; "isSignal": true; }; }, { "outputs": "outputs"; }, never, never, true, never>;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* An XtSimpleComponent just displays the given value or element in a form.
|
|
926
|
+
* If you need to dynamically embed other XtComponents to display sub elements, then please use the XtCompositeComponent
|
|
927
|
+
*/
|
|
928
|
+
declare class XtSimpleComponent<T = any> implements XtComponent<T>, OnInit {
|
|
929
|
+
/** Required input signal providing the XtContext for this component. */
|
|
930
|
+
context: _angular_core.InputSignal<XtContext<T>>;
|
|
931
|
+
/** Object holding the base output definitions for this component. */
|
|
932
|
+
outputsObject: XtBaseOutput;
|
|
933
|
+
/** Object holding the base input definitions for this component. */
|
|
934
|
+
inputsObject: XtBaseInput;
|
|
935
|
+
/** Output emitter that publishes the component's output map. */
|
|
936
|
+
outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
|
|
937
|
+
/** Input signal accepting model bindings for two-way data flow. */
|
|
938
|
+
models: _angular_core.InputSignal<XtComponentModel | undefined>;
|
|
939
|
+
/** Computed signal indicating whether this component is inside a reactive form. */
|
|
940
|
+
isInForm: _angular_core.Signal<boolean>;
|
|
941
|
+
/** Computed signal returning the form control name, if any. */
|
|
942
|
+
formControlNameIfAny: _angular_core.Signal<string | undefined>;
|
|
943
|
+
/** Computed signal returning the form group if one exists, or undefined. */
|
|
944
|
+
formGroupIfAny: _angular_core.Signal<FormGroup<any> | undefined>;
|
|
945
|
+
/** Computed signal returning the form group, throwing if none exists. */
|
|
946
|
+
formGroup: _angular_core.Signal<FormGroup<any>>;
|
|
947
|
+
/**
|
|
948
|
+
* Returns the component form name, which is for now the subName
|
|
949
|
+
*/
|
|
950
|
+
componentNameInForm: _angular_core.Signal<string>;
|
|
951
|
+
constructor();
|
|
952
|
+
/**
|
|
953
|
+
* Angular lifecycle hook. Sets up input/output bindings and emits outputs
|
|
954
|
+
* if any output objects have been defined.
|
|
955
|
+
*/
|
|
956
|
+
ngOnInit(): void;
|
|
957
|
+
/**
|
|
958
|
+
* Manages a form control within the component's form group, optionally creating it if it does not exist.
|
|
959
|
+
* Can be safely called even when no form group is available.
|
|
960
|
+
* @param ctrlName - The name of the form control
|
|
961
|
+
* @param create - Whether to create the control if it does not exist (default true)
|
|
962
|
+
* @returns The AbstractControl, or undefined if no form group is available
|
|
963
|
+
*/
|
|
964
|
+
manageFormControl<T>(ctrlName: string, create?: boolean): AbstractControl<T> | undefined;
|
|
965
|
+
/** Computed signal that safely returns the sub-name, throwing if it is null. */
|
|
966
|
+
safelyGetSubName: _angular_core.Signal<string>;
|
|
967
|
+
/**
|
|
968
|
+
* Computed signal returning the form control name for this component.
|
|
969
|
+
*/
|
|
970
|
+
formControlName: _angular_core.Signal<string>;
|
|
971
|
+
/** Computed signal that retrieves the existing AbstractControl for this component's sub-name. */
|
|
972
|
+
formControl: _angular_core.Signal<AbstractControl<any, any, any>>;
|
|
973
|
+
/**
|
|
974
|
+
* Returns a human-readable descriptor for this component.
|
|
975
|
+
* @returns A string describing the component type and context
|
|
976
|
+
*/
|
|
977
|
+
componentDescriptor(): string;
|
|
978
|
+
/** Computed signal exposing the raw value from the context. */
|
|
979
|
+
getValue: _angular_core.Signal<T | null | undefined>;
|
|
980
|
+
/** Computed signal exposing the display value from the context. */
|
|
981
|
+
displayValue: _angular_core.Signal<T | null>;
|
|
982
|
+
/**
|
|
983
|
+
* This is where components can assign their output() and input() into the XtComponent inputs and outputs member
|
|
984
|
+
* @protected
|
|
985
|
+
*/
|
|
986
|
+
protected setupInputOutput(): void;
|
|
987
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtSimpleComponent<any>, never>;
|
|
988
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtSimpleComponent<any>, "ng-component", never, { "context": { "alias": "context"; "required": true; "isSignal": true; }; "models": { "alias": "models"; "required": false; "isSignal": true; }; }, { "outputs": "outputs"; }, never, never, true, never>;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* A composite XtComponent that manages a form group for its sub-elements.
|
|
993
|
+
* Extends XtSimpleComponent to provide context-based form group management
|
|
994
|
+
* and sub-context resolution for nested components.
|
|
995
|
+
* Selector: not directly used (abstract base via template).
|
|
996
|
+
*/
|
|
997
|
+
declare class XtCompositeComponent<T = any> extends XtSimpleComponent<T> {
|
|
998
|
+
/** Injected service for resolving components and type information. */
|
|
999
|
+
resolverService: XtResolverService;
|
|
1000
|
+
/**
|
|
1001
|
+
* Computes the local form group for this composite, creating one from the parent form group if it does not exist.
|
|
1002
|
+
* Overrides the base implementation to manage a dedicated form group for sub-elements.
|
|
1003
|
+
*/
|
|
1004
|
+
formGroupIfAny: _angular_core.Signal<FormGroup<any> | undefined>;
|
|
1005
|
+
/**
|
|
1006
|
+
* We need to create a new form group to manage the sub elements.
|
|
1007
|
+
*/
|
|
1008
|
+
formGroup: _angular_core.Signal<FormGroup<any>>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Helper function to calculate the sub context for a named child element.
|
|
1011
|
+
* @param subName - The name of the sub-element
|
|
1012
|
+
* @param subType - Optional type hint for the sub-element
|
|
1013
|
+
* @returns The sub-context for the given child
|
|
1014
|
+
*/
|
|
1015
|
+
subContext(subName: string, subType?: string): XtContext<any>;
|
|
1016
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtCompositeComponent<any>, never>;
|
|
1017
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtCompositeComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/** Default implementation of XtComponentModel */
|
|
1021
|
+
declare class XtBaseModel<T> implements XtComponentModel {
|
|
1022
|
+
/** Model signal for the currently selected value */
|
|
1023
|
+
valueSelected?: ModelSignal<T | null> | undefined;
|
|
1024
|
+
/** Model signal for sort criteria */
|
|
1025
|
+
sortBy?: ModelSignal<ISortBy<T>[]> | undefined;
|
|
1026
|
+
/** Model signal for filter criteria */
|
|
1027
|
+
filterBy?: ModelSignal<IStoreCriteria<T>[]> | undefined;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
declare class XtMessageHandler {
|
|
1031
|
+
/**
|
|
1032
|
+
* Handles an error occurrence by logging it to the console
|
|
1033
|
+
* @param error - The error object
|
|
1034
|
+
* @param errorMsg - Optional custom error message
|
|
1035
|
+
*/
|
|
1036
|
+
errorOccurred(error: any, errorMsg?: string): void;
|
|
1037
|
+
/**
|
|
1038
|
+
* Handles a warning occurrence by logging it to the console
|
|
1039
|
+
* @param warningMsg - Optional warning message
|
|
1040
|
+
*/
|
|
1041
|
+
warningOccurred(warningMsg?: string): void;
|
|
1042
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtMessageHandler, never>;
|
|
1043
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtMessageHandler>;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Attaches a value to a form group by creating either a FormControl or nested FormGroup based on the value type
|
|
1048
|
+
* @param formGroup - The form group to attach to
|
|
1049
|
+
* @param controlName - The control name within the form group
|
|
1050
|
+
* @param value - The value to attach
|
|
1051
|
+
* @param valueType - Optional type identifier for type resolution
|
|
1052
|
+
* @param resolver - Optional type resolver for determining if the value is primitive
|
|
1053
|
+
*/
|
|
1054
|
+
declare function attachToFormGroup(formGroup: FormGroup, controlName: string, value: any, valueType?: string, resolver?: XtTypeResolver): void;
|
|
1055
|
+
/**
|
|
1056
|
+
* Updates a form group with the properties from a value object, adding, updating, or removing controls as needed
|
|
1057
|
+
* @param formGroup - The form group to update
|
|
1058
|
+
* @param value - The value object containing the properties to sync
|
|
1059
|
+
* @param valueType - Optional type identifier for type resolution
|
|
1060
|
+
* @param resolver - Optional type resolver for determining property types
|
|
1061
|
+
*/
|
|
1062
|
+
declare function updateFormGroupWithValue(formGroup: FormGroup, value: {
|
|
1063
|
+
[key: string]: any;
|
|
1064
|
+
}, valueType?: string, resolver?: XtTypeResolver): void;
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* Helper class to ease unit testing
|
|
1068
|
+
*/
|
|
1069
|
+
declare class XtUnitTestHelper {
|
|
1070
|
+
/**
|
|
1071
|
+
* Asynchronously wait for test function to return true. By default try 20 times with a delay of 50ms
|
|
1072
|
+
* @param test
|
|
1073
|
+
* @param tries
|
|
1074
|
+
* @param timer
|
|
1075
|
+
*/
|
|
1076
|
+
static waitFor(test: () => boolean, tries?: number, timer?: number): Promise<void>;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Component that can be used to bootstrap tests.
|
|
1081
|
+
* Just set the value and component type, and it will be injected in your test.
|
|
1082
|
+
*/
|
|
1083
|
+
declare class HostTestSimpleComponent {
|
|
1084
|
+
/** Required input for the component type to render. */
|
|
1085
|
+
type: _angular_core.InputSignal<Type<XtComponent<any>>>;
|
|
1086
|
+
/** Input for the display mode. Defaults to FULL_VIEW. */
|
|
1087
|
+
displayMode: _angular_core.InputSignal<XtDisplayMode>;
|
|
1088
|
+
/** Input for the value to pass to the rendered component. */
|
|
1089
|
+
value: _angular_core.InputSignal<any>;
|
|
1090
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestSimpleComponent, never>;
|
|
1091
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HostTestSimpleComponent, "test-host", never, { "type": { "alias": "type"; "required": true; "isSignal": true; }; "displayMode": { "alias": "displayMode"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Same as HostTestSimpleComponent but it includes everything in a form.
|
|
1095
|
+
* Just set the component type, the formGroup and the component name, and your component will be run.
|
|
1096
|
+
* You can as well easily read and set the value.
|
|
1097
|
+
*/
|
|
1098
|
+
declare class HostTestFormComponent {
|
|
1099
|
+
/** Injected FormBuilder for creating form groups. */
|
|
1100
|
+
builder: FormBuilder;
|
|
1101
|
+
/** Required input for the component type to render. */
|
|
1102
|
+
type: _angular_core.InputSignal<Type<XtComponent<any>>>;
|
|
1103
|
+
/** Required input for the form control name. */
|
|
1104
|
+
controlName: _angular_core.InputSignal<string>;
|
|
1105
|
+
/** Input for the form description object used to generate the form group. */
|
|
1106
|
+
formDescription: _angular_core.InputSignal<any>;
|
|
1107
|
+
/** Input to provide an existing FormGroup directly. */
|
|
1108
|
+
formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
|
|
1109
|
+
/** The parent FormGroup that contains the component's form group. */
|
|
1110
|
+
parentFormGroup: FormGroup<{
|
|
1111
|
+
[x: string]: AbstractControl<any, any, any>;
|
|
1112
|
+
}>;
|
|
1113
|
+
/** Computed signal returning the created form group. */
|
|
1114
|
+
createdFormGroup: _angular_core.Signal<FormGroup<any>>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Computes the form group from the input, either using a provided form group or generating one from the form description.
|
|
1117
|
+
* @returns The created FormGroup
|
|
1118
|
+
*/
|
|
1119
|
+
protected computeFormGroup(): FormGroup;
|
|
1120
|
+
/**
|
|
1121
|
+
* Patches the component's form control with a new value.
|
|
1122
|
+
* @param newVal - The value to patch
|
|
1123
|
+
*/
|
|
1124
|
+
patchValue(newVal: any): void;
|
|
1125
|
+
/**
|
|
1126
|
+
* Retrieves the current value from the component's form control.
|
|
1127
|
+
* @returns The current form value
|
|
1128
|
+
*/
|
|
1129
|
+
retrieveValue(): any;
|
|
1130
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestFormComponent, never>;
|
|
1131
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HostTestFormComponent, "test-form-host", never, { "type": { "alias": "type"; "required": true; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": true; "isSignal": true; }; "formDescription": { "alias": "formDescription"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Component that can be used to test your component based on the type it handles
|
|
1135
|
+
* Just set the type hierarchy to register, the value, and it will instantiate the right component in your plugin
|
|
1136
|
+
*/
|
|
1137
|
+
declare class HostTestTypedComponent {
|
|
1138
|
+
/** Input for the display mode. Defaults to FULL_VIEW. */
|
|
1139
|
+
displayMode: _angular_core.InputSignal<XtDisplayMode>;
|
|
1140
|
+
/** Input for the value to display. */
|
|
1141
|
+
value: _angular_core.InputSignal<any>;
|
|
1142
|
+
/** Input for the value type string used for context creation. */
|
|
1143
|
+
valueType: _angular_core.InputSignal<string | undefined>;
|
|
1144
|
+
/** Computed signal that creates the XtBaseContext from the input values. */
|
|
1145
|
+
context: _angular_core.Signal<XtBaseContext<unknown>>;
|
|
1146
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestTypedComponent, never>;
|
|
1147
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HostTestTypedComponent, "test-typed-host", never, { "displayMode": { "alias": "displayMode"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "valueType": { "alias": "valueType"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Same as HostTestSimpleComponent but it includes everything in a form.
|
|
1151
|
+
* Just set the component type, the formGroup and the component name, and your component will be run.
|
|
1152
|
+
* You can as well easily read and set the value.
|
|
1153
|
+
*/
|
|
1154
|
+
declare class HostTestTypedFormComponent implements OnInit {
|
|
1155
|
+
/** Injected FormBuilder for creating form groups. */
|
|
1156
|
+
builder: FormBuilder;
|
|
1157
|
+
/** Injected resolver service for type resolution. */
|
|
1158
|
+
resolver: XtResolverService;
|
|
1159
|
+
/** Default control name used if none is provided. */
|
|
1160
|
+
static readonly CONTROL_NAME = "ForTest";
|
|
1161
|
+
/** Input for the value type string. */
|
|
1162
|
+
valueType: _angular_core.InputSignal<string | undefined>;
|
|
1163
|
+
/** Input for the form control name. */
|
|
1164
|
+
controlName: _angular_core.InputSignal<string | undefined>;
|
|
1165
|
+
/** Input for the form description used to generate the form group. */
|
|
1166
|
+
formDescription: _angular_core.InputSignal<any>;
|
|
1167
|
+
/** Input to provide an existing FormGroup directly. */
|
|
1168
|
+
formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
|
|
1169
|
+
/** The parent FormGroup that contains the component's form group. */
|
|
1170
|
+
parentFormGroup: FormGroup<{
|
|
1171
|
+
[x: string]: AbstractControl<any, any, any>;
|
|
1172
|
+
}>;
|
|
1173
|
+
/** Computed signal returning the created form group. */
|
|
1174
|
+
createdFormGroup: _angular_core.Signal<FormGroup<any>>;
|
|
1175
|
+
ngOnInit(): void;
|
|
1176
|
+
/**
|
|
1177
|
+
* Computes the form group from inputs, generating one from description or type if needed.
|
|
1178
|
+
* @returns The created FormGroup
|
|
1179
|
+
*/
|
|
1180
|
+
protected computeFormGroup(): FormGroup;
|
|
1181
|
+
/** Computed signal that builds the XtBaseContext from form group and control name. */
|
|
1182
|
+
subContext: _angular_core.Signal<XtBaseContext<any>>;
|
|
1183
|
+
/**
|
|
1184
|
+
* Patches a form control with a new value.
|
|
1185
|
+
* @param controlName - The name of the control to patch
|
|
1186
|
+
* @param newVal - The value to set
|
|
1187
|
+
*/
|
|
1188
|
+
patchValue(controlName: string, newVal: any): void;
|
|
1189
|
+
/**
|
|
1190
|
+
* Retrieves the current value from a form control.
|
|
1191
|
+
* @param controlName - The name of the control to read
|
|
1192
|
+
* @returns The current form value
|
|
1193
|
+
*/
|
|
1194
|
+
retrieveValue(controlName: string): any;
|
|
1195
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestTypedFormComponent, never>;
|
|
1196
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<HostTestTypedFormComponent, "test-typed-form-host", never, { "valueType": { "alias": "valueType"; "required": false; "isSignal": true; }; "controlName": { "alias": "controlName"; "required": false; "isSignal": true; }; "formDescription": { "alias": "formDescription"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* A very light and not 100% compatible storemanager in case you are not using xt-store.
|
|
1201
|
+
* It can emulate XtStoreManager to some extends for doing some tests
|
|
1202
|
+
*/
|
|
1203
|
+
declare class StoreTestHelper {
|
|
1204
|
+
/**
|
|
1205
|
+
* Sets a TestStoreManager as the test store manager in StoreSupport.
|
|
1206
|
+
* Call this in test setup to use the in-memory store provider.
|
|
1207
|
+
*/
|
|
1208
|
+
static ensureTestProviderOnly(): void;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* A test implementation of IStoreManager that always returns a single TestStoreProvider.
|
|
1212
|
+
* Used to emulate xt-store for unit testing purposes.
|
|
1213
|
+
*/
|
|
1214
|
+
declare class TestStoreManager implements IStoreManager {
|
|
1215
|
+
/** The default provider returned for all store operations. */
|
|
1216
|
+
protected defaultProvider: TestStoreProvider<never>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Returns the default test store provider.
|
|
1219
|
+
* @param name - Ignored; always returns the same provider
|
|
1220
|
+
* @returns The default TestStoreProvider
|
|
1221
|
+
*/
|
|
1222
|
+
getProvider<T = never>(name?: string): IStoreProvider<T> | undefined;
|
|
1223
|
+
/**
|
|
1224
|
+
* Returns the default test store provider (safe variant).
|
|
1225
|
+
* @param name - Ignored; always returns the same provider
|
|
1226
|
+
* @returns The default TestStoreProvider
|
|
1227
|
+
*/
|
|
1228
|
+
getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Returns the default test store provider.
|
|
1231
|
+
* @returns The default TestStoreProvider or undefined
|
|
1232
|
+
*/
|
|
1233
|
+
getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
|
|
1234
|
+
/**
|
|
1235
|
+
* Returns the default test store provider (safe variant).
|
|
1236
|
+
* @returns The default TestStoreProvider
|
|
1237
|
+
*/
|
|
1238
|
+
getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Creates a new TestStoreCriteria instance.
|
|
1241
|
+
* @param name - The field name for the criteria
|
|
1242
|
+
* @param value - The value to match
|
|
1243
|
+
* @param operator - The comparison operator
|
|
1244
|
+
* @returns A new TestStoreCriteria
|
|
1245
|
+
*/
|
|
1246
|
+
newStoreCriteria<T = any>(name: keyof T, value: any, operator: IStoreCriteriaOperator): IStoreCriteria<T>;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* A test implementation of IStoreProvider that stores entities in an in-memory map.
|
|
1250
|
+
* Supports basic CRUD and filtering operations for unit testing.
|
|
1251
|
+
*/
|
|
1252
|
+
declare class TestStoreProvider<T = never> implements IStoreProvider<T> {
|
|
1253
|
+
/** In-memory data store, keyed by entity type name then by entity key. */
|
|
1254
|
+
protected data: Map<string, Map<string, any>>;
|
|
1255
|
+
/**
|
|
1256
|
+
* Gets or creates a named entity map within the data store.
|
|
1257
|
+
* @param name - The entity type name
|
|
1258
|
+
* @returns The map of entities for the given type
|
|
1259
|
+
*/
|
|
1260
|
+
protected getOrCreateArray(name: string): Map<string, T>;
|
|
1261
|
+
/**
|
|
1262
|
+
* Extracts a unique key from a value object, using _id, id, or generating a new one.
|
|
1263
|
+
* @param value - The value to extract the key from
|
|
1264
|
+
* @param create - Whether to generate a new key if none exists
|
|
1265
|
+
* @returns The extracted or generated key string
|
|
1266
|
+
*/
|
|
1267
|
+
protected extractKey(value: any, create?: boolean): string;
|
|
1268
|
+
/**
|
|
1269
|
+
* Stores an entity in the in-memory data store.
|
|
1270
|
+
* @param name - The entity type name
|
|
1271
|
+
* @param entity - The entity to store
|
|
1272
|
+
* @returns A promise resolving to the stored entity
|
|
1273
|
+
*/
|
|
1274
|
+
storeEntity(name: string, entity: T): Promise<T>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Loads an entity by key, throwing if not found.
|
|
1277
|
+
* @param name - The entity type name
|
|
1278
|
+
* @param key - The entity key
|
|
1279
|
+
* @returns A promise resolving to the entity
|
|
1280
|
+
*/
|
|
1281
|
+
safeLoadEntity(name: string, key: any): Promise<T>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Loads an entity by key, returning undefined if not found.
|
|
1284
|
+
* @param name - The entity type name
|
|
1285
|
+
* @param key - The entity key
|
|
1286
|
+
* @returns A promise resolving to the entity or undefined
|
|
1287
|
+
*/
|
|
1288
|
+
loadEntity(name: string, key: any): Promise<T | undefined>;
|
|
1289
|
+
/**
|
|
1290
|
+
* Deletes an entity by key.
|
|
1291
|
+
* @param name - The entity type name
|
|
1292
|
+
* @param key - The entity key
|
|
1293
|
+
* @returns A promise resolving to true if deleted, false otherwise
|
|
1294
|
+
*/
|
|
1295
|
+
deleteEntity(name: string, key: any): Promise<boolean>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Searches entities by optional criteria. Returns all entities if no criteria provided.
|
|
1298
|
+
* @param name - The entity type name
|
|
1299
|
+
* @param criteria - Optional filter criteria
|
|
1300
|
+
* @returns An observable of matching entities
|
|
1301
|
+
*/
|
|
1302
|
+
searchEntities(name: string, ...criteria: IStoreCriteria<T>[]): Observable<T[]>;
|
|
1303
|
+
/**
|
|
1304
|
+
* Search and prepare entities with sorting, grouping, and transformation (not implemented).
|
|
1305
|
+
*/
|
|
1306
|
+
searchAndPrepareEntities(name: string, sort?: any, groupBy?: any, transformer?: IDataTransformer<T> | undefined, ...criteria: any[]): Observable<any>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Indicates that this provider supports document storage.
|
|
1309
|
+
* @returns True
|
|
1310
|
+
*/
|
|
1311
|
+
canStoreDocument(): boolean;
|
|
1312
|
+
/**
|
|
1313
|
+
* Stores a document file and returns its document info.
|
|
1314
|
+
* @param toStore - The file to store
|
|
1315
|
+
* @returns A promise resolving to the document info
|
|
1316
|
+
*/
|
|
1317
|
+
storeDocument(toStore: File): Promise<IDocumentInfo>;
|
|
1318
|
+
/**
|
|
1319
|
+
* Stores multiple document files (not implemented).
|
|
1320
|
+
*/
|
|
1321
|
+
storeDocuments(toStore: File[]): Observable<IDocumentInfo>;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* A test implementation of IDocumentInfo for testing document storage operations.
|
|
1325
|
+
*/
|
|
1326
|
+
declare class TestDocumentInfo implements IDocumentInfo {
|
|
1327
|
+
/** The name of the stored document. */
|
|
1328
|
+
documentName: string;
|
|
1329
|
+
/** Whether the document is referenced by URL. */
|
|
1330
|
+
isUrl: boolean;
|
|
1331
|
+
/** Optional document identifier. */
|
|
1332
|
+
documentId?: string;
|
|
1333
|
+
/**
|
|
1334
|
+
* Creates a new TestDocumentInfo instance.
|
|
1335
|
+
* @param documentName - The document name
|
|
1336
|
+
* @param isUrl - Whether the document is a URL
|
|
1337
|
+
* @param documentId - Optional document identifier
|
|
1338
|
+
*/
|
|
1339
|
+
constructor(documentName: string, isUrl: boolean, documentId?: string);
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* A test implementation of IStoreCriteria that filters entities by field comparison.
|
|
1343
|
+
*/
|
|
1344
|
+
declare class TestStoreCriteria<T = any> implements IStoreCriteria<T> {
|
|
1345
|
+
/** The field name to filter on. */
|
|
1346
|
+
name: keyof T;
|
|
1347
|
+
/** The value to compare against. */
|
|
1348
|
+
value: any;
|
|
1349
|
+
/** The comparison operator (=, <=, <). */
|
|
1350
|
+
operator: '=' | '<=' | '<';
|
|
1351
|
+
/**
|
|
1352
|
+
* Creates a new TestStoreCriteria instance.
|
|
1353
|
+
* @param name - The field name to filter on
|
|
1354
|
+
* @param value - The value to compare against
|
|
1355
|
+
* @param operator - The comparison operator (default '=')
|
|
1356
|
+
*/
|
|
1357
|
+
constructor(name: keyof T, value: any, operator?: IStoreCriteriaOperator);
|
|
1358
|
+
/**
|
|
1359
|
+
* Filters an entity by comparing its field value against the criteria value.
|
|
1360
|
+
* @param toFilter - The entity to test
|
|
1361
|
+
* @returns True if the entity matches the criteria
|
|
1362
|
+
*/
|
|
1363
|
+
filter(toFilter: any): boolean;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
export { HostTestFormComponent, HostTestSimpleComponent, HostTestTypedComponent, HostTestTypedFormComponent, ISortByDirection, StoreSupport, StoreTestHelper, TestDocumentInfo, TestStoreCriteria, TestStoreManager, TestStoreProvider, XT_REGISTRY_TOKEN, XT_RESOLVER_TOKEN, XT_TYPE_RESOLVER_TOKEN, XtBaseContext, XtBaseInput, XtBaseModel, XtBaseOutput, XtCompositeComponent, XtMessageHandler, XtPluginRegistry, XtRenderComponent, XtRenderSubComponent, XtResolvedComponent, XtResolverService, XtSimpleComponent, XtUnitTestHelper, attachToFormGroup, initXtPluginRegistry, updateFormGroupWithValue, xtPluginRegistry };
|
|
1367
|
+
export type { IDataTransformer, IDocumentInfo, ISortBy, IStoreCriteria, IStoreCriteriaOperator, IStoreManager, IStoreProvider, XtActionHandler, XtActionHandlerInfo, XtActionInfo, XtActionResult, XtComponent, XtComponentInfo, XtComponentInput, XtComponentModel, XtComponentOutput, XtContext, XtDisplayMode, XtInputType, XtModelType, XtOutputType, XtPluginInfo, XtResolver, XtTypeHandlerInfo, XtWorkflow, XtWorkflowInfo };
|