@vuu-ui/vuu-utils 3.3.9 → 3.3.11

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 (78) hide show
  1. package/package.json +6 -6
  2. package/types/src/Clock.d.ts +20 -0
  3. package/types/src/PageVisibilityObserver.d.ts +36 -0
  4. package/types/src/ScaledDecimal.d.ts +12 -0
  5. package/types/src/ShellContext.d.ts +11 -0
  6. package/types/src/ThemeProvider.d.ts +32 -0
  7. package/types/src/array-utils.d.ts +16 -0
  8. package/types/src/box-utils.d.ts +24 -0
  9. package/types/src/broadcast-channel.d.ts +16 -0
  10. package/types/src/column-utils.d.ts +243 -0
  11. package/types/src/common-types.d.ts +6 -0
  12. package/types/src/component-registry.d.ts +65 -0
  13. package/types/src/context-definitions/DataContext.d.ts +21 -0
  14. package/types/src/context-definitions/DataProvider.d.ts +7 -0
  15. package/types/src/context-definitions/DataSourceProvider.d.ts +12 -0
  16. package/types/src/context-definitions/WorkspaceContext.d.ts +17 -0
  17. package/types/src/cookie-utils.d.ts +9 -0
  18. package/types/src/css-utils.d.ts +1 -0
  19. package/types/src/data-utils.d.ts +33 -0
  20. package/types/src/datasource/BaseDataSource.d.ts +63 -0
  21. package/types/src/datasource/datasource-action-utils.d.ts +7 -0
  22. package/types/src/datasource/datasource-filter-utils.d.ts +2 -0
  23. package/types/src/datasource/datasource-utils.d.ts +61 -0
  24. package/types/src/date/date-utils.d.ts +39 -0
  25. package/types/src/date/dateTimePattern.d.ts +8 -0
  26. package/types/src/date/formatter.d.ts +9 -0
  27. package/types/src/date/index.d.ts +4 -0
  28. package/types/src/date/types.d.ts +29 -0
  29. package/types/src/debug-utils.d.ts +9 -0
  30. package/types/src/edit-utils.d.ts +2 -0
  31. package/types/src/errors.d.ts +2 -0
  32. package/types/src/event-emitter.d.ts +21 -0
  33. package/types/src/feature-utils.d.ts +110 -0
  34. package/types/src/filters/filter-utils.d.ts +75 -0
  35. package/types/src/filters/filterAsQuery.d.ts +8 -0
  36. package/types/src/filters/index.d.ts +2 -0
  37. package/types/src/form-utils.d.ts +37 -0
  38. package/types/src/formatting-utils.d.ts +14 -0
  39. package/types/src/getUniqueId.d.ts +1 -0
  40. package/types/src/group-utils.d.ts +10 -0
  41. package/types/src/html-utils.d.ts +21 -0
  42. package/types/src/index.d.ts +76 -0
  43. package/types/src/input-utils.d.ts +2 -0
  44. package/types/src/invariant.d.ts +1 -0
  45. package/types/src/itemToString.d.ts +2 -0
  46. package/types/src/json-types.d.ts +52 -0
  47. package/types/src/json-utils.d.ts +6 -0
  48. package/types/src/keyboard-utils.d.ts +15 -0
  49. package/types/src/keyset.d.ts +16 -0
  50. package/types/src/layout-types.d.ts +22 -0
  51. package/types/src/list-utils.d.ts +2 -0
  52. package/types/src/local-storage-utils.d.ts +4 -0
  53. package/types/src/logging-utils.d.ts +45 -0
  54. package/types/src/module-utils.d.ts +8 -0
  55. package/types/src/nanoid/index.d.ts +1 -0
  56. package/types/src/perf-utils.d.ts +5 -0
  57. package/types/src/promise-utils.d.ts +8 -0
  58. package/types/src/protocol-message-utils.d.ts +43 -0
  59. package/types/src/range-utils.d.ts +29 -0
  60. package/types/src/react-utils.d.ts +15 -0
  61. package/types/src/round-decimal.d.ts +4 -0
  62. package/types/src/row-utils.d.ts +28 -0
  63. package/types/src/selection-utils.d.ts +9 -0
  64. package/types/src/shell-layout-types.d.ts +15 -0
  65. package/types/src/sort-utils.d.ts +11 -0
  66. package/types/src/table-schema-utils.d.ts +5 -0
  67. package/types/src/text-utils.d.ts +10 -0
  68. package/types/src/theme-utils.d.ts +14 -0
  69. package/types/src/tree-types.d.ts +9 -0
  70. package/types/src/tree-utils.d.ts +9 -0
  71. package/types/src/ts-utils.d.ts +20 -0
  72. package/types/src/typeahead-utils.d.ts +1 -0
  73. package/types/src/url-utils.d.ts +3 -0
  74. package/types/src/useId.d.ts +1 -0
  75. package/types/src/useLayoutEffectSkipFirst.d.ts +2 -0
  76. package/types/src/useResizeObserver.d.ts +15 -0
  77. package/types/src/useStateRef.d.ts +2 -0
  78. package/types/src/user-types.d.ts +3 -0
@@ -0,0 +1,76 @@
1
+ import { RestrictToHorizontalAxis } from "@dnd-kit/abstract/modifiers";
2
+ import { KeyboardSensor, PointerSensor } from "@dnd-kit/dom";
3
+ import { DragDropProvider, DragOverlay, useInstance } from "@dnd-kit/react";
4
+ import { useSortable } from "@dnd-kit/react/sortable";
5
+ export * from "./array-utils";
6
+ export * from "./box-utils";
7
+ export * from "./broadcast-channel";
8
+ export { Clock } from "./Clock";
9
+ export * from "./column-utils";
10
+ export * from "./common-types";
11
+ export * from "./component-registry";
12
+ export * from "./cookie-utils";
13
+ export * from "./css-utils";
14
+ export * from "./data-utils";
15
+ export * from "./datasource/BaseDataSource";
16
+ export * from "./datasource/datasource-action-utils";
17
+ export * from "./datasource/datasource-filter-utils";
18
+ export * from "./datasource/datasource-utils";
19
+ export * from "./date";
20
+ export * from "./debug-utils";
21
+ export { isInlineEditingSession } from "./edit-utils";
22
+ export { StaleUpdateError } from "./errors";
23
+ export * from "./event-emitter";
24
+ export * from "./feature-utils";
25
+ export * from "./filters";
26
+ export * from "./form-utils";
27
+ export * from "./formatting-utils";
28
+ export * from "./getUniqueId";
29
+ export * from "./group-utils";
30
+ export * from "./html-utils";
31
+ export * from "./input-utils";
32
+ export * from "./invariant";
33
+ export * from "./itemToString";
34
+ export * from "./json-types";
35
+ export * from "./json-utils";
36
+ export * from "./keyboard-utils";
37
+ export * from "./keyset";
38
+ export * from "./layout-types";
39
+ export * from "./list-utils";
40
+ export * from "./local-storage-utils";
41
+ export * from "./logging-utils";
42
+ export * from "./module-utils";
43
+ export * from "./nanoid";
44
+ export * from "./perf-utils";
45
+ export * from "./promise-utils";
46
+ export * from "./protocol-message-utils";
47
+ export * from "./range-utils";
48
+ export * from "./react-utils";
49
+ export * from "./round-decimal";
50
+ export * from "./row-utils";
51
+ export * from "./ScaledDecimal";
52
+ export * from "./selection-utils";
53
+ export * from "./shell-layout-types";
54
+ export * from "./sort-utils";
55
+ export * from "./table-schema-utils";
56
+ export * from "./text-utils";
57
+ export * from "./ThemeProvider";
58
+ export * from "./tree-types";
59
+ export * from "./tree-utils";
60
+ export * from "./ts-utils";
61
+ export * from "./typeahead-utils";
62
+ export * from "./url-utils";
63
+ export * from "./useId";
64
+ export * from "./useLayoutEffectSkipFirst";
65
+ export * from "./user-types";
66
+ export { useResizeObserver, WidthHeight, WidthOnly, type measurements, type ResizeHandler, } from "./useResizeObserver";
67
+ export * from "./useStateRef";
68
+ export { DragDropProvider, DragOverlay, KeyboardSensor, PointerSensor, RestrictToHorizontalAxis, useInstance, useSortable, };
69
+ /** Context declarations hosted in utils to minimize intra package dependencies */
70
+ export { DataContext } from "./context-definitions/DataContext";
71
+ export * from "./context-definitions/DataProvider";
72
+ export { DataSourceProvider, useDataSource, } from "./context-definitions/DataSourceProvider";
73
+ export * from "./context-definitions/WorkspaceContext";
74
+ export { PageVisibilityObserver } from "./PageVisibilityObserver";
75
+ export * from "./ShellContext";
76
+ export { ThemeLoadChecker } from "./theme-utils";
@@ -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
+ import { ValueOf } from "./ts-utils";
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,16 @@
1
+ import { VuuRange } from "@vuu-ui/vuu-protocol-types";
2
+ export interface IKeySet {
3
+ keyFor: (rowIndex: number) => number;
4
+ reset: (range: VuuRange) => void;
5
+ }
6
+ export declare class KeySet implements IKeySet {
7
+ private keys;
8
+ private nextKeyValue;
9
+ private range;
10
+ constructor(range: VuuRange);
11
+ next(free?: number[]): number;
12
+ private init;
13
+ reset(range: VuuRange): boolean;
14
+ keyFor(rowIndex: number): number;
15
+ toDebugString(): string;
16
+ }
@@ -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,4 @@
1
+ export declare const getLocalEntity: <T>(key: string, deleteOnRead?: boolean) => T | undefined;
2
+ export declare const clearLocalEntity: (key: string) => boolean;
3
+ export declare const getAllLocalEntity: <T>(url: string) => T[];
4
+ export declare const saveLocalEntity: <T>(key: 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,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 @@
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,43 @@
1
+ import type { MenuRpcAction, MenuRpcResponse, OpenDialogActionWithSchema, RpcResponse, TableSchema, VuuUiMessageInRequestResponse } from "@vuu-ui/vuu-data-types";
2
+ import { VuuRpcMenuRequest, OpenDialogAction, VuuRpcRequest, VuuRpcResponse, VuuRpcMenuSuccess, VuuViewportRpcTypeaheadRequest, VuuRpcServiceRequest, ViewportRpcContext, OpenComponentInDialogAction, VuuLoginSuccessResponse, SelectRequest, SelectResponse, SelectSuccessWithRowCount, VuuViewportCreateSuccessResponse, VuuViewportCreateResponse, InvalidTokenReason, InvalidSessionReason, LoginErrorMessage, RpcResult, RpcResultSuccess, RpcResultError, VuuColumnDataType, VuuNumericType, AddRowRpcServiceRequest, EndEditSessionRpcServiceRequest, EditCellRpcServiceRequest, BeginEditSessionRpcServiceRequest, UndoRowChangeRpcServiceRequest, DeleteSelectedRowsRpcServiceRequest, CreateSessionTableRpcServiceRequest, ServerToClientError } from "@vuu-ui/vuu-protocol-types";
3
+ export declare const INVALID_SESSION: InvalidSessionReason;
4
+ export declare const SESSION_LIMIT_EXCEEDED: InvalidSessionReason;
5
+ export declare const INVALID_TOKEN: InvalidTokenReason;
6
+ export declare const TOKEN_EXPIRED: InvalidTokenReason;
7
+ export declare const isErrorMessage: (message: unknown) => message is ServerToClientError;
8
+ export declare const isLoginErrorMessage: (message: unknown) => message is LoginErrorMessage;
9
+ export declare const isSelectRequest: (message: object) => message is SelectRequest;
10
+ export declare const isSelectSuccessWithRowCount: (response: SelectResponse | SelectSuccessWithRowCount) => response is SelectSuccessWithRowCount;
11
+ export declare const isRpcServiceRequest: (message: {
12
+ type: string;
13
+ }) => message is VuuRpcServiceRequest | Omit<VuuRpcServiceRequest, "context">;
14
+ export declare const hasViewPortContext: (message: VuuRpcServiceRequest) => message is VuuRpcServiceRequest<ViewportRpcContext>;
15
+ export declare const isVuuMenuRpcRequest: (message: VuuRpcRequest | Omit<VuuRpcRequest, "vpId">) => message is VuuRpcMenuRequest;
16
+ export declare const isLoginResponse: (message: unknown) => message is VuuLoginSuccessResponse;
17
+ export declare const isRpcSuccess: (rpcResult?: RpcResult) => rpcResult is RpcResultSuccess;
18
+ export declare const isRpcError: (rpcResult?: RpcResult) => rpcResult is RpcResultError;
19
+ export declare const isRequestResponse: (message: object) => message is VuuUiMessageInRequestResponse;
20
+ export declare const isOpenSessionTableDialogMessage: (rpcResponse: RpcResponse) => rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema>;
21
+ export declare const isOpenDialogAction: (action?: MenuRpcAction) => action is OpenDialogAction;
22
+ export declare const isTypeaheadRequest: (request: Omit<VuuRpcRequest, "vpId">) => request is Omit<VuuViewportRpcTypeaheadRequest, "vpId">;
23
+ export declare const isCreateVpSuccess: (response: VuuViewportCreateResponse) => response is VuuViewportCreateSuccessResponse;
24
+ export declare const isSessionTable: (table?: unknown) => boolean;
25
+ export declare function isActionMessage(rpcResponse: VuuRpcResponse): rpcResponse is VuuRpcMenuSuccess;
26
+ export declare function isActionMessage(rpcResponse: Omit<VuuRpcResponse, "vpId">): rpcResponse is Omit<VuuRpcMenuSuccess, "vpId">;
27
+ export declare function isSessionTableActionMessage(rpcResponse: VuuRpcResponse): rpcResponse is VuuRpcMenuSuccess<OpenDialogAction & {
28
+ tableSchema: TableSchema;
29
+ }>;
30
+ export declare function isSessionTableActionMessage(rpcResponse: Omit<VuuRpcResponse, "vpId">): rpcResponse is Omit<VuuRpcMenuSuccess<OpenDialogAction & {
31
+ tableSchema: TableSchema;
32
+ }>, "vpId">;
33
+ export declare function isCustomComponentActionMessage(rpcResponse: VuuRpcResponse | Omit<VuuRpcResponse, "vpId">): rpcResponse is VuuRpcMenuSuccess<OpenComponentInDialogAction & {
34
+ tableSchema: TableSchema;
35
+ }>;
36
+ export declare function isNumericType(dataType?: VuuColumnDataType): dataType is VuuNumericType;
37
+ export declare const isAddRowRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is AddRowRpcServiceRequest;
38
+ export declare const isEditCellRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is EditCellRpcServiceRequest;
39
+ export declare const isBeginEditSessionRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is BeginEditSessionRpcServiceRequest;
40
+ export declare const isEndEditSessionRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is EndEditSessionRpcServiceRequest;
41
+ export declare const isUndoRowChangeRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is UndoRowChangeRpcServiceRequest;
42
+ export declare const isDeleteSelectedRowsRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is DeleteSelectedRowsRpcServiceRequest;
43
+ export declare const isCreateSessionTableRpcRequest: (rpcRequest: VuuRpcServiceRequest) => rpcRequest is CreateSessionTableRpcServiceRequest;
@@ -0,0 +1,29 @@
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
+ reset: Range;
9
+ withBuffer: VuuRange;
10
+ }
11
+ export interface RangeOptions {
12
+ renderBufferSize?: number;
13
+ rowCount?: number;
14
+ }
15
+ export declare const Range: (from: number, to: number, renderBufferSize?: number) => Range;
16
+ export declare const NULL_RANGE: Range;
17
+ export declare function getFullRange({ from, to }: VuuRange, bufferSize?: number, maxRangeEnd?: number): FromToRange;
18
+ export declare const withinRange: (value: number, { from, to }: VuuRange) => boolean;
19
+ export declare const rangeNewItems: ({ from: from1, to: to1 }: VuuRange, newRange: VuuRange) => VuuRange;
20
+ export declare class WindowRange {
21
+ from: number;
22
+ to: number;
23
+ constructor(from: number, to: number);
24
+ isWithin(index: number): boolean;
25
+ overlap(from: number, to: number): [number, number];
26
+ copy(): WindowRange;
27
+ }
28
+ export declare const constrainRange: (range: VuuRange, maxRangeEnd: number, maxRangeWidth?: number) => VuuRange;
29
+ export {};
@@ -0,0 +1,15 @@
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;
5
+ /**
6
+ * From an example by stack overflow user Maxim G
7
+ */
8
+ export declare const createSyntheticEvent: <T extends Element, E extends Event>(event: E) => React.SyntheticEvent<T, E>;
9
+ /**
10
+ * Store a value in a RefObject and update that ref whenever the value changes.
11
+ * Use to maintain a stable reference to a changing value that we need to use
12
+ * within a hook, but when that hook does not need to be triggered just because
13
+ * this value changes.
14
+ */
15
+ export declare const useStableReference: <T>(value: T) => import("react").RefObject<T>;
@@ -0,0 +1,4 @@
1
+ import { RoundingRule } from "@vuu-ui/vuu-table-types";
2
+ export declare const exceedsMaxSafeInteger: (value: string) => boolean;
3
+ export declare function roundDecimal(value?: number, align?: string, decimals?: number, zeroPad?: boolean, alignOnDecimals?: boolean, useLocaleString?: boolean, roundingRule?: RoundingRule): string;
4
+ export declare function roundScaledDecimal(value: string, align?: string, decimals?: number, zeroPad?: boolean, alignOnDecimals?: boolean, useLocaleString?: boolean, roundingRule?: RoundingRule): string;
@@ -0,0 +1,28 @@
1
+ import type { DataSourceRow, DataSourceRowObject } from "@vuu-ui/vuu-data-types";
2
+ import { ColumnMap } from "./column-utils";
3
+ import { IKeySet } from "./keyset";
4
+ import { VuuRow } from "@vuu-ui/vuu-protocol-types";
5
+ import { RefObject } from "react";
6
+ import { DataRow } from "@vuu-ui/vuu-table-types";
7
+ export type RowOffsetFunc = (dataRow: DataRow, pctScrollTop?: number) => number;
8
+ export type RowAtPositionFunc = (position: number) => number;
9
+ /**
10
+ * RowOffset function, RowAtPosition function, isVirtualScroll
11
+ */
12
+ export type RowPositioning = [RowOffsetFunc, RowAtPositionFunc, boolean];
13
+ export declare const actualRowPositioning: (rowHeight: number) => RowPositioning;
14
+ /**
15
+ * return functions for determining a) the pixel offset to apply to a row, given the
16
+ * row index and b) the index of the row at a given scroll offset. This implementation
17
+ * is used when we are forced to 'virtualise' scrolling - because the number of rows
18
+ * is high enough that we cannot create a large enough HTML content container.
19
+ *
20
+ * @param rowHeight
21
+ * @param virtualisedExtent
22
+ * @param pctScrollTop
23
+ * @returns
24
+ */
25
+ export declare const virtualRowPositioning: (rowHeight: number, virtualisedExtent: number, pctScrollTop: RefObject<number>) => RowPositioning;
26
+ export type RowToObjectMapper = (row: DataSourceRow, columnMap: ColumnMap) => DataSourceRowObject;
27
+ export declare const asDataSourceRowObject: RowToObjectMapper;
28
+ export declare const vuuRowToDataSourceRow: ({ rowIndex, rowKey, sel: isSelected, ts, data }: VuuRow, keys: IKeySet) => DataSourceRow;
@@ -0,0 +1,9 @@
1
+ import { DataRow, TableSelectionModel } from "@vuu-ui/vuu-table-types";
2
+ import { SelectRequest } from "@vuu-ui/vuu-protocol-types";
3
+ export declare const deselectItem: (selectionModel: TableSelectionModel, rowKey: string, rangeSelect: boolean, preserveExistingSelection?: boolean) => Omit<SelectRequest, "vpId"> | undefined;
4
+ export declare const selectItem: (selectionModel: TableSelectionModel, rowKey: string, rangeSelect: boolean, preserveExistingSelection?: boolean, activeRowKey?: string) => Omit<SelectRequest, "vpId"> | undefined;
5
+ /**
6
+ * Split a row range into sub-ranges that exclude non-selectable rows.
7
+ * Returns one SELECT_ROW_RANGE per consecutive run of selectable rows.
8
+ */
9
+ export declare const splitSelectableRanges: (rows: DataRow[], isRowSelectable: (row: DataRow) => boolean, preserveExistingSelection: boolean) => Omit<SelectRequest, "vpId">[];
@@ -0,0 +1,15 @@
1
+ import { ValueOf } from "./ts-utils";
2
+ /**
3
+ * The Vuu Shell creates the outermost application layout. This includes some
4
+ * 'special' identifiers that can be targetted by layout commands to effect or
5
+ * react to layout changes.
6
+ */
7
+ export declare const VuuShellLocation: {
8
+ readonly ContextPanel: "context-panel";
9
+ readonly MultiWorkspaceContainer: "vuu-multi-workspace-container";
10
+ readonly SidePanel: "vuu-side-panel";
11
+ readonly SideToolbar: "vuu-side-toolbar";
12
+ readonly Workspace: "vuu-workspace";
13
+ readonly WorkspaceContainer: "vuu-workspace-container";
14
+ };
15
+ export type VuuShellLocation = ValueOf<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,5 @@
1
+ import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
+ import type { SchemaColumn, TableSchemaTable } from "@vuu-ui/vuu-data-types";
3
+ import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
4
+ export declare const toSchemaColumn: ({ editable, name, serverDataType, }: ColumnDescriptor) => SchemaColumn;
5
+ export declare const getVuuTable: (schemaTable: TableSchemaTable) => VuuTable;
@@ -0,0 +1,10 @@
1
+ export type SingularPluralForm = {
2
+ singular: string;
3
+ plural: string;
4
+ };
5
+ export type ItemTypeName = string | SingularPluralForm;
6
+ export declare const lastWord: (text: string) => string;
7
+ export declare const capitalize: (text: string) => string;
8
+ export declare const singularForm: (typeName: ItemTypeName) => string;
9
+ export declare const pluralForm: (typeName: ItemTypeName) => string;
10
+ export declare const wordify: (text: string) => string;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Checks that a theme is loaded by making sure a known css variable
4
+ * returns a value. Not normally needed except for cases where a theme
5
+ * is loaded dynamically on startup and there may be components that
6
+ * may fail if theme is not in place (eg component that rely on taking dom
7
+ * measurements).
8
+ * Used by Showcase.
9
+ */
10
+ export declare const ThemeLoadChecker: ({ children, cssToken, theme, }: {
11
+ children: ReactNode;
12
+ cssToken?: string;
13
+ theme: string;
14
+ }) => ReactNode;
@@ -0,0 +1,9 @@
1
+ export interface TreeSourceNode<T = unknown> {
2
+ nodeData?: T;
3
+ id: string;
4
+ icon?: string;
5
+ header?: boolean;
6
+ label: string;
7
+ childNodes?: TreeSourceNode<T>[];
8
+ tags?: string[];
9
+ }
@@ -0,0 +1,9 @@
1
+ import { TreeSourceNode } from "./tree-types";
2
+ import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
3
+ import { DataSourceRow } from "@vuu-ui/vuu-data-types";
4
+ import { IconProvider } from "@vuu-ui/vuu-data-local/src/tree-data-source/IconProvider";
5
+ export declare const treeToDataSourceRows: (treeSourceNodes: TreeSourceNode[], iconProvider?: IconProvider) => [ColumnDescriptor[], DataSourceRow[]];
6
+ export declare const lastPathSegment: (path: string, separator?: string) => string;
7
+ export declare const dropLastPathSegment: (path: string, separator?: string) => string;
8
+ export declare const getParentRow: (rows: DataSourceRow[], row: DataSourceRow) => DataSourceRow | undefined;
9
+ export declare const missingAncestor: (row: DataSourceRow, previousRow?: DataSourceRow) => boolean;
@@ -0,0 +1,20 @@
1
+ import { JSXElementConstructor, ReactElement } from "react";
2
+ import { LayoutJSON } from "./json-types";
3
+ export declare function isNotNullOrUndefined<T>(value: T | undefined | null): value is NonNullable<T>;
4
+ export declare const isObject: (o: unknown) => o is object;
5
+ export type OptionalProperty<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
6
+ export type ValueOf<T> = T[keyof T];
7
+ /**
8
+ * test whether a given react element implements a custom toJSON
9
+ * serialisation (static) method.
10
+ */
11
+ type JsonEnabledJSXElementConstructor<P> = JSXElementConstructor<P> & {
12
+ toJSON: (el: ReactElement) => LayoutJSON<any>;
13
+ };
14
+ interface ReactElementWithJSON<P = any, T extends JsonEnabledJSXElementConstructor<any> = JsonEnabledJSXElementConstructor<any>> {
15
+ type: T;
16
+ props: P;
17
+ key: string | null;
18
+ }
19
+ export declare const elementImplementsJSONSerialization: (element: ReactElement) => element is ReactElementWithJSON;
20
+ export {};
@@ -0,0 +1 @@
1
+ export declare const NO_DATA_MATCH: string[];
@@ -0,0 +1,3 @@
1
+ export declare function getUrlParameter(paramName: string): string | undefined;
2
+ export declare function getUrlParameter(paramName: string, defaultValue: string): string;
3
+ export declare const hasUrlParameter: (paramName: string) => boolean;
@@ -0,0 +1 @@
1
+ export declare const useId: (id?: string) => string;
@@ -0,0 +1,2 @@
1
+ import { DependencyList, EffectCallback } from "react";
2
+ export declare const useLayoutEffectSkipFirst: (func: EffectCallback, deps: DependencyList) => void;
@@ -0,0 +1,15 @@
1
+ import { RefObject } from "react";
2
+ export declare const WidthHeight: string[];
3
+ export declare const WidthOnly: string[];
4
+ export type measurements<T = string | number> = {
5
+ height?: T;
6
+ clientHeight?: number;
7
+ clientWidth?: number;
8
+ contentHeight?: number;
9
+ contentWidth?: number;
10
+ scrollHeight?: number;
11
+ scrollWidth?: number;
12
+ width?: T;
13
+ };
14
+ export type ResizeHandler = (measurements: measurements<number>) => void;
15
+ export declare function useResizeObserver(ref: RefObject<Element | HTMLElement | null>, dimensions: readonly string[], onResize: ResizeHandler, reportInitialSize?: boolean): void;
@@ -0,0 +1,2 @@
1
+ import { Dispatch, RefObject, SetStateAction } from "react";
2
+ export declare const useStateRef: <T = string>(initialValue: T) => [RefObject<T>, Dispatch<SetStateAction<T>>];
@@ -0,0 +1,3 @@
1
+ export type VuuUser = {
2
+ username: string;
3
+ };