@vuu-ui/vuu-utils 0.13.3 → 0.13.4

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 (74) hide show
  1. package/package.json +9 -11
  2. package/types/DataWindow.d.ts +0 -39
  3. package/types/ShellContext.d.ts +0 -11
  4. package/types/ThemeProvider.d.ts +0 -32
  5. package/types/array-utils.d.ts +0 -8
  6. package/types/box-utils.d.ts +0 -24
  7. package/types/broadcast-channel.d.ts +0 -16
  8. package/types/column-utils.d.ts +0 -175
  9. package/types/common-types.d.ts +0 -6
  10. package/types/component-registry.d.ts +0 -62
  11. package/types/context-definitions/DataContext.d.ts +0 -19
  12. package/types/context-definitions/DataProvider.d.ts +0 -8
  13. package/types/context-definitions/DataSourceProvider.d.ts +0 -12
  14. package/types/context-definitions/WorkspaceContext.d.ts +0 -17
  15. package/types/cookie-utils.d.ts +0 -1
  16. package/types/css-utils.d.ts +0 -1
  17. package/types/data-utils.d.ts +0 -19
  18. package/types/datasource/BaseDataSource.d.ts +0 -46
  19. package/types/datasource/datasource-action-utils.d.ts +0 -7
  20. package/types/datasource/datasource-filter-utils.d.ts +0 -2
  21. package/types/datasource/datasource-utils.d.ts +0 -45
  22. package/types/date/date-utils.d.ts +0 -2
  23. package/types/date/dateTimePattern.d.ts +0 -8
  24. package/types/date/formatter.d.ts +0 -4
  25. package/types/date/index.d.ts +0 -4
  26. package/types/date/types.d.ts +0 -24
  27. package/types/debug-utils.d.ts +0 -9
  28. package/types/event-emitter.d.ts +0 -21
  29. package/types/feature-utils.d.ts +0 -104
  30. package/types/filters/filter-utils.d.ts +0 -69
  31. package/types/filters/filterAsQuery.d.ts +0 -7
  32. package/types/filters/index.d.ts +0 -2
  33. package/types/form-utils.d.ts +0 -22
  34. package/types/formatting-utils.d.ts +0 -14
  35. package/types/getUniqueId.d.ts +0 -1
  36. package/types/group-utils.d.ts +0 -10
  37. package/types/html-utils.d.ts +0 -21
  38. package/types/index.d.ts +0 -67
  39. package/types/input-utils.d.ts +0 -2
  40. package/types/invariant.d.ts +0 -1
  41. package/types/itemToString.d.ts +0 -2
  42. package/types/json-types.d.ts +0 -52
  43. package/types/json-utils.d.ts +0 -6
  44. package/types/keyboard-utils.d.ts +0 -15
  45. package/types/keyset.d.ts +0 -12
  46. package/types/layout-types.d.ts +0 -22
  47. package/types/list-utils.d.ts +0 -2
  48. package/types/local-storage-utils.d.ts +0 -3
  49. package/types/logging-utils.d.ts +0 -45
  50. package/types/menu-utils.d.ts +0 -6
  51. package/types/module-utils.d.ts +0 -8
  52. package/types/moving-window.d.ts +0 -18
  53. package/types/nanoid/index.d.ts +0 -1
  54. package/types/perf-utils.d.ts +0 -5
  55. package/types/promise-utils.d.ts +0 -8
  56. package/types/protocol-message-utils.d.ts +0 -28
  57. package/types/range-utils.d.ts +0 -31
  58. package/types/react-utils.d.ts +0 -4
  59. package/types/round-decimal.d.ts +0 -1
  60. package/types/row-utils.d.ts +0 -24
  61. package/types/selection-utils.d.ts +0 -29
  62. package/types/shell-layout-types.d.ts +0 -14
  63. package/types/sort-utils.d.ts +0 -11
  64. package/types/table-schema-utils.d.ts +0 -3
  65. package/types/text-utils.d.ts +0 -2
  66. package/types/tree-types.d.ts +0 -8
  67. package/types/tree-utils.d.ts +0 -9
  68. package/types/ts-utils.d.ts +0 -19
  69. package/types/typeahead-utils.d.ts +0 -1
  70. package/types/url-utils.d.ts +0 -2
  71. package/types/useId.d.ts +0 -1
  72. package/types/useLayoutEffectSkipFirst.d.ts +0 -2
  73. package/types/useStateRef.d.ts +0 -2
  74. package/types/user-types.d.ts +0 -4
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
- "version": "0.13.3",
2
+ "version": "0.13.4",
3
3
  "author": "heswell",
4
4
  "license": "Apache-2.0",
5
- "types": "types/index.d.ts",
5
+ "types": "src/index.ts",
6
6
  "devDependencies": {
7
- "@vuu-ui/vuu-data-types": "0.13.3",
8
- "@vuu-ui/vuu-table-types": "0.13.3",
9
- "@vuu-ui/vuu-filter-types": "0.13.3",
10
- "@vuu-ui/vuu-protocol-types": "0.13.3"
7
+ "@vuu-ui/vuu-data-types": "0.13.4",
8
+ "@vuu-ui/vuu-table-types": "0.13.4",
9
+ "@vuu-ui/vuu-filter-types": "0.13.4",
10
+ "@vuu-ui/vuu-protocol-types": "0.13.4"
11
11
  },
12
12
  "peerDependencies": {
13
13
  "@internationalized/date": "^3.0.0",
14
- "@vuu-ui/vuu-filter-parser": "0.13.3",
14
+ "@vuu-ui/vuu-filter-parser": "0.13.4",
15
15
  "clsx": "^2.0.0",
16
16
  "react": "^19.1.0",
17
17
  "react-dom": "^19.1.0"
@@ -20,14 +20,12 @@
20
20
  "files": [
21
21
  "README.md",
22
22
  "esm",
23
- "cjs",
24
- "/types"
23
+ "cjs"
25
24
  ],
26
25
  "exports": {
27
26
  ".": {
28
27
  "require": "./cjs/index.js",
29
- "import": "./esm/index.js",
30
- "types": "./types/index.d.ts"
28
+ "import": "./esm/index.js"
31
29
  }
32
30
  },
33
31
  "main": "cjs/index.js",
@@ -1,39 +0,0 @@
1
- export type DataItem = string | number | boolean;
2
- export type DataRow = [
3
- /** index */
4
- number,
5
- /** render index */
6
- number,
7
- /** isLeaf */
8
- boolean,
9
- /** isExpanded */
10
- boolean,
11
- /** depth */
12
- number,
13
- /** child count */
14
- number,
15
- /** key */
16
- string,
17
- /** selected */
18
- number,
19
- /** data values */
20
- ...DataItem[]
21
- ];
22
- export type RangeLike = {
23
- from: number;
24
- to: number;
25
- };
26
- export declare class DataWindow {
27
- private range;
28
- data: DataRow[];
29
- rowCount: number;
30
- constructor({ from, to }: RangeLike);
31
- setRowCount: (rowCount: number) => void;
32
- add(data: DataRow): boolean;
33
- getAtIndex(index: number): DataRow | undefined;
34
- getByKey(key: string): DataRow | undefined;
35
- isWithinRange(index: number): boolean;
36
- setRange(from: number, to: number): void;
37
- hasData(from: number, to: number): boolean;
38
- getData(from: number, to: number): any[];
39
- }
@@ -1,11 +0,0 @@
1
- import type { RpcResponseHandler } from "@vuu-ui/vuu-data-types";
2
- import type { DefaultColumnConfiguration, DefaultTableConfiguration } from "@vuu-ui/vuu-table-types";
3
- import { LookupTableProvider } from "./feature-utils";
4
- export interface ShellContextProps {
5
- getDefaultColumnConfig?: DefaultColumnConfiguration;
6
- getDefaultTableConfig?: DefaultTableConfiguration;
7
- getLookupValues?: LookupTableProvider;
8
- handleRpcResponse?: RpcResponseHandler;
9
- }
10
- export declare const ShellContext: import("react").Context<ShellContextProps>;
11
- export declare const useShellContext: () => ShellContextProps;
@@ -1,32 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- export declare const DEFAULT_DENSITY: Density;
3
- export declare const DEFAULT_THEME = "salt-theme";
4
- export declare const DEFAULT_THEME_MODE: ThemeMode;
5
- export type Density = "high" | "medium" | "low" | "touch";
6
- export type ThemeMode = "light" | "dark";
7
- export type TargetElement = "root" | "scope" | "child";
8
- export interface ThemeContextProps {
9
- density: Density;
10
- theme: string;
11
- themeMode: ThemeMode;
12
- }
13
- export declare const ThemeContext: React.Context<ThemeContextProps>;
14
- export type ThemeClasses = [string, string, ThemeMode];
15
- export type ThemeAttributes = {
16
- themeClass: string;
17
- densityClass: string;
18
- dataMode: ThemeMode;
19
- };
20
- export declare const useThemeAttributes: (themeAttributes?: ThemeAttributes) => [string, string, ThemeMode];
21
- interface ThemeProviderProps {
22
- applyThemeClasses?: boolean;
23
- children: ReactNode;
24
- density?: Density;
25
- theme?: string;
26
- themeMode?: ThemeMode;
27
- }
28
- export declare const ThemeProvider: {
29
- ({ applyThemeClasses, children, theme: themeProp, themeMode: themeModeProp, density: densityProp, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
30
- displayName: string;
31
- };
32
- export {};
@@ -1,8 +0,0 @@
1
- export type PartitionTest<T> = (value: T, index: number) => boolean;
2
- export declare function partition<T>(array: T[], test: PartitionTest<T>, pass?: T[], fail?: T[]): [T[], T[]];
3
- export declare function itemsChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
4
- export declare function itemsOrOrderChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
5
- export declare const moveItemDeprecated: <T = unknown>(items: T[], item: T, moveTo: number) => T[];
6
- export declare const moveItem: <T = unknown>(items: T[], fromIndex: number, toIndex: number) => T[];
7
- export declare const getAddedItems: <T>(values: undefined | T[], newValues: T[]) => T[];
8
- export declare const getMissingItems: <T, I>(sourceItems: T[], items: I[], identity: (s: T) => I) => I[];
@@ -1,24 +0,0 @@
1
- export interface rect {
2
- bottom: number;
3
- left: number;
4
- right: number;
5
- top: number;
6
- }
7
- export type rectTuple = [number, number, number, number];
8
- export type dimension = "width" | "height";
9
- export declare function boxContainsPoint(rect: rect, x: number, y: number): boolean | undefined;
10
- export type GridLayoutSplitDirection = "north" | "south" | "east" | "west";
11
- export type GridLayoutDropPosition = GridLayoutSplitDirection | "header" | "centre";
12
- export declare function getCenteredBox({ right, left, top, bottom }: rect, pctSize: number): {
13
- left: number;
14
- top: number;
15
- right: number;
16
- bottom: number;
17
- };
18
- export declare function pointPositionWithinRect(x: number, y: number, rect: rect, borderZone?: number): {
19
- pctX: number;
20
- pctY: number;
21
- closeToTheEdge: number;
22
- };
23
- export declare const isGridLayoutSplitDirection: (position: GridLayoutDropPosition) => position is GridLayoutSplitDirection;
24
- export declare function getPositionWithinBox(x: number, y: number, rect: rect, pctX: number, pctY: number): GridLayoutDropPosition;
@@ -1,16 +0,0 @@
1
- interface VuuBroadcastChannelEventMap<T> {
2
- message: MessageEvent<T>;
3
- messageerror: MessageEvent<T>;
4
- }
5
- export interface VuuBroadcastChannel<T> extends EventTarget {
6
- readonly name: string;
7
- onmessage: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
8
- onmessageerror: ((this: BroadcastChannel, evt: MessageEvent<T>) => void) | null;
9
- close(): void;
10
- postMessage<M extends T = T>(message: M): void;
11
- addEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | AddEventListenerOptions): void;
12
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
13
- removeEventListener<K extends keyof VuuBroadcastChannelEventMap<T>>(type: K, listener: (this: BroadcastChannel, evt: VuuBroadcastChannelEventMap<T>[K]) => void, options?: boolean | EventListenerOptions): void;
14
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
15
- }
16
- export {};
@@ -1,175 +0,0 @@
1
- import type { DataSourceRow, DataValueType, DataValueTypeSimple, DateTimeDataValueDescriptor, SchemaColumn, TableSchema } from "@vuu-ui/vuu-data-types";
2
- import type { VuuAggType, VuuAggregation, VuuColumnDataType, VuuDataRow, VuuDataRowDto, VuuGroupBy, VuuSort } from "@vuu-ui/vuu-protocol-types";
3
- import type { ColumnAlignment, ColumnDescriptor, ColumnLayout, DataValueTypeDescriptor, ColumnTypeFormatting, ColumnTypeRendering, ColumnTypeWithValidationRules, DefaultColumnConfiguration, GroupColumnDescriptor, LookupRenderer, MappedValueTypeRenderer, PinLocation, RuntimeColumnDescriptor, TableCellRendererProps, TableConfig, TableHeadings, ValueListRenderer } from "@vuu-ui/vuu-table-types";
4
- import { type CSSProperties } from "react";
5
- import { TableModel } from "@vuu-ui/vuu-table";
6
- /**
7
- * ColumnMap provides a lookup of the index position of a data item within a row
8
- * by column name.
9
- */
10
- export interface ColumnMap {
11
- [columnName: string]: number;
12
- }
13
- export type SortCriteriaItem = string | [string, "asc"];
14
- export declare const AggregationType: {
15
- [key: string]: VuuAggType;
16
- };
17
- export declare function mapSortCriteria(sortCriteria: SortCriteriaItem[], columnMap: ColumnMap, metadataOffset?: number): [number, "asc"][];
18
- export declare const getDefaultAlignment: (serverDataType?: VuuColumnDataType) => ColumnAlignment;
19
- export declare const getRuntimeColumnWidth: (col: ColumnDescriptor, runtimeColumns: RuntimeColumnDescriptor[]) => number;
20
- export declare const applyRuntimeColumnWidthsToConfig: (tableConfig: TableConfig, columns: RuntimeColumnDescriptor[]) => TableConfig;
21
- export declare const isValidColumnAlignment: (v: string) => v is ColumnAlignment;
22
- export declare const isValidPinLocation: (v: string) => v is PinLocation;
23
- export type CalculatedColumn = {
24
- name: string;
25
- expression: string;
26
- serverDataType: VuuColumnDataType;
27
- };
28
- export declare const isVuuColumnDataType: (value: string | undefined | null) => value is VuuColumnDataType;
29
- export declare const fromServerDataType: (serverDataType: VuuColumnDataType) => DataValueTypeSimple;
30
- export declare const isNumericColumn: ({ serverDataType, type }: ColumnDescriptor) => boolean;
31
- export declare const isDateTimeDataValue: (column: ColumnDescriptor) => column is DateTimeDataValueDescriptor;
32
- export declare const isPinned: (column: ColumnDescriptor) => boolean;
33
- export declare const hasHeadings: (column: ColumnDescriptor) => boolean;
34
- export declare const isResizing: (column: RuntimeColumnDescriptor) => boolean | undefined;
35
- export declare const isTextColumn: ({ serverDataType }: ColumnDescriptor) => boolean;
36
- export declare const toColumnDescriptor: (name: string) => ColumnDescriptor;
37
- /**
38
- *
39
- */
40
- export declare const isTypeDescriptor: (type?: DataValueType) => type is DataValueTypeDescriptor;
41
- export declare const isColumnTypeRenderer: (renderer?: unknown) => renderer is ColumnTypeRendering;
42
- export declare const hasCustomRenderer: (type?: DataValueType) => type is DataValueTypeDescriptor;
43
- export declare const isLookupRenderer: (renderer?: unknown) => renderer is LookupRenderer;
44
- export declare const isValueListRenderer: (renderer?: unknown) => renderer is ValueListRenderer;
45
- export declare const hasValidationRules: (type?: DataValueType) => type is ColumnTypeWithValidationRules;
46
- export declare const isMappedValueTypeRenderer: (renderer?: unknown) => renderer is MappedValueTypeRenderer;
47
- export declare function buildColumnMap(columns?: (ColumnDescriptor | SchemaColumn | string)[]): ColumnMap;
48
- export declare function projectUpdates(updates: number[]): number[];
49
- export declare const metadataKeys: {
50
- readonly IDX: 0;
51
- readonly RENDER_IDX: 1;
52
- readonly IS_LEAF: 2;
53
- readonly IS_EXPANDED: 3;
54
- readonly DEPTH: 4;
55
- readonly COUNT: 5;
56
- readonly KEY: 6;
57
- readonly SELECTED: 7;
58
- readonly count: 8;
59
- readonly PARENT_IDX: "parent_idx";
60
- readonly IDX_POINTER: "idx_pointer";
61
- readonly FILTER_COUNT: "filter_count";
62
- readonly NEXT_FILTER_IDX: "next_filter_idx";
63
- };
64
- export declare const flattenColumnGroup: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
65
- export declare function extractGroupColumn({ availableWidth, columns, groupBy, confirmed, }: ColumnGroupProps): [
66
- GroupColumnDescriptor | null,
67
- RuntimeColumnDescriptor[]
68
- ];
69
- export declare const isGroupColumn: (column: RuntimeColumnDescriptor) => column is GroupColumnDescriptor;
70
- /**
71
- * groupConfirmed is currently the only 'pending' attribute we use. A
72
- * value of true is only reset by a follow-up value of false. Intermediary
73
- * values of undefined are discounted.
74
- */
75
- export declare const checkConfirmationPending: (previousConfig?: TableModel) => boolean | undefined;
76
- export declare const isJsonAttribute: (value: unknown) => boolean;
77
- export declare const isJsonGroup: (column: RuntimeColumnDescriptor, row: VuuDataRow, columnMap: ColumnMap) => boolean;
78
- export declare const isJsonColumn: (column: RuntimeColumnDescriptor) => boolean;
79
- export declare const sortPinnedColumns: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
80
- export declare const measurePinnedColumns: (columns: RuntimeColumnDescriptor[], selectionEndSize: number) => {
81
- pinnedWidthLeft: number;
82
- pinnedWidthRight: number;
83
- unpinnedWidth: number;
84
- };
85
- export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[]) => TableHeadings;
86
- export declare const getColumnStyle: ({ pin, pinnedOffset, width, }: RuntimeColumnDescriptor) => CSSProperties;
87
- export declare const setAggregations: (aggregations: VuuAggregation[], column: ColumnDescriptor, aggType: VuuAggType) => VuuAggregation[];
88
- export type ColumnGroupProps = {
89
- columns: RuntimeColumnDescriptor[];
90
- groupBy: VuuGroupBy;
91
- confirmed?: boolean;
92
- availableWidth: number;
93
- };
94
- export declare const applyGroupByToColumns: (props: ColumnGroupProps) => RuntimeColumnDescriptor[];
95
- export declare const applySortToColumns: (columns: RuntimeColumnDescriptor[], sort: VuuSort) => RuntimeColumnDescriptor[];
96
- export declare const removeSort: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
97
- export declare const existingSort: (columns: RuntimeColumnDescriptor[]) => boolean;
98
- export declare const getColumnName: (name: string) => string;
99
- export declare const getColumnLabel: (column: ColumnDescriptor) => string;
100
- export declare const findColumn: (columns: RuntimeColumnDescriptor[], columnName: string) => RuntimeColumnDescriptor | undefined;
101
- export declare function updateColumn<T extends ColumnDescriptor>(columns: T[], column: T): T[];
102
- export declare function updateColumn(columns: RuntimeColumnDescriptor[], column: string, options: Partial<ColumnDescriptor>): RuntimeColumnDescriptor[];
103
- export declare const toDataSourceColumns: (column: ColumnDescriptor) => string;
104
- export declare const dataSourceRowToDataRowDto: (row: DataSourceRow, columnMap: ColumnMap) => VuuDataRowDto;
105
- export declare const isDataLoading: (columns: RuntimeColumnDescriptor[]) => boolean;
106
- export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[], vpStart: number, vpEnd: number) => [RuntimeColumnDescriptor[], number];
107
- export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
108
- export declare const visibleColumnAtIndex: (columns: RuntimeColumnDescriptor[], index: number) => RuntimeColumnDescriptor | undefined;
109
- export declare const getGroupIcon: (columns: RuntimeColumnDescriptor[], row: DataSourceRow) => string | undefined;
110
- export declare const getGroupValue: (columns: RuntimeColumnDescriptor[], row: DataSourceRow, columnMap: ColumnMap) => string | null;
111
- export declare const getDefaultColumnType: (serverDataType?: VuuColumnDataType) => DataValueTypeSimple;
112
- export declare const updateColumnFormatting: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, formatting: ColumnTypeFormatting) => T;
113
- export declare function updateColumnType<T extends ColumnDescriptor = ColumnDescriptor>(column: T, type: DataValueTypeSimple): T;
114
- export declare const updateColumnRenderProps: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, renderer: ColumnTypeRendering) => T;
115
- export declare const getTypeFormattingFromColumn: (column: ColumnDescriptor) => ColumnTypeFormatting;
116
- /**
117
- * Return a filter predicate that will reject columns, names of which
118
- * are not in provided list. Exception made for columns explicitly
119
- * configured as client columns.
120
- */
121
- export declare const subscribedOnly: (columnNames?: string[]) => (column: ColumnDescriptor) => boolean | undefined;
122
- export declare const addColumnToSubscribedColumns: (subscribedColumns: ColumnDescriptor[], availableColumns: SchemaColumn[], columnName: string) => ColumnDescriptor[];
123
- export declare const isCalculatedColumn: (columnName?: string) => boolean;
124
- export declare const getCalculatedColumnDetails: (column: ColumnDescriptor) => Partial<CalculatedColumn>;
125
- export declare const setCalculatedColumnName: (column: ColumnDescriptor, name: string) => ColumnDescriptor;
126
- export declare const setCalculatedColumnType: (column: ColumnDescriptor, type: string) => ColumnDescriptor;
127
- export declare const setCalculatedColumnExpression: (column: ColumnDescriptor, expression: string) => ColumnDescriptor;
128
- export declare const moveColumnTo: (columns: ColumnDescriptor[], column: ColumnDescriptor, newIndex: number) => ColumnDescriptor[];
129
- export declare function replaceColumn<C extends ColumnDescriptor = RuntimeColumnDescriptor>(columns: C[], column: C): C[];
130
- export declare const applyDefaultColumnConfig: ({ columns, table }: TableSchema, getDefaultColumnConfig?: DefaultColumnConfiguration) => SchemaColumn[];
131
- export type columnOptions = {
132
- availableWidth?: number;
133
- columnLayout?: ColumnLayout;
134
- defaultWidth?: number;
135
- defaultMinWidth?: number;
136
- defaultMaxWidth?: number;
137
- defaultFlex?: number;
138
- };
139
- type ColumnLayoutOptions = Pick<columnOptions, "defaultMinWidth" | "defaultMaxWidth" | "defaultWidth">;
140
- interface StaticColumnLayoutOptions extends ColumnLayoutOptions {
141
- columnLayout: "manual" | "static";
142
- }
143
- interface FitColumnLayoutOptions extends ColumnLayoutOptions {
144
- availableWidth?: number;
145
- columnLayout: "fit";
146
- }
147
- export declare function applyWidthToColumns(columns: RuntimeColumnDescriptor[], options: StaticColumnLayoutOptions | FitColumnLayoutOptions): RuntimeColumnDescriptor[];
148
- /**
149
- * A memo compare function for cell renderers. Can be used to suppress
150
- * render where column and data are both unchanged. Avoids render
151
- * when row changes, where changes in row are unrelated to this cell.
152
- * Suitabnle only for readonly cell renderers. See below for editable
153
- * cell renderers.
154
- */
155
- export declare const dataAndColumnUnchanged: (p: TableCellRendererProps, p1: TableCellRendererProps) => boolean;
156
- /**
157
- * A memo compare function for cell renderers. Can be used to suppress
158
- * render where column, row key and data are all unchanged. Avoids render
159
- * when row changes, where changes in row are unrelated to this cell.
160
- * Suitable for editable cells. Including key in compare is not strictly
161
- * necessary for rendering, but it is important in the event that user
162
- * edits data - ensures we never have a stale key.
163
- */
164
- export declare const dataColumnAndKeyUnchanged: (p: TableCellRendererProps, p1: TableCellRendererProps) => boolean;
165
- export declare const toColumnName: (column: ColumnDescriptor) => string;
166
- export declare const isStringColumn: (column: ColumnDescriptor) => boolean;
167
- /**
168
- * Given an ordered list of column names, return column items in same order
169
- */
170
- export declare const reorderColumnItems: <T extends {
171
- name: string;
172
- } = {
173
- name: string;
174
- }>(columnItems: Array<T>, orderedNames: string[]) => T[];
175
- export {};
@@ -1,6 +0,0 @@
1
- export type orientationType = "horizontal" | "vertical";
2
- type measureProp = keyof DOMRect;
3
- type measureType = Record<string, measureProp>;
4
- type measuresType = Record<orientationType, measureType>;
5
- export declare const MEASURES: measuresType;
6
- export {};
@@ -1,62 +0,0 @@
1
- import { DataSourceRow, EditRuleValidator } from "@vuu-ui/vuu-data-types";
2
- import { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
3
- import { ColumnDescriptor, ColumnDescriptorCustomRenderer, ColumnTypeRendering, HeaderCellProps, TableCellRendererProps } from "@vuu-ui/vuu-table-types";
4
- import { FunctionComponent as FC, HTMLAttributes } from "react";
5
- import { ColumnMap } from "./column-utils";
6
- export interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {
7
- onConfigChange: () => void;
8
- }
9
- export type PropertyChangeHandler = (propertyName: string, propertyValue: string | number | boolean) => void;
10
- export type ColumnRenderPropsChangeHandler = (renderProps: ColumnTypeRendering) => void;
11
- export interface ConfigurationEditorProps {
12
- column: ColumnDescriptorCustomRenderer;
13
- onChangeRendering: ColumnRenderPropsChangeHandler;
14
- }
15
- export type RowClassNameGenerator = (row: DataSourceRow, columnMap: ColumnMap) => string | undefined;
16
- export type RowClassGenerator = {
17
- id: string;
18
- fn: RowClassNameGenerator;
19
- };
20
- export type ConfigEditorComponent = FC<CellConfigPanelProps>;
21
- export type layoutComponentType = "container" | "view";
22
- export type ComponentType = layoutComponentType | "cell-renderer" | "cell-config-panel" | "column-header-content-renderer" | "column-header-label-renderer" | "component" | "data-edit-validator" | "row-class-generator";
23
- type CellRendererOptions = {
24
- configEditor?: string;
25
- description?: string;
26
- label?: string;
27
- serverDataType?: VuuColumnDataType | VuuColumnDataType[] | "json" | "private";
28
- userCanAssign?: boolean;
29
- };
30
- export interface CellRendererDescriptor extends CellRendererOptions {
31
- name: string;
32
- }
33
- /**
34
- * This check is performed during construction of UI from JSON. If component
35
- * is not registered, it will log a warning.
36
- */
37
- export declare const isContainer: (componentType: string) => boolean;
38
- /**
39
- * This check is performed during construction of UI from JSON. If component
40
- * is not registered, it will log a warning.
41
- */
42
- export declare const isView: (componentType: string) => boolean;
43
- /**
44
- * This check is performed during construction of UI from JSON. If component
45
- * is not registered, it will log a warning.
46
- */
47
- export declare const isLayoutComponent: (componentType: string) => componentType is layoutComponentType;
48
- export declare function registerComponent(componentName: string, component: RowClassGenerator, componentType: "row-class-generator", options?: CellRendererOptions): void;
49
- export declare function registerComponent(componentName: string, component: EditRuleValidator, componentType: "data-edit-validator", options?: CellRendererOptions): void;
50
- export declare function registerComponent(componentName: string, component: FC<any>, componentType: Omit<ComponentType, "data-edit-validator" | "row-class-generator">, options?: CellRendererOptions): void;
51
- export declare const registerConfigurationEditor: (componentName: string, configurationEditor: FC<ConfigurationEditorProps>) => void;
52
- export declare const getRegisteredCellRenderers: (serverDataType?: VuuColumnDataType | "json") => CellRendererDescriptor[];
53
- export declare const getLayoutComponent: (componentName: string) => FC<any>;
54
- export declare const getCellRendererOptions: (renderName: string) => CellRendererOptions | undefined;
55
- export declare function getCellRenderer(column: ColumnDescriptor): FC<TableCellRendererProps> | undefined;
56
- export declare function getColumnHeaderContentRenderer(column: ColumnDescriptor): FC<HeaderCellProps> | undefined;
57
- export declare function getColumnHeaderLabelRenderer(column: ColumnDescriptor): FC<HeaderCellProps> | undefined;
58
- export declare const getRowClassNameGenerator: (generatorId: string) => RowClassGenerator | undefined;
59
- export declare function getConfigurationEditor(configEditor?: string): FC<ConfigurationEditorProps> | undefined;
60
- export declare function getCellConfigPanelRenderer(name: string): ConfigEditorComponent | undefined;
61
- export declare function getEditRuleValidator(name: string): EditRuleValidator | undefined;
62
- export {};
@@ -1,19 +0,0 @@
1
- import type { DataSource, DataSourceConstructorProps, ServerAPI, TableSchema } from "@vuu-ui/vuu-data-types";
2
- export type DataSourceConstructor = {
3
- new (props: DataSourceConstructorProps): DataSource;
4
- };
5
- export interface DataContextProps {
6
- VuuDataSource: DataSourceConstructor;
7
- dataSourceExtensions?: unknown;
8
- isLocalData: boolean;
9
- getServerAPI: () => Promise<Pick<ServerAPI, "getTableList" | "getTableSchema" | "rpcCall">>;
10
- /**
11
- * A tableSchema would normally be requested via the serverAPI.
12
- * schemas can be injected, in which case these 'local' schemas
13
- * will be returned from the getTableSchema API call.
14
- * The key is formed from concatenation of module and tableName
15
- * from VuuTable e.g 'SIMUL:instruments'
16
- */
17
- tableSchemas?: Record<string, TableSchema>;
18
- }
19
- export declare const DataContext: import("react").Context<DataContextProps>;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { DataContextProps } from "./DataContext";
3
- export declare const DataProvider: ({ children, getServerAPI, isLocalData, VuuDataSource, }: Omit<DataContextProps, "isLocalData"> & {
4
- children: ReactNode;
5
- isLocalData?: boolean;
6
- }) => import("react/jsx-runtime").JSX.Element;
7
- export declare const useData: () => DataContextProps;
8
- export declare const useDataSourceExtensions: () => unknown;
@@ -1,12 +0,0 @@
1
- import { DataSource } from "@vuu-ui/vuu-data-types";
2
- import { ReactNode } from "react";
3
- export interface DataSourceContextProps {
4
- dataSource?: DataSource;
5
- }
6
- export declare const DataSourceContext: import("react").Context<DataSourceContextProps>;
7
- export declare const DataSourceProvider: ({ children, dataSource, }: {
8
- children: ReactNode;
9
- dataSource: DataSource;
10
- }) => import("react/jsx-runtime").JSX.Element;
11
- export declare function useDataSource(throwIfNoDataSource: true): DataSource;
12
- export declare function useDataSource(throwIfNoDataSource: false | undefined): DataSource | undefined;
@@ -1,17 +0,0 @@
1
- import React from "react";
2
- import { ApplicationSetting, ApplicationSettings, LayoutJSON } from "../json-types";
3
- import { LayoutMetadata, LayoutMetadataDto } from "../layout-types";
4
- export interface WorkspaceContextProps {
5
- layoutMetadata: LayoutMetadata[];
6
- layoutPlaceholderJSON?: LayoutJSON;
7
- getApplicationSettings: (key?: keyof ApplicationSettings) => ApplicationSettings | ApplicationSetting | undefined;
8
- loadLayoutById: (id: string) => void;
9
- saveApplicationSettings: (settings: ApplicationSettings | ApplicationSetting, key?: keyof ApplicationSettings) => void;
10
- saveLayout: (n: LayoutMetadataDto) => void;
11
- saveApplicationLayout: (layout: LayoutJSON) => void;
12
- workspaceJSON?: LayoutJSON | LayoutJSON[];
13
- }
14
- export declare const WorkspaceContext: React.Context<WorkspaceContextProps>;
15
- export declare const usePlaceholderJSON: () => LayoutJSON<{
16
- [key: string]: any;
17
- }> | undefined;
@@ -1 +0,0 @@
1
- export declare const getCookieValue: (name: string) => string | number | undefined;
@@ -1 +0,0 @@
1
- export declare const importCSS: (path: string) => Promise<CSSStyleSheet>;
@@ -1,19 +0,0 @@
1
- export type valueChangeDirection = "up1" | "up2" | "down1" | "down2" | "";
2
- export declare const UP1 = "up1";
3
- export declare const UP2 = "up2";
4
- export declare const DOWN1 = "down1";
5
- export declare const DOWN2 = "down2";
6
- export declare const stringIsValidInt: (val: string) => boolean;
7
- export declare const stringIsValidDecimal: (val: string) => boolean;
8
- export declare const stringIsValidNumber: (val: string) => boolean;
9
- export declare const numericTypeOfStringValue: (val: string) => "int" | "double" | "NaN";
10
- export declare const isValidNumber: (n: unknown) => n is number;
11
- export declare const shallowEquals: (o1?: {
12
- [key: string]: unknown;
13
- }, o2?: {
14
- [key: string]: unknown;
15
- }) => boolean;
16
- export declare function getMovingValueDirection(newValue?: number, direction?: valueChangeDirection, prevValue?: number,
17
- /** the number of decimal places to take into account when highlighting a change */
18
- decimalPlaces?: number): valueChangeDirection;
19
- export declare function asInteger(index: number | string | undefined, defaultValue?: number): number;
@@ -1,46 +0,0 @@
1
- import type { DataSource, DataSourceConfig, DataSourceConstructorProps, DataSourceEvents, DataSourceFilter, DataSourceSubscribeCallback, DataSourceSubscribeProps, WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
2
- import { LinkDescriptorWithLabel, VuuAggregation, VuuRange, VuuSort } from "@vuu-ui/vuu-protocol-types";
3
- import { EventEmitter } from "../event-emitter";
4
- import { DataSourceConfigChanges } from "./datasource-utils";
5
- import { Range } from "../range-utils";
6
- export type RuntimeConfig = WithBaseFilter<WithFullConfig> & {
7
- visualLink?: LinkDescriptorWithLabel;
8
- };
9
- export declare abstract class BaseDataSource extends EventEmitter<DataSourceEvents> implements Pick<DataSource, "config"> {
10
- #private;
11
- viewport: string;
12
- protected _clientCallback: DataSourceSubscribeCallback | undefined;
13
- protected _config: RuntimeConfig;
14
- protected _impendingConfig: RuntimeConfig | undefined;
15
- protected _range: Range;
16
- protected _size: number;
17
- protected _title: string | undefined;
18
- private awaitingConfirmationOfConfigChanges;
19
- constructor({ aggregations, baseFilterSpec, columns, filterSpec, groupBy, sort, title, viewport, }: Omit<DataSourceConstructorProps, "table">);
20
- subscribe({ baseFilterSpec, columns, aggregations, range, sort, groupBy, filterSpec, viewport, }: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): void;
21
- get aggregations(): VuuAggregation[];
22
- set aggregations(aggregations: VuuAggregation[]);
23
- get baseFilter(): DataSourceFilter | undefined;
24
- set baseFilter(baseFilter: DataSourceFilter | undefined);
25
- get columns(): string[];
26
- set columns(columns: string[]);
27
- get filter(): DataSourceFilter;
28
- set filter(filter: DataSourceFilter);
29
- get isAwaitingConfirmationOfConfigChange(): boolean;
30
- protected confirmConfigChange(): void;
31
- get config(): WithBaseFilter<WithFullConfig>;
32
- set config(config: WithBaseFilter<WithFullConfig>);
33
- set impendingConfig(config: WithBaseFilter<WithFullConfig>);
34
- get pageCount(): number;
35
- set pageCount(pageCount: number);
36
- get range(): Range;
37
- set range(range: Range);
38
- get size(): number;
39
- set size(size: number);
40
- get sort(): VuuSort;
41
- set sort(sort: VuuSort);
42
- get title(): string;
43
- set title(title: string);
44
- applyConfig(config: WithBaseFilter<DataSourceConfig>, preserveExistingConfigAttributes?: boolean): DataSourceConfigChanges | undefined;
45
- abstract rangeRequest(range: VuuRange): void;
46
- }
@@ -1,7 +0,0 @@
1
- import { DataSourceMenusMessage, DataSourceVisualLinkCreatedMessage, DataSourceVisualLinkRemovedMessage, DataSourceVisualLinksMessage, VuuFeatureMessage } from "@vuu-ui/vuu-data-types";
2
- import { GridAction } from "@vuu-ui/vuu-table-types";
3
- export declare const isVisualLinksAction: (action: GridAction) => action is DataSourceVisualLinksMessage;
4
- export declare const isVisualLinkCreatedAction: (action: GridAction) => action is DataSourceVisualLinkCreatedMessage;
5
- export declare const isVisualLinkRemovedAction: (action: GridAction) => action is DataSourceVisualLinkRemovedMessage;
6
- export declare const isViewportMenusAction: (action: GridAction) => action is DataSourceMenusMessage;
7
- export declare const isVuuFeatureAction: (action: GridAction) => action is VuuFeatureMessage;
@@ -1,2 +0,0 @@
1
- import { WithBaseFilter, WithFullConfig } from "@vuu-ui/vuu-data-types";
2
- export declare const combineFilters: ({ baseFilterSpec, filterSpec, ...config }: WithBaseFilter<WithFullConfig>) => WithFullConfig;
@@ -1,45 +0,0 @@
1
- import { ConnectionQualityMetrics, DataSourceCallbackMessage, DataSourceConfig, DataSourceDataMessage, DataSourceRow, RpcResponse, TypeaheadSuggestionProvider, VuuUIMessageIn, VuuUIMessageInRPC, VuuUIMessageInRPCEditReject, VuuUIMessageInTableMeta, VuuUIMessageOutViewport, WithBaseFilter, WithFilter, WithFullConfig, WithGroupBy, WithSort } from "@vuu-ui/vuu-data-types";
2
- import { LinkDescriptorWithLabel, VuuCreateVisualLink, VuuFilter, VuuRemoveVisualLink, VuuRowDataItemType, VuuSort } from "@vuu-ui/vuu-protocol-types";
3
- import { ColumnMap } from "../column-utils";
4
- export declare const NoFilter: VuuFilter;
5
- export declare const NoSort: VuuSort;
6
- export declare const vanillaConfig: WithFullConfig;
7
- export type DataSourceConfigChanges = {
8
- aggregationsChanged: boolean;
9
- baseFilterChanged: boolean;
10
- columnsChanged: boolean;
11
- filterChanged: boolean;
12
- groupByChanged: boolean;
13
- sortChanged: boolean;
14
- visualLinkChanged: boolean;
15
- };
16
- export type MaybeDataSourceConfigChanges = DataSourceConfigChanges & {
17
- noChanges: boolean;
18
- };
19
- type DataConfigPredicate = (config: WithBaseFilter<DataSourceConfig>, newConfig: WithBaseFilter<DataSourceConfig>) => boolean;
20
- export declare const isBaseFilterChanged: DataConfigPredicate;
21
- export declare const isFilterChanged: DataConfigPredicate;
22
- export declare const isGroupByChanged: DataConfigPredicate;
23
- export declare const NO_CONFIG_CHANGES: MaybeDataSourceConfigChanges;
24
- export declare const isConfigChanged: (config: DataSourceConfig | undefined, newConfig: DataSourceConfig | undefined) => MaybeDataSourceConfigChanges;
25
- export declare const hasGroupBy: (config?: WithBaseFilter<DataSourceConfig>) => config is WithGroupBy;
26
- export declare const hasBaseFilter: (config?: WithBaseFilter<DataSourceConfig>) => config is WithFilter;
27
- export declare const hasFilter: (config?: DataSourceConfig) => config is WithFilter;
28
- export declare const hasSort: (config?: DataSourceConfig) => config is WithSort;
29
- export declare const isTypeaheadSuggestionProvider: (source: unknown) => source is TypeaheadSuggestionProvider;
30
- export declare const isTableSchemaMessage: (message: VuuUIMessageIn) => message is VuuUIMessageInTableMeta;
31
- export declare const isConnectionQualityMetrics: (msg: object) => msg is ConnectionQualityMetrics;
32
- export declare const messageHasResult: (msg: object) => msg is VuuUIMessageInRPC;
33
- export declare const isErrorResponse: (response?: Partial<RpcResponse>) => response is VuuUIMessageInRPCEditReject;
34
- export declare const isVisualLinkMessage: (msg: unknown) => msg is VuuCreateVisualLink | VuuRemoveVisualLink;
35
- export declare const isViewportMessage: (msg: object) => msg is VuuUIMessageOutViewport;
36
- export type DataSourceDataMessageWithRows = Omit<DataSourceDataMessage, "rows"> & {
37
- rows: DataSourceRow[];
38
- };
39
- export declare const messageHasDataRows: (message: DataSourceCallbackMessage) => message is DataSourceDataMessageWithRows;
40
- export declare const withConfigDefaults: (config: WithBaseFilter<DataSourceConfig>) => WithBaseFilter<WithFullConfig> & {
41
- visualLink?: LinkDescriptorWithLabel;
42
- };
43
- export type Entity = Record<string, VuuRowDataItemType>;
44
- export declare const dataSourceRowToEntity: <T extends Entity = Entity>(row: DataSourceRow, columnMap: ColumnMap) => T;
45
- export {};
@@ -1,2 +0,0 @@
1
- import { CalendarDate } from "@internationalized/date";
2
- export declare function toCalendarDate(d: Date): CalendarDate;
@@ -1,8 +0,0 @@
1
- import { DateTimeDataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
- import { DateTimePattern } from "./types";
3
- export declare const defaultPatternsByType: {
4
- readonly time: "hh:mm:ss";
5
- readonly date: "dd.mm.yyyy";
6
- };
7
- export declare const fallbackDateTimePattern: DateTimePattern;
8
- export declare function dateTimePattern(type: DateTimeDataValueDescriptor["type"]): DateTimePattern;