dotvvm-types 4.1.0-preview10-final → 4.1.0-preview12-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 +40 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotvvm-types",
3
- "version": "4.1.0-preview10-final",
3
+ "version": "4.1.0-preview12-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
@@ -24,12 +24,18 @@ declare module "utils/logging" {
24
24
  export function logWarning(area: string, ...args: any[]): void;
25
25
  export function logError(area: string, ...args: any[]): void;
26
26
  export function logPostBackScriptError(err: any): void;
27
+ /** puts the string in quotes, escaping weird characters if it is more complex than just letters */
28
+ export function debugQuoteString(s: string): string;
27
29
  }
28
30
  declare module "serialization/date" {
29
31
  export function parseDate(value: string | null, convertFromUtc?: boolean): Date | null;
32
+ export function parseDateOnly(value: string | null): Date | null;
33
+ export function parseTimeOnly(value: string | null): Date | null;
30
34
  export function parseTimeSpan(value: string | null): number | null;
31
35
  export function parseDateTimeOffset(value: string | null): Date | null;
32
36
  export function serializeDate(date: string | Date | null, convertToUtc?: boolean): string | null;
37
+ export function serializeDateOnly(date: Date | null): string | null;
38
+ export function serializeTimeOnly(date: Date | null): string | null;
33
39
  export function serializeTimeSpan(time: string | number | null): string | null;
34
40
  }
35
41
  declare module "utils/dom" {
@@ -96,6 +102,14 @@ declare module "events" {
96
102
  export const staticCommandMethodFailed: DotvvmEvent<DotvvmStaticCommandMethodFailedEventArgs>;
97
103
  export const newState: DotvvmEvent<RootViewModel>;
98
104
  }
105
+ declare module "utils/isNumber" {
106
+ export function isNumber(value: any): boolean;
107
+ }
108
+ declare module "metadata/enums" {
109
+ export function enumStringToInt(value: number | string, type: EnumTypeMetadata): number | null;
110
+ export function enumIntToString(value: number, type: EnumTypeMetadata): string | null;
111
+ export function tryCoerceEnum(value: any, type: EnumTypeMetadata): CoerceResult;
112
+ }
99
113
  declare module "metadata/primitiveTypes" {
100
114
  type PrimitiveTypes = {
101
115
  [name: string]: {
@@ -443,11 +457,13 @@ declare module "DotVVM.Globalize" {
443
457
  import { parseDate as serializationParseDate } from "serialization/date";
444
458
  export function format(format: string, ...values: any[]): string;
445
459
  type GlobalizeFormattable = null | undefined | string | Date | number;
446
- export function formatString(format: string | null | undefined, value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>): string;
460
+ export function formatString(format: string | null | undefined, value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>, type: string | null): string;
447
461
  export function parseNumber(value: string): number;
448
462
  export function parseDate(value: string, format: string, previousValue?: Date): Date | null;
449
463
  export const parseDotvvmDate: typeof serializationParseDate;
450
464
  export function bindingDateToString(value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>, format?: string): KnockoutComputed<string>;
465
+ export function bindingDateOnlyToString(value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>, format?: string): KnockoutComputed<string>;
466
+ export function bindingTimeOnlyToString(value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>, format?: string): KnockoutComputed<string>;
451
467
  export function bindingNumberToString(value: GlobalizeFormattable | KnockoutObservable<GlobalizeFormattable>, format?: string): KnockoutComputed<string>;
452
468
  }
453
469
  declare var compileConstants: {
@@ -658,15 +674,14 @@ declare module "metadata/metadataHelper" {
658
674
  export function getTypeId(viewModel: object): string | undefined;
659
675
  export function getTypeMetadata(typeId: string): TypeMetadata;
660
676
  export function getEnumMetadata(enumMetadataId: string): EnumTypeMetadata;
661
- export function getEnumValue(identifier: string | number, enumMetadataId: string): number | undefined;
662
677
  }
663
- declare module "collections/sortingHelper" {
678
+ declare module "translations/sortingHelper" {
664
679
  type ElementType = string | number | boolean;
665
680
  export const orderBy: <T>(array: T[], selector: (item: T) => ElementType, typeId: string) => T[];
666
681
  export const orderByDesc: <T>(array: T[], selector: (item: T) => ElementType, typeId: string) => T[];
667
682
  }
668
- declare module "collections/arrayHelper" {
669
- import { orderBy, orderByDesc } from "collections/sortingHelper";
683
+ declare module "translations/arrayHelper" {
684
+ import { orderBy, orderByDesc } from "translations/sortingHelper";
670
685
  export { add, addOrUpdate, addRange, clear, distinct, firstOrDefault, insert, insertRange, lastOrDefault, max, min, orderBy, orderByDesc, removeAll, removeAt, removeFirst, removeLast, removeRange, reverse, setItem };
671
686
  function add<T>(observable: any, element: T): void;
672
687
  function addOrUpdate<T>(observable: any, element: T, matcher: (e: T) => boolean, updater: (e: T) => T): void;
@@ -687,7 +702,7 @@ declare module "collections/arrayHelper" {
687
702
  function reverse<T>(observable: any): void;
688
703
  function setItem<T>(observable: any, index: number, value: T): void;
689
704
  }
690
- declare module "collections/dictionaryHelper" {
705
+ declare module "translations/dictionaryHelper" {
691
706
  type Dictionary<Key, Value> = {
692
707
  Key: Key;
693
708
  Value: Value;
@@ -698,7 +713,7 @@ declare module "collections/dictionaryHelper" {
698
713
  export function remove<Key, Value>(observable: any, identifier: Key): boolean;
699
714
  export function setItem<Key, Value>(observable: any, identifier: Key, value: Value): void;
700
715
  }
701
- declare module "utils/stringHelper" {
716
+ declare module "translations/stringHelper" {
702
717
  export function contains(haystack: string, needle: string, options: string): boolean;
703
718
  export function endsWith(haystack: string, needle: string, options: string): boolean;
704
719
  export function startsWith(haystack: string, needle: string, options: string): boolean;
@@ -710,9 +725,26 @@ declare module "utils/stringHelper" {
710
725
  export function trimStart(text: string, char: string): string;
711
726
  export function trimEnd(text: string, char: string): string;
712
727
  }
713
- declare module "utils/dateTimeHelper" {
728
+ declare module "translations/dateTimeHelper" {
714
729
  export function toBrowserLocalTime(value: KnockoutObservable<string | null>): KnockoutComputed<string | null>;
715
730
  }
731
+ declare module "translations/translations" {
732
+ import * as array from "translations/arrayHelper";
733
+ import * as dictionary from "translations/dictionaryHelper";
734
+ import * as string from "translations/stringHelper";
735
+ import * as dateTime from "translations/dateTimeHelper";
736
+ const _default_13: Readonly<{
737
+ array: typeof array;
738
+ dictionary: typeof dictionary;
739
+ string: typeof string;
740
+ dateTime: typeof dateTime;
741
+ enums: {
742
+ fromInt(value: any, type: string): any;
743
+ toInt(value: any, type: string): number | null;
744
+ };
745
+ }>;
746
+ export default _default_13;
747
+ }
716
748
  declare module "dotvvm-root" {
717
749
  import { getCulture } from "dotvvm-base";
718
750
  import * as events from "events";
@@ -801,7 +833,6 @@ declare module "dotvvm-root" {
801
833
  getTypeId: typeof metadataHelper.getTypeId;
802
834
  getTypeMetadata: typeof metadataHelper.getTypeMetadata;
803
835
  getEnumMetadata: typeof metadataHelper.getEnumMetadata;
804
- getEnumValue: typeof metadataHelper.getEnumValue;
805
836
  };
806
837
  viewModules: {
807
838
  registerOne: typeof viewModuleManager.registerViewModule;