@vuu-ui/vuu-utils 0.8.55 → 0.8.57

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 (41) hide show
  1. package/cjs/column-utils.js +14 -11
  2. package/cjs/column-utils.js.map +1 -1
  3. package/cjs/date/{utils.js → date-utils.js} +1 -1
  4. package/cjs/date/date-utils.js.map +1 -0
  5. package/cjs/date/types.js +4 -0
  6. package/cjs/date/types.js.map +1 -1
  7. package/cjs/form-utils.js +16 -0
  8. package/cjs/form-utils.js.map +1 -0
  9. package/cjs/html-utils.js +16 -0
  10. package/cjs/html-utils.js.map +1 -1
  11. package/cjs/index.js +26 -20
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/list-utils.js +11 -0
  14. package/cjs/list-utils.js.map +1 -0
  15. package/esm/column-utils.js +15 -9
  16. package/esm/column-utils.js.map +1 -1
  17. package/esm/date/{utils.js → date-utils.js} +1 -1
  18. package/esm/date/date-utils.js.map +1 -0
  19. package/esm/date/types.js +2 -1
  20. package/esm/date/types.js.map +1 -1
  21. package/esm/form-utils.js +14 -0
  22. package/esm/form-utils.js.map +1 -0
  23. package/esm/html-utils.js +15 -1
  24. package/esm/html-utils.js.map +1 -1
  25. package/esm/index.js +6 -4
  26. package/esm/index.js.map +1 -1
  27. package/esm/list-utils.js +9 -0
  28. package/esm/list-utils.js.map +1 -0
  29. package/package.json +6 -6
  30. package/types/array-utils.d.ts +1 -1
  31. package/types/column-utils.d.ts +6 -4
  32. package/types/date/index.d.ts +2 -2
  33. package/types/date/types.d.ts +6 -0
  34. package/types/form-utils.d.ts +6 -0
  35. package/types/html-utils.d.ts +3 -0
  36. package/types/index.d.ts +3 -0
  37. package/types/list-utils.d.ts +2 -0
  38. package/types/user-types.d.ts +4 -0
  39. package/cjs/date/utils.js.map +0 -1
  40. package/esm/date/utils.js.map +0 -1
  41. /package/types/date/{utils.d.ts → date-utils.d.ts} +0 -0
@@ -17,6 +17,11 @@ export declare function mapSortCriteria(sortCriteria: SortCriteriaItem[], column
17
17
  export declare const getDefaultAlignment: (serverDataType?: VuuColumnDataType) => ColumnAlignment;
18
18
  export declare const isValidColumnAlignment: (v: string) => v is ColumnAlignment;
19
19
  export declare const isValidPinLocation: (v: string) => v is PinLocation;
20
+ export type CalculatedColumn = {
21
+ name: string;
22
+ expression: string;
23
+ serverDataType: VuuColumnDataType;
24
+ };
20
25
  export declare const isVuuColumnDataType: (value: string | undefined | null) => value is VuuColumnDataType;
21
26
  export declare const fromServerDataType: (serverDataType: VuuColumnDataType) => ColumnTypeSimple;
22
27
  export declare const isNumericColumn: ({ serverDataType, type }: ColumnDescriptor) => boolean;
@@ -96,10 +101,7 @@ export declare const getTypeFormattingFromColumn: (column: ColumnDescriptor) =>
96
101
  export declare const subscribedOnly: (columnNames?: string[]) => (column: ColumnDescriptor) => boolean | undefined;
97
102
  export declare const addColumnToSubscribedColumns: (subscribedColumns: ColumnDescriptor[], availableColumns: SchemaColumn[], columnName: string) => ColumnDescriptor[];
98
103
  export declare const isCalculatedColumn: (columnName?: string) => boolean;
99
- export declare const getCalculatedColumnDetails: (column: ColumnDescriptor) => string[];
100
- export declare const getCalculatedColumnName: (column: ColumnDescriptor) => string;
101
- export declare const getCalculatedColumnType: (column: ColumnDescriptor) => VuuColumnDataType;
102
- export declare const getCalculatedColumnExpression: (column: ColumnDescriptor) => string;
104
+ export declare const getCalculatedColumnDetails: (column: ColumnDescriptor) => Partial<CalculatedColumn>;
103
105
  export declare const setCalculatedColumnName: (column: ColumnDescriptor, name: string) => ColumnDescriptor;
104
106
  export declare const setCalculatedColumnType: (column: ColumnDescriptor, type: string) => ColumnDescriptor;
105
107
  export declare const setCalculatedColumnExpression: (column: ColumnDescriptor, expression: string) => ColumnDescriptor;
@@ -1,4 +1,4 @@
1
1
  export * from "./formatter";
2
- export { isDateTimePattern, type DateTimePattern, supportedDateTimePatterns, } from "./types";
3
- export { toCalendarDate } from "./utils";
2
+ export { dateTimeLabelByType, isDatePattern, isTimePattern, isDateTimePattern, type DatePattern, type TimePattern, type DateTimePattern, supportedDateTimePatterns, } from "./types";
3
+ export { toCalendarDate } from "./date-utils";
4
4
  export { dateTimePattern, defaultPatternsByType, fallbackDateTimePattern, } from "./dateTimePattern";
@@ -5,6 +5,10 @@ export declare const supportedDateTimePatterns: {
5
5
  date: readonly ["dd.mm.yyyy", "dd/mm/yyyy", "dd MMM yyyy", "dd MMMM yyyy", "mm/dd/yyyy", "MMM dd, yyyy", "MMMM dd, yyyy"];
6
6
  time: readonly ["hh:mm:ss", "hh:mm:ss a"];
7
7
  };
8
+ export declare const dateTimeLabelByType: {
9
+ readonly date: "Date";
10
+ readonly time: "Time";
11
+ };
8
12
  export type DatePattern = (typeof supportedDatePatterns)[number];
9
13
  export type TimePattern = (typeof supportedTimePatterns)[number];
10
14
  export type DateTimePattern = {
@@ -14,5 +18,7 @@ export type DateTimePattern = {
14
18
  date: DatePattern;
15
19
  time?: TimePattern;
16
20
  };
21
+ export declare const isDatePattern: (pattern?: string) => pattern is "dd.mm.yyyy" | "dd/mm/yyyy" | "dd MMM yyyy" | "dd MMMM yyyy" | "mm/dd/yyyy" | "MMM dd, yyyy" | "MMMM dd, yyyy";
22
+ export declare const isTimePattern: (pattern?: string) => pattern is "hh:mm:ss" | "hh:mm:ss a";
17
23
  export declare const isDateTimePattern: (pattern?: ColumnTypeFormatting["pattern"]) => pattern is DateTimePattern;
18
24
  export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Use with the following convention:
3
+ *
4
+ * <FormField data-field="my-field-name">
5
+ */
6
+ export declare const getFieldName: (input: HTMLInputElement | HTMLButtonElement) => string;
@@ -8,8 +8,11 @@ export declare function getElementByDataIndex(c: HTMLElement | null, i: number |
8
8
  export declare function getElementByDataIndex(c: HTMLElement | null, i: number | string, throwIfNotFound?: false): HTMLElement | undefined;
9
9
  export declare const focusFirstFocusableElement: (el: HTMLElement | null, tabIndex?: number) => void;
10
10
  export declare const isSelectableElement: (el?: HTMLElement | null) => boolean;
11
+ export declare const hasOpenOptionList: (el: HTMLElement | EventTarget | null) => boolean | undefined;
11
12
  export declare function getScrollbarSize(): number;
12
13
  export type MouseEventTypes = "dblclick" | "click";
14
+ export type KeyboardEventTypes = "keydown" | "keypress" | "keyup";
13
15
  export declare const dispatchMouseEvent: (el: HTMLElement, type: MouseEventTypes) => void;
16
+ export declare const dispatchKeyboardEvent: (el: HTMLElement, type: KeyboardEventTypes, key: string) => void;
14
17
  export type VuuDomEventType = "vuu-commit" | "vuu-dropped";
15
18
  export declare const dispatchCustomEvent: (el: HTMLElement, type: VuuDomEventType) => void;
package/types/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./debug-utils";
14
14
  export * from "./filters";
15
15
  export * from "./html-utils";
16
16
  export * from "./event-emitter";
17
+ export * from "./form-utils";
17
18
  export * from "./formatting-utils";
18
19
  export * from "./getUniqueId";
19
20
  export * from "./group-utils";
@@ -23,6 +24,7 @@ export * from "./itemToString";
23
24
  export * from "./json-utils";
24
25
  export * from "./keyboard-utils";
25
26
  export * from "./keyset";
27
+ export * from "./list-utils";
26
28
  export * from "./local-storage-utils";
27
29
  export * from "./logging-utils";
28
30
  export * from "./menu-utils";
@@ -41,4 +43,5 @@ export * from "./ThemeProvider";
41
43
  export * from "./ts-utils";
42
44
  export * from "./url-utils";
43
45
  export * from "./useId";
46
+ export * from "./user-types";
44
47
  export * from "./useLayoutEffectSkipFirst";
@@ -0,0 +1,2 @@
1
+ import type { ListOption } from "@vuu-ui/vuu-table-types";
2
+ export declare const getSelectedOption: (values: ListOption[], selectedValue: string | number | undefined) => ListOption | undefined;
@@ -0,0 +1,4 @@
1
+ export type VuuUser = {
2
+ username: string;
3
+ token: string;
4
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/date/utils.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\n\nexport function toCalendarDate(d: Date) {\n return new CalendarDate(d.getFullYear(), d.getMonth() + 1, d.getDate());\n}\n"],"names":["CalendarDate"],"mappings":";;;;AAEO,SAAS,eAAe,CAAS,EAAA;AACtC,EAAO,OAAA,IAAIA,iBAAa,CAAA,CAAA,CAAE,WAAY,EAAA,EAAG,CAAE,CAAA,QAAA,EAAa,GAAA,CAAA,EAAG,CAAE,CAAA,OAAA,EAAS,CAAA,CAAA;AACxE;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/date/utils.ts"],"sourcesContent":["import { CalendarDate } from \"@internationalized/date\";\n\nexport function toCalendarDate(d: Date) {\n return new CalendarDate(d.getFullYear(), d.getMonth() + 1, d.getDate());\n}\n"],"names":[],"mappings":";;AAEO,SAAS,eAAe,CAAS,EAAA;AACtC,EAAO,OAAA,IAAI,YAAa,CAAA,CAAA,CAAE,WAAY,EAAA,EAAG,CAAE,CAAA,QAAA,EAAa,GAAA,CAAA,EAAG,CAAE,CAAA,OAAA,EAAS,CAAA,CAAA;AACxE;;;;"}
File without changes