xt-components 0.5.0 → 0.6.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 +655 -311
- package/fesm2022/xt-components.mjs.map +1 -1
- package/index.d.ts +252 -99
- package/package.json +4 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Signal, WritableSignal, InputSignal, OutputEmitterRef, Type, InjectionToken, AfterViewInit, OnInit } from '@angular/core';
|
|
3
3
|
import { FormGroup, AbstractControl, FormBuilder } from '@angular/forms';
|
|
4
|
-
import {
|
|
4
|
+
import { XtTypeInfo, XtTypeReference, XtTypeResolver, XtTypeHandler, MappingHelper } from 'xt-type';
|
|
5
5
|
import * as xt_components from 'xt-components';
|
|
6
|
-
import { NgComponentOutlet } from '@angular/common';
|
|
7
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
|
+
}
|
|
8
46
|
|
|
9
47
|
/**
|
|
10
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
|
|
@@ -19,6 +57,24 @@ type XtContext<T> = {
|
|
|
19
57
|
subName?: string;
|
|
20
58
|
parentFormGroup?: FormGroup;
|
|
21
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
|
+
*/
|
|
22
78
|
parentContext?: XtContext<any>;
|
|
23
79
|
isInForm(): boolean;
|
|
24
80
|
formGroup(): FormGroup | undefined;
|
|
@@ -33,6 +89,9 @@ type XtContext<T> = {
|
|
|
33
89
|
value(): T | null | undefined;
|
|
34
90
|
valueType?: string;
|
|
35
91
|
toString(): string;
|
|
92
|
+
listActions: WritableSignal<XtAction<T>[] | null>;
|
|
93
|
+
isReference(): boolean;
|
|
94
|
+
setReferenceInfo(ref: XtTypeReference): void;
|
|
36
95
|
};
|
|
37
96
|
type XtDisplayMode = 'INLINE_VIEW' | 'FULL_VIEW' | 'FULL_EDITABLE' | 'LIST_VIEW';
|
|
38
97
|
declare class XtBaseContext<T> implements XtContext<T> {
|
|
@@ -59,6 +118,19 @@ declare class XtBaseContext<T> implements XtContext<T> {
|
|
|
59
118
|
*/
|
|
60
119
|
nonFormValue?: WritableSignal<T | null>;
|
|
61
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>;
|
|
62
134
|
/**
|
|
63
135
|
*
|
|
64
136
|
* @param displayMode
|
|
@@ -87,6 +159,23 @@ declare class XtBaseContext<T> implements XtContext<T> {
|
|
|
87
159
|
elementSetContext(elementIndex: number): XtContext<any>;
|
|
88
160
|
subContext(subName: string | undefined | null, subType?: string, typeResolver?: XtTypeResolver | null): XtContext<any>;
|
|
89
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
|
+
}*/
|
|
90
179
|
toString(): string;
|
|
91
180
|
}
|
|
92
181
|
|
|
@@ -110,24 +199,6 @@ type XtComponentInput = {
|
|
|
110
199
|
[key in XtInputType]: InputSignal<any> | undefined;
|
|
111
200
|
};
|
|
112
201
|
|
|
113
|
-
type XtComponentInfo<T> = {
|
|
114
|
-
componentName: string;
|
|
115
|
-
componentClass: T;
|
|
116
|
-
typesHandled: string[];
|
|
117
|
-
outputs?: XtOutputType[];
|
|
118
|
-
};
|
|
119
|
-
type XtTypeHandlerInfo<T> = {
|
|
120
|
-
typesHandled: string[];
|
|
121
|
-
handlerClass: T;
|
|
122
|
-
};
|
|
123
|
-
type XtPluginInfo = {
|
|
124
|
-
name: string;
|
|
125
|
-
uriLogo?: string;
|
|
126
|
-
components?: XtComponentInfo<any>[];
|
|
127
|
-
types?: XtTypeInfo;
|
|
128
|
-
typeHandlers?: XtTypeHandlerInfo<any>[];
|
|
129
|
-
};
|
|
130
|
-
|
|
131
202
|
declare class XtResolvedComponent {
|
|
132
203
|
componentName: string;
|
|
133
204
|
componentClass: any;
|
|
@@ -144,6 +215,7 @@ declare class XtPluginRegistry {
|
|
|
144
215
|
pluginRegistry: Map<string, XtPluginInfo>;
|
|
145
216
|
componentRegistry: Map<string, XtComponentInfo<any>>;
|
|
146
217
|
componentByTypeCache: Map<string, XtComponentInfo<any>[]>;
|
|
218
|
+
protected actionByTypeRegistry: Map<string, Map<string, XtActionInfo<any>>>;
|
|
147
219
|
listComponents: _angular_core.WritableSignal<XtComponentInfo<any>[]>;
|
|
148
220
|
listPlugins: _angular_core.WritableSignal<XtPluginInfo[]>;
|
|
149
221
|
/**
|
|
@@ -164,29 +236,97 @@ declare class XtPluginRegistry {
|
|
|
164
236
|
static readonly ANY_OBJECT_TYPE = "ANY_OBJECT_TYPE";
|
|
165
237
|
static readonly ANY_PRIMITIVE_SET = "ANY_PRIMITIVE_SET";
|
|
166
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";
|
|
167
244
|
registerPlugin(info: XtPluginInfo): void;
|
|
168
245
|
registerComponent<T>(info: XtComponentInfo<T>): void;
|
|
169
246
|
findComponentsForType<T>(valueType: string | null | undefined, value?: T): XtComponentInfo<any>[];
|
|
170
247
|
static registry(): XtPluginRegistry;
|
|
171
248
|
findComponentInfo(type: Type<XtComponent<any>>): XtComponentInfo<any> | null;
|
|
172
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
|
+
}[];
|
|
173
256
|
}
|
|
174
257
|
|
|
175
258
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
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
|
|
178
262
|
*/
|
|
179
263
|
|
|
180
|
-
declare
|
|
181
|
-
|
|
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;
|
|
182
325
|
}
|
|
183
|
-
declare function initXtPluginRegistry(): void;
|
|
184
|
-
declare function xtPluginRegistry(): XtPluginRegistry;
|
|
185
|
-
|
|
186
|
-
declare const XT_RESOLVER_TOKEN: InjectionToken<XtResolver>;
|
|
187
|
-
declare const XT_TYPE_RESOLVER_TOKEN: InjectionToken<XtTypeResolver>;
|
|
188
|
-
declare const XT_REGISTRY_TOKEN: InjectionToken<XtPluginRegistry>;
|
|
189
326
|
|
|
327
|
+
/**
|
|
328
|
+
* An all in one helper class, enabling manipulation of the context, with data and type associated with it.
|
|
329
|
+
*/
|
|
190
330
|
declare class XtResolverService {
|
|
191
331
|
pluginRegistry: xt_components.XtPluginRegistry;
|
|
192
332
|
protected baseResolver: XtResolver | null;
|
|
@@ -204,6 +344,18 @@ declare class XtResolverService {
|
|
|
204
344
|
listSubNamesOfType<T>(valueType: string, value?: T): string[];
|
|
205
345
|
registerPlugin(info: XtPluginInfo): void;
|
|
206
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>>;
|
|
207
359
|
protected handlerDefinedFor(newType: string, handlers: XtTypeHandlerInfo<any>[] | undefined): any;
|
|
208
360
|
getComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent;
|
|
209
361
|
findComponentInfo<T>(type: Type<XtComponent<T>>): XtResolvedComponent | null;
|
|
@@ -216,10 +368,62 @@ declare class XtResolverService {
|
|
|
216
368
|
* @returns a Promise with the module loaded and already registered.
|
|
217
369
|
*/
|
|
218
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[]>;
|
|
219
392
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtResolverService, never>;
|
|
220
393
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtResolverService>;
|
|
221
394
|
}
|
|
222
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
|
+
|
|
223
427
|
declare class XtBaseOutput implements XtComponentOutput {
|
|
224
428
|
valueSelected: OutputEmitterRef<any> | undefined;
|
|
225
429
|
}
|
|
@@ -247,6 +451,7 @@ declare class XtRenderComponent<T> implements AfterViewInit {
|
|
|
247
451
|
outlet: Signal<NgComponentOutlet<any>>;
|
|
248
452
|
constructor();
|
|
249
453
|
context: Signal<XtContext<any>>;
|
|
454
|
+
realContext: Signal<XtContext<any>>;
|
|
250
455
|
type: Signal<Type<XtComponent<T>> | null>;
|
|
251
456
|
/**
|
|
252
457
|
* Transfers the input and outputs from the host to the rendered component
|
|
@@ -268,6 +473,7 @@ declare class XtRenderSubComponent<T> implements AfterViewInit {
|
|
|
268
473
|
outputs: _angular_core.OutputEmitterRef<XtComponentOutput>;
|
|
269
474
|
outlet: Signal<NgComponentOutlet<any>>;
|
|
270
475
|
resolverService: XtResolverService;
|
|
476
|
+
realContext: Signal<XtContext<T>>;
|
|
271
477
|
type: Signal<Type<XtComponent<T>> | null>;
|
|
272
478
|
/**
|
|
273
479
|
* Transfers the input and outputs from the host to the rendered component
|
|
@@ -332,72 +538,11 @@ declare class XtCompositeComponent<T = any> extends XtSimpleComponent<T> {
|
|
|
332
538
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<XtCompositeComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
333
539
|
}
|
|
334
540
|
|
|
335
|
-
declare class
|
|
541
|
+
declare class XtMessageHandler {
|
|
336
542
|
errorOccurred(error: any, errorMsg?: string): void;
|
|
337
543
|
warningOccurred(warningMsg?: string): void;
|
|
338
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<
|
|
339
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Wrapper around xt-store manager: You can use it to check if xt-store is included or not, and decide what to do
|
|
344
|
-
*
|
|
345
|
-
* This allow plugins to potentially use xt-store whenever included in the applications running the plugin
|
|
346
|
-
*/
|
|
347
|
-
|
|
348
|
-
declare class StoreSupport {
|
|
349
|
-
protected static testStoreManager?: IStoreManager;
|
|
350
|
-
static isStoreManagerAvailable(): boolean;
|
|
351
|
-
static getStoreManager(): IStoreManager;
|
|
352
|
-
static setTestStoreManager(testStoreManager: IStoreManager): void;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Interface definition for xt-store component.
|
|
356
|
-
* We re-define them here to avoid importing xt-store in all plugins that don't need it.
|
|
357
|
-
*/
|
|
358
|
-
interface IDataTransformer<T> {
|
|
359
|
-
/**
|
|
360
|
-
* Enable transformation of data right after it has been loaded from the store
|
|
361
|
-
* @param source
|
|
362
|
-
*/
|
|
363
|
-
postLoadingTransformation(source: any[]): T[];
|
|
364
|
-
}
|
|
365
|
-
interface IDocumentInfo {
|
|
366
|
-
documentName: string;
|
|
367
|
-
isUrl: boolean;
|
|
368
|
-
documentId?: string;
|
|
369
|
-
}
|
|
370
|
-
interface IStoreProvider<T> {
|
|
371
|
-
storeEntity(name: string, entity: T): Promise<T>;
|
|
372
|
-
/**
|
|
373
|
-
* Rejects the promise if the entity is not found
|
|
374
|
-
* @param name
|
|
375
|
-
* @param key
|
|
376
|
-
*/
|
|
377
|
-
safeLoadEntity(name: string, key: any): Promise<T>;
|
|
378
|
-
loadEntity(name: string, key: any): Promise<T | undefined>;
|
|
379
|
-
deleteEntity(name: string, key: any): Promise<boolean>;
|
|
380
|
-
searchEntities(name: string, ...criteria: any[]): Observable<Array<T>>;
|
|
381
|
-
searchAndPrepareEntities(name: string, sort?: any, groupBy?: any, transformer?: IDataTransformer<T>, ...criteria: any[]): Observable<any>;
|
|
382
|
-
canStoreDocument(): boolean;
|
|
383
|
-
/**
|
|
384
|
-
* Upload one document to a server store and returns the url or the id needed to retrieve them.
|
|
385
|
-
* @param toStore
|
|
386
|
-
* @param position
|
|
387
|
-
*/
|
|
388
|
-
storeDocument(toStore: File): Promise<IDocumentInfo>;
|
|
389
|
-
/**
|
|
390
|
-
* Upload documents to a server store and returns the url or the id needed to retrieve them.
|
|
391
|
-
* @param toStore
|
|
392
|
-
* @param position
|
|
393
|
-
*/
|
|
394
|
-
storeDocuments(toStore: File[]): Observable<IDocumentInfo>;
|
|
395
|
-
}
|
|
396
|
-
interface IStoreManager {
|
|
397
|
-
getProvider<T = never>(name?: string): IStoreProvider<T> | undefined;
|
|
398
|
-
getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
|
|
399
|
-
getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
|
|
400
|
-
getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
|
|
544
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<XtMessageHandler, never>;
|
|
545
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<XtMessageHandler>;
|
|
401
546
|
}
|
|
402
547
|
|
|
403
548
|
declare function attachToFormGroup(formGroup: FormGroup, controlName: string, value: any, valueType?: string, resolver?: XtTypeResolver): void;
|
|
@@ -488,16 +633,17 @@ declare class TestStoreManager implements IStoreManager {
|
|
|
488
633
|
getProviderSafe<T = never>(name?: string): IStoreProvider<T>;
|
|
489
634
|
getDefaultProvider<T = never>(): IStoreProvider<T> | undefined;
|
|
490
635
|
getDefaultProviderSafe<T = never>(): IStoreProvider<T>;
|
|
636
|
+
newStoreCriteria(name: string, value: any, operator: IStoreCriteriaOperator): IStoreCriteria;
|
|
491
637
|
}
|
|
492
638
|
declare class TestStoreProvider<T = never> implements IStoreProvider<T> {
|
|
493
639
|
protected data: Map<string, Map<string, any>>;
|
|
494
|
-
protected getOrCreateArray(name: string): Map<string,
|
|
495
|
-
protected extractKey(value: any): string;
|
|
640
|
+
protected getOrCreateArray(name: string): Map<string, T>;
|
|
641
|
+
protected extractKey(value: any, create?: boolean): string;
|
|
496
642
|
storeEntity(name: string, entity: T): Promise<T>;
|
|
497
643
|
safeLoadEntity(name: string, key: any): Promise<T>;
|
|
498
644
|
loadEntity(name: string, key: any): Promise<T | undefined>;
|
|
499
645
|
deleteEntity(name: string, key: any): Promise<boolean>;
|
|
500
|
-
searchEntities(name: string, ...criteria:
|
|
646
|
+
searchEntities(name: string, ...criteria: TestStoreCriteria[]): Observable<T[]>;
|
|
501
647
|
searchAndPrepareEntities(name: string, sort?: any, groupBy?: any, transformer?: IDataTransformer<T> | undefined, ...criteria: any[]): Observable<any>;
|
|
502
648
|
canStoreDocument(): boolean;
|
|
503
649
|
storeDocument(toStore: File): Promise<IDocumentInfo>;
|
|
@@ -509,6 +655,13 @@ declare class TestDocumentInfo implements IDocumentInfo {
|
|
|
509
655
|
documentId?: string;
|
|
510
656
|
constructor(documentName: string, isUrl: boolean, documentId?: string);
|
|
511
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
|
+
}
|
|
512
665
|
|
|
513
|
-
export { HostTestFormComponent, HostTestSimpleComponent, HostTestTypedComponent, HostTestTypedFormComponent,
|
|
514
|
-
export type { IDataTransformer, IDocumentInfo, IStoreManager, IStoreProvider, XtComponent, XtComponentInfo, XtComponentInput, XtComponentOutput, XtContext, XtDisplayMode, XtInputType, XtOutputType, XtPluginInfo, XtResolver, XtTypeHandlerInfo };
|
|
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 };
|
package/package.json
CHANGED