dotvvm-types 4.1.0 → 4.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/index.d.ts +35 -9
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -68,8 +68,11 @@ declare module "utils/objects" {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
declare module "metadata/typeMap" {
|
|
71
|
-
export function getTypeInfo(typeId: string): TypeMetadata;
|
|
72
|
-
export function getObjectTypeInfo(typeId: string): ObjectTypeMetadata;
|
|
71
|
+
export function getTypeInfo(typeId: string | object): TypeMetadata;
|
|
72
|
+
export function getObjectTypeInfo(typeId: string): ObjectTypeMetadata | DynamicTypeMetadata;
|
|
73
|
+
export function getTypeProperties(typeId: string | object | null | undefined): {
|
|
74
|
+
[prop: string]: PropertyMetadata;
|
|
75
|
+
};
|
|
73
76
|
export function getKnownTypes(): string[];
|
|
74
77
|
export function updateTypeInfo(newTypes: TypeMap | undefined): void;
|
|
75
78
|
export function replaceTypeInfo(newTypes: TypeMap | undefined): void;
|
|
@@ -126,13 +129,13 @@ declare module "metadata/coercer" {
|
|
|
126
129
|
* @param type Expected type of type value.
|
|
127
130
|
* @param originalValue Value that is known to be valid instance of type. It is used to perform incremental validation.
|
|
128
131
|
*/
|
|
129
|
-
export function tryCoerce(value: any, type: TypeDefinition, originalValue?: any): CoerceResult;
|
|
132
|
+
export function tryCoerce(value: any, type: TypeDefinition | null | undefined, originalValue?: any): CoerceResult;
|
|
130
133
|
export function coerce(value: any, type: TypeDefinition, originalValue?: any): any;
|
|
131
134
|
}
|
|
132
135
|
declare module "postback/updater" {
|
|
133
136
|
export function cleanUpdatedControls(resultObject: any, updatedControls?: any): any;
|
|
134
137
|
export function restoreUpdatedControls(resultObject: any, updatedControls: any): void;
|
|
135
|
-
export function updateViewModelAndControls(resultObject: any): void;
|
|
138
|
+
export function updateViewModelAndControls(resultObject: any, updateTypeInfo: (t: TypeMap) => void): void;
|
|
136
139
|
export function patchViewModel(source: any, patch: any): any;
|
|
137
140
|
export function diffViewModel(source: any, modified: any): any;
|
|
138
141
|
}
|
|
@@ -295,19 +298,21 @@ declare module "viewModules/viewModuleManager" {
|
|
|
295
298
|
export function registerViewModules(modules: {
|
|
296
299
|
[name: string]: any;
|
|
297
300
|
}): void;
|
|
298
|
-
export function initViewModule(name: string, viewIdOrElement: string | HTMLElement, rootElement: HTMLElement): ModuleContext;
|
|
301
|
+
export function initViewModule(name: string, viewIdOrElement: string | HTMLElement, rootElement: HTMLElement, properties?: object): ModuleContext;
|
|
299
302
|
export function callViewModuleCommand(viewIdOrElement: string | HTMLElement, commandName: string, args: any[], allowAsync?: boolean): any;
|
|
300
303
|
export function findComponent(viewIdOrElement: null | string | HTMLElement, name: string): [ModuleContext | null, DotvvmJsComponentFactory];
|
|
301
304
|
export function registerGlobalComponent(name: string, c: DotvvmJsComponentFactory): void;
|
|
302
305
|
export function registerNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string, command: ModuleCommand, rootElement: HTMLElement): void;
|
|
303
306
|
export function unregisterNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string): void;
|
|
304
|
-
export class ModuleContext {
|
|
307
|
+
export class ModuleContext implements DotvvmModuleContext {
|
|
305
308
|
readonly moduleName: string;
|
|
306
309
|
readonly elements: HTMLElement[];
|
|
307
310
|
readonly properties: {
|
|
308
311
|
[name: string]: any;
|
|
309
312
|
};
|
|
310
|
-
|
|
313
|
+
readonly namedCommands: {
|
|
314
|
+
[name: string]: (...args: any[]) => Promise<any>;
|
|
315
|
+
};
|
|
311
316
|
module: any;
|
|
312
317
|
constructor(moduleName: string, elements: HTMLElement[], properties: {
|
|
313
318
|
[name: string]: any;
|
|
@@ -653,6 +658,7 @@ declare module "api/api" {
|
|
|
653
658
|
type ApiComputed<T> = KnockoutComputed<T | null> & {
|
|
654
659
|
refreshValue: () => PromiseLike<any>;
|
|
655
660
|
};
|
|
661
|
+
export const isLoading: KnockoutObservable<boolean>;
|
|
656
662
|
export function invoke<T>(target: any, methodName: string, argsProvider: () => any[], refreshTriggers: (args: any[]) => Array<KnockoutObservable<any> | string>, notifyTriggers: (args: any[]) => string[], cacheElement: HTMLElement, sharingKeyProvider: (args: any[]) => string[], lifetimeElement: HTMLElement): ApiComputed<T>;
|
|
657
663
|
export function refreshOn<T>(value: ApiComputed<T>, watch: KnockoutObservable<any>): ApiComputed<T>;
|
|
658
664
|
export function clearApiCachedValues(): void;
|
|
@@ -684,7 +690,7 @@ declare module "controls/fileUpload" {
|
|
|
684
690
|
}
|
|
685
691
|
declare module "metadata/metadataHelper" {
|
|
686
692
|
export function getTypeId(viewModel: object): string | undefined;
|
|
687
|
-
export function getTypeMetadata(typeId: string): TypeMetadata;
|
|
693
|
+
export function getTypeMetadata(typeId: string | object): TypeMetadata;
|
|
688
694
|
export function getEnumMetadata(enumMetadataId: string): EnumTypeMetadata;
|
|
689
695
|
}
|
|
690
696
|
declare module "translations/sortingHelper" {
|
|
@@ -794,6 +800,7 @@ declare module "dotvvm-root" {
|
|
|
794
800
|
showUploadDialog: typeof fileUpload.showUploadDialog;
|
|
795
801
|
};
|
|
796
802
|
api: {
|
|
803
|
+
isLoading: KnockoutObservable<boolean>;
|
|
797
804
|
invoke: typeof api.invoke;
|
|
798
805
|
refreshOn: typeof api.refreshOn;
|
|
799
806
|
};
|
|
@@ -1091,6 +1098,9 @@ declare type RootViewModel = {
|
|
|
1091
1098
|
declare type TypeMap = {
|
|
1092
1099
|
[typeId: string]: TypeMetadata;
|
|
1093
1100
|
};
|
|
1101
|
+
declare type DynamicTypeMetadata = {
|
|
1102
|
+
type: "dynamic";
|
|
1103
|
+
};
|
|
1094
1104
|
declare type ObjectTypeMetadata = {
|
|
1095
1105
|
type: "object";
|
|
1096
1106
|
properties: {
|
|
@@ -1104,7 +1114,7 @@ declare type EnumTypeMetadata = {
|
|
|
1104
1114
|
};
|
|
1105
1115
|
isFlags?: boolean;
|
|
1106
1116
|
};
|
|
1107
|
-
declare type TypeMetadata = ObjectTypeMetadata | EnumTypeMetadata;
|
|
1117
|
+
declare type TypeMetadata = ObjectTypeMetadata | EnumTypeMetadata | DynamicTypeMetadata;
|
|
1108
1118
|
declare type PropertyMetadata = {
|
|
1109
1119
|
type: TypeDefinition;
|
|
1110
1120
|
post?: "always" | "pathOnly" | "no";
|
|
@@ -1179,3 +1189,19 @@ declare type DotvvmViewModule = {
|
|
|
1179
1189
|
$dispose?: (context: any) => void;
|
|
1180
1190
|
[commandName: DotvvmViewModuleCommandName]: (...args: any[]) => Promise<any> | any;
|
|
1181
1191
|
};
|
|
1192
|
+
declare type DotvvmModuleContext = {
|
|
1193
|
+
/** Name of the resource defining the view module */
|
|
1194
|
+
moduleName: string;
|
|
1195
|
+
/** Instance of the view module */
|
|
1196
|
+
module: any;
|
|
1197
|
+
/** List of element where this module is mounted. It will be `document.body` for pages and the wrapper tag for markup controls. Most likely, only one element is in the collection. */
|
|
1198
|
+
elements: HTMLElement[];
|
|
1199
|
+
/** Properties of the markup control which were sent to the client */
|
|
1200
|
+
properties: {
|
|
1201
|
+
[name: string]: any;
|
|
1202
|
+
};
|
|
1203
|
+
/** <dot:NamedCommand /> declared in the dothtml/dotcontrol view. */
|
|
1204
|
+
namedCommands: {
|
|
1205
|
+
[name: string]: (...args: any[]) => Promise<any>;
|
|
1206
|
+
};
|
|
1207
|
+
};
|