@vuu-ui/vuu-utils 0.13.4 → 0.13.6

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 (86) hide show
  1. package/cjs/datasource/BaseDataSource.js +4 -0
  2. package/cjs/datasource/BaseDataSource.js.map +1 -1
  3. package/cjs/moving-window.js +0 -2
  4. package/cjs/moving-window.js.map +1 -1
  5. package/cjs/range-utils.js +0 -3
  6. package/cjs/range-utils.js.map +1 -1
  7. package/esm/datasource/BaseDataSource.js +4 -0
  8. package/esm/datasource/BaseDataSource.js.map +1 -1
  9. package/esm/moving-window.js +0 -2
  10. package/esm/moving-window.js.map +1 -1
  11. package/esm/range-utils.js +0 -3
  12. package/esm/range-utils.js.map +1 -1
  13. package/package.json +11 -9
  14. package/types/DataWindow.d.ts +39 -0
  15. package/types/ShellContext.d.ts +11 -0
  16. package/types/ThemeProvider.d.ts +32 -0
  17. package/types/array-utils.d.ts +8 -0
  18. package/types/box-utils.d.ts +24 -0
  19. package/types/broadcast-channel.d.ts +16 -0
  20. package/types/column-utils.d.ts +175 -0
  21. package/types/common-types.d.ts +6 -0
  22. package/types/component-registry.d.ts +62 -0
  23. package/types/context-definitions/DataContext.d.ts +19 -0
  24. package/types/context-definitions/DataProvider.d.ts +8 -0
  25. package/types/context-definitions/DataSourceProvider.d.ts +12 -0
  26. package/types/context-definitions/WorkspaceContext.d.ts +17 -0
  27. package/types/cookie-utils.d.ts +1 -0
  28. package/types/css-utils.d.ts +1 -0
  29. package/types/data-utils.d.ts +19 -0
  30. package/types/datasource/BaseDataSource.d.ts +46 -0
  31. package/types/datasource/datasource-action-utils.d.ts +7 -0
  32. package/types/datasource/datasource-filter-utils.d.ts +2 -0
  33. package/types/datasource/datasource-utils.d.ts +45 -0
  34. package/types/date/date-utils.d.ts +2 -0
  35. package/types/date/dateTimePattern.d.ts +8 -0
  36. package/types/date/formatter.d.ts +4 -0
  37. package/types/date/index.d.ts +4 -0
  38. package/types/date/types.d.ts +24 -0
  39. package/types/debug-utils.d.ts +9 -0
  40. package/types/event-emitter.d.ts +21 -0
  41. package/types/feature-utils.d.ts +104 -0
  42. package/types/filters/filter-utils.d.ts +69 -0
  43. package/types/filters/filterAsQuery.d.ts +7 -0
  44. package/types/filters/index.d.ts +2 -0
  45. package/types/form-utils.d.ts +22 -0
  46. package/types/formatting-utils.d.ts +14 -0
  47. package/types/getUniqueId.d.ts +1 -0
  48. package/types/group-utils.d.ts +10 -0
  49. package/types/html-utils.d.ts +21 -0
  50. package/types/index.d.ts +67 -0
  51. package/types/input-utils.d.ts +2 -0
  52. package/types/invariant.d.ts +1 -0
  53. package/types/itemToString.d.ts +2 -0
  54. package/types/json-types.d.ts +52 -0
  55. package/types/json-utils.d.ts +6 -0
  56. package/types/keyboard-utils.d.ts +15 -0
  57. package/types/keyset.d.ts +12 -0
  58. package/types/layout-types.d.ts +22 -0
  59. package/types/list-utils.d.ts +2 -0
  60. package/types/local-storage-utils.d.ts +3 -0
  61. package/types/logging-utils.d.ts +45 -0
  62. package/types/menu-utils.d.ts +6 -0
  63. package/types/module-utils.d.ts +8 -0
  64. package/types/moving-window.d.ts +18 -0
  65. package/types/nanoid/index.d.ts +1 -0
  66. package/types/perf-utils.d.ts +5 -0
  67. package/types/promise-utils.d.ts +8 -0
  68. package/types/protocol-message-utils.d.ts +28 -0
  69. package/types/range-utils.d.ts +31 -0
  70. package/types/react-utils.d.ts +4 -0
  71. package/types/round-decimal.d.ts +1 -0
  72. package/types/row-utils.d.ts +24 -0
  73. package/types/selection-utils.d.ts +29 -0
  74. package/types/shell-layout-types.d.ts +14 -0
  75. package/types/sort-utils.d.ts +11 -0
  76. package/types/table-schema-utils.d.ts +3 -0
  77. package/types/text-utils.d.ts +2 -0
  78. package/types/tree-types.d.ts +8 -0
  79. package/types/tree-utils.d.ts +9 -0
  80. package/types/ts-utils.d.ts +19 -0
  81. package/types/typeahead-utils.d.ts +1 -0
  82. package/types/url-utils.d.ts +2 -0
  83. package/types/useId.d.ts +1 -0
  84. package/types/useLayoutEffectSkipFirst.d.ts +2 -0
  85. package/types/useStateRef.d.ts +2 -0
  86. package/types/user-types.d.ts +4 -0
@@ -0,0 +1,69 @@
1
+ import type { DataSourceFilter } from "@vuu-ui/vuu-data-types";
2
+ import { AndFilter, Filter, FilterClauseOp, FilterWithPartialClause, MultiClauseFilter, MultiValueFilterClause, OrFilter, SingleValueFilterClause } from "@vuu-ui/vuu-filter-types";
3
+ import { ColumnDescriptor, RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
4
+ import { EventEmitter } from "../event-emitter";
5
+ import { VuuFilter } from "@vuu-ui/vuu-protocol-types";
6
+ export declare const isValidFilterClauseOp: (op?: string) => op is FilterClauseOp;
7
+ export declare const isNamedFilter: (f?: Filter) => boolean;
8
+ export declare const isSingleValueFilter: (f?: Partial<Filter>) => f is SingleValueFilterClause;
9
+ export declare const isFilterClause: (f?: Partial<Filter>) => f is SingleValueFilterClause | MultiValueFilterClause;
10
+ export declare const isMultiValueFilter: (f?: Partial<Filter>) => f is MultiValueFilterClause;
11
+ export declare const isInFilter: (f: Partial<Filter>) => f is MultiValueFilterClause;
12
+ export declare const isAndFilter: (f: Partial<Filter>) => f is AndFilter;
13
+ export declare const isOrFilter: (f: Partial<Filter>) => f is OrFilter;
14
+ export declare const isCompleteFilter: (filter: Partial<Filter>) => filter is Filter;
15
+ export declare function isMultiClauseFilter(f?: Partial<Filter> | FilterWithPartialClause): f is MultiClauseFilter;
16
+ export declare const applyFilterToColumns: (columns: RuntimeColumnDescriptor[], { filterStruct }: DataSourceFilter) => RuntimeColumnDescriptor[];
17
+ export declare const isFilteredColumn: (column: RuntimeColumnDescriptor) => boolean;
18
+ export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]) => {
19
+ align?: "left" | "right";
20
+ ariaColIndex: number;
21
+ CellRenderer?: import("react").FunctionComponent<import("@vuu-ui/vuu-table-types").TableCellRendererProps>;
22
+ HeaderCellLabelRenderer?: import("react").FunctionComponent<import("@vuu-ui/vuu-table-types").HeaderCellProps>;
23
+ HeaderCellContentRenderer?: import("react").FunctionComponent<import("@vuu-ui/vuu-table-types").HeaderCellProps>;
24
+ canStretch?: boolean;
25
+ className?: string;
26
+ clientSideEditValidationCheck?: import("@vuu-ui/vuu-data-types").DataValueValidationChecker;
27
+ endPin?: true | undefined;
28
+ flex?: number;
29
+ heading?: [...string[]];
30
+ isGroup?: boolean;
31
+ isSystemColumn?: boolean;
32
+ label: string;
33
+ locked?: boolean;
34
+ marginLeft?: number;
35
+ moving?: boolean;
36
+ originalIdx?: number;
37
+ pinnedOffset?: number;
38
+ resizeable?: boolean;
39
+ resizing?: boolean;
40
+ sortable?: boolean;
41
+ sorted?: import("@vuu-ui/vuu-table-types").ColumnSort;
42
+ valueFormatter: import("@vuu-ui/vuu-table-types").ValueFormatter;
43
+ width: number;
44
+ aggregate?: import("@vuu-ui/vuu-protocol-types").VuuAggType;
45
+ colHeaderContentRenderer?: string;
46
+ colHeaderLabelRenderer?: string;
47
+ getIcon?: (row: import("@vuu-ui/vuu-data-types").DataSourceRow) => string | undefined;
48
+ groupable?: boolean;
49
+ hidden?: boolean;
50
+ maxWidth?: number;
51
+ minWidth?: number;
52
+ pin?: import("@vuu-ui/vuu-table-types").PinLocation | false;
53
+ source?: "client" | "server";
54
+ editable?: boolean;
55
+ editableBulk?: import("@vuu-ui/vuu-data-types").BulkEdit;
56
+ name: string;
57
+ serverDataType?: import("@vuu-ui/vuu-protocol-types").VuuColumnDataType;
58
+ type?: import("@vuu-ui/vuu-data-types").DataValueType;
59
+ }[];
60
+ export declare const extractFilterForColumn: (filter: Filter | undefined, columnName: string) => Filter | undefined;
61
+ export type FilterEvents = {
62
+ filter: (vuuFilter: VuuFilter) => void;
63
+ };
64
+ export declare class FilterAggregator extends EventEmitter<FilterEvents> {
65
+ #private;
66
+ addFilter(column: ColumnDescriptor, value: string | number): void;
67
+ removeFilter(column: ColumnDescriptor): boolean;
68
+ get filter(): VuuFilter;
69
+ }
@@ -0,0 +1,7 @@
1
+ import { ColumnDescriptorsByName, Filter, SingleValueFilterClause } from "@vuu-ui/vuu-filter-types";
2
+ import type { RuntimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
+ export declare const filterAsQuery: (f: Filter, opts?: {
4
+ columnsByName?: ColumnDescriptorsByName;
5
+ }) => string;
6
+ export declare function dateFilterAsQuery(f: SingleValueFilterClause<number>): string;
7
+ export declare const removeColumnFromFilter: (column: RuntimeColumnDescriptor, filter: Filter) => [Filter | undefined, string];
@@ -0,0 +1,2 @@
1
+ export * from "./filter-utils";
2
+ export * from "./filterAsQuery";
@@ -0,0 +1,22 @@
1
+ import { VuuColumnDataType, VuuRowDataItemType } from "@vuu-ui/vuu-protocol-types";
2
+ import { KeyboardEvent, SyntheticEvent } from "react";
3
+ /**
4
+ * Use with the following convention:
5
+ *
6
+ * <FormField data-field="my-field-name">
7
+ */
8
+ export declare const getFieldName: (target: EventTarget | HTMLElement) => string;
9
+ export type InputSource = "typeahead-suggestion" | "text-input";
10
+ export declare const isNumber: (type: string, value: VuuRowDataItemType) => value is number;
11
+ export type CommitHandler<E extends HTMLElement = HTMLInputElement, T extends VuuRowDataItemType = VuuRowDataItemType> = (evt: SyntheticEvent<E> | KeyboardEvent<E>, value: T, source?: InputSource) => void;
12
+ /**
13
+ * Convert a string value to the type appropriate for the associated
14
+ * column or form field. Can be used when processing a string value
15
+ * from an input used for user editing.
16
+ *
17
+ * @param value
18
+ * @param type
19
+ * @param throwIfInvalid
20
+ */
21
+ export declare function getTypedValue(value: string, type: VuuColumnDataType | "number", throwIfInvalid?: false): VuuRowDataItemType | undefined;
22
+ export declare function getTypedValue(value: string, type: VuuColumnDataType | "number", throwIfInvalid: true): VuuRowDataItemType;
@@ -0,0 +1,14 @@
1
+ import { ColumnDescriptor, ValueFormatter } from "@vuu-ui/vuu-table-types";
2
+ export type ValueFormatters = {
3
+ [key: string]: ValueFormatter;
4
+ };
5
+ export declare const defaultValueFormatter: (value: unknown) => string;
6
+ export declare const numericFormatter: ({ align, type, }: Partial<ColumnDescriptor>) => (value: unknown) => string;
7
+ export declare const getValueFormatter: (column: ColumnDescriptor, serverDataType?: import("@vuu-ui/vuu-protocol-types").VuuColumnDataType | undefined) => ValueFormatter;
8
+ /**
9
+ * Lowercases a string and returns as Lowercase typescript type
10
+ *
11
+ * @param str the input string
12
+ * @returns str converted to Lowercase
13
+ */
14
+ export declare const lowerCase: (str: string) => Lowercase<string>;
@@ -0,0 +1 @@
1
+ export declare const getUniqueId: () => string;
@@ -0,0 +1,10 @@
1
+ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
+ import { VuuGroupBy } from "@vuu-ui/vuu-protocol-types";
3
+ export declare function addGroupColumn(groupBy: VuuGroupBy, column: ColumnDescriptor): string[];
4
+ export declare const removeGroupColumn: (groupBy: VuuGroupBy, column: ColumnDescriptor) => string[];
5
+ export type ColumnGroupStatus = "no-groupby" | "single-groupby-other-column" | "single-groupby" | "multi-groupby-other-columns" | "multi-groupby-includes-column";
6
+ /**
7
+ * Given a VuuGroupby definition and a column, determine whether the given column
8
+ * is included in the grouping and if so, in what position/direction.
9
+ */
10
+ export declare const getGroupStatus: (columnName: string, groupBy?: VuuGroupBy) => ColumnGroupStatus;
@@ -0,0 +1,21 @@
1
+ export declare const createEl: (elementType: "div" | "p" | "span", className?: string, textContent?: string) => HTMLElement;
2
+ export declare const getFocusableElement: (el: HTMLElement | null, tabIndex?: number) => HTMLElement | undefined;
3
+ export declare const getElementDataIndex: (el: HTMLElement | null) => number;
4
+ export declare function queryClosest<T extends HTMLElement = HTMLElement>(el: HTMLElement | EventTarget | null, cssQueryString: string, throwIfNotFound?: false): T | null;
5
+ export declare function queryClosest<T extends HTMLElement = HTMLElement>(el: HTMLElement | EventTarget | null, cssQueryString: string, throwIfNotFound: true): T;
6
+ export declare const getClosest: (el: HTMLElement, dataProperty: string) => HTMLElement | null;
7
+ export declare const getClosestIndexItem: (el: HTMLElement) => HTMLElement | null;
8
+ export declare function getElementByDataIndex(c: HTMLElement | null | undefined, i: number | string, throwIfNotFound: true): HTMLElement;
9
+ export declare function getElementByDataIndex(c: HTMLElement | null | undefined, i: number | string, throwIfNotFound?: false): HTMLElement | undefined;
10
+ export declare const focusFirstFocusableElement: (el: HTMLElement | null, tabIndex?: number) => void;
11
+ export declare const isSelectableElement: (el?: HTMLElement | null) => boolean;
12
+ export declare const isInputElement: (el: HTMLElement | EventTarget | null) => el is HTMLInputElement;
13
+ export declare const isDateInput: (el: HTMLElement | EventTarget | null) => el is HTMLInputElement;
14
+ export declare const hasOpenOptionList: (el: HTMLElement | EventTarget | null) => boolean | undefined;
15
+ export declare function getScrollbarSize(): number;
16
+ export type MouseEventTypes = "dblclick" | "click";
17
+ export type KeyboardEventTypes = "keydown" | "keypress" | "keyup";
18
+ export declare const dispatchMouseEvent: (el: HTMLElement, type: MouseEventTypes) => void;
19
+ export declare const dispatchKeyboardEvent: (el: HTMLElement, type: KeyboardEventTypes, key: string) => void;
20
+ export type VuuDomEventType = "vuu-commit" | "vuu-dropped";
21
+ export declare const dispatchCustomEvent: (el: HTMLElement, type: VuuDomEventType) => void;
@@ -0,0 +1,67 @@
1
+ export * from "./array-utils";
2
+ export * from "./box-utils";
3
+ export * from "./broadcast-channel";
4
+ export * from "./column-utils";
5
+ export * from "./cookie-utils";
6
+ export * from "./component-registry";
7
+ export * from "./DataWindow";
8
+ export * from "./common-types";
9
+ export * from "./css-utils";
10
+ export * from "./data-utils";
11
+ export * from "./datasource/BaseDataSource";
12
+ export * from "./datasource/datasource-action-utils";
13
+ export * from "./datasource/datasource-filter-utils";
14
+ export * from "./datasource/datasource-utils";
15
+ export * from "./date";
16
+ export * from "./debug-utils";
17
+ export * from "./filters";
18
+ export * from "./html-utils";
19
+ export * from "./event-emitter";
20
+ export * from "./feature-utils";
21
+ export * from "./form-utils";
22
+ export * from "./formatting-utils";
23
+ export * from "./getUniqueId";
24
+ export * from "./group-utils";
25
+ export * from "./input-utils";
26
+ export * from "./invariant";
27
+ export * from "./itemToString";
28
+ export * from "./json-types";
29
+ export * from "./json-utils";
30
+ export * from "./keyboard-utils";
31
+ export * from "./keyset";
32
+ export * from "./layout-types";
33
+ export * from "./list-utils";
34
+ export * from "./local-storage-utils";
35
+ export * from "./logging-utils";
36
+ export * from "./menu-utils";
37
+ export * from "./module-utils";
38
+ export * from "./moving-window";
39
+ export * from "./nanoid";
40
+ export * from "./react-utils";
41
+ export * from "./round-decimal";
42
+ export * from "./perf-utils";
43
+ export * from "./promise-utils";
44
+ export * from "./protocol-message-utils";
45
+ export * from "./range-utils";
46
+ export * from "./row-utils";
47
+ export * from "./selection-utils";
48
+ export * from "./shell-layout-types";
49
+ export * from "./sort-utils";
50
+ export * from "./table-schema-utils";
51
+ export * from "./text-utils";
52
+ export * from "./typeahead-utils";
53
+ export * from "./tree-types";
54
+ export * from "./tree-utils";
55
+ export * from "./ThemeProvider";
56
+ export * from "./ts-utils";
57
+ export * from "./url-utils";
58
+ export * from "./useId";
59
+ export * from "./useStateRef";
60
+ export * from "./user-types";
61
+ export * from "./useLayoutEffectSkipFirst";
62
+ /** Context declarations hosted in utils to minimize intra package dependencies */
63
+ export * from "./ShellContext";
64
+ export * from "./context-definitions/DataContext";
65
+ export * from "./context-definitions/DataProvider";
66
+ export { DataSourceProvider, useDataSource, } from "./context-definitions/DataSourceProvider";
67
+ export * from "./context-definitions/WorkspaceContext";
@@ -0,0 +1,2 @@
1
+ export declare const isCharacterKey: (key: string) => boolean;
2
+ export declare const isQuoteKey: (evt: KeyboardEvent) => boolean;
@@ -0,0 +1 @@
1
+ export declare function invariant(condition: boolean, message: string): void;
@@ -0,0 +1,2 @@
1
+ export type ItemToStringFunction = (item: any) => string;
2
+ export declare function itemToString(item: unknown): string;
@@ -0,0 +1,52 @@
1
+ import { NamedFilter } from "@vuu-ui/vuu-filter-types";
2
+ import { CSSProperties, ReactElement } from "react";
3
+ export type ValueOf<T> = T[keyof T];
4
+ export interface ApplicationSettings {
5
+ leftNav?: {
6
+ activeTabIndex: number;
7
+ expanded: boolean;
8
+ };
9
+ /**
10
+ * filters are keyed by MODULE:tablename
11
+ */
12
+ filters?: {
13
+ [key: string]: NamedFilter[];
14
+ };
15
+ }
16
+ export type ApplicationSetting = ValueOf<ApplicationSettings>;
17
+ export type Settings = Record<string, string | number | boolean>;
18
+ export interface ApplicationJSON {
19
+ workspaceJSON: LayoutJSON | LayoutJSON[];
20
+ settings?: ApplicationSettings;
21
+ userSettings?: Settings;
22
+ }
23
+ export interface WithActive {
24
+ active?: number;
25
+ }
26
+ export interface WithProps {
27
+ props?: {
28
+ [key: string]: unknown;
29
+ };
30
+ }
31
+ export interface LayoutRoot extends WithProps {
32
+ active?: number;
33
+ children?: ReactElement[];
34
+ type: string;
35
+ }
36
+ export interface WithType {
37
+ props?: unknown;
38
+ title?: string;
39
+ type: string;
40
+ }
41
+ export type LayoutModel = LayoutRoot | ReactElement | WithType;
42
+ export interface LayoutJSON<T extends object = {
43
+ [key: string]: any;
44
+ }> extends WithType {
45
+ active?: number;
46
+ children?: LayoutJSON[];
47
+ id?: string;
48
+ props?: T;
49
+ state?: unknown;
50
+ type: string;
51
+ style?: CSSProperties;
52
+ }
@@ -0,0 +1,6 @@
1
+ import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
+ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
+ export type JsonData = {
4
+ [key: string]: unknown;
5
+ } | JsonData[];
6
+ export declare const jsonToDataSourceRows: (json: JsonData) => [ColumnDescriptor[], DataSourceRow[]];
@@ -0,0 +1,15 @@
1
+ export declare const ArrowUp = "ArrowUp";
2
+ export declare const ArrowDown = "ArrowDown";
3
+ export declare const ArrowLeft = "ArrowLeft";
4
+ export declare const ArrowRight = "ArrowRight";
5
+ export declare const Enter = "Enter";
6
+ export declare const Escape = "Escape";
7
+ export declare const Home = "Home";
8
+ export declare const End = "End";
9
+ export declare const PageUp = "PageUp";
10
+ export declare const PageDown = "PageDown";
11
+ export declare const Space = " ";
12
+ export declare const Tab = "Tab";
13
+ export type ArrowKey = "ArrowUp" | "ArrowDown" | "ArrowLeft" | "ArrowRight";
14
+ export type PageKey = "Home" | "End" | "PageUp" | "PageDown";
15
+ export declare const isArrowKey: (key: string) => key is ArrowKey;
@@ -0,0 +1,12 @@
1
+ import { VuuRange } from "@vuu-ui/vuu-protocol-types";
2
+ export declare class KeySet {
3
+ private keys;
4
+ private nextKeyValue;
5
+ private range;
6
+ constructor(range: VuuRange);
7
+ next(free?: number[]): number;
8
+ private init;
9
+ reset(range: VuuRange): boolean;
10
+ keyFor(rowIndex: number): number;
11
+ toDebugString(): string;
12
+ }
@@ -0,0 +1,22 @@
1
+ import { LayoutJSON } from "@vuu-ui/vuu-utils";
2
+ export interface WithId {
3
+ id: string;
4
+ }
5
+ export interface LayoutMetadata extends WithId {
6
+ name: string;
7
+ group: string;
8
+ screenshot: string;
9
+ user: string;
10
+ created: string;
11
+ }
12
+ export interface SystemLayoutMetadata extends LayoutMetadata {
13
+ layoutJSON: LayoutJSON;
14
+ }
15
+ export type LayoutMetadataDto = Omit<LayoutMetadata, "id" | "created">;
16
+ export interface Layout extends WithId {
17
+ json: LayoutJSON;
18
+ }
19
+ export type ApplicationLayout = {
20
+ username: string;
21
+ definition: LayoutJSON;
22
+ };
@@ -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,3 @@
1
+ export declare const getLocalEntity: <T>(url: string) => T | undefined;
2
+ export declare const getAllLocalEntity: <T>(url: string) => T[];
3
+ export declare const saveLocalEntity: <T>(url: string, data: T) => T | undefined;
@@ -0,0 +1,45 @@
1
+ declare global {
2
+ const loggingSettings: loggingSettings;
3
+ }
4
+ export interface LogFn {
5
+ (message?: unknown, ...optionalParams: unknown[]): void;
6
+ }
7
+ export interface AssertLogFn {
8
+ (condition: boolean, message?: unknown, errorMessaage?: unknown): void;
9
+ }
10
+ export interface TableLogFn {
11
+ (properties?: object): void;
12
+ }
13
+ type loggingSettings = {
14
+ loggingLevel: LogLevel;
15
+ };
16
+ export interface Logger {
17
+ warn: LogFn;
18
+ error: LogFn;
19
+ debug: LogFn;
20
+ info: LogFn;
21
+ }
22
+ export type LogLevel = keyof Logger;
23
+ export type BuildEnv = "production" | "development";
24
+ export declare const logger: (category: string) => {
25
+ errorEnabled: boolean;
26
+ error: (message: string) => void;
27
+ debugEnabled?: undefined;
28
+ infoEnabled?: undefined;
29
+ warnEnabled?: undefined;
30
+ info?: undefined;
31
+ warn?: undefined;
32
+ debug?: undefined;
33
+ } | {
34
+ debugEnabled: boolean;
35
+ infoEnabled: boolean;
36
+ warnEnabled: boolean;
37
+ errorEnabled: boolean;
38
+ info: (message: string) => void;
39
+ warn: (message: string) => void;
40
+ debug: (message: string) => void;
41
+ error: (message: string) => void;
42
+ };
43
+ export declare const getLoggingConfigForWorker: () => string;
44
+ export declare const logUnhandledMessage: (message: never, context?: string) => void;
45
+ export {};
@@ -0,0 +1,6 @@
1
+ import { MenuRpcResponse, OpenDialogActionWithSchema } from "@vuu-ui/vuu-data-types";
2
+ import { ShowNotificationAction, VuuRpcResponse } from "@vuu-ui/vuu-protocol-types";
3
+ import { ContextMenuGroupItemDescriptor, ContextMenuItemDescriptor } from "@vuu-ui/vuu-context-menu";
4
+ export declare const isGroupMenuItemDescriptor: (menuItem?: ContextMenuItemDescriptor) => menuItem is ContextMenuGroupItemDescriptor;
5
+ export declare const isOpenBulkEditResponse: (rpcResponse: Partial<VuuRpcResponse>) => rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema>;
6
+ export declare const hasShowNotificationAction: (res: Partial<VuuRpcResponse>) => res is MenuRpcResponse<ShowNotificationAction>;
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from "react";
2
+ export type ReactComponent = {
3
+ (props?: any): ReactElement;
4
+ };
5
+ export declare const isModule: (entity: Module | ReactComponent) => entity is Module;
6
+ export interface Module<T = ReactComponent> {
7
+ [key: string]: Module<T> | T;
8
+ }
@@ -0,0 +1,18 @@
1
+ import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
+ import { VuuRange } from "@vuu-ui/vuu-protocol-types";
3
+ import { WindowRange } from "./range-utils";
4
+ export declare class MovingWindow {
5
+ #private;
6
+ data: DataSourceRow[];
7
+ rowCount: number;
8
+ constructor({ from, to }: VuuRange);
9
+ setRowCount: (rowCount: number) => void;
10
+ add(data: DataSourceRow): void;
11
+ getAtIndex(index: number): DataSourceRow | undefined;
12
+ isWithinRange(index: number): boolean;
13
+ setRange({ from, to }: VuuRange): void;
14
+ getSelectedRows(): DataSourceRow[];
15
+ get range(): WindowRange;
16
+ slice(): DataSourceRow[];
17
+ get hasAllRowsWithinRange(): boolean;
18
+ }
@@ -0,0 +1 @@
1
+ export declare const uuid: (size?: number) => string;
@@ -0,0 +1,5 @@
1
+ type VoidFunction = (...args: any) => void;
2
+ export type PerfFunction<T extends VoidFunction> = (...args: Parameters<T>) => void;
3
+ export declare function debounce<T extends VoidFunction>(callback: T, timeInterval: number): PerfFunction<T>;
4
+ export declare function throttle<T extends VoidFunction>(callback: T, limit: number): PerfFunction<T>;
5
+ export {};
@@ -0,0 +1,8 @@
1
+ export declare class DeferredPromise<T = unknown> {
2
+ #private;
3
+ constructor();
4
+ get promise(): Promise<T>;
5
+ get isResolved(): boolean;
6
+ resolve(value: T): void;
7
+ get reject(): (err: unknown) => void;
8
+ }
@@ -0,0 +1,28 @@
1
+ import type { MenuRpcAction, MenuRpcResponse, OpenDialogActionWithSchema, RpcResponse, TableSchema, VuuUiMessageInRequestResponse } from "@vuu-ui/vuu-data-types";
2
+ import { VuuRpcMenuRequest, OpenDialogAction, VuuRpcEditCellRequest, VuuRowDataItemType, VuuRpcRequest, VuuRpcEditAddRowRequest, VuuDataRowDto, VuuRpcEditDeleteRowRequest, VuuRpcViewportRequest, VuuRpcResponse, VuuRpcMenuSuccess, VuuRpcViewportResponse } from "@vuu-ui/vuu-protocol-types";
3
+ export declare const isVuuMenuRpcRequest: (message: VuuRpcRequest | Omit<VuuRpcRequest, "vpId">) => message is VuuRpcMenuRequest;
4
+ export declare const isRequestResponse: (message: object) => message is VuuUiMessageInRequestResponse;
5
+ export declare const isOpenSessionTableDialogMessage: (rpcResponse: RpcResponse) => rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema>;
6
+ export declare const isOpenDialogAction: (action?: MenuRpcAction) => action is OpenDialogAction;
7
+ export declare function isViewportRpcRequest(request: VuuRpcRequest): request is VuuRpcViewportRequest;
8
+ export declare function isViewportRpcRequest(request: Omit<VuuRpcRequest, "vpId">): request is Omit<VuuRpcViewportRequest, "vpId">;
9
+ export declare function isEditCellRequest(request: VuuRpcRequest): request is VuuRpcEditCellRequest;
10
+ export declare function isEditCellRequest(request: Omit<VuuRpcRequest, "vpId">): request is Omit<VuuRpcEditCellRequest, "vpId">;
11
+ export declare function vuuEditCellRequest(rowKey: string, field: string, value: VuuRowDataItemType, vpId: string): VuuRpcEditCellRequest;
12
+ export declare function vuuEditCellRequest(rowKey: string, field: string, value: VuuRowDataItemType): Omit<VuuRpcEditCellRequest, "vpId">;
13
+ export declare function viewportRpcRequest(rpcName: string, vpId: string): VuuRpcViewportRequest;
14
+ export declare function viewportRpcRequest(rpcName: string): Omit<VuuRpcViewportRequest, "vpId">;
15
+ export declare function vuuAddRowRequest(rowKey: string, data: VuuDataRowDto, vpId: string): VuuRpcEditAddRowRequest;
16
+ export declare function vuuAddRowRequest(rowKey: string, data: VuuDataRowDto): Omit<VuuRpcEditAddRowRequest, "vpId">;
17
+ export declare function vuuDeleteRowRequest(rowKey: string, vpId: string): VuuRpcEditDeleteRowRequest;
18
+ export declare function vuuDeleteRowRequest(rowKey: string): Omit<VuuRpcEditDeleteRowRequest, "vpId">;
19
+ export declare const isSessionTable: (table?: unknown) => boolean;
20
+ export declare function isActionMessage(rpcResponse: VuuRpcResponse): rpcResponse is VuuRpcViewportResponse | VuuRpcMenuSuccess;
21
+ export declare function isActionMessage(rpcResponse: Omit<VuuRpcResponse, "vpId">): rpcResponse is Omit<VuuRpcViewportResponse, "vpId"> | Omit<VuuRpcMenuSuccess, "vpId">;
22
+ export declare function isSessionTableActionMessage(rpcResponse: VuuRpcResponse): rpcResponse is VuuRpcMenuSuccess<OpenDialogAction & {
23
+ tableSchema: TableSchema;
24
+ }>;
25
+ export declare function isSessionTableActionMessage(rpcResponse: Omit<VuuRpcResponse, "vpId">): rpcResponse is Omit<VuuRpcMenuSuccess<OpenDialogAction & {
26
+ tableSchema: TableSchema;
27
+ }>, "vpId">;
28
+ export declare const isRpcSuccess: (response: VuuRpcResponse | Omit<VuuRpcResponse, "vpId">) => response is VuuRpcViewportResponse;
@@ -0,0 +1,31 @@
1
+ import { VuuRange } from "@vuu-ui/vuu-protocol-types";
2
+ interface FromToRange {
3
+ from: number;
4
+ to: number;
5
+ }
6
+ export interface Range extends VuuRange {
7
+ equals: (vuuRange: VuuRange) => boolean;
8
+ firstRowInViewport: number;
9
+ lastRowInViewport: number;
10
+ renderBufferSize?: number;
11
+ reset: Range;
12
+ rowCount?: number;
13
+ }
14
+ export interface RangeOptions {
15
+ renderBufferSize?: number;
16
+ rowCount?: number;
17
+ }
18
+ export declare const Range: (from: number, to: number, rangeOptions?: RangeOptions) => Range;
19
+ export declare const NULL_RANGE: Range;
20
+ export declare function getFullRange({ from, to }: VuuRange, bufferSize?: number, totalRowCount?: number): FromToRange;
21
+ export declare const withinRange: (value: number, { from, to }: VuuRange) => boolean;
22
+ export declare const rangeNewItems: ({ from: from1, to: to1 }: VuuRange, newRange: VuuRange) => VuuRange;
23
+ export declare class WindowRange {
24
+ from: number;
25
+ to: number;
26
+ constructor(from: number, to: number);
27
+ isWithin(index: number): boolean;
28
+ overlap(from: number, to: number): [number, number];
29
+ copy(): WindowRange;
30
+ }
31
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ReactElement, ReactNode, SetStateAction } from "react";
2
+ export declare const asReactElements: (children: ReactNode) => ReactElement[];
3
+ export declare const useIsMounted: (id?: string) => import("react").RefObject<boolean>;
4
+ export declare const isSimpleStateValue: <T>(arg: SetStateAction<T>) => arg is T;
@@ -0,0 +1 @@
1
+ export declare function roundDecimal(value?: number, align?: string, decimals?: number, zeroPad?: boolean, alignOnDecimals?: boolean): string;
@@ -0,0 +1,24 @@
1
+ import type { DataSourceRow, DataSourceRowObject } from "@vuu-ui/vuu-data-types";
2
+ import type { MutableRefObject } from "react";
3
+ import { ColumnMap } from "./column-utils";
4
+ export type RowOffsetFunc = (row: DataSourceRow, pctScrollTop?: number) => number;
5
+ export type RowAtPositionFunc = (position: number) => number;
6
+ /**
7
+ * RowOffset function, RowAtPosition function, isVirtualScroll
8
+ */
9
+ export type RowPositioning = [RowOffsetFunc, RowAtPositionFunc, boolean];
10
+ export declare const actualRowPositioning: (rowHeight: number) => RowPositioning;
11
+ /**
12
+ * return functions for determining a) the pixel offset to apply to a row, given the
13
+ * row index and b) the index of the row at a given scroll offset. This implementation
14
+ * is used when we are forced to 'virtualise' scrolling - because the number of rows
15
+ * is high enough that we cannot create a large enough HTML content container.
16
+ *
17
+ * @param rowHeight
18
+ * @param virtualisedExtent
19
+ * @param pctScrollTop
20
+ * @returns
21
+ */
22
+ export declare const virtualRowPositioning: (rowHeight: number, virtualisedExtent: number, pctScrollTop: MutableRefObject<number>) => RowPositioning;
23
+ export type RowToObjectMapper = (row: DataSourceRow, columnMap: ColumnMap) => DataSourceRowObject;
24
+ export declare const asDataSourceRowObject: RowToObjectMapper;
@@ -0,0 +1,29 @@
1
+ import { DataSourceRow, Selection, SelectionItem } from "@vuu-ui/vuu-data-types";
2
+ import { TableSelectionModel } from "@vuu-ui/vuu-table-types";
3
+ export declare const RowSelected: {
4
+ False: number;
5
+ True: number;
6
+ First: number;
7
+ Last: number;
8
+ };
9
+ export declare const isRowSelected: (row: DataSourceRow) => boolean;
10
+ export declare const isRowSelectedLast: (row?: DataSourceRow) => boolean;
11
+ export declare const deselectItem: (selectionModel: TableSelectionModel, selected: Selection, itemIndex: number, rangeSelect: boolean, keepExistingSelection?: boolean) => Selection;
12
+ export declare const selectItem: (selectionModel: TableSelectionModel, selected: Selection, itemIndex: number, rangeSelect: boolean, keepExistingSelection?: boolean, activeItemIndex?: number) => Selection;
13
+ /**
14
+ * Determine the value for selected. We use a bitmap to represent a number of selection states
15
+ * a row might exhibit. selected/not-selected is the fundamental value. We also identify first
16
+ * row of a selected block, last row of a selected block;
17
+ */
18
+ export declare const getSelectionStatus: (selected: Selection, itemIndex: number) => number;
19
+ export declare const isSelected: (selected: Selection, itemIndex: number) => boolean;
20
+ /**
21
+ * Vuu server expects a full list if indexes of selected rows. Client represents selection in a more
22
+ * efficient structure. This converts client structure to full server format.
23
+ */
24
+ export declare const expandSelection: (selected: Selection) => number[];
25
+ export type SelectionDiff = {
26
+ added: SelectionItem[];
27
+ removed: SelectionItem[];
28
+ };
29
+ export declare const selectionCount: (selected?: Selection) => number;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The Vuu Shell creates the outermost application layout. This includes some
3
+ * 'special' identifiers that can be targetted by layout commands to effect or
4
+ * react to layout changes.
5
+ */
6
+ export declare const VuuShellLocation: {
7
+ readonly ContextPanel: "context-panel";
8
+ readonly MultiWorkspaceContainer: "vuu-multi-workspace-container";
9
+ readonly SidePanel: "vuu-side-panel";
10
+ readonly SideToolbar: "vuu-side-toolbar";
11
+ readonly Workspace: "vuu-workspace";
12
+ readonly WorkspaceContainer: "vuu-workspace-container";
13
+ };
14
+ export type VuuShellLocation = (typeof VuuShellLocation)[keyof typeof VuuShellLocation];
@@ -0,0 +1,11 @@
1
+ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
+ import { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
3
+ export declare const toggleOrApplySort: ({ sortDefs }: VuuSort, { name: column }: ColumnDescriptor, extendSort?: boolean, sortType?: VuuSortType) => VuuSort;
4
+ export declare const setSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
5
+ export declare const addSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
6
+ export type ColumnSortStatus = "no-sort" | "sort-other-column" | "single-sort-asc" | "single-sort-desc" | "multi-sort-includes-column-asc" | "multi-sort-includes-column-desc";
7
+ /**
8
+ * Given a VuuSort definition and a column, determine whether the given column
9
+ * is included in the sort and if so, in what position/direction.
10
+ */
11
+ export declare const getSortStatus: (columnName: string, vuuSort?: VuuSort) => ColumnSortStatus;
@@ -0,0 +1,3 @@
1
+ import { TableSchemaTable } from "@vuu-ui/vuu-data-types";
2
+ import { VuuTable } from "@vuu-ui/vuu-protocol-types";
3
+ export declare const getVuuTable: (schemaTable: TableSchemaTable) => VuuTable;
@@ -0,0 +1,2 @@
1
+ export declare const lastWord: (text: string) => string;
2
+ export declare const wordify: (text: string) => string;