dotvvm-types 3.0.2 → 4.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +266 -126
- package/package.json +1 -4
- package/dotvvm-types-3.0.2.tgz +0 -0
package/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -94,7 +91,7 @@ declare module "events" {
|
|
|
94
91
|
export const postbackCommitInvoked: DotvvmEvent<DotvvmPostbackCommitInvokedEventArgs>;
|
|
95
92
|
export const postbackViewModelUpdated: DotvvmEvent<DotvvmPostbackViewModelUpdatedEventArgs>;
|
|
96
93
|
export const postbackRejected: DotvvmEvent<DotvvmPostbackRejectedEventArgs>;
|
|
97
|
-
export const staticCommandMethodInvoking: DotvvmEvent<
|
|
94
|
+
export const staticCommandMethodInvoking: DotvvmEvent<DotvvmStaticCommandMethodInvokingEventArgs>;
|
|
98
95
|
export const staticCommandMethodInvoked: DotvvmEvent<DotvvmStaticCommandMethodInvokedEventArgs>;
|
|
99
96
|
export const staticCommandMethodFailed: DotvvmEvent<DotvvmStaticCommandMethodFailedEventArgs>;
|
|
100
97
|
export const newState: DotvvmEvent<RootViewModel>;
|
|
@@ -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,16 +394,22 @@ 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
|
}
|
|
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
|
+
}
|
|
366
413
|
declare module "binding-handlers/all-handlers" {
|
|
367
414
|
type KnockoutHandlerDictionary = {
|
|
368
415
|
[name: string]: KnockoutBindingHandler;
|
|
@@ -394,23 +441,21 @@ declare module "dotvvm-base" {
|
|
|
394
441
|
export function initBindings(): void;
|
|
395
442
|
}
|
|
396
443
|
declare module "DotVVM.Globalize" {
|
|
444
|
+
import { parseDate as serializationParseDate } from "serialization/date";
|
|
397
445
|
export function format(format: string, ...values: any[]): string;
|
|
398
446
|
type GlobalizeFormattable = null | undefined | string | Date | number;
|
|
399
447
|
export function formatString(format: string | null | undefined, value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>): string;
|
|
400
448
|
export function parseNumber(value: string): number;
|
|
401
449
|
export function parseDate(value: string, format: string, previousValue?: Date): Date | null;
|
|
402
|
-
export const parseDotvvmDate: typeof
|
|
403
|
-
export function bindingDateToString(value: KnockoutObservable<string | Date> | string | Date, format?: string):
|
|
404
|
-
export function bindingNumberToString(value: KnockoutObservable<string | number> | string | number, format?: string):
|
|
405
|
-
}
|
|
406
|
-
declare module "DotVVM.Polyfills" {
|
|
407
|
-
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>;
|
|
408
453
|
}
|
|
409
454
|
declare var compileConstants: {
|
|
410
455
|
/** If the compiled bundle is for SPA applications */
|
|
411
456
|
isSpa: boolean;
|
|
412
|
-
/** If the compiled bundle is
|
|
413
|
-
|
|
457
|
+
/** If the compiled bundle is unminified */
|
|
458
|
+
debug: boolean;
|
|
414
459
|
};
|
|
415
460
|
declare module "utils/uri" {
|
|
416
461
|
export function removeVirtualDirectoryFromUrl(url: string): string;
|
|
@@ -423,14 +468,14 @@ declare module "postback/http" {
|
|
|
423
468
|
readonly result: T;
|
|
424
469
|
readonly response?: Response;
|
|
425
470
|
};
|
|
426
|
-
export function getJSON<T>(url: string, spaPlaceHolderUniqueId?: string, additionalHeaders?: {
|
|
471
|
+
export function getJSON<T>(url: string, spaPlaceHolderUniqueId?: string, signal?: AbortSignal, additionalHeaders?: {
|
|
427
472
|
[key: string]: string;
|
|
428
473
|
}): Promise<WrappedResponse<T>>;
|
|
429
|
-
export function postJSON<T>(url: string, postData: any, additionalHeaders?: {
|
|
474
|
+
export function postJSON<T>(url: string, postData: any, signal: AbortSignal | undefined, additionalHeaders?: {
|
|
430
475
|
[key: string]: string;
|
|
431
476
|
}): Promise<WrappedResponse<T>>;
|
|
432
477
|
export function fetchJson<T>(url: string, init: RequestInit): Promise<WrappedResponse<T>>;
|
|
433
|
-
export function fetchCsrfToken(): Promise<string>;
|
|
478
|
+
export function fetchCsrfToken(signal: AbortSignal | undefined): Promise<string>;
|
|
434
479
|
export function retryOnInvalidCsrfToken<TResult>(postbackFunction: () => Promise<TResult>, iteration?: number, customErrorHandler?: () => void): Promise<TResult>;
|
|
435
480
|
}
|
|
436
481
|
declare module "postback/counter" {
|
|
@@ -443,12 +488,6 @@ declare module "postback/redirect" {
|
|
|
443
488
|
export function performRedirect(url: string, replace: boolean, allowSpa: boolean): Promise<any>;
|
|
444
489
|
export function handleRedirect(options: PostbackOptions, resultObject: any, response: Response, replace?: boolean): Promise<DotvvmRedirectEventArgs>;
|
|
445
490
|
}
|
|
446
|
-
declare module "utils/evaluator" {
|
|
447
|
-
export function evaluateOnViewModel(context: any, expression: string): any;
|
|
448
|
-
export function getDataSourceItems(viewModel: any): Array<KnockoutObservable<any>>;
|
|
449
|
-
export function wrapObservable(func: () => any, isArray?: boolean): KnockoutComputed<any>;
|
|
450
|
-
export const unwrapComputedProperty: (obs: any) => any;
|
|
451
|
-
}
|
|
452
491
|
declare module "postback/gate" {
|
|
453
492
|
export function isPostbackDisabled(postbackId: number): boolean;
|
|
454
493
|
export function enablePostbacks(): void;
|
|
@@ -471,18 +510,6 @@ declare module "validation/validators" {
|
|
|
471
510
|
};
|
|
472
511
|
export const validators: DotvvmValidatorSet;
|
|
473
512
|
}
|
|
474
|
-
declare module "validation/error" {
|
|
475
|
-
export const allErrors: ValidationError[];
|
|
476
|
-
export function detachAllErrors(): void;
|
|
477
|
-
export function getErrors<T>(o: KnockoutObservable<T> | null): ValidationError[];
|
|
478
|
-
export class ValidationError {
|
|
479
|
-
errorMessage: string;
|
|
480
|
-
validatedObservable: KnockoutObservable<any>;
|
|
481
|
-
private constructor();
|
|
482
|
-
static attach(errorMessage: string, observable: KnockoutObservable<any>): ValidationError;
|
|
483
|
-
detach(): void;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
513
|
declare module "postback/internal-handlers" {
|
|
487
514
|
export const isPostbackRunning: KnockoutObservable<boolean>;
|
|
488
515
|
export const suppressOnDisabledElementHandler: DotvvmPostbackHandler;
|
|
@@ -555,16 +582,17 @@ declare module "validation/validation" {
|
|
|
555
582
|
/**
|
|
556
583
|
* Adds validation errors from the server to the appropriate arrays
|
|
557
584
|
*/
|
|
558
|
-
export function showValidationErrorsFromServer(
|
|
585
|
+
export function showValidationErrorsFromServer(serverResponseObject: any, options: PostbackOptions): void;
|
|
559
586
|
}
|
|
560
587
|
declare module "postback/postbackCore" {
|
|
588
|
+
export function throwIfAborted(options: PostbackOptions): void;
|
|
561
589
|
export function getLastStartedPostbackId(): number;
|
|
562
590
|
export function postbackCore(options: PostbackOptions, path: string[], command: string, controlUniqueId: string, context: any, commandArgs?: any[]): Promise<PostbackCommitFunction>;
|
|
563
591
|
}
|
|
564
592
|
declare module "postback/postback" {
|
|
565
|
-
export function postBack(sender: HTMLElement, path: string[], command: string, controlUniqueId: string, context?: any, handlers?: ClientFriendlyPostbackHandlerConfiguration[], commandArgs?: any[]): Promise<DotvvmAfterPostBackEventArgs>;
|
|
593
|
+
export function postBack(sender: HTMLElement, path: string[], command: string, controlUniqueId: string, context?: any, handlers?: ClientFriendlyPostbackHandlerConfiguration[], commandArgs?: any[], abortSignal?: AbortSignal): Promise<DotvvmAfterPostBackEventArgs>;
|
|
566
594
|
type MaybePromise<T> = Promise<T> | T;
|
|
567
|
-
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>;
|
|
568
596
|
export function isPostbackHandler(obj: any): obj is DotvvmPostbackHandler;
|
|
569
597
|
export function sortHandlers(handlers: DotvvmPostbackHandler[]): DotvvmPostbackHandler[];
|
|
570
598
|
}
|
|
@@ -579,11 +607,11 @@ declare module "spa/spa" {
|
|
|
579
607
|
export function handleSpaNavigationCore(url: string | null, sender?: HTMLElement, handlePageNavigating?: (url: string) => void): Promise<DotvvmNavigationEventArgs>;
|
|
580
608
|
}
|
|
581
609
|
declare module "binding-handlers/register" {
|
|
582
|
-
const
|
|
583
|
-
export default
|
|
610
|
+
const _default_12: () => void;
|
|
611
|
+
export default _default_12;
|
|
584
612
|
}
|
|
585
613
|
declare module "postback/staticCommand" {
|
|
586
|
-
export function staticCommandPostback(
|
|
614
|
+
export function staticCommandPostback(command: string, args: any[], options: PostbackOptions): Promise<any>;
|
|
587
615
|
}
|
|
588
616
|
declare module "controls/routeLink" {
|
|
589
617
|
export function buildRouteUrl(routePath: string, params: any): string;
|
|
@@ -591,20 +619,7 @@ declare module "controls/routeLink" {
|
|
|
591
619
|
}
|
|
592
620
|
declare module "controls/fileUpload" {
|
|
593
621
|
export function showUploadDialog(sender: HTMLElement): void;
|
|
594
|
-
export function
|
|
595
|
-
export function reportProgress(targetControlId: any, isBusy: boolean, progress: number, result: DotvvmStaticCommandResponse<DotvvmFileUploadData[]> | string): void;
|
|
596
|
-
type DotvvmFileUploadData = {
|
|
597
|
-
FileId: KnockoutObservable<string>;
|
|
598
|
-
FileName: KnockoutObservable<string>;
|
|
599
|
-
FileSize: KnockoutObservable<DotvvmFileSize>;
|
|
600
|
-
IsFileTypeAllowed: KnockoutObservable<boolean>;
|
|
601
|
-
IsMaxSizeExceeded: KnockoutObservable<boolean>;
|
|
602
|
-
IsAllowed: KnockoutObservable<boolean>;
|
|
603
|
-
};
|
|
604
|
-
type DotvvmFileSize = {
|
|
605
|
-
Bytes: KnockoutObservable<number>;
|
|
606
|
-
FormattedText: KnockoutObservable<string>;
|
|
607
|
-
};
|
|
622
|
+
export function reportProgress(inputControl: HTMLInputElement, isBusy: boolean, progress: number, result: DotvvmStaticCommandResponse<DotvvmFileUploadData[]> | string): void;
|
|
608
623
|
}
|
|
609
624
|
declare module "api/eventHub" {
|
|
610
625
|
export function notify(id: string): void;
|
|
@@ -617,6 +632,65 @@ declare module "api/api" {
|
|
|
617
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>;
|
|
618
633
|
export function refreshOn<T>(value: ApiComputed<T>, watch: KnockoutObservable<any>): ApiComputed<T>;
|
|
619
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
|
+
}
|
|
620
694
|
declare module "dotvvm-root" {
|
|
621
695
|
import { getCulture } from "dotvvm-base";
|
|
622
696
|
import * as events from "events";
|
|
@@ -638,6 +712,8 @@ declare module "dotvvm-root" {
|
|
|
638
712
|
import * as viewModuleManager from "viewModules/viewModuleManager";
|
|
639
713
|
import { notifyModuleLoaded } from "postback/resourceLoader";
|
|
640
714
|
import { logError, logWarning, logInfo, logInfoVerbose, logPostBackScriptError } from "utils/logging";
|
|
715
|
+
import * as metadataHelper from "metadata/metadataHelper";
|
|
716
|
+
import { StateManager } from "state-manager";
|
|
641
717
|
function init(culture: string): void;
|
|
642
718
|
const dotvvmExports: {
|
|
643
719
|
getCulture: typeof getCulture;
|
|
@@ -648,7 +724,6 @@ declare module "dotvvm-root" {
|
|
|
648
724
|
fileUpload: {
|
|
649
725
|
reportProgress: typeof fileUpload.reportProgress;
|
|
650
726
|
showUploadDialog: typeof fileUpload.showUploadDialog;
|
|
651
|
-
createUploadId: typeof fileUpload.createUploadId;
|
|
652
727
|
};
|
|
653
728
|
api: {
|
|
654
729
|
invoke: typeof api.invoke;
|
|
@@ -678,6 +753,7 @@ declare module "dotvvm-root" {
|
|
|
678
753
|
};
|
|
679
754
|
postBack: typeof postBack;
|
|
680
755
|
init: typeof init;
|
|
756
|
+
registerGlobalComponent: typeof viewModuleManager.registerGlobalComponent;
|
|
681
757
|
isPostbackRunning: KnockoutObservable<boolean>;
|
|
682
758
|
events: Partial<typeof spaEvents> & typeof events;
|
|
683
759
|
viewModels: {
|
|
@@ -696,6 +772,12 @@ declare module "dotvvm-root" {
|
|
|
696
772
|
parseDate: typeof parseDate;
|
|
697
773
|
deserialize: typeof deserialize;
|
|
698
774
|
};
|
|
775
|
+
metadata: {
|
|
776
|
+
getTypeId: typeof metadataHelper.getTypeId;
|
|
777
|
+
getTypeMetadata: typeof metadataHelper.getTypeMetadata;
|
|
778
|
+
getEnumMetadata: typeof metadataHelper.getEnumMetadata;
|
|
779
|
+
getEnumValue: typeof metadataHelper.getEnumValue;
|
|
780
|
+
};
|
|
699
781
|
viewModules: {
|
|
700
782
|
registerOne: typeof viewModuleManager.registerViewModule;
|
|
701
783
|
init: typeof viewModuleManager.initViewModule;
|
|
@@ -713,9 +795,13 @@ declare module "dotvvm-root" {
|
|
|
713
795
|
logPostBackScriptError: typeof logPostBackScriptError;
|
|
714
796
|
level: "normal" | "verbose";
|
|
715
797
|
};
|
|
798
|
+
translations: any;
|
|
799
|
+
StateManager: typeof StateManager;
|
|
800
|
+
DotvvmEvent: typeof events.DotvvmEvent;
|
|
716
801
|
};
|
|
717
802
|
global {
|
|
718
803
|
const dotvvm: typeof dotvvmExports & {
|
|
804
|
+
debug?: true;
|
|
719
805
|
isSpaReady?: typeof isSpaReady;
|
|
720
806
|
handleSpaNavigation?: typeof handleSpaNavigation;
|
|
721
807
|
};
|
|
@@ -725,7 +811,7 @@ declare module "dotvvm-root" {
|
|
|
725
811
|
}
|
|
726
812
|
export default dotvvmExports;
|
|
727
813
|
}
|
|
728
|
-
declare type PostbackCommitFunction = (
|
|
814
|
+
declare type PostbackCommitFunction = () => Promise<DotvvmAfterPostBackEventArgs>;
|
|
729
815
|
declare type DotvvmPostbackHandler = {
|
|
730
816
|
execute(next: () => Promise<PostbackCommitFunction>, options: PostbackOptions): Promise<PostbackCommitFunction>;
|
|
731
817
|
name?: string;
|
|
@@ -735,7 +821,7 @@ declare type DotvvmPostbackHandler = {
|
|
|
735
821
|
declare type DotvvmPostbackErrorLike = {
|
|
736
822
|
readonly reason: DotvvmPostbackErrorReason;
|
|
737
823
|
};
|
|
738
|
-
declare type DotvvmPostbackErrorReason = {
|
|
824
|
+
declare type DotvvmPostbackErrorReason = ({
|
|
739
825
|
type: 'handler';
|
|
740
826
|
handlerName: string;
|
|
741
827
|
message?: string;
|
|
@@ -760,7 +846,13 @@ declare type DotvvmPostbackErrorReason = {
|
|
|
760
846
|
type: 'validation';
|
|
761
847
|
responseObject: any;
|
|
762
848
|
response?: Response;
|
|
763
|
-
}
|
|
849
|
+
} | {
|
|
850
|
+
type: 'abort';
|
|
851
|
+
} | {
|
|
852
|
+
type: 'redirect';
|
|
853
|
+
responseObject: any;
|
|
854
|
+
response?: Response;
|
|
855
|
+
}) & {
|
|
764
856
|
options?: PostbackOptions;
|
|
765
857
|
};
|
|
766
858
|
declare type PostbackCommandType = "postback" | "staticCommand" | "spaNavigation";
|
|
@@ -770,8 +862,10 @@ declare type PostbackOptions = {
|
|
|
770
862
|
readonly args: any[];
|
|
771
863
|
readonly sender?: HTMLElement;
|
|
772
864
|
readonly viewModel?: any;
|
|
865
|
+
readonly knockoutContext?: any;
|
|
773
866
|
serverResponseObject?: any;
|
|
774
867
|
validationTargetPath?: string;
|
|
868
|
+
abortSignal?: AbortSignal;
|
|
775
869
|
};
|
|
776
870
|
declare type DotvvmErrorEventArgs = PostbackOptions & {
|
|
777
871
|
readonly response?: Response;
|
|
@@ -920,6 +1014,7 @@ declare type DotvvmObservable<T> = DeepKnockoutObservable<T> & {
|
|
|
920
1014
|
declare type RootViewModel = {
|
|
921
1015
|
$type: string;
|
|
922
1016
|
$csrfToken?: string;
|
|
1017
|
+
[name: string]: any;
|
|
923
1018
|
};
|
|
924
1019
|
declare type TypeMap = {
|
|
925
1020
|
[typeId: string]: TypeMetadata;
|
|
@@ -935,6 +1030,7 @@ declare type EnumTypeMetadata = {
|
|
|
935
1030
|
values: {
|
|
936
1031
|
[name: string]: number;
|
|
937
1032
|
};
|
|
1033
|
+
isFlags?: boolean;
|
|
938
1034
|
};
|
|
939
1035
|
declare type TypeMetadata = ObjectTypeMetadata | EnumTypeMetadata;
|
|
940
1036
|
declare type PropertyMetadata = {
|
|
@@ -967,3 +1063,47 @@ declare type CoerceResult = CoerceErrorType | {
|
|
|
967
1063
|
wasCoerced?: boolean;
|
|
968
1064
|
isError?: false;
|
|
969
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;
|
|
1109
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotvvm-types",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.8",
|
|
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
|
}
|
package/dotvvm-types-3.0.2.tgz
DELETED
|
Binary file
|