xt-components 0.6.3 → 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/index.d.ts DELETED
@@ -1,667 +0,0 @@
1
- import * as _angular_core from '@angular/core';
2
- import { Signal, WritableSignal, InputSignal, OutputEmitterRef, 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
- type XtComponentInfo<T> = {
10
- componentName: string;
11
- componentClass: T;
12
- typesHandled: string[];
13
- outputs?: XtOutputType[];
14
- };
15
- type XtTypeHandlerInfo<T> = {
16
- typesHandled: string[];
17
- handlerClass: T;
18
- };
19
- type XtActionInfo<T> = {
20
- description: string;
21
- visible: boolean;
22
- handlerClass: any;
23
- iconUrl?: string;
24
- };
25
- type XtActionHandlerInfo<T> = {
26
- types: string[];
27
- actions: {
28
- [name: string]: XtActionInfo<T>;
29
- };
30
- };
31
- type XtPluginInfo = {
32
- name: string;
33
- uriLogo?: string;
34
- components?: XtComponentInfo<any>[];
35
- types?: XtTypeInfo;
36
- typeHandlers?: XtTypeHandlerInfo<any>[];
37
- actionHandlers?: XtActionHandlerInfo<any>[];
38
- };
39
-
40
- declare class XtAction<T> {
41
- name: string;
42
- info: XtActionInfo<T>;
43
- enabled: _angular_core.WritableSignal<boolean>;
44
- constructor(name: string, info: XtActionInfo<T>, enabled?: boolean);
45
- }
46
-
47
- /**
48
- * A XtContext provides all the necessary information for an ng-extended component to operate. It is passed from parent to child component and pass
49
- * - The display mode - View, Inline view or Edit
50
- * - The value, either directly as a signal or in a formgroup when editing.
51
- * - The valueType, necessary to find the right ng-extended component to display
52
- *
53
- * To do this, it maintains a hierarchy of context and subContexts by name.
54
- */
55
- type XtContext<T> = {
56
- displayMode: XtDisplayMode;
57
- subName?: string;
58
- parentFormGroup?: FormGroup;
59
- localFormGroup?: FormGroup;
60
- /**
61
- * When the value in the context is a reference to another type
62
- */
63
- reference?: XtTypeReference;
64
- /**
65
- * If it's a reference, we keep the context referenced
66
- */
67
- referencedContext?: XtContext<any>;
68
- /**
69
- * creates the referencedContext by using this referenced value
70
- * @param val
71
- *
72
- updateReferencedContext(val: any, valueType?:string): void;*/
73
- /**
74
- * Signal when all the asynchronously defined subreferences are resolved.
75
- *
76
- subReferencesResolved: WritableSignal<boolean>;
77
- */
78
- parentContext?: XtContext<any>;
79
- isInForm(): boolean;
80
- formGroup(): FormGroup | undefined;
81
- formControlNameOrNull(): string | null;
82
- formControlValue(): any | null;
83
- subValue(subName?: string): T | null | undefined;
84
- subContext(subName: string | undefined | null, subType?: string, typeResolver?: XtTypeResolver | null): XtContext<any>;
85
- elementSetContext(subElement: any): XtContext<any>;
86
- displayValue: Signal<T | null>;
87
- setDisplayValue(newValue: T | null | undefined, type?: string): XtContext<T>;
88
- setFormValue(newValue: T | null | undefined, markAsDirty?: boolean): boolean;
89
- value(): T | null | undefined;
90
- valueType?: string;
91
- toString(): string;
92
- listActions: WritableSignal<XtAction<T>[] | null>;
93
- isReference(): boolean;
94
- setReferenceInfo(ref: XtTypeReference): void;
95
- };
96
- type XtDisplayMode = 'INLINE_VIEW' | 'FULL_VIEW' | 'FULL_EDITABLE' | 'LIST_VIEW';
97
- declare class XtBaseContext<T> implements XtContext<T> {
98
- displayMode: XtDisplayMode;
99
- /**
100
- * When editable, the value is stored in a parent formGroup
101
- */
102
- subName?: string;
103
- parentFormGroup?: FormGroup<any>;
104
- /**
105
- * When the context is a child, it potentially needs to update its parent value
106
- */
107
- parentContext?: XtBaseContext<any>;
108
- /**
109
- * All child contexts are kept in this map
110
- */
111
- protected childContexts?: Map<string, XtBaseContext<any>>;
112
- /**
113
- * localFormGroup exists only for composite components: it's children are all gathered in a form group
114
- */
115
- localFormGroup?: FormGroup<any>;
116
- /**
117
- * When not managed by a form, the value is here
118
- */
119
- nonFormValue?: WritableSignal<T | null>;
120
- valueType?: string;
121
- /**
122
- * When the value in the context is a reference to another type
123
- */
124
- reference?: XtTypeReference;
125
- /**
126
- * If it's a reference, we keep the context referenced
127
- *
128
- referencedContext?:XtContext<any>;*/
129
- /**
130
- * Keeps track of all the possible actions for this context
131
- * @protected
132
- */
133
- listActions: WritableSignal<XtAction<T>[] | null>;
134
- /**
135
- *
136
- * @param displayMode
137
- * @param readOnly
138
- * @param parentGroup
139
- * @param controlName
140
- */
141
- constructor(displayMode: XtDisplayMode, subName?: string, parentGroup?: FormGroup, parentContext?: XtBaseContext<any>);
142
- setDisplayValue(newValue: T | null | undefined, type?: string, updateParent?: boolean): XtBaseContext<T>;
143
- displayValue: Signal<T | null>;
144
- isInForm(): boolean;
145
- formControlNameOrNull(): string | null;
146
- value(): T | null | undefined;
147
- subValue(subsubName?: string): any | null | undefined;
148
- /**
149
- * Enable child contexts to update its own value in the parent context whenever it's value changes
150
- */
151
- protected updateSubDisplayValue(subName: string, subValue: any): void;
152
- formControlValue(): T | null | undefined;
153
- setFormValue(newValue: T | null | undefined, markAsDirty?: boolean): boolean;
154
- /**
155
- * Returns the context associated with a specific element in a set.
156
- * Value must be an array.
157
- * @param elementIndex
158
- */
159
- elementSetContext(elementIndex: number): XtContext<any>;
160
- subContext(subName: string | undefined | null, subType?: string, typeResolver?: XtTypeResolver | null): XtContext<any>;
161
- formGroup(): FormGroup | undefined;
162
- isReference(): boolean;
163
- setReferenceInfo(reference: XtTypeReference): void;
164
- /**
165
- * creates the referencedContext by using this referenced value
166
- * @param val
167
- *
168
- updateReferencedContext(val: any, valueType?:string): void {
169
- if (!this.isReference()) throw new Error ('This context '+this.toString()+' is not a reference.');
170
-
171
- if( this.referencedContext==null) {
172
- let refDisplayMode = 'INLINE_VIEW' as XtDisplayMode;
173
- if (this.displayMode=='FULL_VIEW') refDisplayMode = 'FULL_VIEW';
174
- this.referencedContext = new XtBaseContext(refDisplayMode);
175
- }
176
- this.referencedContext.setDisplayValue(val);
177
- if( valueType!=null) this.referencedContext.valueType=valueType;
178
- }*/
179
- toString(): string;
180
- }
181
-
182
- type XtComponent<T = any> = {
183
- context: InputSignal<XtContext<T>>;
184
- inputsObject?: XtComponentInput;
185
- outputsObject?: XtComponentOutput;
186
- inputs?: InputSignal<XtComponentInput>;
187
- outputs?: OutputEmitterRef<XtComponentOutput>;
188
- isInForm(): boolean;
189
- formControlName(): string | undefined;
190
- formGroup(): FormGroup;
191
- formGroupIfAny(): FormGroup | undefined;
192
- };
193
- type XtOutputType = 'valueSelected';
194
- type XtInputType = 'valueSelected';
195
- type XtComponentOutput = {
196
- [key in XtOutputType]: OutputEmitterRef<any> | undefined;
197
- };
198
- type XtComponentInput = {
199
- [key in XtInputType]: InputSignal<any> | undefined;
200
- };
201
-
202
- declare class XtResolvedComponent {
203
- componentName: string;
204
- componentClass: any;
205
- outputs: boolean;
206
- constructor(componantName: string, componentClass: any, outputs?: boolean);
207
- static from(info: XtComponentInfo<any>): XtResolvedComponent;
208
- }
209
-
210
- type XtResolver = {
211
- resolve<T>(baseContext: XtContext<T>, subName?: string): XtResolvedComponent | null;
212
- };
213
-
214
- declare class XtPluginRegistry {
215
- pluginRegistry: Map<string, XtPluginInfo>;
216
- componentRegistry: Map<string, XtComponentInfo<any>>;
217
- componentByTypeCache: Map<string, XtComponentInfo<any>[]>;
218
- protected actionByTypeRegistry: Map<string, Map<string, XtActionInfo<any>>>;
219
- listComponents: _angular_core.WritableSignal<XtComponentInfo<any>[]>;
220
- listPlugins: _angular_core.WritableSignal<XtPluginInfo[]>;
221
- /**
222
- * The component can manage any standard javascript primitives types. That's usually the default whenever we don't know any particular type
223
- * string
224
- * number
225
- * bigint
226
- * boolean
227
- * undefined
228
- * null
229
- * symbol is not managed
230
- * Date, while an object and not a primitive, is managed
231
- */
232
- static readonly ANY_PRIMITIVE_TYPE = "ANY_PRIMITIVE_TYPE";
233
- /**
234
- * 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)
235
- */
236
- static readonly ANY_OBJECT_TYPE = "ANY_OBJECT_TYPE";
237
- static readonly ANY_PRIMITIVE_SET = "ANY_PRIMITIVE_SET";
238
- static readonly ANY_OBJECT_SET = "ANY_OBJECT_SET";
239
- /**
240
- * Whenever a component can handle any type of reference to a single entity or to multiple entities.
241
- */
242
- static readonly ANY_SINGLE_REFERENCE = "ANY_SINGLE_REFERENCE";
243
- static readonly ANY_MULTIPLE_REFERENCE = "ANY_MULTIPLE_REFERENCE";
244
- registerPlugin(info: XtPluginInfo): void;
245
- registerComponent<T>(info: XtComponentInfo<T>): void;
246
- findComponentsForType<T>(valueType: string | null | undefined, value?: T): XtComponentInfo<any>[];
247
- static registry(): XtPluginRegistry;
248
- findComponentInfo(type: Type<XtComponent<any>>): XtComponentInfo<any> | null;
249
- getComponentInfo(type: Type<XtComponent<any>>): XtComponentInfo<any>;
250
- registerActionHandler<T>(handlerInfo: XtActionHandlerInfo<T>): void;
251
- findActionInfo<T>(type: string, actionName: string): XtActionInfo<T> | undefined;
252
- listActionInfos<T>(type: string): {
253
- name: string;
254
- info: XtActionInfo<T>;
255
- }[];
256
- }
257
-
258
- /**
259
- * Wrapper around xt-store manager: You can use it to check if xt-store is included or not, and decide what to do
260
- *
261
- * This allows plugins to potentially use xt-store whenever included in the applications running the plugin
262
- */
263
-
264
- declare class StoreSupport {
265
- protected static testStoreManager?: IStoreManager;
266
- static isStoreManagerAvailable(): boolean;
267
- static getStoreManager(): IStoreManager;
268
- static setTestStoreManager(testStoreManager: IStoreManager): void;
269
- static newStoreCriteria(name: string, value: any, operator?: IStoreCriteriaOperator): IStoreCriteria;
270
- }
271
- /**
272
- * Interface definition for xt-store component.
273
- * We re-define them here to avoid importing xt-store in all plugins that don't need it.
274
- */
275
- interface IDataTransformer<T> {
276
- /**
277
- * Enable transformation of data right after it has been loaded from the store
278
- * @param source
279
- */
280
- postLoadingTransformation(source: any[]): T[];
281
- }
282
- interface IDocumentInfo {
283
- documentName: string;
284
- isUrl: boolean;
285
- documentId?: string;
286
- }
287
- type IStoreCriteriaOperator = '=' | '<' | '<=';
288
- interface IStoreCriteria {
289
- name: string;
290
- value: any;
291
- operator: IStoreCriteriaOperator;
292
- }
293
- interface IStoreProvider<T> {
294
- storeEntity(name: string, entity: T): Promise<T>;
295
- /**
296
- * Rejects the promise if the entity is not found
297
- * @param name
298
- * @param key
299
- */
300
- safeLoadEntity(name: string, key: any): Promise<T>;
301
- loadEntity(name: string, key: any): Promise<T | undefined>;
302
- deleteEntity(name: string, key: any): Promise<boolean>;
303
- searchEntities(name: string, ...criteria: IStoreCriteria[]): Observable<Array<T>>;
304
- searchAndPrepareEntities(name: string, sort?: any, groupBy?: any, transformer?: IDataTransformer<T>, ...criteria: any[]): Observable<any>;
305
- canStoreDocument(): boolean;
306
- /**
307
- * Upload one document to a server store and returns the url or the id needed to retrieve them.
308
- * @param toStore
309
- * @param position
310
- */
311
- storeDocument(toStore: File): Promise<IDocumentInfo>;
312
- /**
313
- * Upload documents to a server store and returns the url or the id needed to retrieve them.
314
- * @param toStore
315
- * @param position
316
- */
317
- storeDocuments(toStore: File[]): Observable<IDocumentInfo>;
318
- }
319
- interface IStoreManager {
320
- getProvider<T = never>(name?: string): IStoreProvider<T> | undefined;
321
- getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
322
- getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
323
- getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
324
- newStoreCriteria(name: string, value: any, operator: IStoreCriteriaOperator): IStoreCriteria;
325
- }
326
-
327
- /**
328
- * An all in one helper class, enabling manipulation of the context, with data and type associated with it.
329
- */
330
- declare class XtResolverService {
331
- pluginRegistry: xt_components.XtPluginRegistry;
332
- protected baseResolver: XtResolver | null;
333
- protected baseTypeResolver: XtTypeResolver | null;
334
- resolver: XtResolver;
335
- typeResolver: XtTypeResolver;
336
- constructor();
337
- findBestComponent<T>(baseContext: XtContext<T>, subName?: string): XtResolvedComponent;
338
- findTypeOf<T>(baseContext: XtContext<T>, subName?: string, value?: T): string | null | undefined;
339
- findTypeHandlerOf<T>(baseContext: XtContext<T>, subName?: string, value?: T): {
340
- typeName?: string | null;
341
- handler?: XtTypeHandler<any>;
342
- };
343
- listSubNamesOf<T>(baseContext: XtContext<T>, value?: T): string[];
344
- listSubNamesOfType<T>(valueType: string, value?: T): string[];
345
- registerPlugin(info: XtPluginInfo): void;
346
- registerTypes(types: XtTypeInfo | undefined, handlers?: XtTypeHandlerInfo<any>[]): void;
347
- /**
348
- * Calculates all the possible actions for a given context
349
- * @param context
350
- * @param onlyVisible
351
- */
352
- possibleActions<T>(context: XtContext<T>, onlyVisible?: boolean): Array<XtAction<T>>;
353
- /**
354
- * Finds the possible action with the given name for the current type, and runs it in the current value.
355
- * If the action is not possible in this context, try a parent context
356
- * @param actionName
357
- */
358
- runAction<T>(context: XtContext<T>, actionName: string, storeMgr?: any): Promise<XtActionResult<any>>;
359
- protected handlerDefinedFor(newType: string, handlers: XtTypeHandlerInfo<any>[] | undefined): any;
360
- getComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent;
361
- findComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent | null;
362
- listComponents: _angular_core.Signal<XtComponentInfo<any>[]>;
363
- listPlugins: _angular_core.Signal<XtPluginInfo[]>;
364
- /**
365
- * Dynamically load a register a plugin from the given url
366
- * The plugin must export at least a Register entrypoint that will be called right after loading..
367
- * @param url
368
- * @returns a Promise with the module loaded and already registered.
369
- */
370
- loadPlugin(url: URL | string): Promise<any>;
371
- /**
372
- * Based on the type & value of the element, find which property is on its type and returns it's value
373
- * @param context
374
- * @param subPropertyType
375
- * @param value
376
- */
377
- findSubPropertyWithType<T>(context: XtContext<T>, subPropertyType: string, value: T): any;
378
- /**
379
- * Creates a duplicate of an object, using our knowledge on its type given by the context
380
- * @param context
381
- * @param value
382
- */
383
- safeDuplicate<T>(context: XtContext<T>, value: T): T;
384
- resolveMappingOf<U, T>(context: XtContext<T>, targetType: string, value?: T): MappingHelper<U, T> | undefined;
385
- resolveReferencedValue<T, U>(context: XtContext<T>, storeMgr: IStoreManager): Promise<U | U[] | null | undefined>;
386
- resolvePendingReferences(): void;
387
- /**
388
- * Calculates the values that can be referenced by the reference & value of this context
389
- * @param context
390
- */
391
- findPossibleReferences<T, U>(context: XtContext<T>): Observable<U[]>;
392
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtResolverService, never>;
393
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtResolverService>;
394
- }
395
-
396
- type XtActionResult<Type> = {
397
- status: 'success' | 'error' | 'none';
398
- warnings?: string[];
399
- errors?: string[];
400
- value?: Type | null;
401
- };
402
- type XtActionHandler<Type> = {
403
- /**
404
- * Runs an action on a item under the context
405
- * @param context
406
- * @param actionName
407
- * @param store
408
- */
409
- runAction(context: XtContext<Type>, actionName: string, resolver: XtResolverService, storeMgr?: any): Promise<XtActionResult<Type>>;
410
- };
411
-
412
- /**
413
- * The global plugin registry.
414
- * Plugins will register to this when loaded.
415
- */
416
-
417
- declare global {
418
- var XT_REGISTRY: XtPluginRegistry;
419
- }
420
- declare function initXtPluginRegistry(): void;
421
- declare function xtPluginRegistry(): XtPluginRegistry;
422
-
423
- declare const XT_RESOLVER_TOKEN: InjectionToken<XtResolver>;
424
- declare const XT_TYPE_RESOLVER_TOKEN: InjectionToken<XtTypeResolver>;
425
- declare const XT_REGISTRY_TOKEN: InjectionToken<XtPluginRegistry>;
426
-
427
- declare class XtBaseOutput implements XtComponentOutput {
428
- valueSelected: OutputEmitterRef<any> | undefined;
429
- }
430
-
431
- declare class XtBaseInput implements XtComponentInput {
432
- valueSelected: InputSignal<any> | undefined;
433
- }
434
-
435
- /**
436
- * Offers a nice and easy to dynamically embed a component.
437
- * You set the type, the display mode, and either the value or the formgroup & subName to use.
438
- * XtRender will then instantiate the component, bind it to the value or form, and display it.
439
- */
440
- declare class XtRenderComponent<T> implements AfterViewInit {
441
- resolverService: XtResolverService;
442
- componentType: _angular_core.InputSignal<Type<XtComponent<T>> | undefined>;
443
- displayMode: _angular_core.InputSignal<XtDisplayMode>;
444
- valueType: _angular_core.InputSignal<string | undefined>;
445
- value: _angular_core.ModelSignal<T | undefined>;
446
- formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
447
- subName: _angular_core.InputSignal<string | undefined>;
448
- outputsObject: XtBaseOutput;
449
- inputs: _angular_core.InputSignal<XtBaseInput | undefined>;
450
- outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
451
- outlet: Signal<NgComponentOutlet<any>>;
452
- constructor();
453
- context: Signal<XtContext<any>>;
454
- realContext: Signal<XtContext<any>>;
455
- type: Signal<Type<XtComponent<T>> | null>;
456
- /**
457
- * Transfers the input and outputs from the host to the rendered component
458
- */
459
- ngAfterViewInit(): void;
460
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtRenderComponent<any>, never>;
461
- 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; }; }, { "value": "valueChange"; "outputs": "outputs"; }, never, never, true, never>;
462
- }
463
-
464
- /**
465
- * Dynamically render a component that will display the given subValue.
466
- * To be used only inside an XtSimpleComponent or XtCompositeComponent
467
- */
468
- declare class XtRenderSubComponent<T> implements AfterViewInit {
469
- context: _angular_core.InputSignal<XtContext<T>>;
470
- componentType: _angular_core.InputSignal<Type<XtComponent<T>> | undefined>;
471
- outputsObject: XtBaseOutput;
472
- inputs: _angular_core.InputSignal<XtBaseInput | undefined>;
473
- outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
474
- outlet: Signal<NgComponentOutlet<any>>;
475
- resolverService: XtResolverService;
476
- realContext: Signal<XtContext<T>>;
477
- type: Signal<Type<XtComponent<T>> | null>;
478
- /**
479
- * Transfers the input and outputs from the host to the rendered component
480
- */
481
- ngAfterViewInit(): void;
482
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtRenderSubComponent<any>, never>;
483
- 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; }; }, { "outputs": "outputs"; }, never, never, true, never>;
484
- }
485
-
486
- /**
487
- * An XtSimpleComponent just displays the given value or element in a form.
488
- * If you need to dynamically embed other XtComponents to display sub elements, then please use the XtCompositeComponent
489
- */
490
- declare class XtSimpleComponent<T = any> implements XtComponent<T>, OnInit {
491
- context: _angular_core.InputSignal<XtContext<T>>;
492
- outputsObject: XtBaseOutput;
493
- inputsObject: XtBaseInput;
494
- outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
495
- isInForm: _angular_core.Signal<boolean>;
496
- formControlNameIfAny: _angular_core.Signal<string | undefined>;
497
- formGroupIfAny: _angular_core.Signal<FormGroup<any> | undefined>;
498
- formGroup: _angular_core.Signal<FormGroup<any>>;
499
- /**
500
- * Returns the component form name, which is for now the subName
501
- */
502
- componentNameInForm: _angular_core.Signal<string>;
503
- constructor();
504
- ngOnInit(): void;
505
- manageFormControl<T>(ctrlName: string, create?: boolean): AbstractControl<T> | undefined;
506
- safelyGetSubName: _angular_core.Signal<string>;
507
- /**
508
- * Returns the form control name and create a form control behind the scene
509
- */
510
- formControlName: _angular_core.Signal<string>;
511
- formControl: _angular_core.Signal<AbstractControl<any, any, any>>;
512
- componentDescriptor(): string;
513
- getValue: _angular_core.Signal<T | null | undefined>;
514
- displayValue: _angular_core.Signal<T | null>;
515
- /**
516
- * This is where components can assign their output() and input() into the XtComponent inputs and outputs member
517
- * @protected
518
- */
519
- protected setupInputOutput(): void;
520
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtSimpleComponent<any>, never>;
521
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtSimpleComponent<any>, "ng-component", never, { "context": { "alias": "context"; "required": true; "isSignal": true; }; }, { "outputs": "outputs"; }, never, never, true, never>;
522
- }
523
-
524
- declare class XtCompositeComponent<T = any> extends XtSimpleComponent<T> {
525
- resolverService: XtResolverService;
526
- formGroupIfAny: _angular_core.Signal<FormGroup<any> | undefined>;
527
- /**
528
- * We need to create a new form group to manage the sub elements.
529
- */
530
- formGroup: _angular_core.Signal<FormGroup<any>>;
531
- /**
532
- * Helper function to calculate the sub context
533
- * @param subName
534
- * @param subType
535
- */
536
- subContext(subName: string, subType?: string): XtContext<any>;
537
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtCompositeComponent<any>, never>;
538
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtCompositeComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
539
- }
540
-
541
- declare class XtMessageHandler {
542
- errorOccurred(error: any, errorMsg?: string): void;
543
- warningOccurred(warningMsg?: string): void;
544
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtMessageHandler, never>;
545
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtMessageHandler>;
546
- }
547
-
548
- declare function attachToFormGroup(formGroup: FormGroup, controlName: string, value: any, valueType?: string, resolver?: XtTypeResolver): void;
549
- declare function updateFormGroupWithValue(formGroup: FormGroup, value: {
550
- [key: string]: any;
551
- }, valueType?: string, resolver?: XtTypeResolver): void;
552
-
553
- declare class XtUnitTestHelper {
554
- }
555
-
556
- /**
557
- * Component that can be used to bootstrap tests.
558
- * Just set the value and component type, and it will be injected in your test.
559
- */
560
- declare class HostTestSimpleComponent {
561
- type: _angular_core.InputSignal<Type<XtComponent<any>>>;
562
- displayMode: _angular_core.InputSignal<XtDisplayMode>;
563
- value: _angular_core.InputSignal<any>;
564
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestSimpleComponent, never>;
565
- 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>;
566
- }
567
- /**
568
- * Same as HostTestSimpleComponent but it includes everything in a form.
569
- * Just set the component type, the formGroup and the component name, and your component will be run.
570
- * You can as well easily read and set the value.
571
- */
572
- declare class HostTestFormComponent {
573
- builder: FormBuilder;
574
- type: _angular_core.InputSignal<Type<XtComponent<any>>>;
575
- controlName: _angular_core.InputSignal<string>;
576
- formDescription: _angular_core.InputSignal<any>;
577
- formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
578
- createdFormGroup: FormGroup | null;
579
- computedFormGroup(): FormGroup<any>;
580
- patchValue(newVal: any): void;
581
- retrieveValue(): any;
582
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestFormComponent, never>;
583
- 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>;
584
- }
585
- /**
586
- * Component that can be used to test your component based on the type it handles
587
- * Just set the type hierarchy to register, the value, and it will instantiate the right component in your plugin
588
- */
589
- declare class HostTestTypedComponent {
590
- displayMode: _angular_core.InputSignal<XtDisplayMode>;
591
- value: _angular_core.InputSignal<any>;
592
- valueType: _angular_core.InputSignal<string | undefined>;
593
- context: _angular_core.Signal<XtBaseContext<unknown>>;
594
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestTypedComponent, never>;
595
- 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>;
596
- }
597
- /**
598
- * Same as HostTestSimpleComponent but it includes everything in a form.
599
- * Just set the component type, the formGroup and the component name, and your component will be run.
600
- * You can as well easily read and set the value.
601
- */
602
- declare class HostTestTypedFormComponent implements OnInit {
603
- builder: FormBuilder;
604
- resolver: XtResolverService;
605
- static readonly CONTROL_NAME = "ForTest";
606
- valueType: _angular_core.InputSignal<string | undefined>;
607
- controlName: _angular_core.InputSignal<string | undefined>;
608
- formDescription: _angular_core.InputSignal<any>;
609
- formGroup: _angular_core.InputSignal<FormGroup<any> | undefined>;
610
- parentFormGroup: FormGroup<{
611
- [x: string]: AbstractControl<any, any, any>;
612
- }>;
613
- createdFormGroup: FormGroup | null;
614
- ngOnInit(): void;
615
- computeFormGroup(): FormGroup<any>;
616
- subContext(): XtBaseContext<any>;
617
- patchValue(controlName: string, newVal: any): void;
618
- retrieveValue(controlName: string): any;
619
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<HostTestTypedFormComponent, never>;
620
- 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>;
621
- }
622
-
623
- /**
624
- * A very light and not 100% compatible storemanager in case you are not using xt-store.
625
- * It can emulate XtStoreManager to some extends for doing some tests
626
- */
627
- declare class StoreTestHelper {
628
- static ensureTestProviderOnly(): void;
629
- }
630
- declare class TestStoreManager implements IStoreManager {
631
- protected defaultProvider: TestStoreProvider<never>;
632
- getProvider<T = never>(name?: string): IStoreProvider<T> | undefined;
633
- getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
634
- getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
635
- getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
636
- newStoreCriteria(name: string, value: any, operator: IStoreCriteriaOperator): IStoreCriteria;
637
- }
638
- declare class TestStoreProvider<T = never> implements IStoreProvider<T> {
639
- protected data: Map<string, Map<string, any>>;
640
- protected getOrCreateArray(name: string): Map<string, T>;
641
- protected extractKey(value: any, create?: boolean): string;
642
- storeEntity(name: string, entity: T): Promise<T>;
643
- safeLoadEntity(name: string, key: any): Promise<T>;
644
- loadEntity(name: string, key: any): Promise<T | undefined>;
645
- deleteEntity(name: string, key: any): Promise<boolean>;
646
- searchEntities(name: string, ...criteria: TestStoreCriteria[]): Observable<T[]>;
647
- searchAndPrepareEntities(name: string, sort?: any, groupBy?: any, transformer?: IDataTransformer<T> | undefined, ...criteria: any[]): Observable<any>;
648
- canStoreDocument(): boolean;
649
- storeDocument(toStore: File): Promise<IDocumentInfo>;
650
- storeDocuments(toStore: File[]): Observable<IDocumentInfo>;
651
- }
652
- declare class TestDocumentInfo implements IDocumentInfo {
653
- documentName: string;
654
- isUrl: boolean;
655
- documentId?: string;
656
- constructor(documentName: string, isUrl: boolean, documentId?: string);
657
- }
658
- declare class TestStoreCriteria implements IStoreCriteria {
659
- name: string;
660
- value: any;
661
- operator: '=' | '<=' | '<';
662
- constructor(name: string, value: any, operator?: IStoreCriteriaOperator);
663
- filter(toFilter: any): boolean;
664
- }
665
-
666
- export { HostTestFormComponent, HostTestSimpleComponent, HostTestTypedComponent, HostTestTypedFormComponent, StoreSupport, StoreTestHelper, TestDocumentInfo, TestStoreCriteria, TestStoreManager, TestStoreProvider, XT_REGISTRY_TOKEN, XT_RESOLVER_TOKEN, XT_TYPE_RESOLVER_TOKEN, XtBaseContext, XtCompositeComponent, XtMessageHandler, XtPluginRegistry, XtRenderComponent, XtRenderSubComponent, XtResolvedComponent, XtResolverService, XtSimpleComponent, XtUnitTestHelper, attachToFormGroup, initXtPluginRegistry, updateFormGroupWithValue, xtPluginRegistry };
667
- export type { IDataTransformer, IDocumentInfo, IStoreCriteria, IStoreCriteriaOperator, IStoreManager, IStoreProvider, XtActionHandler, XtActionHandlerInfo, XtActionInfo, XtActionResult, XtComponent, XtComponentInfo, XtComponentInput, XtComponentOutput, XtContext, XtDisplayMode, XtInputType, XtOutputType, XtPluginInfo, XtResolver, XtTypeHandlerInfo };