dotvvm-types 3.0.0-preview01 → 4.0.7
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 +656 -253
- package/package.json +1 -4
package/index.d.ts
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
|
+
/// <reference path="../../Resources/Scripts/typings/globalize/globalize.d.ts" />
|
|
2
|
+
declare module "shared-classes" {
|
|
3
|
+
export class DotvvmPostbackError {
|
|
4
|
+
reason: DotvvmPostbackErrorReason;
|
|
5
|
+
constructor(reason: DotvvmPostbackErrorReason);
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
|
8
|
+
export class CoerceError implements CoerceErrorType {
|
|
9
|
+
message: string;
|
|
10
|
+
path: string;
|
|
11
|
+
isError: true;
|
|
12
|
+
wasCoerced: false;
|
|
13
|
+
get value(): never;
|
|
14
|
+
constructor(message: string, path?: string);
|
|
15
|
+
static generic(value: any, type: TypeDefinition): CoerceError;
|
|
16
|
+
prependPathFragment(fragment: string): void;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare module "utils/logging" {
|
|
20
|
+
type LogLevel = "normal" | "verbose";
|
|
21
|
+
export const level: LogLevel;
|
|
22
|
+
export function logInfoVerbose(area: string, ...args: any[]): void;
|
|
23
|
+
export function logInfo(area: string, ...args: any[]): void;
|
|
24
|
+
export function logWarning(area: string, ...args: any[]): void;
|
|
25
|
+
export function logError(area: string, ...args: any[]): void;
|
|
26
|
+
export function logPostBackScriptError(err: any): void;
|
|
27
|
+
}
|
|
1
28
|
declare module "serialization/date" {
|
|
2
|
-
export function parseDate(value: string): Date | null;
|
|
29
|
+
export function parseDate(value: string | null, convertFromUtc?: boolean): Date | null;
|
|
30
|
+
export function parseTimeSpan(value: string | null): number | null;
|
|
31
|
+
export function parseDateTimeOffset(value: string | null): Date | null;
|
|
3
32
|
export function serializeDate(date: string | Date | null, convertToUtc?: boolean): string | null;
|
|
33
|
+
export function serializeTimeSpan(time: string | number | null): string | null;
|
|
4
34
|
}
|
|
5
35
|
declare module "utils/dom" {
|
|
6
36
|
export const getElementByDotvvmId: (id: string) => HTMLElement;
|
|
@@ -18,27 +48,169 @@ declare module "utils/knockout" {
|
|
|
18
48
|
}
|
|
19
49
|
declare module "utils/objects" {
|
|
20
50
|
export function isPrimitive(viewModel: any): boolean;
|
|
21
|
-
export const createArray:
|
|
51
|
+
export const createArray: {
|
|
52
|
+
<T>(arrayLike: ArrayLike<T>): T[];
|
|
53
|
+
<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
54
|
+
<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
55
|
+
<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
56
|
+
};
|
|
22
57
|
export const hasOwnProperty: (obj: any, prop: string) => boolean;
|
|
23
58
|
export const keys: {
|
|
24
59
|
(o: object): string[];
|
|
25
60
|
(o: {}): string[];
|
|
26
61
|
};
|
|
27
62
|
}
|
|
63
|
+
declare module "metadata/typeMap" {
|
|
64
|
+
export function getTypeInfo(typeId: string): TypeMetadata;
|
|
65
|
+
export function getObjectTypeInfo(typeId: string): ObjectTypeMetadata;
|
|
66
|
+
export function getKnownTypes(): string[];
|
|
67
|
+
export function updateTypeInfo(newTypes: TypeMap | undefined): void;
|
|
68
|
+
export function replaceTypeInfo(newTypes: TypeMap | undefined): void;
|
|
69
|
+
}
|
|
70
|
+
declare module "events" {
|
|
71
|
+
export class DotvvmEvent<T> {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
private readonly triggerMissedEventsOnSubscribe;
|
|
74
|
+
private handlers;
|
|
75
|
+
private history;
|
|
76
|
+
constructor(name: string, triggerMissedEventsOnSubscribe?: boolean);
|
|
77
|
+
subscribe(handler: (data: T) => void): void;
|
|
78
|
+
subscribeOnce(handler: (data: T) => void): void;
|
|
79
|
+
unsubscribe(handler: (data: T) => void): void;
|
|
80
|
+
trigger(data: T): void;
|
|
81
|
+
}
|
|
82
|
+
export const init: DotvvmEvent<DotvvmInitEventArgs>;
|
|
83
|
+
export const initCompleted: DotvvmEvent<DotvvmInitCompletedEventArgs>;
|
|
84
|
+
export const beforePostback: DotvvmEvent<DotvvmBeforePostBackEventArgs>;
|
|
85
|
+
export const afterPostback: DotvvmEvent<DotvvmAfterPostBackEventArgs>;
|
|
86
|
+
export const error: DotvvmEvent<DotvvmErrorEventArgs>;
|
|
87
|
+
export const redirect: DotvvmEvent<DotvvmRedirectEventArgs>;
|
|
88
|
+
export const postbackHandlersStarted: DotvvmEvent<PostbackOptions>;
|
|
89
|
+
export const postbackHandlersCompleted: DotvvmEvent<PostbackOptions>;
|
|
90
|
+
export const postbackResponseReceived: DotvvmEvent<DotvvmPostbackResponseReceivedEventArgs>;
|
|
91
|
+
export const postbackCommitInvoked: DotvvmEvent<DotvvmPostbackCommitInvokedEventArgs>;
|
|
92
|
+
export const postbackViewModelUpdated: DotvvmEvent<DotvvmPostbackViewModelUpdatedEventArgs>;
|
|
93
|
+
export const postbackRejected: DotvvmEvent<DotvvmPostbackRejectedEventArgs>;
|
|
94
|
+
export const staticCommandMethodInvoking: DotvvmEvent<DotvvmStaticCommandMethodInvokingEventArgs>;
|
|
95
|
+
export const staticCommandMethodInvoked: DotvvmEvent<DotvvmStaticCommandMethodInvokedEventArgs>;
|
|
96
|
+
export const staticCommandMethodFailed: DotvvmEvent<DotvvmStaticCommandMethodFailedEventArgs>;
|
|
97
|
+
export const newState: DotvvmEvent<RootViewModel>;
|
|
98
|
+
}
|
|
99
|
+
declare module "metadata/primitiveTypes" {
|
|
100
|
+
type PrimitiveTypes = {
|
|
101
|
+
[name: string]: {
|
|
102
|
+
tryCoerce: (value: any) => CoerceResult | undefined;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export const primitiveTypes: PrimitiveTypes;
|
|
106
|
+
}
|
|
107
|
+
declare module "metadata/coercer" {
|
|
108
|
+
/**
|
|
109
|
+
* Validates type of value
|
|
110
|
+
* @param type Expected type of type value.
|
|
111
|
+
* @param originalValue Value that is known to be valid instance of type. It is used to perform incremental validation.
|
|
112
|
+
*/
|
|
113
|
+
export function tryCoerce(value: any, type: TypeDefinition, originalValue?: any): CoerceResult;
|
|
114
|
+
export function coerce(value: any, type: TypeDefinition, originalValue?: any): any;
|
|
115
|
+
}
|
|
116
|
+
declare module "postback/updater" {
|
|
117
|
+
export function cleanUpdatedControls(resultObject: any, updatedControls?: any): any;
|
|
118
|
+
export function restoreUpdatedControls(resultObject: any, updatedControls: any): void;
|
|
119
|
+
export function updateViewModelAndControls(resultObject: any): void;
|
|
120
|
+
export function patchViewModel(source: any, patch: any): any;
|
|
121
|
+
export function diffViewModel(source: any, modified: any): any;
|
|
122
|
+
}
|
|
123
|
+
declare module "validation/common" {
|
|
124
|
+
export type DotvvmValidationContext = {
|
|
125
|
+
readonly valueToValidate: any;
|
|
126
|
+
readonly parentViewModel: any;
|
|
127
|
+
readonly parameters: any[];
|
|
128
|
+
};
|
|
129
|
+
export type DotvvmValidationObservableMetadata = DotvvmValidationElementMetadata[];
|
|
130
|
+
export type DotvvmValidationElementMetadata = {
|
|
131
|
+
element: HTMLElement;
|
|
132
|
+
dataType: string;
|
|
133
|
+
format: string;
|
|
134
|
+
domNodeDisposal: boolean;
|
|
135
|
+
elementValidationState: boolean;
|
|
136
|
+
};
|
|
137
|
+
export const errorsSymbol: unique symbol;
|
|
138
|
+
/** Checks if the value is null, undefined or a whitespace only string */
|
|
139
|
+
export function isEmpty(value: any): boolean;
|
|
140
|
+
export function getValidationMetadata(property: KnockoutObservable<any>): DotvvmValidationObservableMetadata;
|
|
141
|
+
}
|
|
142
|
+
declare module "utils/evaluator" {
|
|
143
|
+
/**
|
|
144
|
+
* Traverses provided context according to given path.
|
|
145
|
+
* @example / - returns context
|
|
146
|
+
* @example "" or null - returns context
|
|
147
|
+
* @example /exampleProp/A - returns prop A located withing property exampleProp located at provided context
|
|
148
|
+
* @example /exampleProp/B/1 - returns second item from collection B located within property exampleProp located at provided context
|
|
149
|
+
* @returns found property as unwrapped object
|
|
150
|
+
*/
|
|
151
|
+
export function traverseContext(context: any, path: string): any;
|
|
152
|
+
export function findPathToChildObject(vm: any, child: any, path: string): string | null;
|
|
153
|
+
export function evaluateOnViewModel(context: any, expression: string): any;
|
|
154
|
+
export function getDataSourceItems(viewModel: any): Array<KnockoutObservable<any>>;
|
|
155
|
+
export function wrapObservable(func: () => any, isArray?: boolean): KnockoutComputed<any>;
|
|
156
|
+
export const unwrapComputedProperty: (obs: any) => any;
|
|
157
|
+
}
|
|
158
|
+
declare module "validation/error" {
|
|
159
|
+
export const allErrors: ValidationError[];
|
|
160
|
+
export function detachAllErrors(): void;
|
|
161
|
+
export function getErrors<T>(o: KnockoutObservable<T> | null): ValidationError[];
|
|
162
|
+
export class ValidationError {
|
|
163
|
+
errorMessage: string;
|
|
164
|
+
propertyPath: string;
|
|
165
|
+
validatedObservable: KnockoutObservable<any>;
|
|
166
|
+
private constructor();
|
|
167
|
+
static attach(errorMessage: string, propertyPath: string, observable: KnockoutObservable<any>): ValidationError;
|
|
168
|
+
detach(): void;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
declare module "state-manager" {
|
|
172
|
+
import { DotvvmEvent } from "events";
|
|
173
|
+
export const currentStateSymbol: unique symbol;
|
|
174
|
+
export const notifySymbol: unique symbol;
|
|
175
|
+
export const lastSetErrorSymbol: unique symbol;
|
|
176
|
+
const updateSymbol: unique symbol;
|
|
177
|
+
export function getIsViewModelUpdating(): boolean;
|
|
178
|
+
export type UpdatableObjectExtensions<T> = {
|
|
179
|
+
[notifySymbol]: (newValue: T) => void;
|
|
180
|
+
[currentStateSymbol]: T;
|
|
181
|
+
[updateSymbol]?: UpdateDispatcher<T>;
|
|
182
|
+
};
|
|
183
|
+
export class StateManager<TViewModel extends {
|
|
184
|
+
$type?: TypeDefinition;
|
|
185
|
+
}> {
|
|
186
|
+
stateUpdateEvent: DotvvmEvent<DeepReadonly<TViewModel>>;
|
|
187
|
+
readonly stateObservable: DeepKnockoutObservable<TViewModel>;
|
|
188
|
+
private _state;
|
|
189
|
+
get state(): DeepReadonly<TViewModel>;
|
|
190
|
+
private _isDirty;
|
|
191
|
+
get isDirty(): boolean;
|
|
192
|
+
private _currentFrameNumber;
|
|
193
|
+
constructor(initialState: DeepReadonly<TViewModel>, stateUpdateEvent: DotvvmEvent<DeepReadonly<TViewModel>>);
|
|
194
|
+
dispatchUpdate(): void;
|
|
195
|
+
doUpdateNow(): void;
|
|
196
|
+
private rerender;
|
|
197
|
+
setState(newState: DeepReadonly<TViewModel>): DeepReadonly<TViewModel>;
|
|
198
|
+
patchState(patch: Partial<TViewModel>): DeepReadonly<TViewModel>;
|
|
199
|
+
update(updater: StateUpdate<TViewModel>): DeepReadonly<TViewModel>;
|
|
200
|
+
}
|
|
201
|
+
export function unmapKnockoutObservables(viewModel: any): any;
|
|
202
|
+
}
|
|
28
203
|
declare module "serialization/deserialize" {
|
|
29
204
|
export function deserialize(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
30
205
|
export function deserializePrimitive(viewModel: any, target?: any): any;
|
|
31
206
|
export function deserializeDate(viewModel: any, target?: any): any;
|
|
32
207
|
export function deserializeArray(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
33
208
|
export function deserializeObject(viewModel: any, target: any, deserializeAll: boolean): any;
|
|
34
|
-
|
|
35
|
-
declare module "serialization/typeValidation" {
|
|
36
|
-
export function validateType(value: any, type: string): boolean;
|
|
209
|
+
export function extendToObservableArrayIfRequired(observable: any): any;
|
|
37
210
|
}
|
|
38
211
|
declare module "serialization/serialize" {
|
|
39
212
|
interface ISerializationOptions {
|
|
40
213
|
serializeAll?: boolean;
|
|
41
|
-
oneLevel?: boolean;
|
|
42
214
|
ignoreSpecialProperties?: boolean;
|
|
43
215
|
pathMatcher?: (vm: any) => boolean;
|
|
44
216
|
path?: string[];
|
|
@@ -46,6 +218,7 @@ declare module "serialization/serialize" {
|
|
|
46
218
|
restApiTarget?: boolean;
|
|
47
219
|
}
|
|
48
220
|
export function serialize(viewModel: any, opt?: ISerializationOptions): any;
|
|
221
|
+
export function serializeCore(viewModel: any, opt?: ISerializationOptions): any;
|
|
49
222
|
}
|
|
50
223
|
declare module "postback/resourceLoader" {
|
|
51
224
|
export type RenderedResourceList = {
|
|
@@ -54,25 +227,7 @@ declare module "postback/resourceLoader" {
|
|
|
54
227
|
export function registerResources(rs: string[] | null | undefined): void;
|
|
55
228
|
export const getRenderedResources: () => string[];
|
|
56
229
|
export function loadResourceList(resources: RenderedResourceList | undefined): Promise<void>;
|
|
57
|
-
|
|
58
|
-
declare module "validation/common" {
|
|
59
|
-
export type DotvvmValidationContext = {
|
|
60
|
-
readonly valueToValidate: any;
|
|
61
|
-
readonly parentViewModel: any;
|
|
62
|
-
readonly parameters: any[];
|
|
63
|
-
};
|
|
64
|
-
export type DotvvmValidationObservableMetadata = DotvvmValidationElementMetadata[];
|
|
65
|
-
export type DotvvmValidationElementMetadata = {
|
|
66
|
-
element: HTMLElement;
|
|
67
|
-
dataType: string;
|
|
68
|
-
format: string;
|
|
69
|
-
domNodeDisposal: boolean;
|
|
70
|
-
elementValidationState: boolean;
|
|
71
|
-
};
|
|
72
|
-
export const ErrorsPropertyName = "validationErrors";
|
|
73
|
-
/** Checks if the value is null, undefined or a whitespace only string */
|
|
74
|
-
export function isEmpty(value: any): boolean;
|
|
75
|
-
export function getValidationMetadata(property: KnockoutObservable<any>): DotvvmValidationObservableMetadata;
|
|
230
|
+
export function notifyModuleLoaded(id: number): void;
|
|
76
231
|
}
|
|
77
232
|
declare module "binding-handlers/textbox-text" {
|
|
78
233
|
const _default: {
|
|
@@ -111,13 +266,47 @@ declare module "binding-handlers/SSR-foreach" {
|
|
|
111
266
|
};
|
|
112
267
|
export default _default_2;
|
|
113
268
|
}
|
|
114
|
-
declare module "
|
|
269
|
+
declare module "viewModules/viewModuleManager" {
|
|
270
|
+
type ModuleCommand = (...args: any) => Promise<unknown>;
|
|
271
|
+
export const viewModulesSymbol: unique symbol;
|
|
272
|
+
export function registerViewModule(name: string, moduleObject: any): void;
|
|
273
|
+
export function registerViewModules(modules: {
|
|
274
|
+
[name: string]: any;
|
|
275
|
+
}): void;
|
|
276
|
+
export function initViewModule(name: string, viewIdOrElement: string | HTMLElement, rootElement: HTMLElement): ModuleContext;
|
|
277
|
+
export function callViewModuleCommand(viewIdOrElement: string | HTMLElement, commandName: string, args: any[], allowAsync?: boolean): any;
|
|
278
|
+
export function findComponent(viewIdOrElement: null | string | HTMLElement, name: string): [ModuleContext | null, DotvvmJsComponentFactory];
|
|
279
|
+
export function registerGlobalComponent(name: string, c: DotvvmJsComponentFactory): void;
|
|
280
|
+
export function registerNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string, command: ModuleCommand, rootElement: HTMLElement): void;
|
|
281
|
+
export function unregisterNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string): void;
|
|
282
|
+
export class ModuleContext {
|
|
283
|
+
readonly moduleName: string;
|
|
284
|
+
readonly elements: HTMLElement[];
|
|
285
|
+
readonly properties: {
|
|
286
|
+
[name: string]: any;
|
|
287
|
+
};
|
|
288
|
+
private readonly namedCommands;
|
|
289
|
+
module: any;
|
|
290
|
+
constructor(moduleName: string, elements: HTMLElement[], properties: {
|
|
291
|
+
[name: string]: any;
|
|
292
|
+
});
|
|
293
|
+
registerNamedCommand: (name: string, command: (...args: any[]) => Promise<any>) => void;
|
|
294
|
+
unregisterNamedCommand: (name: string) => void;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
declare module "binding-handlers/markup-controls" {
|
|
298
|
+
export function wrapControlProperties(valueAccessor: () => any): any;
|
|
115
299
|
const _default_3: {
|
|
116
300
|
'dotvvm-with-control-properties': {
|
|
117
301
|
init: (element: HTMLElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => {
|
|
118
302
|
controlsDescendantBindings: boolean;
|
|
119
303
|
};
|
|
120
304
|
};
|
|
305
|
+
'dotvvm-with-view-modules': {
|
|
306
|
+
init: (element: HTMLElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => {
|
|
307
|
+
controlsDescendantBindings: boolean;
|
|
308
|
+
} | undefined;
|
|
309
|
+
};
|
|
121
310
|
};
|
|
122
311
|
export default _default_3;
|
|
123
312
|
}
|
|
@@ -138,56 +327,16 @@ declare module "binding-handlers/enable" {
|
|
|
138
327
|
};
|
|
139
328
|
export default _default_5;
|
|
140
329
|
}
|
|
141
|
-
declare module "events" {
|
|
142
|
-
export class DotvvmEvent<T> {
|
|
143
|
-
readonly name: string;
|
|
144
|
-
private readonly triggerMissedEventsOnSubscribe;
|
|
145
|
-
private handlers;
|
|
146
|
-
private history;
|
|
147
|
-
constructor(name: string, triggerMissedEventsOnSubscribe?: boolean);
|
|
148
|
-
subscribe(handler: (data: T) => void): void;
|
|
149
|
-
subscribeOnce(handler: (data: T) => void): void;
|
|
150
|
-
unsubscribe(handler: (data: T) => void): void;
|
|
151
|
-
trigger(data: T): void;
|
|
152
|
-
}
|
|
153
|
-
export const init: DotvvmEvent<DotvvmEventArgs>;
|
|
154
|
-
export const beforePostback: DotvvmEvent<DotvvmBeforePostBackEventArgs>;
|
|
155
|
-
export const afterPostback: DotvvmEvent<DotvvmAfterPostBackEventArgs>;
|
|
156
|
-
export const error: DotvvmEvent<DotvvmErrorEventArgs>;
|
|
157
|
-
export const redirect: DotvvmEvent<DotvvmRedirectEventArgs>;
|
|
158
|
-
export const postbackHandlersStarted: DotvvmEvent<{}>;
|
|
159
|
-
export const postbackHandlersCompleted: DotvvmEvent<{}>;
|
|
160
|
-
export const postbackResponseReceived: DotvvmEvent<{}>;
|
|
161
|
-
export const postbackCommitInvoked: DotvvmEvent<{}>;
|
|
162
|
-
export const postbackViewModelUpdated: DotvvmEvent<{}>;
|
|
163
|
-
export const postbackRejected: DotvvmEvent<{}>;
|
|
164
|
-
export const staticCommandMethodInvoking: DotvvmEvent<{
|
|
165
|
-
args: any[];
|
|
166
|
-
command: string;
|
|
167
|
-
}>;
|
|
168
|
-
export const staticCommandMethodInvoked: DotvvmEvent<{
|
|
169
|
-
args: any[];
|
|
170
|
-
command: string;
|
|
171
|
-
result: any;
|
|
172
|
-
xhr: XMLHttpRequest;
|
|
173
|
-
}>;
|
|
174
|
-
export const staticCommandMethodFailed: DotvvmEvent<{
|
|
175
|
-
args: any[];
|
|
176
|
-
command: string;
|
|
177
|
-
xhr: XMLHttpRequest;
|
|
178
|
-
error?: any;
|
|
179
|
-
}>;
|
|
180
|
-
}
|
|
181
330
|
declare module "binding-handlers/checkbox" {
|
|
182
331
|
const _default_6: {
|
|
183
332
|
'dotvvm-checkbox-updateAfterPostback': {
|
|
184
333
|
init(element: HTMLElement, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined): void;
|
|
185
334
|
};
|
|
186
|
-
'dotvvm-checked-pointer': {
|
|
187
|
-
init(): void;
|
|
188
|
-
};
|
|
335
|
+
'dotvvm-checked-pointer': {};
|
|
189
336
|
"dotvvm-CheckState": {
|
|
190
|
-
init(element:
|
|
337
|
+
init: ((element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => void | {
|
|
338
|
+
controlsDescendantBindings: boolean;
|
|
339
|
+
}) | undefined;
|
|
191
340
|
update(element: any, valueAccessor: () => any): void;
|
|
192
341
|
};
|
|
193
342
|
"dotvvm-checkedItems": {
|
|
@@ -225,6 +374,42 @@ declare module "binding-handlers/update-progress" {
|
|
|
225
374
|
};
|
|
226
375
|
export default _default_7;
|
|
227
376
|
}
|
|
377
|
+
declare module "binding-handlers/gridviewdataset" {
|
|
378
|
+
const _default_8: {
|
|
379
|
+
"dotvvm-gridviewdataset": {
|
|
380
|
+
init: (element: Node, valueAccessor: () => any, allBindings: KnockoutAllBindingsAccessor | undefined, _viewModel: any, bindingContext: KnockoutBindingContext | undefined) => {
|
|
381
|
+
controlsDescendantBindings: boolean;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
export default _default_8;
|
|
386
|
+
}
|
|
387
|
+
declare module "binding-handlers/named-command" {
|
|
388
|
+
const _default_9: {
|
|
389
|
+
'dotvvm-named-command': {
|
|
390
|
+
init: (element: HTMLElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => {
|
|
391
|
+
controlsDescendantBindings: boolean;
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
export default _default_9;
|
|
396
|
+
}
|
|
397
|
+
declare module "binding-handlers/file-upload" {
|
|
398
|
+
const _default_10: {
|
|
399
|
+
"dotvvm-FileUpload": {
|
|
400
|
+
init: (element: HTMLInputElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => void;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
export default _default_10;
|
|
404
|
+
}
|
|
405
|
+
declare module "binding-handlers/js-component" {
|
|
406
|
+
const _default_11: {
|
|
407
|
+
"dotvvm-js-component": {
|
|
408
|
+
init(element: HTMLInputElement, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined): void;
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
export default _default_11;
|
|
412
|
+
}
|
|
228
413
|
declare module "binding-handlers/all-handlers" {
|
|
229
414
|
type KnockoutHandlerDictionary = {
|
|
230
415
|
[name: string]: KnockoutBindingHandler;
|
|
@@ -236,112 +421,99 @@ declare module "spa/events" {
|
|
|
236
421
|
import { DotvvmEvent } from "events";
|
|
237
422
|
export const spaNavigating: DotvvmEvent<DotvvmSpaNavigatingEventArgs>;
|
|
238
423
|
export const spaNavigated: DotvvmEvent<DotvvmSpaNavigatedEventArgs>;
|
|
424
|
+
export const spaNavigationFailed: DotvvmEvent<DotvvmSpaNavigationFailedEventArgs>;
|
|
239
425
|
}
|
|
240
426
|
declare module "dotvvm-base" {
|
|
241
|
-
|
|
427
|
+
import { StateManager } from "state-manager";
|
|
428
|
+
export function getViewModel(): DeepKnockoutObservableObject<RootViewModel>;
|
|
242
429
|
export function getViewModelCacheId(): string | undefined;
|
|
243
430
|
export function getViewModelCache(): any;
|
|
244
|
-
export function getViewModelObservable():
|
|
431
|
+
export function getViewModelObservable(): DeepKnockoutObservable<RootViewModel>;
|
|
245
432
|
export function getInitialUrl(): string;
|
|
246
433
|
export function getVirtualDirectory(): string;
|
|
247
434
|
export function replaceViewModel(vm: RootViewModel): void;
|
|
435
|
+
export function getState(): Readonly<RootViewModel>;
|
|
248
436
|
export function updateViewModelCache(viewModelCacheId: string, viewModelCache: any): void;
|
|
249
437
|
export function clearViewModelCache(): void;
|
|
250
|
-
export function getValidationRules(): ValidationRuleTable;
|
|
251
438
|
export function getCulture(): string;
|
|
439
|
+
export function getStateManager(): StateManager<RootViewModel>;
|
|
252
440
|
export function initCore(culture: string): void;
|
|
253
441
|
export function initBindings(): void;
|
|
254
442
|
}
|
|
255
443
|
declare module "DotVVM.Globalize" {
|
|
444
|
+
import { parseDate as serializationParseDate } from "serialization/date";
|
|
256
445
|
export function format(format: string, ...values: any[]): string;
|
|
257
446
|
type GlobalizeFormattable = null | undefined | string | Date | number;
|
|
258
447
|
export function formatString(format: string | null | undefined, value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>): string;
|
|
259
448
|
export function parseNumber(value: string): number;
|
|
260
449
|
export function parseDate(value: string, format: string, previousValue?: Date): Date | null;
|
|
261
|
-
export
|
|
262
|
-
export function
|
|
263
|
-
|
|
264
|
-
declare module "DotVVM.Polyfills" {
|
|
265
|
-
export default function (): void;
|
|
450
|
+
export const parseDotvvmDate: typeof serializationParseDate;
|
|
451
|
+
export function bindingDateToString(value: KnockoutObservable<string | Date> | string | Date | null | undefined, format?: string): KnockoutComputed<string>;
|
|
452
|
+
export function bindingNumberToString(value: KnockoutObservable<string | number> | string | number | null | undefined, format?: string): KnockoutComputed<string>;
|
|
266
453
|
}
|
|
267
454
|
declare var compileConstants: {
|
|
268
455
|
/** If the compiled bundle is for SPA applications */
|
|
269
456
|
isSpa: boolean;
|
|
270
|
-
/** If the compiled bundle is
|
|
271
|
-
|
|
457
|
+
/** If the compiled bundle is unminified */
|
|
458
|
+
debug: boolean;
|
|
272
459
|
};
|
|
273
|
-
declare module "createPostbackArgs" {
|
|
274
|
-
export function createPostbackArgs(options: PostbackOptions): {
|
|
275
|
-
postbackClientId: number;
|
|
276
|
-
viewModel: any;
|
|
277
|
-
sender: HTMLElement | undefined;
|
|
278
|
-
postbackOptions: PostbackOptions;
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
460
|
declare module "utils/uri" {
|
|
282
461
|
export function removeVirtualDirectoryFromUrl(url: string): string;
|
|
283
462
|
export function addVirtualDirectoryToUrl(appRelativeUrl: string): string;
|
|
284
463
|
export function addLeadingSlash(url: string): string;
|
|
285
464
|
export function concatUrl(url1: string, url2: string): string;
|
|
286
465
|
}
|
|
287
|
-
declare module "shared-classes" {
|
|
288
|
-
export class DotvvmPostbackError {
|
|
289
|
-
reason: PostbackRejectionReason;
|
|
290
|
-
constructor(reason: PostbackRejectionReason);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
466
|
declare module "postback/http" {
|
|
294
|
-
export
|
|
467
|
+
export type WrappedResponse<T> = {
|
|
468
|
+
readonly result: T;
|
|
469
|
+
readonly response?: Response;
|
|
470
|
+
};
|
|
471
|
+
export function getJSON<T>(url: string, spaPlaceHolderUniqueId?: string, signal?: AbortSignal, additionalHeaders?: {
|
|
295
472
|
[key: string]: string;
|
|
296
|
-
}): Promise<T
|
|
297
|
-
export function postJSON<T>(url: string, postData: any, additionalHeaders?: {
|
|
473
|
+
}): Promise<WrappedResponse<T>>;
|
|
474
|
+
export function postJSON<T>(url: string, postData: any, signal: AbortSignal | undefined, additionalHeaders?: {
|
|
298
475
|
[key: string]: string;
|
|
299
|
-
}): Promise<T
|
|
300
|
-
export function fetchJson<T>(url: string, init: RequestInit): Promise<T
|
|
301
|
-
export function fetchCsrfToken(): Promise<string>;
|
|
476
|
+
}): Promise<WrappedResponse<T>>;
|
|
477
|
+
export function fetchJson<T>(url: string, init: RequestInit): Promise<WrappedResponse<T>>;
|
|
478
|
+
export function fetchCsrfToken(signal: AbortSignal | undefined): Promise<string>;
|
|
302
479
|
export function retryOnInvalidCsrfToken<TResult>(postbackFunction: () => Promise<TResult>, iteration?: number, customErrorHandler?: () => void): Promise<TResult>;
|
|
303
480
|
}
|
|
304
481
|
declare module "postback/counter" {
|
|
305
482
|
export function backUpPostBackCounter(): number;
|
|
306
|
-
export function isPostBackStillActive(currentPostBackCounter: number): boolean;
|
|
307
|
-
export function resetPostBackCounter(): void;
|
|
308
|
-
}
|
|
309
|
-
declare module "postback/updater" {
|
|
310
|
-
export function getIsViewModelUpdating(): boolean;
|
|
311
|
-
export function cleanUpdatedControls(resultObject: any, updatedControls?: any): any;
|
|
312
|
-
export function restoreUpdatedControls(resultObject: any, updatedControls: any, applyBindingsOnEachControl: boolean): void;
|
|
313
|
-
export function updateViewModelAndControls(resultObject: any, clearViewModel: boolean): void;
|
|
314
|
-
export function patchViewModel(source: any, patch: any): any;
|
|
315
|
-
export function diffViewModel(source: any, modified: any): any;
|
|
316
483
|
}
|
|
317
484
|
declare module "utils/magic-navigator" {
|
|
318
485
|
export function navigate(url: string): void;
|
|
319
486
|
}
|
|
320
|
-
declare module "postback/gate" {
|
|
321
|
-
export const isSpaNavigationRunning: KnockoutObservable<boolean>;
|
|
322
|
-
export function arePostbacksDisabled(): boolean;
|
|
323
|
-
export function disablePostbacks(): void;
|
|
324
|
-
}
|
|
325
487
|
declare module "postback/redirect" {
|
|
326
|
-
export function performRedirect(url: string, replace: boolean, allowSpa: boolean): Promise<
|
|
327
|
-
export function handleRedirect(resultObject: any, replace?: boolean): Promise<
|
|
488
|
+
export function performRedirect(url: string, replace: boolean, allowSpa: boolean): Promise<any>;
|
|
489
|
+
export function handleRedirect(options: PostbackOptions, resultObject: any, response: Response, replace?: boolean): Promise<DotvvmRedirectEventArgs>;
|
|
328
490
|
}
|
|
329
|
-
declare module "
|
|
330
|
-
export function
|
|
331
|
-
export function
|
|
332
|
-
export function
|
|
333
|
-
export const unwrapComputedProperty: (obs: any) => any;
|
|
491
|
+
declare module "postback/gate" {
|
|
492
|
+
export function isPostbackDisabled(postbackId: number): boolean;
|
|
493
|
+
export function enablePostbacks(): void;
|
|
494
|
+
export function disablePostbacks(): void;
|
|
334
495
|
}
|
|
335
|
-
declare module "
|
|
336
|
-
|
|
337
|
-
export
|
|
496
|
+
declare module "validation/validators" {
|
|
497
|
+
import { DotvvmValidationContext } from "validation/common";
|
|
498
|
+
export type DotvvmValidator = {
|
|
499
|
+
isValid: (value: any, context: DotvvmValidationContext, property: KnockoutObservable<any>) => boolean;
|
|
500
|
+
};
|
|
501
|
+
export const required: DotvvmValidator;
|
|
502
|
+
export const regex: DotvvmValidator;
|
|
503
|
+
export const intRange: DotvvmValidator;
|
|
504
|
+
export const enforceClientFormat: DotvvmValidator;
|
|
505
|
+
export const range: DotvvmValidator;
|
|
506
|
+
export const notNull: DotvvmValidator;
|
|
507
|
+
export const emailAddress: DotvvmValidator;
|
|
508
|
+
type DotvvmValidatorSet = {
|
|
509
|
+
[name: string]: DotvvmValidator;
|
|
510
|
+
};
|
|
511
|
+
export const validators: DotvvmValidatorSet;
|
|
338
512
|
}
|
|
339
513
|
declare module "postback/internal-handlers" {
|
|
340
514
|
export const isPostbackRunning: KnockoutObservable<boolean>;
|
|
341
515
|
export const suppressOnDisabledElementHandler: DotvvmPostbackHandler;
|
|
342
516
|
export const isPostBackRunningHandler: DotvvmPostbackHandler;
|
|
343
|
-
export const postbackHandlersStartedEventHandler: DotvvmPostbackHandler;
|
|
344
|
-
export const postbackHandlersCompletedEventHandler: DotvvmPostbackHandler;
|
|
345
517
|
export const concurrencyDefault: (o: any) => {
|
|
346
518
|
name: string;
|
|
347
519
|
before: string[];
|
|
@@ -362,6 +534,7 @@ declare module "postback/internal-handlers" {
|
|
|
362
534
|
before: string[];
|
|
363
535
|
execute(next: () => Promise<PostbackCommitFunction>, options: PostbackOptions): Promise<PostbackCommitFunction>;
|
|
364
536
|
};
|
|
537
|
+
export function isPostbackStillActive(options: PostbackOptions): boolean;
|
|
365
538
|
}
|
|
366
539
|
declare module "postback/handlers" {
|
|
367
540
|
class ConfirmPostBackHandler implements DotvvmPostbackHandler {
|
|
@@ -381,52 +554,6 @@ declare module "postback/handlers" {
|
|
|
381
554
|
export function getPostbackHandler(name: string): (options: any) => DotvvmPostbackHandler;
|
|
382
555
|
export const defaultConcurrencyPostbackHandler: DotvvmPostbackHandler;
|
|
383
556
|
}
|
|
384
|
-
declare module "postback/postback" {
|
|
385
|
-
export function postBack(sender: HTMLElement, path: string[], command: string, controlUniqueId: string, context?: any, handlers?: ClientFriendlyPostbackHandlerConfiguration[], commandArgs?: any[]): Promise<DotvvmAfterPostBackEventArgs>;
|
|
386
|
-
type MaybePromise<T> = Promise<T> | T;
|
|
387
|
-
export function applyPostbackHandlers(next: (options: PostbackOptions) => MaybePromise<PostbackCommitFunction | any>, sender: HTMLElement, handlerConfigurations?: ClientFriendlyPostbackHandlerConfiguration[], args?: any[], context?: any, viewModel?: any): Promise<DotvvmAfterPostBackEventArgs>;
|
|
388
|
-
export function isPostbackHandler(obj: any): obj is DotvvmPostbackHandler;
|
|
389
|
-
export function sortHandlers(handlers: DotvvmPostbackHandler[]): DotvvmPostbackHandler[];
|
|
390
|
-
}
|
|
391
|
-
declare module "spa/navigation" {
|
|
392
|
-
export function navigateCore(url: string, handlePageNavigating?: (url: string) => void): Promise<DotvvmNavigationEventArgs>;
|
|
393
|
-
}
|
|
394
|
-
declare module "spa/spa" {
|
|
395
|
-
export const isSpaReady: KnockoutObservable<boolean>;
|
|
396
|
-
export function init(): void;
|
|
397
|
-
export function getSpaPlaceHoldersUniqueId(): string;
|
|
398
|
-
export function handleSpaNavigation(element: HTMLElement): Promise<DotvvmNavigationEventArgs>;
|
|
399
|
-
export function handleSpaNavigationCore(url: string | null): Promise<DotvvmNavigationEventArgs>;
|
|
400
|
-
}
|
|
401
|
-
declare module "validation/validators" {
|
|
402
|
-
import { DotvvmValidationContext } from "validation/common";
|
|
403
|
-
export type DotvvmValidator = {
|
|
404
|
-
isValid: (value: any, context: DotvvmValidationContext, property: KnockoutObservable<any>) => boolean;
|
|
405
|
-
};
|
|
406
|
-
export const required: DotvvmValidator;
|
|
407
|
-
export const regex: DotvvmValidator;
|
|
408
|
-
export const intRange: DotvvmValidator;
|
|
409
|
-
export const enforceClientFormat: DotvvmValidator;
|
|
410
|
-
export const range: DotvvmValidator;
|
|
411
|
-
export const notNull: DotvvmValidator;
|
|
412
|
-
export const emailAddress: DotvvmValidator;
|
|
413
|
-
type DotvvmValidatorSet = {
|
|
414
|
-
[name: string]: DotvvmValidator;
|
|
415
|
-
};
|
|
416
|
-
export const validators: DotvvmValidatorSet;
|
|
417
|
-
}
|
|
418
|
-
declare module "validation/error" {
|
|
419
|
-
export const allErrors: ValidationError[];
|
|
420
|
-
export function detachAllErrors(): void;
|
|
421
|
-
export function getErrors<T>(o: KnockoutObservable<T> | null): ValidationError[];
|
|
422
|
-
export class ValidationError {
|
|
423
|
-
errorMessage: string;
|
|
424
|
-
validatedObservable: KnockoutObservable<any>;
|
|
425
|
-
private constructor();
|
|
426
|
-
static attach(errorMessage: string, observable: KnockoutObservable<any>): ValidationError;
|
|
427
|
-
detach(): void;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
557
|
declare module "validation/actions" {
|
|
431
558
|
type DotvvmValidationActions = {
|
|
432
559
|
[name: string]: (element: HTMLElement, errorMessages: string[], param: any) => void;
|
|
@@ -434,33 +561,57 @@ declare module "validation/actions" {
|
|
|
434
561
|
export const elementActions: DotvvmValidationActions;
|
|
435
562
|
}
|
|
436
563
|
declare module "validation/validation" {
|
|
437
|
-
import { DotvvmValidator } from "validation/validators";
|
|
438
564
|
import { ValidationError } from "validation/error";
|
|
439
565
|
import { DotvvmEvent } from "events";
|
|
566
|
+
type DotvvmValidationErrorsChangedEventArgs = PostbackOptions & {
|
|
567
|
+
readonly allErrors: ValidationError[];
|
|
568
|
+
};
|
|
440
569
|
export const events: {
|
|
441
|
-
validationErrorsChanged: DotvvmEvent<
|
|
570
|
+
validationErrorsChanged: DotvvmEvent<DotvvmValidationErrorsChangedEventArgs>;
|
|
442
571
|
};
|
|
443
572
|
export const globalValidationObject: {
|
|
444
573
|
rules: {
|
|
445
|
-
[name: string]: DotvvmValidator;
|
|
574
|
+
[name: string]: import("validation/validators").DotvvmValidator;
|
|
446
575
|
};
|
|
447
576
|
errors: ValidationError[];
|
|
448
577
|
events: {
|
|
449
|
-
validationErrorsChanged: DotvvmEvent<
|
|
578
|
+
validationErrorsChanged: DotvvmEvent<DotvvmValidationErrorsChangedEventArgs>;
|
|
450
579
|
};
|
|
451
580
|
};
|
|
452
581
|
export function init(): void;
|
|
582
|
+
/**
|
|
583
|
+
* Adds validation errors from the server to the appropriate arrays
|
|
584
|
+
*/
|
|
585
|
+
export function showValidationErrorsFromServer(serverResponseObject: any, options: PostbackOptions): void;
|
|
586
|
+
}
|
|
587
|
+
declare module "postback/postbackCore" {
|
|
588
|
+
export function throwIfAborted(options: PostbackOptions): void;
|
|
589
|
+
export function getLastStartedPostbackId(): number;
|
|
590
|
+
export function postbackCore(options: PostbackOptions, path: string[], command: string, controlUniqueId: string, context: any, commandArgs?: any[]): Promise<PostbackCommitFunction>;
|
|
591
|
+
}
|
|
592
|
+
declare module "postback/postback" {
|
|
593
|
+
export function postBack(sender: HTMLElement, path: string[], command: string, controlUniqueId: string, context?: any, handlers?: ClientFriendlyPostbackHandlerConfiguration[], commandArgs?: any[], abortSignal?: AbortSignal): Promise<DotvvmAfterPostBackEventArgs>;
|
|
594
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
595
|
+
export function applyPostbackHandlers(next: (options: PostbackOptions) => MaybePromise<PostbackCommitFunction | any>, sender: HTMLElement, handlerConfigurations?: ClientFriendlyPostbackHandlerConfiguration[], args?: any[], context?: any, abortSignal?: AbortSignal): Promise<DotvvmAfterPostBackEventArgs>;
|
|
596
|
+
export function isPostbackHandler(obj: any): obj is DotvvmPostbackHandler;
|
|
597
|
+
export function sortHandlers(handlers: DotvvmPostbackHandler[]): DotvvmPostbackHandler[];
|
|
598
|
+
}
|
|
599
|
+
declare module "spa/navigation" {
|
|
600
|
+
export function navigateCore(url: string, options: PostbackOptions, handlePageNavigating: (url: string) => void): Promise<DotvvmNavigationEventArgs>;
|
|
601
|
+
}
|
|
602
|
+
declare module "spa/spa" {
|
|
603
|
+
export const isSpaReady: KnockoutObservable<boolean>;
|
|
604
|
+
export function init(): void;
|
|
605
|
+
export function getSpaPlaceHoldersUniqueId(): string;
|
|
606
|
+
export function handleSpaNavigation(element: HTMLElement): Promise<DotvvmNavigationEventArgs | undefined>;
|
|
607
|
+
export function handleSpaNavigationCore(url: string | null, sender?: HTMLElement, handlePageNavigating?: (url: string) => void): Promise<DotvvmNavigationEventArgs>;
|
|
453
608
|
}
|
|
454
609
|
declare module "binding-handlers/register" {
|
|
455
|
-
const
|
|
456
|
-
export default
|
|
610
|
+
const _default_12: () => void;
|
|
611
|
+
export default _default_12;
|
|
457
612
|
}
|
|
458
613
|
declare module "postback/staticCommand" {
|
|
459
|
-
export function
|
|
460
|
-
xhr?: XMLHttpRequest;
|
|
461
|
-
error?: any;
|
|
462
|
-
}) => void): Promise<void>;
|
|
463
|
-
export function staticCommandPostback(sender: HTMLElement, command: string, args: any[]): Promise<any>;
|
|
614
|
+
export function staticCommandPostback(command: string, args: any[], options: PostbackOptions): Promise<any>;
|
|
464
615
|
}
|
|
465
616
|
declare module "controls/routeLink" {
|
|
466
617
|
export function buildRouteUrl(routePath: string, params: any): string;
|
|
@@ -468,20 +619,7 @@ declare module "controls/routeLink" {
|
|
|
468
619
|
}
|
|
469
620
|
declare module "controls/fileUpload" {
|
|
470
621
|
export function showUploadDialog(sender: HTMLElement): void;
|
|
471
|
-
export function
|
|
472
|
-
export function reportProgress(targetControlId: any, isBusy: boolean, progress: number, result: DotvvmFileUploadData[] | string): void;
|
|
473
|
-
type DotvvmFileUploadData = {
|
|
474
|
-
FileId: KnockoutObservable<string>;
|
|
475
|
-
FileName: KnockoutObservable<string>;
|
|
476
|
-
FileSize: KnockoutObservable<DotvvmFileSize>;
|
|
477
|
-
IsFileTypeAllowed: KnockoutObservable<boolean>;
|
|
478
|
-
IsMaxSizeExceeded: KnockoutObservable<boolean>;
|
|
479
|
-
IsAllowed: KnockoutObservable<boolean>;
|
|
480
|
-
};
|
|
481
|
-
type DotvvmFileSize = {
|
|
482
|
-
Bytes: KnockoutObservable<number>;
|
|
483
|
-
FormattedText: KnockoutObservable<string>;
|
|
484
|
-
};
|
|
622
|
+
export function reportProgress(inputControl: HTMLInputElement, isBusy: boolean, progress: number, result: DotvvmStaticCommandResponse<DotvvmFileUploadData[]> | string): void;
|
|
485
623
|
}
|
|
486
624
|
declare module "api/eventHub" {
|
|
487
625
|
export function notify(id: string): void;
|
|
@@ -494,6 +632,65 @@ declare module "api/api" {
|
|
|
494
632
|
export function invoke<T>(target: any, methodName: string, argsProvider: () => any[], refreshTriggers: (args: any[]) => Array<KnockoutObservable<any> | string>, notifyTriggers: (args: any[]) => string[], element: HTMLElement, sharingKeyProvider: (args: any[]) => string[]): ApiComputed<T>;
|
|
495
633
|
export function refreshOn<T>(value: ApiComputed<T>, watch: KnockoutObservable<any>): ApiComputed<T>;
|
|
496
634
|
}
|
|
635
|
+
declare module "metadata/metadataHelper" {
|
|
636
|
+
export function getTypeId(viewModel: object): string | undefined;
|
|
637
|
+
export function getTypeMetadata(typeId: string): TypeMetadata;
|
|
638
|
+
export function getEnumMetadata(enumMetadataId: string): EnumTypeMetadata;
|
|
639
|
+
export function getEnumValue(identifier: string | number, enumMetadataId: string): number | undefined;
|
|
640
|
+
}
|
|
641
|
+
declare module "collections/sortingHelper" {
|
|
642
|
+
type ElementType = string | number | boolean;
|
|
643
|
+
export const orderBy: <T>(array: T[], selector: (item: T) => ElementType, typeId: string) => T[];
|
|
644
|
+
export const orderByDesc: <T>(array: T[], selector: (item: T) => ElementType, typeId: string) => T[];
|
|
645
|
+
}
|
|
646
|
+
declare module "collections/arrayHelper" {
|
|
647
|
+
import { orderBy, orderByDesc } from "collections/sortingHelper";
|
|
648
|
+
export { add, addOrUpdate, addRange, clear, distinct, firstOrDefault, insert, insertRange, lastOrDefault, max, min, orderBy, orderByDesc, removeAll, removeAt, removeFirst, removeLast, removeRange, reverse, setItem };
|
|
649
|
+
function add<T>(observable: any, element: T): void;
|
|
650
|
+
function addOrUpdate<T>(observable: any, element: T, matcher: (e: T) => boolean, updater: (e: T) => T): void;
|
|
651
|
+
function addRange<T>(observable: any, elements: T[]): void;
|
|
652
|
+
function clear(observable: any): void;
|
|
653
|
+
function distinct<T>(array: T[]): T[];
|
|
654
|
+
function firstOrDefault<T>(array: T[], predicate: (s: T) => boolean): T | null;
|
|
655
|
+
function insert<T>(observable: any, index: number, element: T): void;
|
|
656
|
+
function insertRange<T>(observable: any, index: number, elements: T[]): void;
|
|
657
|
+
function lastOrDefault<T>(array: T[], predicate: (s: T) => boolean): T | null;
|
|
658
|
+
function max<T>(array: T[], selector: (item: T) => number, throwIfEmpty: boolean): number | null;
|
|
659
|
+
function min<T>(array: T[], selector: (item: T) => number, throwIfEmpty: boolean): number | null;
|
|
660
|
+
function removeAt<T>(observable: any, index: number): void;
|
|
661
|
+
function removeAll<T>(observable: any, predicate: (s: T) => boolean): void;
|
|
662
|
+
function removeRange<T>(observable: any, index: number, length: number): void;
|
|
663
|
+
function removeFirst<T>(observable: any, predicate: (s: T) => boolean): void;
|
|
664
|
+
function removeLast<T>(observable: any, predicate: (s: T) => boolean): void;
|
|
665
|
+
function reverse<T>(observable: any): void;
|
|
666
|
+
function setItem<T>(observable: any, index: number, value: T): void;
|
|
667
|
+
}
|
|
668
|
+
declare module "collections/dictionaryHelper" {
|
|
669
|
+
type Dictionary<Key, Value> = {
|
|
670
|
+
Key: Key;
|
|
671
|
+
Value: Value;
|
|
672
|
+
}[];
|
|
673
|
+
export function clear(observable: any): void;
|
|
674
|
+
export function containsKey<Key, Value>(dictionary: Dictionary<Key, Value>, identifier: Key): boolean;
|
|
675
|
+
export function getItem<Key, Value>(dictionary: Dictionary<Key, Value>, identifier: Key): Value;
|
|
676
|
+
export function remove<Key, Value>(observable: any, identifier: Key): boolean;
|
|
677
|
+
export function setItem<Key, Value>(observable: any, identifier: Key, value: Value): void;
|
|
678
|
+
}
|
|
679
|
+
declare module "utils/stringHelper" {
|
|
680
|
+
export function contains(haystack: string, needle: string, options: string): boolean;
|
|
681
|
+
export function endsWith(haystack: string, needle: string, options: string): boolean;
|
|
682
|
+
export function startsWith(haystack: string, needle: string, options: string): boolean;
|
|
683
|
+
export function indexOf(haystack: string, startIndex: number, needle: string, options: string): number;
|
|
684
|
+
export function lastIndexOf(haystack: string, startIndex: number, needle: string, options: string): number;
|
|
685
|
+
export function split(text: string, delimiter: string, options: string): string[];
|
|
686
|
+
export function join<T>(elements: T[], delimiter: string): string;
|
|
687
|
+
export function format(pattern: string, expressions: any[]): string;
|
|
688
|
+
export function trimStart(text: string, char: string): string;
|
|
689
|
+
export function trimEnd(text: string, char: string): string;
|
|
690
|
+
}
|
|
691
|
+
declare module "utils/dateTimeHelper" {
|
|
692
|
+
export function toBrowserLocalTime(value: KnockoutObservable<string | null>): KnockoutComputed<string | null>;
|
|
693
|
+
}
|
|
497
694
|
declare module "dotvvm-root" {
|
|
498
695
|
import { getCulture } from "dotvvm-base";
|
|
499
696
|
import * as events from "events";
|
|
@@ -505,10 +702,18 @@ declare module "dotvvm-root" {
|
|
|
505
702
|
import * as globalize from "DotVVM.Globalize";
|
|
506
703
|
import { staticCommandPostback } from "postback/staticCommand";
|
|
507
704
|
import { applyPostbackHandlers } from "postback/postback";
|
|
705
|
+
import { isSpaReady } from "spa/spa";
|
|
508
706
|
import { buildRouteUrl, buildUrlSuffix } from "controls/routeLink";
|
|
509
707
|
import * as fileUpload from "controls/fileUpload";
|
|
708
|
+
import { handleSpaNavigation } from "spa/spa";
|
|
709
|
+
import * as spaEvents from "spa/events";
|
|
510
710
|
import * as api from "api/api";
|
|
511
711
|
import * as eventHub from "api/eventHub";
|
|
712
|
+
import * as viewModuleManager from "viewModules/viewModuleManager";
|
|
713
|
+
import { notifyModuleLoaded } from "postback/resourceLoader";
|
|
714
|
+
import { logError, logWarning, logInfo, logInfoVerbose, logPostBackScriptError } from "utils/logging";
|
|
715
|
+
import * as metadataHelper from "metadata/metadataHelper";
|
|
716
|
+
import { StateManager } from "state-manager";
|
|
512
717
|
function init(culture: string): void;
|
|
513
718
|
const dotvvmExports: {
|
|
514
719
|
getCulture: typeof getCulture;
|
|
@@ -519,7 +724,6 @@ declare module "dotvvm-root" {
|
|
|
519
724
|
fileUpload: {
|
|
520
725
|
reportProgress: typeof fileUpload.reportProgress;
|
|
521
726
|
showUploadDialog: typeof fileUpload.showUploadDialog;
|
|
522
|
-
createUploadId: typeof fileUpload.createUploadId;
|
|
523
727
|
};
|
|
524
728
|
api: {
|
|
525
729
|
invoke: typeof api.invoke;
|
|
@@ -531,6 +735,7 @@ declare module "dotvvm-root" {
|
|
|
531
735
|
};
|
|
532
736
|
globalize: typeof globalize;
|
|
533
737
|
postBackHandlers: DotvvmPostbackHandlerCollection;
|
|
738
|
+
postbackHandlers: DotvvmPostbackHandlerCollection;
|
|
534
739
|
buildUrlSuffix: typeof buildUrlSuffix;
|
|
535
740
|
buildRouteUrl: typeof buildRouteUrl;
|
|
536
741
|
staticCommandPostback: typeof staticCommandPostback;
|
|
@@ -541,20 +746,25 @@ declare module "dotvvm-root" {
|
|
|
541
746
|
};
|
|
542
747
|
errors: import("validation/error").ValidationError[];
|
|
543
748
|
events: {
|
|
544
|
-
validationErrorsChanged: events.DotvvmEvent<
|
|
749
|
+
validationErrorsChanged: events.DotvvmEvent<PostbackOptions & {
|
|
750
|
+
readonly allErrors: import("validation/error").ValidationError[];
|
|
751
|
+
}>;
|
|
545
752
|
};
|
|
546
753
|
};
|
|
547
754
|
postBack: typeof postBack;
|
|
548
755
|
init: typeof init;
|
|
756
|
+
registerGlobalComponent: typeof viewModuleManager.registerGlobalComponent;
|
|
549
757
|
isPostbackRunning: KnockoutObservable<boolean>;
|
|
550
|
-
events: typeof events;
|
|
758
|
+
events: Partial<typeof spaEvents> & typeof events;
|
|
551
759
|
viewModels: {
|
|
552
760
|
root: {
|
|
553
|
-
readonly viewModel: RootViewModel
|
|
761
|
+
readonly viewModel: DeepKnockoutObservableObject<RootViewModel>;
|
|
554
762
|
};
|
|
555
763
|
};
|
|
764
|
+
readonly state: Readonly<RootViewModel>;
|
|
765
|
+
patchState(a: any): void;
|
|
556
766
|
viewModelObservables: {
|
|
557
|
-
readonly root: KnockoutObservable<RootViewModel
|
|
767
|
+
readonly root: KnockoutObservable<DeepKnockoutObservableObject<RootViewModel>>;
|
|
558
768
|
};
|
|
559
769
|
serialization: {
|
|
560
770
|
serialize: typeof serialize;
|
|
@@ -562,9 +772,39 @@ declare module "dotvvm-root" {
|
|
|
562
772
|
parseDate: typeof parseDate;
|
|
563
773
|
deserialize: typeof deserialize;
|
|
564
774
|
};
|
|
775
|
+
metadata: {
|
|
776
|
+
getTypeId: typeof metadataHelper.getTypeId;
|
|
777
|
+
getTypeMetadata: typeof metadataHelper.getTypeMetadata;
|
|
778
|
+
getEnumMetadata: typeof metadataHelper.getEnumMetadata;
|
|
779
|
+
getEnumValue: typeof metadataHelper.getEnumValue;
|
|
780
|
+
};
|
|
781
|
+
viewModules: {
|
|
782
|
+
registerOne: typeof viewModuleManager.registerViewModule;
|
|
783
|
+
init: typeof viewModuleManager.initViewModule;
|
|
784
|
+
call: typeof viewModuleManager.callViewModuleCommand;
|
|
785
|
+
registerMany: typeof viewModuleManager.registerViewModules;
|
|
786
|
+
};
|
|
787
|
+
resourceLoader: {
|
|
788
|
+
notifyModuleLoaded: typeof notifyModuleLoaded;
|
|
789
|
+
};
|
|
790
|
+
log: {
|
|
791
|
+
logError: typeof logError;
|
|
792
|
+
logWarning: typeof logWarning;
|
|
793
|
+
logInfo: typeof logInfo;
|
|
794
|
+
logInfoVerbose: typeof logInfoVerbose;
|
|
795
|
+
logPostBackScriptError: typeof logPostBackScriptError;
|
|
796
|
+
level: "normal" | "verbose";
|
|
797
|
+
};
|
|
798
|
+
translations: any;
|
|
799
|
+
StateManager: typeof StateManager;
|
|
800
|
+
DotvvmEvent: typeof events.DotvvmEvent;
|
|
565
801
|
};
|
|
566
802
|
global {
|
|
567
|
-
const dotvvm: typeof dotvvmExports
|
|
803
|
+
const dotvvm: typeof dotvvmExports & {
|
|
804
|
+
debug?: true;
|
|
805
|
+
isSpaReady?: typeof isSpaReady;
|
|
806
|
+
handleSpaNavigation?: typeof handleSpaNavigation;
|
|
807
|
+
};
|
|
568
808
|
interface Window {
|
|
569
809
|
dotvvm: typeof dotvvmExports;
|
|
570
810
|
}
|
|
@@ -578,8 +818,11 @@ declare type DotvvmPostbackHandler = {
|
|
|
578
818
|
after?: Array<string | DotvvmPostbackHandler>;
|
|
579
819
|
before?: Array<string | DotvvmPostbackHandler>;
|
|
580
820
|
};
|
|
581
|
-
declare type
|
|
582
|
-
|
|
821
|
+
declare type DotvvmPostbackErrorLike = {
|
|
822
|
+
readonly reason: DotvvmPostbackErrorReason;
|
|
823
|
+
};
|
|
824
|
+
declare type DotvvmPostbackErrorReason = ({
|
|
825
|
+
type: 'handler';
|
|
583
826
|
handlerName: string;
|
|
584
827
|
message?: string;
|
|
585
828
|
} | {
|
|
@@ -599,72 +842,96 @@ declare type PostbackRejectionReason = {
|
|
|
599
842
|
response?: Response;
|
|
600
843
|
} | {
|
|
601
844
|
type: 'event';
|
|
602
|
-
}
|
|
845
|
+
} | {
|
|
846
|
+
type: 'validation';
|
|
847
|
+
responseObject: any;
|
|
848
|
+
response?: Response;
|
|
849
|
+
} | {
|
|
850
|
+
type: 'abort';
|
|
851
|
+
} | {
|
|
852
|
+
type: 'redirect';
|
|
853
|
+
responseObject: any;
|
|
854
|
+
response?: Response;
|
|
855
|
+
}) & {
|
|
603
856
|
options?: PostbackOptions;
|
|
604
857
|
};
|
|
605
|
-
|
|
606
|
-
[key: string]: any;
|
|
607
|
-
validationTargetPath?: string;
|
|
608
|
-
}
|
|
858
|
+
declare type PostbackCommandType = "postback" | "staticCommand" | "spaNavigation";
|
|
609
859
|
declare type PostbackOptions = {
|
|
610
|
-
readonly additionalPostbackData: AdditionalPostbackData;
|
|
611
860
|
readonly postbackId: number;
|
|
612
|
-
readonly
|
|
861
|
+
readonly commandType: PostbackCommandType;
|
|
613
862
|
readonly args: any[];
|
|
863
|
+
readonly sender?: HTMLElement;
|
|
614
864
|
readonly viewModel?: any;
|
|
865
|
+
readonly knockoutContext?: any;
|
|
866
|
+
serverResponseObject?: any;
|
|
867
|
+
validationTargetPath?: string;
|
|
868
|
+
abortSignal?: AbortSignal;
|
|
615
869
|
};
|
|
616
|
-
declare type
|
|
617
|
-
readonly
|
|
618
|
-
readonly
|
|
619
|
-
readonly xhr?: XMLHttpRequest;
|
|
620
|
-
readonly serverResponseObject?: any;
|
|
621
|
-
readonly postbackOptions: PostbackOptions;
|
|
622
|
-
};
|
|
623
|
-
declare type DotvvmEventArgs = {
|
|
624
|
-
/** The global view model */
|
|
625
|
-
readonly viewModel?: any;
|
|
626
|
-
};
|
|
627
|
-
declare type DotvvmErrorEventArgs = {
|
|
628
|
-
readonly sender?: Element;
|
|
629
|
-
readonly serverResponseObject?: any;
|
|
630
|
-
readonly viewModel?: any;
|
|
631
|
-
readonly isSpaNavigationError?: true;
|
|
870
|
+
declare type DotvvmErrorEventArgs = PostbackOptions & {
|
|
871
|
+
readonly response?: Response;
|
|
872
|
+
readonly error: DotvvmPostbackErrorLike;
|
|
632
873
|
handled: boolean;
|
|
633
874
|
};
|
|
634
|
-
declare type DotvvmBeforePostBackEventArgs =
|
|
875
|
+
declare type DotvvmBeforePostBackEventArgs = PostbackOptions & {
|
|
635
876
|
cancel: boolean;
|
|
636
877
|
};
|
|
637
|
-
declare type DotvvmAfterPostBackEventArgs =
|
|
638
|
-
handled: boolean;
|
|
878
|
+
declare type DotvvmAfterPostBackEventArgs = PostbackOptions & {
|
|
639
879
|
/** Set to true in case the postback did not finish and it was cancelled by an event or a postback handler */
|
|
640
|
-
readonly wasInterrupted
|
|
641
|
-
readonly
|
|
642
|
-
readonly commandResult: any;
|
|
880
|
+
readonly wasInterrupted?: boolean;
|
|
881
|
+
readonly commandResult?: any;
|
|
643
882
|
readonly response?: Response;
|
|
644
|
-
|
|
645
|
-
readonly redirectPromise?: Promise<DotvvmNavigationEventArgs>;
|
|
883
|
+
readonly error?: DotvvmPostbackErrorLike;
|
|
646
884
|
};
|
|
647
|
-
declare type
|
|
648
|
-
|
|
649
|
-
cancel: boolean;
|
|
650
|
-
/** The url we are navigating to */
|
|
651
|
-
readonly newUrl: string;
|
|
885
|
+
declare type DotvvmNavigationEventArgs = PostbackOptions & {
|
|
886
|
+
readonly url: string;
|
|
652
887
|
};
|
|
653
|
-
declare type
|
|
654
|
-
|
|
655
|
-
readonly xhr?: XMLHttpRequest;
|
|
656
|
-
readonly isSpa?: true;
|
|
888
|
+
declare type DotvvmSpaNavigatingEventArgs = DotvvmNavigationEventArgs & {
|
|
889
|
+
cancel: boolean;
|
|
657
890
|
};
|
|
658
891
|
declare type DotvvmSpaNavigatedEventArgs = DotvvmNavigationEventArgs & {
|
|
659
|
-
|
|
660
|
-
isHandled: boolean;
|
|
892
|
+
readonly response?: Response;
|
|
661
893
|
};
|
|
662
|
-
declare type
|
|
663
|
-
|
|
664
|
-
readonly
|
|
894
|
+
declare type DotvvmSpaNavigationFailedEventArgs = DotvvmNavigationEventArgs & {
|
|
895
|
+
readonly response?: Response;
|
|
896
|
+
readonly error?: DotvvmPostbackErrorLike;
|
|
897
|
+
};
|
|
898
|
+
declare type DotvvmRedirectEventArgs = DotvvmNavigationEventArgs & {
|
|
899
|
+
readonly response?: Response;
|
|
665
900
|
/** Whether the new url should replace the current url in the browsing history */
|
|
666
901
|
readonly replace: boolean;
|
|
667
902
|
};
|
|
903
|
+
declare type DotvvmPostbackHandlersStartedEventArgs = PostbackOptions & {};
|
|
904
|
+
declare type DotvvmPostbackHandlersCompletedEventArgs = PostbackOptions & {};
|
|
905
|
+
declare type DotvvmPostbackResponseReceivedEventArgs = PostbackOptions & {
|
|
906
|
+
readonly response: Response;
|
|
907
|
+
};
|
|
908
|
+
declare type DotvvmPostbackCommitInvokedEventArgs = PostbackOptions & {
|
|
909
|
+
readonly response: Response;
|
|
910
|
+
};
|
|
911
|
+
declare type DotvvmPostbackViewModelUpdatedEventArgs = PostbackOptions & {
|
|
912
|
+
readonly response: Response;
|
|
913
|
+
};
|
|
914
|
+
declare type DotvvmPostbackRejectedEventArgs = PostbackOptions & {
|
|
915
|
+
readonly error: DotvvmPostbackErrorLike;
|
|
916
|
+
};
|
|
917
|
+
declare type DotvvmStaticCommandMethodEventArgs = PostbackOptions & {
|
|
918
|
+
readonly methodId: string;
|
|
919
|
+
readonly methodArgs: any[];
|
|
920
|
+
};
|
|
921
|
+
declare type DotvvmStaticCommandMethodInvokingEventArgs = DotvvmStaticCommandMethodEventArgs & {};
|
|
922
|
+
declare type DotvvmStaticCommandMethodInvokedEventArgs = DotvvmStaticCommandMethodEventArgs & {
|
|
923
|
+
readonly result: any;
|
|
924
|
+
readonly response?: Response;
|
|
925
|
+
};
|
|
926
|
+
declare type DotvvmStaticCommandMethodFailedEventArgs = DotvvmStaticCommandMethodEventArgs & {
|
|
927
|
+
readonly result?: any;
|
|
928
|
+
readonly response?: Response;
|
|
929
|
+
readonly error: DotvvmPostbackErrorLike;
|
|
930
|
+
};
|
|
931
|
+
declare type DotvvmInitEventArgs = {
|
|
932
|
+
readonly viewModel: any;
|
|
933
|
+
};
|
|
934
|
+
declare type DotvvmInitCompletedEventArgs = {};
|
|
668
935
|
interface DotvvmViewModelInfo {
|
|
669
936
|
viewModel?: any;
|
|
670
937
|
viewModelCacheId?: string;
|
|
@@ -672,6 +939,7 @@ interface DotvvmViewModelInfo {
|
|
|
672
939
|
renderedResources?: string[];
|
|
673
940
|
url?: string;
|
|
674
941
|
virtualDirectory?: string;
|
|
942
|
+
typeMetadata: TypeMap;
|
|
675
943
|
}
|
|
676
944
|
interface DotvvmViewModels {
|
|
677
945
|
[name: string]: DotvvmViewModelInfo;
|
|
@@ -680,11 +948,17 @@ interface DotvvmViewModels {
|
|
|
680
948
|
interface DotvvmPostbackHandlerCollection {
|
|
681
949
|
[name: string]: ((options: any) => DotvvmPostbackHandler);
|
|
682
950
|
}
|
|
683
|
-
declare type DotvvmStaticCommandResponse = {
|
|
951
|
+
declare type DotvvmStaticCommandResponse<T = any> = {
|
|
684
952
|
result: any;
|
|
953
|
+
customData: {
|
|
954
|
+
[key: string]: any;
|
|
955
|
+
};
|
|
956
|
+
typeMetadata?: TypeMap;
|
|
685
957
|
} | {
|
|
686
958
|
action: "redirect";
|
|
687
959
|
url: string;
|
|
960
|
+
replace?: boolean;
|
|
961
|
+
allowSpa?: boolean;
|
|
688
962
|
};
|
|
689
963
|
declare type DotvvmPostBackHandlerConfiguration = {
|
|
690
964
|
name: string;
|
|
@@ -701,6 +975,135 @@ declare type ValidationRuleTable = {
|
|
|
701
975
|
[property: string]: [PropertyValidationRuleInfo];
|
|
702
976
|
};
|
|
703
977
|
};
|
|
978
|
+
declare type StateUpdate<TViewModel> = (initial: DeepReadonly<TViewModel>) => DeepReadonly<TViewModel>;
|
|
979
|
+
declare type UpdateDispatcher<TViewModel> = (update: StateUpdate<TViewModel>) => void;
|
|
980
|
+
/** Knockout observable, including all child object and arrays */
|
|
981
|
+
declare type DeepKnockoutObservable<T> = T extends (infer R)[] ? DeepKnockoutObservableArray<R> : T extends object ? KnockoutObservable<DeepKnockoutObservableObject<T>> : KnockoutObservable<T>;
|
|
982
|
+
declare type DeepKnockoutObservableArray<T> = KnockoutObservableArray<DeepKnockoutObservable<T>>;
|
|
983
|
+
declare type DeepKnockoutObservableObject<T> = {
|
|
984
|
+
readonly [P in keyof T]: DeepKnockoutObservable<T[P]>;
|
|
985
|
+
};
|
|
986
|
+
/** Partial<T>, but including all child objects */
|
|
987
|
+
declare type DeepPartial<T> = T extends object ? {
|
|
988
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
989
|
+
} : T;
|
|
990
|
+
/** Readonly<T>, but including all child objects and arrays */
|
|
991
|
+
declare type DeepReadonly<T> = T extends TypeDefinition ? T : T extends (infer R)[] ? readonly DeepReadonly<R>[] : T extends object ? {
|
|
992
|
+
readonly [P in keyof T]: DeepReadonly<T[P]>;
|
|
993
|
+
} : T;
|
|
994
|
+
/** Knockout observable that is found in the DotVVM ViewModel - all nested objects and arrays are also observable + it has some helper functions (state, patchState, ...) */
|
|
995
|
+
declare type DotvvmObservable<T> = DeepKnockoutObservable<T> & {
|
|
996
|
+
/** A property, returns latest state from dotvvm.state. It does not contain any knockout observable and does not have any propagation delay, as the value in the observable */
|
|
997
|
+
readonly state: DeepReadonly<T>;
|
|
998
|
+
/** Sets new state directly into the dotvvm.state.
|
|
999
|
+
* Note that the value arrives into the observable itself asynchronously, so there might be slight delay */
|
|
1000
|
+
readonly setState: (newState: DeepReadonly<T>) => void;
|
|
1001
|
+
/** Patches the current state and sets it into dotvvm.state.
|
|
1002
|
+
* Compared to setState, when property does not exist in the patch parameter, the old value from state is used.
|
|
1003
|
+
* Note that the value arrives into the observable itself asynchronously, so there might be slight delay
|
|
1004
|
+
* @example observable.patchState({ Prop2: 0 }) // Only must be specified, although Prop1 also exists and is required */
|
|
1005
|
+
readonly patchState: (patch: DeepReadonly<DeepPartial<T>>) => void;
|
|
1006
|
+
/** Dispatches update of the state.
|
|
1007
|
+
* Note that the value arrives into the observable itself asynchronously, so there might be slight delay
|
|
1008
|
+
* @example observable.updater(state => [ ...state, newElement ]) // This appends an element to an (observable) array
|
|
1009
|
+
* @example observable.updater(state => state + 1) // Increments the value by one
|
|
1010
|
+
* @example observable.updater(state => ({ ...state, MyProperty: state.MyProperty + 1 })) // Increments the property MyProperty by one
|
|
1011
|
+
*/
|
|
1012
|
+
readonly updater: UpdateDispatcher<T>;
|
|
1013
|
+
};
|
|
704
1014
|
declare type RootViewModel = {
|
|
705
|
-
$
|
|
1015
|
+
$type: string;
|
|
1016
|
+
$csrfToken?: string;
|
|
1017
|
+
[name: string]: any;
|
|
1018
|
+
};
|
|
1019
|
+
declare type TypeMap = {
|
|
1020
|
+
[typeId: string]: TypeMetadata;
|
|
1021
|
+
};
|
|
1022
|
+
declare type ObjectTypeMetadata = {
|
|
1023
|
+
type: "object";
|
|
1024
|
+
properties: {
|
|
1025
|
+
[prop: string]: PropertyMetadata;
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
declare type EnumTypeMetadata = {
|
|
1029
|
+
type: "enum";
|
|
1030
|
+
values: {
|
|
1031
|
+
[name: string]: number;
|
|
1032
|
+
};
|
|
1033
|
+
isFlags?: boolean;
|
|
1034
|
+
};
|
|
1035
|
+
declare type TypeMetadata = ObjectTypeMetadata | EnumTypeMetadata;
|
|
1036
|
+
declare type PropertyMetadata = {
|
|
1037
|
+
type: TypeDefinition;
|
|
1038
|
+
post?: "always" | "pathOnly" | "no";
|
|
1039
|
+
update?: "always" | "firstRequest" | "no";
|
|
1040
|
+
validationRules?: PropertyValidationRuleInfo[];
|
|
1041
|
+
clientExtenders?: ClientExtenderInfo[];
|
|
1042
|
+
};
|
|
1043
|
+
declare type TypeDefinition = string | {
|
|
1044
|
+
readonly type: "nullable";
|
|
1045
|
+
readonly inner: TypeDefinition;
|
|
1046
|
+
} | {
|
|
1047
|
+
readonly type: "dynamic";
|
|
1048
|
+
} | TypeDefinition[];
|
|
1049
|
+
declare type ClientExtenderInfo = {
|
|
1050
|
+
name: string;
|
|
1051
|
+
parameter: any;
|
|
1052
|
+
};
|
|
1053
|
+
declare type CoerceErrorType = {
|
|
1054
|
+
isError: true;
|
|
1055
|
+
wasCoerced: false;
|
|
1056
|
+
message: string;
|
|
1057
|
+
path: string;
|
|
1058
|
+
prependPathFragment(fragment: string): void;
|
|
1059
|
+
value: never;
|
|
1060
|
+
};
|
|
1061
|
+
declare type CoerceResult = CoerceErrorType | {
|
|
1062
|
+
value: any;
|
|
1063
|
+
wasCoerced?: boolean;
|
|
1064
|
+
isError?: false;
|
|
1065
|
+
};
|
|
1066
|
+
declare type DotvvmFileUploadCollection = {
|
|
1067
|
+
Files: KnockoutObservableArray<KnockoutObservable<DotvvmFileUploadData>>;
|
|
1068
|
+
Progress: KnockoutObservable<number>;
|
|
1069
|
+
Error: KnockoutObservable<string>;
|
|
1070
|
+
IsBusy: KnockoutObservable<boolean>;
|
|
1071
|
+
};
|
|
1072
|
+
declare type DotvvmFileUploadData = {
|
|
1073
|
+
FileId: KnockoutObservable<string>;
|
|
1074
|
+
FileName: KnockoutObservable<string>;
|
|
1075
|
+
FileSize: KnockoutObservable<DotvvmFileSize>;
|
|
1076
|
+
IsFileTypeAllowed: KnockoutObservable<boolean>;
|
|
1077
|
+
IsMaxSizeExceeded: KnockoutObservable<boolean>;
|
|
1078
|
+
IsAllowed: KnockoutObservable<boolean>;
|
|
1079
|
+
};
|
|
1080
|
+
declare type DotvvmFileSize = {
|
|
1081
|
+
Bytes: KnockoutObservable<number>;
|
|
1082
|
+
FormattedText: KnockoutObservable<string>;
|
|
1083
|
+
};
|
|
1084
|
+
declare type DotvvmJsComponent = {
|
|
1085
|
+
updateProps(p: {
|
|
1086
|
+
[key: string]: any;
|
|
1087
|
+
}): void;
|
|
1088
|
+
dispose(): void;
|
|
1089
|
+
};
|
|
1090
|
+
declare type DotvvmJsComponentFactory = {
|
|
1091
|
+
create(element: HTMLElement, props: {
|
|
1092
|
+
[key: string]: any;
|
|
1093
|
+
}, commands: {
|
|
1094
|
+
[key: string]: (args: any[]) => Promise<any>;
|
|
1095
|
+
}, templates: {
|
|
1096
|
+
[key: string]: string;
|
|
1097
|
+
}, // TODO
|
|
1098
|
+
setProps: (p: {
|
|
1099
|
+
[key: string]: any;
|
|
1100
|
+
}) => void): DotvvmJsComponent;
|
|
1101
|
+
};
|
|
1102
|
+
declare type DotvvmViewModuleCommandName = `${'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z'}${string}`;
|
|
1103
|
+
declare type DotvvmViewModule = {
|
|
1104
|
+
$controls?: {
|
|
1105
|
+
[name: string]: DotvvmJsComponentFactory;
|
|
1106
|
+
};
|
|
1107
|
+
$dispose?: (context: any) => void;
|
|
1108
|
+
[commandName: DotvvmViewModuleCommandName]: (...args: any[]) => Promise<any> | any;
|
|
706
1109
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotvvm-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.7",
|
|
4
4
|
"description": "MVVM framework for ASP.NET",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
"url": "https://github.com/riganti/dotvvm/issues"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/riganti/dotvvm#readme",
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"typescript": "^4.0.3"
|
|
18
|
-
},
|
|
19
16
|
"dependencies": {
|
|
20
17
|
"@types/knockout": "^3.4.69"
|
|
21
18
|
}
|