dotvvm-types 4.3.5 → 5.0.0-preview01-final

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +240 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotvvm-types",
3
- "version": "4.3.5",
3
+ "version": "5.0.0-preview01-final",
4
4
  "description": "MVVM framework for ASP.NET",
5
5
  "types": "./types/index.d.ts",
6
6
  "repository": {
package/types/index.d.ts CHANGED
@@ -212,6 +212,8 @@ declare module "validation/error" {
212
212
  }
213
213
  declare module "state-manager" {
214
214
  import { DotvvmEvent } from "events";
215
+ import { ValidationError } from "validation/error";
216
+ import { errorsSymbol } from "validation/common";
215
217
  export const currentStateSymbol: unique symbol;
216
218
  export const notifySymbol: unique symbol;
217
219
  export const lastSetErrorSymbol: unique symbol;
@@ -232,7 +234,7 @@ declare module "state-manager" {
232
234
  export class StateManager<TViewModel extends {
233
235
  $type?: TypeDefinition;
234
236
  }> implements DotvvmStateContainer<TViewModel> {
235
- stateUpdateEvent: DotvvmEvent<DeepReadonly<TViewModel>>;
237
+ stateUpdateEvent?: DotvvmEvent<DeepReadonly<TViewModel>> | undefined;
236
238
  /** The knockout observable containing the root objects, equivalent to `dotvvm.viewModels.root.viewModel` */
237
239
  readonly stateObservable: DeepKnockoutObservable<TViewModel>;
238
240
  private _state;
@@ -242,7 +244,7 @@ declare module "state-manager" {
242
244
  /** Indicates whether there is a pending update of the knockout observables. */
243
245
  get isDirty(): boolean;
244
246
  private _currentFrameNumber;
245
- constructor(initialState: DeepReadonly<TViewModel>, stateUpdateEvent: DotvvmEvent<DeepReadonly<TViewModel>>);
247
+ constructor(initialState: DeepReadonly<TViewModel>, stateUpdateEvent?: DotvvmEvent<DeepReadonly<TViewModel>> | undefined);
246
248
  private dispatchUpdate;
247
249
  /** Performs a synchronous update of knockout observables with the data currently stored in `state`.
248
250
  * Consequently, if ko.options.deferUpdates is false (default), the UI will be updated immediately.
@@ -268,12 +270,25 @@ declare module "state-manager" {
268
270
  /** @deprecated Use updateState method instead */
269
271
  update: UpdateDispatcher<TViewModel>;
270
272
  }
273
+ class FakeObservableObject<T extends object> implements UpdatableObjectExtensions<T> {
274
+ [currentStateSymbol]: T;
275
+ [errorsSymbol]: Array<ValidationError>;
276
+ [updateSymbol]: UpdateDispatcher<T>;
277
+ [notifySymbol](newValue: T): void;
278
+ [internalPropCache]: {
279
+ [name: string]: (KnockoutObservable<any> & UpdatableObjectExtensions<any>) | null;
280
+ };
281
+ [updatePropertySymbol](propName: keyof DeepReadonly<T>, valUpdate: StateUpdate<any>): void;
282
+ constructor(initialValue: T, getter: () => DeepReadonly<T> | undefined, updater: UpdateDispatcher<T>, typeId: TypeDefinition, typeInfo: ObjectTypeMetadata | DynamicTypeMetadata | undefined, additionalProperties: string[]);
283
+ }
271
284
  export function isDotvvmObservable(obj: any): obj is DotvvmObservable<any>;
285
+ export function isFakeObservableObject(obj: any): obj is FakeObservableObject<any>;
272
286
  /**
273
287
  * Recursively unwraps knockout observables from the object / array hierarchy. When nothing needs to be unwrapped, the original object is returned.
274
288
  * @param allowStateUnwrap Allows accessing [currentStateSymbol], which makes it faster, but doesn't register in the knockout dependency tracker
289
+ * @param preferStateAccess Also allows accessing observable.state, which also doesn't register in the knockout dependency tracker, but returns an realtime updated value directly from dotvvm.state
275
290
  */
276
- export function unmapKnockoutObservables(viewModel: any, allowStateUnwrap?: boolean): any;
291
+ export function unmapKnockoutObservables(viewModel: any, allowStateUnwrap?: boolean, preferStateAccess?: boolean): any;
277
292
  }
278
293
  declare module "serialization/deserialize" {
279
294
  export function deserialize(viewModel: any, target?: any, deserializeAll?: boolean): any;
@@ -509,6 +524,21 @@ declare module "binding-handlers/modal-dialog" {
509
524
  };
510
525
  export default _default_12;
511
526
  }
527
+ declare module "binding-handlers/appendable-data-pager" {
528
+ type AppendableDataPagerBinding = {
529
+ autoLoadWhenInViewport: boolean;
530
+ loadNextPage: () => Promise<any>;
531
+ dataSet: any;
532
+ };
533
+ const _default_13: {
534
+ 'dotvvm-appendable-data-pager': {
535
+ init: (element: HTMLInputElement, valueAccessor: () => AppendableDataPagerBinding, allBindings?: any, viewModel?: any, bindingContext?: KnockoutBindingContext) => {
536
+ controlsDescendantBindings: boolean;
537
+ };
538
+ };
539
+ };
540
+ export default _default_13;
541
+ }
512
542
  declare module "binding-handlers/all-handlers" {
513
543
  type KnockoutHandlerDictionary = {
514
544
  [name: string]: KnockoutBindingHandler;
@@ -747,8 +777,8 @@ declare module "spa/spa" {
747
777
  export function handleSpaNavigationCore(url: string | null, sender?: HTMLElement, handlePageNavigating?: (url: string) => void): Promise<DotvvmNavigationEventArgs>;
748
778
  }
749
779
  declare module "binding-handlers/register" {
750
- const _default_13: () => void;
751
- export default _default_13;
780
+ const _default_14: () => void;
781
+ export default _default_14;
752
782
  }
753
783
  declare module "postback/staticCommand" {
754
784
  export function resolveRelativeValidationPaths(paths: string[] | null | undefined, context: KnockoutBindingContext | undefined): (string | null)[] | undefined;
@@ -824,7 +854,7 @@ declare module "translations/translations" {
824
854
  import * as dictionary from "translations/dictionaryHelper";
825
855
  import * as string from "translations/stringHelper";
826
856
  import * as dateTime from "translations/dateTimeHelper";
827
- const _default_14: Readonly<{
857
+ const _default_15: Readonly<{
828
858
  array: typeof array;
829
859
  dictionary: typeof dictionary;
830
860
  string: typeof string;
@@ -834,7 +864,90 @@ declare module "translations/translations" {
834
864
  toInt(value: any, type: string): number | null;
835
865
  };
836
866
  }>;
837
- export default _default_14;
867
+ export default _default_15;
868
+ }
869
+ declare module "dataset/loader" {
870
+ type GridViewDataSet = {
871
+ PagingOptions: object;
872
+ SortingOptions: object;
873
+ FilteringOptions: object;
874
+ Items: any[];
875
+ IsRefreshRequired?: boolean;
876
+ };
877
+ type GridViewDataSetOptions = {
878
+ PagingOptions: object;
879
+ SortingOptions: object;
880
+ FilteringOptions: object;
881
+ };
882
+ type GridViewDataSetResult = {
883
+ Items: any[];
884
+ PagingOptions: object;
885
+ SortingOptions: object;
886
+ FilteringOptions: object;
887
+ };
888
+ export function getOptions(dataSetObservable: DotvvmObservable<GridViewDataSet>): GridViewDataSetOptions;
889
+ export function loadDataSet(dataSetObservable: DotvvmObservable<GridViewDataSet>, transformOptions: (options: GridViewDataSetOptions) => void, loadData: (options: GridViewDataSetOptions) => Promise<DotvvmAfterPostBackEventArgs>, postProcessor?: (dataSet: DotvvmObservable<GridViewDataSet>, result: GridViewDataSetResult) => void): Promise<void>;
890
+ export const postProcessors: {
891
+ replace(dataSet: DotvvmObservable<GridViewDataSet>, result: GridViewDataSetResult): void;
892
+ append(dataSet: DotvvmObservable<GridViewDataSet>, result: GridViewDataSetResult): void;
893
+ };
894
+ }
895
+ declare module "dataset/translations" {
896
+ import { getOptions } from "dataset/loader";
897
+ type PagingOptions = {
898
+ PageIndex: number;
899
+ PagesCount: number;
900
+ };
901
+ type NextTokenPagingOptions = {
902
+ CurrentToken: string | null;
903
+ NextPageToken: string | null;
904
+ };
905
+ type NextTokenHistoryPagingOptions = {
906
+ PageIndex: number;
907
+ TokenHistory: (string | null)[];
908
+ };
909
+ type SortingOptions = {
910
+ SortExpression: string | null;
911
+ SortDescending: boolean;
912
+ };
913
+ type MultiCriteriaSortingOptions = {
914
+ Criteria: SortCriterion[];
915
+ MaxSortCriteriaCount: number;
916
+ };
917
+ type SortCriterion = {
918
+ SortExpression: string;
919
+ SortDescending: boolean;
920
+ };
921
+ export const translations: {
922
+ getOptions: typeof getOptions;
923
+ PagingOptions: {
924
+ goToFirstPage(options: PagingOptions): void;
925
+ goToLastPage(options: PagingOptions): void;
926
+ goToNextPage(options: PagingOptions): void;
927
+ goToPreviousPage(options: PagingOptions): void;
928
+ goToPage(options: PagingOptions, pageIndex: number): void;
929
+ };
930
+ NextTokenPagingOptions: {
931
+ goToFirstPage(options: NextTokenPagingOptions): void;
932
+ goToNextPage(options: NextTokenPagingOptions): void;
933
+ };
934
+ NextTokenHistoryPagingOptions: {
935
+ goToFirstPage(options: NextTokenHistoryPagingOptions): void;
936
+ goToNextPage(options: NextTokenHistoryPagingOptions): void;
937
+ goToPreviousPage(options: NextTokenHistoryPagingOptions): void;
938
+ goToPage(options: NextTokenHistoryPagingOptions, pageIndex: number): void;
939
+ };
940
+ SortingOptions: {
941
+ setSortExpression(options: SortingOptions, sortExpression: string): void;
942
+ isColumnSortedAscending(options: SortingOptions, sortExpression: string): boolean;
943
+ isColumnSortedDescending(options: SortingOptions, sortExpression: string): boolean;
944
+ };
945
+ MultiCriteriaSortingOptions: {
946
+ setSortExpression(options: MultiCriteriaSortingOptions, sortExpression: string): void;
947
+ isColumnSortedAscending(options: MultiCriteriaSortingOptions, sortExpression: string): boolean;
948
+ isColumnSortedDescending(options: MultiCriteriaSortingOptions, sortExpression: string): boolean;
949
+ };
950
+ };
838
951
  }
839
952
  declare module "dotvvm-root" {
840
953
  import { getCulture } from "dotvvm-base";
@@ -860,6 +973,7 @@ declare module "dotvvm-root" {
860
973
  import { logError, logWarning, logInfo, logInfoVerbose, logPostBackScriptError, setLogger } from "utils/logging";
861
974
  import * as metadataHelper from "metadata/metadataHelper";
862
975
  import { StateManager } from "state-manager";
976
+ import { loadDataSet } from "dataset/loader";
863
977
  function init(culture: string): void;
864
978
  const dotvvmExports: {
865
979
  getCulture: typeof getCulture;
@@ -953,6 +1067,125 @@ declare module "dotvvm-root" {
953
1067
  compressPOST: boolean;
954
1068
  };
955
1069
  translations: any;
1070
+ dataSet: {
1071
+ loadDataSet: typeof loadDataSet;
1072
+ postProcessors: {
1073
+ replace(dataSet: DotvvmObservable<{
1074
+ PagingOptions: object;
1075
+ SortingOptions: object;
1076
+ FilteringOptions: object;
1077
+ Items: any[];
1078
+ IsRefreshRequired?: boolean | undefined;
1079
+ }>, result: {
1080
+ Items: any[];
1081
+ PagingOptions: object;
1082
+ SortingOptions: object;
1083
+ FilteringOptions: object;
1084
+ }): void;
1085
+ append(dataSet: DotvvmObservable<{
1086
+ PagingOptions: object;
1087
+ SortingOptions: object;
1088
+ FilteringOptions: object;
1089
+ Items: any[];
1090
+ IsRefreshRequired?: boolean | undefined;
1091
+ }>, result: {
1092
+ Items: any[];
1093
+ PagingOptions: object;
1094
+ SortingOptions: object;
1095
+ FilteringOptions: object;
1096
+ }): void;
1097
+ };
1098
+ translations: {
1099
+ getOptions: typeof import("dataset/loader").getOptions;
1100
+ PagingOptions: {
1101
+ goToFirstPage(options: {
1102
+ PageIndex: number;
1103
+ PagesCount: number;
1104
+ }): void;
1105
+ goToLastPage(options: {
1106
+ PageIndex: number;
1107
+ PagesCount: number;
1108
+ }): void;
1109
+ goToNextPage(options: {
1110
+ PageIndex: number;
1111
+ PagesCount: number;
1112
+ }): void;
1113
+ goToPreviousPage(options: {
1114
+ PageIndex: number;
1115
+ PagesCount: number;
1116
+ }): void;
1117
+ goToPage(options: {
1118
+ PageIndex: number;
1119
+ PagesCount: number;
1120
+ }, pageIndex: number): void;
1121
+ };
1122
+ NextTokenPagingOptions: {
1123
+ goToFirstPage(options: {
1124
+ CurrentToken: string | null;
1125
+ NextPageToken: string | null;
1126
+ }): void;
1127
+ goToNextPage(options: {
1128
+ CurrentToken: string | null;
1129
+ NextPageToken: string | null;
1130
+ }): void;
1131
+ };
1132
+ NextTokenHistoryPagingOptions: {
1133
+ goToFirstPage(options: {
1134
+ PageIndex: number;
1135
+ TokenHistory: (string | null)[];
1136
+ }): void;
1137
+ goToNextPage(options: {
1138
+ PageIndex: number;
1139
+ TokenHistory: (string | null)[];
1140
+ }): void;
1141
+ goToPreviousPage(options: {
1142
+ PageIndex: number;
1143
+ TokenHistory: (string | null)[];
1144
+ }): void;
1145
+ goToPage(options: {
1146
+ PageIndex: number;
1147
+ TokenHistory: (string | null)[];
1148
+ }, pageIndex: number): void;
1149
+ };
1150
+ SortingOptions: {
1151
+ setSortExpression(options: {
1152
+ SortExpression: string | null;
1153
+ SortDescending: boolean;
1154
+ }, sortExpression: string): void;
1155
+ isColumnSortedAscending(options: {
1156
+ SortExpression: string | null;
1157
+ SortDescending: boolean;
1158
+ }, sortExpression: string): boolean;
1159
+ isColumnSortedDescending(options: {
1160
+ SortExpression: string | null;
1161
+ SortDescending: boolean;
1162
+ }, sortExpression: string): boolean;
1163
+ };
1164
+ MultiCriteriaSortingOptions: {
1165
+ setSortExpression(options: {
1166
+ Criteria: {
1167
+ SortExpression: string;
1168
+ SortDescending: boolean;
1169
+ }[];
1170
+ MaxSortCriteriaCount: number;
1171
+ }, sortExpression: string): void;
1172
+ isColumnSortedAscending(options: {
1173
+ Criteria: {
1174
+ SortExpression: string;
1175
+ SortDescending: boolean;
1176
+ }[];
1177
+ MaxSortCriteriaCount: number;
1178
+ }, sortExpression: string): boolean;
1179
+ isColumnSortedDescending(options: {
1180
+ Criteria: {
1181
+ SortExpression: string;
1182
+ SortDescending: boolean;
1183
+ }[];
1184
+ MaxSortCriteriaCount: number;
1185
+ }, sortExpression: string): boolean;
1186
+ };
1187
+ };
1188
+ };
956
1189
  StateManager: typeof StateManager;
957
1190
  DotvvmEvent: typeof events.DotvvmEvent;
958
1191
  };