dotvvm-types 3.1.0 → 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/{DotVVM.d.ts → index.d.ts} +181 -114
- package/package.json +1 -4
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../../Resources/Scripts/typings/globalize/globalize.d.ts" />
|
|
1
2
|
declare module "shared-classes" {
|
|
2
3
|
export class DotvvmPostbackError {
|
|
3
4
|
reason: DotvvmPostbackErrorReason;
|
|
@@ -25,9 +26,9 @@ declare module "utils/logging" {
|
|
|
25
26
|
export function logPostBackScriptError(err: any): void;
|
|
26
27
|
}
|
|
27
28
|
declare module "serialization/date" {
|
|
28
|
-
export function parseDate(value: string): Date | null;
|
|
29
|
-
export function parseTimeSpan(value: string): number | null;
|
|
30
|
-
export function parseDateTimeOffset(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;
|
|
31
32
|
export function serializeDate(date: string | Date | null, convertToUtc?: boolean): string | null;
|
|
32
33
|
export function serializeTimeSpan(time: string | number | null): string | null;
|
|
33
34
|
}
|
|
@@ -47,9 +48,13 @@ declare module "utils/knockout" {
|
|
|
47
48
|
}
|
|
48
49
|
declare module "utils/objects" {
|
|
49
50
|
export function isPrimitive(viewModel: any): boolean;
|
|
50
|
-
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
|
+
};
|
|
51
57
|
export const hasOwnProperty: (obj: any, prop: string) => boolean;
|
|
52
|
-
export const symbolOrDollar: (name: string) => symbol;
|
|
53
58
|
export const keys: {
|
|
54
59
|
(o: object): string[];
|
|
55
60
|
(o: {}): string[];
|
|
@@ -62,14 +67,6 @@ declare module "metadata/typeMap" {
|
|
|
62
67
|
export function updateTypeInfo(newTypes: TypeMap | undefined): void;
|
|
63
68
|
export function replaceTypeInfo(newTypes: TypeMap | undefined): void;
|
|
64
69
|
}
|
|
65
|
-
declare module "serialization/deserialize" {
|
|
66
|
-
export function deserialize(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
67
|
-
export function deserializePrimitive(viewModel: any, target?: any): any;
|
|
68
|
-
export function deserializeDate(viewModel: any, target?: any): any;
|
|
69
|
-
export function deserializeArray(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
70
|
-
export function deserializeObject(viewModel: any, target: any, deserializeAll: boolean): any;
|
|
71
|
-
export function extendToObservableArrayIfRequired(observable: any): any;
|
|
72
|
-
}
|
|
73
70
|
declare module "events" {
|
|
74
71
|
export class DotvvmEvent<T> {
|
|
75
72
|
readonly name: string;
|
|
@@ -97,7 +94,7 @@ declare module "events" {
|
|
|
97
94
|
export const staticCommandMethodInvoking: DotvvmEvent<DotvvmStaticCommandMethodInvokingEventArgs>;
|
|
98
95
|
export const staticCommandMethodInvoked: DotvvmEvent<DotvvmStaticCommandMethodInvokedEventArgs>;
|
|
99
96
|
export const staticCommandMethodFailed: DotvvmEvent<DotvvmStaticCommandMethodFailedEventArgs>;
|
|
100
|
-
export const newState: DotvvmEvent<
|
|
97
|
+
export const newState: DotvvmEvent<RootViewModel>;
|
|
101
98
|
}
|
|
102
99
|
declare module "metadata/primitiveTypes" {
|
|
103
100
|
type PrimitiveTypes = {
|
|
@@ -123,10 +120,58 @@ declare module "postback/updater" {
|
|
|
123
120
|
export function patchViewModel(source: any, patch: any): any;
|
|
124
121
|
export function diffViewModel(source: any, modified: any): any;
|
|
125
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
|
+
}
|
|
126
171
|
declare module "state-manager" {
|
|
127
172
|
import { DotvvmEvent } from "events";
|
|
128
173
|
export const currentStateSymbol: unique symbol;
|
|
129
|
-
const notifySymbol: unique symbol;
|
|
174
|
+
export const notifySymbol: unique symbol;
|
|
130
175
|
export const lastSetErrorSymbol: unique symbol;
|
|
131
176
|
const updateSymbol: unique symbol;
|
|
132
177
|
export function getIsViewModelUpdating(): boolean;
|
|
@@ -148,7 +193,6 @@ declare module "state-manager" {
|
|
|
148
193
|
constructor(initialState: DeepReadonly<TViewModel>, stateUpdateEvent: DotvvmEvent<DeepReadonly<TViewModel>>);
|
|
149
194
|
dispatchUpdate(): void;
|
|
150
195
|
doUpdateNow(): void;
|
|
151
|
-
private startTime;
|
|
152
196
|
private rerender;
|
|
153
197
|
setState(newState: DeepReadonly<TViewModel>): DeepReadonly<TViewModel>;
|
|
154
198
|
patchState(patch: Partial<TViewModel>): DeepReadonly<TViewModel>;
|
|
@@ -156,6 +200,14 @@ declare module "state-manager" {
|
|
|
156
200
|
}
|
|
157
201
|
export function unmapKnockoutObservables(viewModel: any): any;
|
|
158
202
|
}
|
|
203
|
+
declare module "serialization/deserialize" {
|
|
204
|
+
export function deserialize(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
205
|
+
export function deserializePrimitive(viewModel: any, target?: any): any;
|
|
206
|
+
export function deserializeDate(viewModel: any, target?: any): any;
|
|
207
|
+
export function deserializeArray(viewModel: any, target?: any, deserializeAll?: boolean): any;
|
|
208
|
+
export function deserializeObject(viewModel: any, target: any, deserializeAll: boolean): any;
|
|
209
|
+
export function extendToObservableArrayIfRequired(observable: any): any;
|
|
210
|
+
}
|
|
159
211
|
declare module "serialization/serialize" {
|
|
160
212
|
interface ISerializationOptions {
|
|
161
213
|
serializeAll?: boolean;
|
|
@@ -177,25 +229,6 @@ declare module "postback/resourceLoader" {
|
|
|
177
229
|
export function loadResourceList(resources: RenderedResourceList | undefined): Promise<void>;
|
|
178
230
|
export function notifyModuleLoaded(id: number): void;
|
|
179
231
|
}
|
|
180
|
-
declare module "validation/common" {
|
|
181
|
-
export type DotvvmValidationContext = {
|
|
182
|
-
readonly valueToValidate: any;
|
|
183
|
-
readonly parentViewModel: any;
|
|
184
|
-
readonly parameters: any[];
|
|
185
|
-
};
|
|
186
|
-
export type DotvvmValidationObservableMetadata = DotvvmValidationElementMetadata[];
|
|
187
|
-
export type DotvvmValidationElementMetadata = {
|
|
188
|
-
element: HTMLElement;
|
|
189
|
-
dataType: string;
|
|
190
|
-
format: string;
|
|
191
|
-
domNodeDisposal: boolean;
|
|
192
|
-
elementValidationState: boolean;
|
|
193
|
-
};
|
|
194
|
-
export const ErrorsPropertyName = "validationErrors";
|
|
195
|
-
/** Checks if the value is null, undefined or a whitespace only string */
|
|
196
|
-
export function isEmpty(value: any): boolean;
|
|
197
|
-
export function getValidationMetadata(property: KnockoutObservable<any>): DotvvmValidationObservableMetadata;
|
|
198
|
-
}
|
|
199
232
|
declare module "binding-handlers/textbox-text" {
|
|
200
233
|
const _default: {
|
|
201
234
|
"dotvvm-textbox-text": {
|
|
@@ -233,13 +266,47 @@ declare module "binding-handlers/SSR-foreach" {
|
|
|
233
266
|
};
|
|
234
267
|
export default _default_2;
|
|
235
268
|
}
|
|
236
|
-
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;
|
|
237
299
|
const _default_3: {
|
|
238
300
|
'dotvvm-with-control-properties': {
|
|
239
301
|
init: (element: HTMLElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => {
|
|
240
302
|
controlsDescendantBindings: boolean;
|
|
241
303
|
};
|
|
242
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
|
+
};
|
|
243
310
|
};
|
|
244
311
|
export default _default_3;
|
|
245
312
|
}
|
|
@@ -265,11 +332,11 @@ declare module "binding-handlers/checkbox" {
|
|
|
265
332
|
'dotvvm-checkbox-updateAfterPostback': {
|
|
266
333
|
init(element: HTMLElement, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined): void;
|
|
267
334
|
};
|
|
268
|
-
'dotvvm-checked-pointer': {
|
|
269
|
-
init(): void;
|
|
270
|
-
};
|
|
335
|
+
'dotvvm-checked-pointer': {};
|
|
271
336
|
"dotvvm-CheckState": {
|
|
272
|
-
init(element:
|
|
337
|
+
init: ((element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => void | {
|
|
338
|
+
controlsDescendantBindings: boolean;
|
|
339
|
+
}) | undefined;
|
|
273
340
|
update(element: any, valueAccessor: () => any): void;
|
|
274
341
|
};
|
|
275
342
|
"dotvvm-checkedItems": {
|
|
@@ -317,35 +384,9 @@ declare module "binding-handlers/gridviewdataset" {
|
|
|
317
384
|
};
|
|
318
385
|
export default _default_8;
|
|
319
386
|
}
|
|
320
|
-
declare module "
|
|
321
|
-
type ModuleCommand = (...args: any) => Promise<unknown>;
|
|
322
|
-
export const viewModulesSymbol: unique symbol;
|
|
323
|
-
export function registerViewModule(name: string, moduleObject: any): void;
|
|
324
|
-
export function registerViewModules(modules: {
|
|
325
|
-
[name: string]: any;
|
|
326
|
-
}): void;
|
|
327
|
-
export function initViewModule(name: string, viewIdOrElement: string | HTMLElement, rootElement: HTMLElement): ModuleContext;
|
|
328
|
-
export function callViewModuleCommand(viewIdOrElement: string | HTMLElement, commandName: string, args: any[]): any;
|
|
329
|
-
export function registerNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string, command: ModuleCommand, rootElement: HTMLElement): void;
|
|
330
|
-
export function unregisterNamedCommand(viewIdOrElement: string | HTMLElement, commandName: string): void;
|
|
331
|
-
export class ModuleContext {
|
|
332
|
-
readonly moduleName: string;
|
|
333
|
-
readonly elements: HTMLElement[];
|
|
334
|
-
readonly properties: {
|
|
335
|
-
[name: string]: any;
|
|
336
|
-
};
|
|
337
|
-
private readonly namedCommands;
|
|
338
|
-
module: any;
|
|
339
|
-
constructor(moduleName: string, elements: HTMLElement[], properties: {
|
|
340
|
-
[name: string]: any;
|
|
341
|
-
});
|
|
342
|
-
registerNamedCommand: (name: string, command: (...args: any[]) => Promise<any>) => void;
|
|
343
|
-
unregisterNamedCommand: (name: string) => void;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
declare module "binding-handlers/with-view-modules" {
|
|
387
|
+
declare module "binding-handlers/named-command" {
|
|
347
388
|
const _default_9: {
|
|
348
|
-
'dotvvm-
|
|
389
|
+
'dotvvm-named-command': {
|
|
349
390
|
init: (element: HTMLElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => {
|
|
350
391
|
controlsDescendantBindings: boolean;
|
|
351
392
|
};
|
|
@@ -353,20 +394,18 @@ declare module "binding-handlers/with-view-modules" {
|
|
|
353
394
|
};
|
|
354
395
|
export default _default_9;
|
|
355
396
|
}
|
|
356
|
-
declare module "binding-handlers/
|
|
397
|
+
declare module "binding-handlers/file-upload" {
|
|
357
398
|
const _default_10: {
|
|
358
|
-
|
|
359
|
-
init: (element:
|
|
360
|
-
controlsDescendantBindings: boolean;
|
|
361
|
-
};
|
|
399
|
+
"dotvvm-FileUpload": {
|
|
400
|
+
init: (element: HTMLInputElement, valueAccessor: () => any, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext | undefined) => void;
|
|
362
401
|
};
|
|
363
402
|
};
|
|
364
403
|
export default _default_10;
|
|
365
404
|
}
|
|
366
|
-
declare module "binding-handlers/
|
|
405
|
+
declare module "binding-handlers/js-component" {
|
|
367
406
|
const _default_11: {
|
|
368
|
-
"dotvvm-
|
|
369
|
-
init
|
|
407
|
+
"dotvvm-js-component": {
|
|
408
|
+
init(element: HTMLInputElement, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor | undefined): void;
|
|
370
409
|
};
|
|
371
410
|
};
|
|
372
411
|
export default _default_11;
|
|
@@ -386,7 +425,7 @@ declare module "spa/events" {
|
|
|
386
425
|
}
|
|
387
426
|
declare module "dotvvm-base" {
|
|
388
427
|
import { StateManager } from "state-manager";
|
|
389
|
-
export function getViewModel():
|
|
428
|
+
export function getViewModel(): DeepKnockoutObservableObject<RootViewModel>;
|
|
390
429
|
export function getViewModelCacheId(): string | undefined;
|
|
391
430
|
export function getViewModelCache(): any;
|
|
392
431
|
export function getViewModelObservable(): DeepKnockoutObservable<RootViewModel>;
|
|
@@ -409,17 +448,14 @@ declare module "DotVVM.Globalize" {
|
|
|
409
448
|
export function parseNumber(value: string): number;
|
|
410
449
|
export function parseDate(value: string, format: string, previousValue?: Date): Date | null;
|
|
411
450
|
export const parseDotvvmDate: typeof serializationParseDate;
|
|
412
|
-
export function bindingDateToString(value: KnockoutObservable<string | Date> | string | Date, format?: string):
|
|
413
|
-
export function bindingNumberToString(value: KnockoutObservable<string | number> | string | number, format?: string):
|
|
414
|
-
}
|
|
415
|
-
declare module "DotVVM.Polyfills" {
|
|
416
|
-
export default function (): void;
|
|
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>;
|
|
417
453
|
}
|
|
418
454
|
declare var compileConstants: {
|
|
419
455
|
/** If the compiled bundle is for SPA applications */
|
|
420
456
|
isSpa: boolean;
|
|
421
|
-
/** If the compiled bundle is
|
|
422
|
-
|
|
457
|
+
/** If the compiled bundle is unminified */
|
|
458
|
+
debug: boolean;
|
|
423
459
|
};
|
|
424
460
|
declare module "utils/uri" {
|
|
425
461
|
export function removeVirtualDirectoryFromUrl(url: string): string;
|
|
@@ -452,12 +488,6 @@ declare module "postback/redirect" {
|
|
|
452
488
|
export function performRedirect(url: string, replace: boolean, allowSpa: boolean): Promise<any>;
|
|
453
489
|
export function handleRedirect(options: PostbackOptions, resultObject: any, response: Response, replace?: boolean): Promise<DotvvmRedirectEventArgs>;
|
|
454
490
|
}
|
|
455
|
-
declare module "utils/evaluator" {
|
|
456
|
-
export function evaluateOnViewModel(context: any, expression: string): any;
|
|
457
|
-
export function getDataSourceItems(viewModel: any): Array<KnockoutObservable<any>>;
|
|
458
|
-
export function wrapObservable(func: () => any, isArray?: boolean): KnockoutComputed<any>;
|
|
459
|
-
export const unwrapComputedProperty: (obs: any) => any;
|
|
460
|
-
}
|
|
461
491
|
declare module "postback/gate" {
|
|
462
492
|
export function isPostbackDisabled(postbackId: number): boolean;
|
|
463
493
|
export function enablePostbacks(): void;
|
|
@@ -480,18 +510,6 @@ declare module "validation/validators" {
|
|
|
480
510
|
};
|
|
481
511
|
export const validators: DotvvmValidatorSet;
|
|
482
512
|
}
|
|
483
|
-
declare module "validation/error" {
|
|
484
|
-
export const allErrors: ValidationError[];
|
|
485
|
-
export function detachAllErrors(): void;
|
|
486
|
-
export function getErrors<T>(o: KnockoutObservable<T> | null): ValidationError[];
|
|
487
|
-
export class ValidationError {
|
|
488
|
-
errorMessage: string;
|
|
489
|
-
validatedObservable: KnockoutObservable<any>;
|
|
490
|
-
private constructor();
|
|
491
|
-
static attach(errorMessage: string, observable: KnockoutObservable<any>): ValidationError;
|
|
492
|
-
detach(): void;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
513
|
declare module "postback/internal-handlers" {
|
|
496
514
|
export const isPostbackRunning: KnockoutObservable<boolean>;
|
|
497
515
|
export const suppressOnDisabledElementHandler: DotvvmPostbackHandler;
|
|
@@ -564,7 +582,7 @@ declare module "validation/validation" {
|
|
|
564
582
|
/**
|
|
565
583
|
* Adds validation errors from the server to the appropriate arrays
|
|
566
584
|
*/
|
|
567
|
-
export function showValidationErrorsFromServer(
|
|
585
|
+
export function showValidationErrorsFromServer(serverResponseObject: any, options: PostbackOptions): void;
|
|
568
586
|
}
|
|
569
587
|
declare module "postback/postbackCore" {
|
|
570
588
|
export function throwIfAborted(options: PostbackOptions): void;
|
|
@@ -574,7 +592,7 @@ declare module "postback/postbackCore" {
|
|
|
574
592
|
declare module "postback/postback" {
|
|
575
593
|
export function postBack(sender: HTMLElement, path: string[], command: string, controlUniqueId: string, context?: any, handlers?: ClientFriendlyPostbackHandlerConfiguration[], commandArgs?: any[], abortSignal?: AbortSignal): Promise<DotvvmAfterPostBackEventArgs>;
|
|
576
594
|
type MaybePromise<T> = Promise<T> | T;
|
|
577
|
-
export function applyPostbackHandlers(next: (options: PostbackOptions) => MaybePromise<PostbackCommitFunction | any>, sender: HTMLElement, handlerConfigurations?: ClientFriendlyPostbackHandlerConfiguration[], args?: any[], context?: any,
|
|
595
|
+
export function applyPostbackHandlers(next: (options: PostbackOptions) => MaybePromise<PostbackCommitFunction | any>, sender: HTMLElement, handlerConfigurations?: ClientFriendlyPostbackHandlerConfiguration[], args?: any[], context?: any, abortSignal?: AbortSignal): Promise<DotvvmAfterPostBackEventArgs>;
|
|
578
596
|
export function isPostbackHandler(obj: any): obj is DotvvmPostbackHandler;
|
|
579
597
|
export function sortHandlers(handlers: DotvvmPostbackHandler[]): DotvvmPostbackHandler[];
|
|
580
598
|
}
|
|
@@ -593,7 +611,7 @@ declare module "binding-handlers/register" {
|
|
|
593
611
|
export default _default_12;
|
|
594
612
|
}
|
|
595
613
|
declare module "postback/staticCommand" {
|
|
596
|
-
export function staticCommandPostback(
|
|
614
|
+
export function staticCommandPostback(command: string, args: any[], options: PostbackOptions): Promise<any>;
|
|
597
615
|
}
|
|
598
616
|
declare module "controls/routeLink" {
|
|
599
617
|
export function buildRouteUrl(routePath: string, params: any): string;
|
|
@@ -627,7 +645,7 @@ declare module "collections/sortingHelper" {
|
|
|
627
645
|
}
|
|
628
646
|
declare module "collections/arrayHelper" {
|
|
629
647
|
import { orderBy, orderByDesc } from "collections/sortingHelper";
|
|
630
|
-
export { add, addOrUpdate, addRange, clear, distinct, firstOrDefault, insert, insertRange, lastOrDefault, max, min, orderBy, orderByDesc, removeAll, removeAt, removeFirst, removeLast, removeRange, reverse };
|
|
648
|
+
export { add, addOrUpdate, addRange, clear, distinct, firstOrDefault, insert, insertRange, lastOrDefault, max, min, orderBy, orderByDesc, removeAll, removeAt, removeFirst, removeLast, removeRange, reverse, setItem };
|
|
631
649
|
function add<T>(observable: any, element: T): void;
|
|
632
650
|
function addOrUpdate<T>(observable: any, element: T, matcher: (e: T) => boolean, updater: (e: T) => T): void;
|
|
633
651
|
function addRange<T>(observable: any, elements: T[]): void;
|
|
@@ -645,6 +663,7 @@ declare module "collections/arrayHelper" {
|
|
|
645
663
|
function removeFirst<T>(observable: any, predicate: (s: T) => boolean): void;
|
|
646
664
|
function removeLast<T>(observable: any, predicate: (s: T) => boolean): void;
|
|
647
665
|
function reverse<T>(observable: any): void;
|
|
666
|
+
function setItem<T>(observable: any, index: number, value: T): void;
|
|
648
667
|
}
|
|
649
668
|
declare module "collections/dictionaryHelper" {
|
|
650
669
|
type Dictionary<Key, Value> = {
|
|
@@ -658,8 +677,19 @@ declare module "collections/dictionaryHelper" {
|
|
|
658
677
|
export function setItem<Key, Value>(observable: any, identifier: Key, value: Value): void;
|
|
659
678
|
}
|
|
660
679
|
declare module "utils/stringHelper" {
|
|
661
|
-
export function
|
|
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[];
|
|
662
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>;
|
|
663
693
|
}
|
|
664
694
|
declare module "dotvvm-root" {
|
|
665
695
|
import { getCulture } from "dotvvm-base";
|
|
@@ -683,6 +713,7 @@ declare module "dotvvm-root" {
|
|
|
683
713
|
import { notifyModuleLoaded } from "postback/resourceLoader";
|
|
684
714
|
import { logError, logWarning, logInfo, logInfoVerbose, logPostBackScriptError } from "utils/logging";
|
|
685
715
|
import * as metadataHelper from "metadata/metadataHelper";
|
|
716
|
+
import { StateManager } from "state-manager";
|
|
686
717
|
function init(culture: string): void;
|
|
687
718
|
const dotvvmExports: {
|
|
688
719
|
getCulture: typeof getCulture;
|
|
@@ -722,17 +753,18 @@ declare module "dotvvm-root" {
|
|
|
722
753
|
};
|
|
723
754
|
postBack: typeof postBack;
|
|
724
755
|
init: typeof init;
|
|
756
|
+
registerGlobalComponent: typeof viewModuleManager.registerGlobalComponent;
|
|
725
757
|
isPostbackRunning: KnockoutObservable<boolean>;
|
|
726
758
|
events: Partial<typeof spaEvents> & typeof events;
|
|
727
759
|
viewModels: {
|
|
728
760
|
root: {
|
|
729
|
-
readonly viewModel:
|
|
761
|
+
readonly viewModel: DeepKnockoutObservableObject<RootViewModel>;
|
|
730
762
|
};
|
|
731
763
|
};
|
|
732
|
-
readonly state: Readonly<
|
|
764
|
+
readonly state: Readonly<RootViewModel>;
|
|
733
765
|
patchState(a: any): void;
|
|
734
766
|
viewModelObservables: {
|
|
735
|
-
readonly root: KnockoutObservable<
|
|
767
|
+
readonly root: KnockoutObservable<DeepKnockoutObservableObject<RootViewModel>>;
|
|
736
768
|
};
|
|
737
769
|
serialization: {
|
|
738
770
|
serialize: typeof serialize;
|
|
@@ -764,9 +796,12 @@ declare module "dotvvm-root" {
|
|
|
764
796
|
level: "normal" | "verbose";
|
|
765
797
|
};
|
|
766
798
|
translations: any;
|
|
799
|
+
StateManager: typeof StateManager;
|
|
800
|
+
DotvvmEvent: typeof events.DotvvmEvent;
|
|
767
801
|
};
|
|
768
802
|
global {
|
|
769
803
|
const dotvvm: typeof dotvvmExports & {
|
|
804
|
+
debug?: true;
|
|
770
805
|
isSpaReady?: typeof isSpaReady;
|
|
771
806
|
handleSpaNavigation?: typeof handleSpaNavigation;
|
|
772
807
|
};
|
|
@@ -776,7 +811,7 @@ declare module "dotvvm-root" {
|
|
|
776
811
|
}
|
|
777
812
|
export default dotvvmExports;
|
|
778
813
|
}
|
|
779
|
-
declare type PostbackCommitFunction = (
|
|
814
|
+
declare type PostbackCommitFunction = () => Promise<DotvvmAfterPostBackEventArgs>;
|
|
780
815
|
declare type DotvvmPostbackHandler = {
|
|
781
816
|
execute(next: () => Promise<PostbackCommitFunction>, options: PostbackOptions): Promise<PostbackCommitFunction>;
|
|
782
817
|
name?: string;
|
|
@@ -786,7 +821,7 @@ declare type DotvvmPostbackHandler = {
|
|
|
786
821
|
declare type DotvvmPostbackErrorLike = {
|
|
787
822
|
readonly reason: DotvvmPostbackErrorReason;
|
|
788
823
|
};
|
|
789
|
-
declare type DotvvmPostbackErrorReason = {
|
|
824
|
+
declare type DotvvmPostbackErrorReason = ({
|
|
790
825
|
type: 'handler';
|
|
791
826
|
handlerName: string;
|
|
792
827
|
message?: string;
|
|
@@ -813,7 +848,11 @@ declare type DotvvmPostbackErrorReason = {
|
|
|
813
848
|
response?: Response;
|
|
814
849
|
} | {
|
|
815
850
|
type: 'abort';
|
|
816
|
-
}
|
|
851
|
+
} | {
|
|
852
|
+
type: 'redirect';
|
|
853
|
+
responseObject: any;
|
|
854
|
+
response?: Response;
|
|
855
|
+
}) & {
|
|
817
856
|
options?: PostbackOptions;
|
|
818
857
|
};
|
|
819
858
|
declare type PostbackCommandType = "postback" | "staticCommand" | "spaNavigation";
|
|
@@ -823,6 +862,7 @@ declare type PostbackOptions = {
|
|
|
823
862
|
readonly args: any[];
|
|
824
863
|
readonly sender?: HTMLElement;
|
|
825
864
|
readonly viewModel?: any;
|
|
865
|
+
readonly knockoutContext?: any;
|
|
826
866
|
serverResponseObject?: any;
|
|
827
867
|
validationTargetPath?: string;
|
|
828
868
|
abortSignal?: AbortSignal;
|
|
@@ -974,7 +1014,8 @@ declare type DotvvmObservable<T> = DeepKnockoutObservable<T> & {
|
|
|
974
1014
|
declare type RootViewModel = {
|
|
975
1015
|
$type: string;
|
|
976
1016
|
$csrfToken?: string;
|
|
977
|
-
|
|
1017
|
+
[name: string]: any;
|
|
1018
|
+
};
|
|
978
1019
|
declare type TypeMap = {
|
|
979
1020
|
[typeId: string]: TypeMetadata;
|
|
980
1021
|
};
|
|
@@ -1040,3 +1081,29 @@ declare type DotvvmFileSize = {
|
|
|
1040
1081
|
Bytes: KnockoutObservable<number>;
|
|
1041
1082
|
FormattedText: KnockoutObservable<string>;
|
|
1042
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;
|
|
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
|
}
|