@vuu-ui/vuu-utils 3.4.1 → 3.5.0-beta.2

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 (111) hide show
  1. package/package.json +6 -6
  2. package/src/column-utils.js +21 -6
  3. package/src/component-registry.js +2 -1
  4. package/src/data-utils.js +1 -0
  5. package/src/datasource/BaseDataSource.js +5 -3
  6. package/src/date/EpochTimestamp.js +80 -0
  7. package/src/date/date-utils.js +50 -18
  8. package/src/date/dateTimePattern.js +33 -5
  9. package/src/date/formatter.js +54 -16
  10. package/src/date/index.js +5 -2
  11. package/src/date/temporal.js +131 -0
  12. package/src/date/time-zone.js +56 -0
  13. package/src/filters/filter-utils.js +12 -6
  14. package/src/filters/filterAsQuery.js +107 -45
  15. package/src/filters/index.js +1 -0
  16. package/src/filters/temporal-cell-filter.js +60 -0
  17. package/src/form-utils.js +38 -4
  18. package/src/formatting-utils.js +46 -25
  19. package/src/nanoid/index.js +3 -3
  20. package/types/column-utils.d.ts +41 -6
  21. package/types/datasource/BaseDataSource.d.ts +2 -2
  22. package/types/date/EpochTimestamp.d.ts +63 -0
  23. package/types/date/date-utils.d.ts +33 -7
  24. package/types/date/dateTimePattern.d.ts +20 -2
  25. package/types/date/formatter.d.ts +26 -1
  26. package/types/date/index.d.ts +6 -2
  27. package/types/date/temporal.d.ts +68 -0
  28. package/types/date/time-zone.d.ts +52 -0
  29. package/types/filters/filter-utils.d.ts +4 -0
  30. package/types/filters/filterAsQuery.d.ts +41 -0
  31. package/types/filters/index.d.ts +1 -0
  32. package/types/filters/temporal-cell-filter.d.ts +24 -0
  33. package/types/form-utils.d.ts +19 -0
  34. package/types/formatting-utils.d.ts +23 -1
  35. package/types/src/Clock.d.ts +0 -20
  36. package/types/src/PageVisibilityObserver.d.ts +0 -36
  37. package/types/src/ScaledDecimal.d.ts +0 -12
  38. package/types/src/ShellContext.d.ts +0 -11
  39. package/types/src/ThemeProvider.d.ts +0 -32
  40. package/types/src/array-utils.d.ts +0 -16
  41. package/types/src/box-utils.d.ts +0 -24
  42. package/types/src/broadcast-channel.d.ts +0 -16
  43. package/types/src/column-utils.d.ts +0 -243
  44. package/types/src/common-types.d.ts +0 -6
  45. package/types/src/component-registry.d.ts +0 -65
  46. package/types/src/context-definitions/DataContext.d.ts +0 -21
  47. package/types/src/context-definitions/DataProvider.d.ts +0 -7
  48. package/types/src/context-definitions/DataSourceProvider.d.ts +0 -12
  49. package/types/src/context-definitions/WorkspaceContext.d.ts +0 -17
  50. package/types/src/cookie-utils.d.ts +0 -9
  51. package/types/src/css-utils.d.ts +0 -1
  52. package/types/src/data-utils.d.ts +0 -33
  53. package/types/src/datasource/BaseDataSource.d.ts +0 -63
  54. package/types/src/datasource/datasource-action-utils.d.ts +0 -7
  55. package/types/src/datasource/datasource-filter-utils.d.ts +0 -2
  56. package/types/src/datasource/datasource-utils.d.ts +0 -61
  57. package/types/src/date/date-utils.d.ts +0 -39
  58. package/types/src/date/dateTimePattern.d.ts +0 -8
  59. package/types/src/date/formatter.d.ts +0 -9
  60. package/types/src/date/index.d.ts +0 -4
  61. package/types/src/date/types.d.ts +0 -29
  62. package/types/src/debug-utils.d.ts +0 -9
  63. package/types/src/edit-utils.d.ts +0 -2
  64. package/types/src/errors.d.ts +0 -2
  65. package/types/src/event-emitter.d.ts +0 -21
  66. package/types/src/feature-utils.d.ts +0 -110
  67. package/types/src/filters/filter-utils.d.ts +0 -75
  68. package/types/src/filters/filterAsQuery.d.ts +0 -8
  69. package/types/src/filters/index.d.ts +0 -2
  70. package/types/src/form-utils.d.ts +0 -37
  71. package/types/src/formatting-utils.d.ts +0 -14
  72. package/types/src/getUniqueId.d.ts +0 -1
  73. package/types/src/group-utils.d.ts +0 -10
  74. package/types/src/html-utils.d.ts +0 -21
  75. package/types/src/index.d.ts +0 -76
  76. package/types/src/input-utils.d.ts +0 -2
  77. package/types/src/invariant.d.ts +0 -1
  78. package/types/src/itemToString.d.ts +0 -2
  79. package/types/src/json-types.d.ts +0 -52
  80. package/types/src/json-utils.d.ts +0 -6
  81. package/types/src/keyboard-utils.d.ts +0 -15
  82. package/types/src/keyset.d.ts +0 -16
  83. package/types/src/layout-types.d.ts +0 -22
  84. package/types/src/list-utils.d.ts +0 -2
  85. package/types/src/local-storage-utils.d.ts +0 -4
  86. package/types/src/logging-utils.d.ts +0 -45
  87. package/types/src/module-utils.d.ts +0 -8
  88. package/types/src/nanoid/index.d.ts +0 -1
  89. package/types/src/perf-utils.d.ts +0 -5
  90. package/types/src/promise-utils.d.ts +0 -8
  91. package/types/src/protocol-message-utils.d.ts +0 -43
  92. package/types/src/range-utils.d.ts +0 -29
  93. package/types/src/react-utils.d.ts +0 -15
  94. package/types/src/round-decimal.d.ts +0 -4
  95. package/types/src/row-utils.d.ts +0 -28
  96. package/types/src/selection-utils.d.ts +0 -9
  97. package/types/src/shell-layout-types.d.ts +0 -15
  98. package/types/src/sort-utils.d.ts +0 -11
  99. package/types/src/table-schema-utils.d.ts +0 -5
  100. package/types/src/text-utils.d.ts +0 -10
  101. package/types/src/theme-utils.d.ts +0 -14
  102. package/types/src/tree-types.d.ts +0 -9
  103. package/types/src/tree-utils.d.ts +0 -9
  104. package/types/src/ts-utils.d.ts +0 -20
  105. package/types/src/typeahead-utils.d.ts +0 -1
  106. package/types/src/url-utils.d.ts +0 -3
  107. package/types/src/useId.d.ts +0 -1
  108. package/types/src/useLayoutEffectSkipFirst.d.ts +0 -2
  109. package/types/src/useResizeObserver.d.ts +0 -15
  110. package/types/src/useStateRef.d.ts +0 -2
  111. package/types/src/user-types.d.ts +0 -3
@@ -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,243 +0,0 @@
1
- import type { DataSourceRow, DataValueDescriptor, DataValueType, DataValueTypeSimple, DateTimeDataValueDescriptor, SchemaColumn, TableSchema, TimeDataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
- import type { VuuAggType, VuuAggregation, VuuColumnDataType, VuuDataRowDto, VuuGroupBy, VuuSort } from "@vuu-ui/vuu-protocol-types";
3
- import { TableModel } from "@vuu-ui/vuu-table";
4
- import type { ColumnAlignment, ColumnDescriptor, ColumnLayout, ColumnTypeFormatting, ColumnTypeRendering, ColumnTypeWithValidationRules, DataRow, DataValueTypeDescriptor, DefaultColumnConfiguration, GroupColumnDescriptor, LookupRenderer, MappedValueTypeRenderer, PinLocation, RuntimeColumnDescriptor, TableCellRendererProps, TableConfig, TableHeadings, ValueListRenderer } from "@vuu-ui/vuu-table-types";
5
- import { type CSSProperties } from "react";
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 interface ReverseColumnMap {
14
- [columnIndex: number]: string;
15
- }
16
- export type SortCriteriaItem = string | [string, "asc"];
17
- export declare const AggregationType: {
18
- [key: string]: VuuAggType;
19
- };
20
- export declare function mapSortCriteria(sortCriteria: SortCriteriaItem[], columnMap: ColumnMap, metadataOffset?: number): [number, "asc"][];
21
- export declare const getDefaultAlignment: (serverDataType?: VuuColumnDataType) => ColumnAlignment;
22
- export type EditOperation = "insert" | "update";
23
- export declare const isDataValueEditable: (dataDescriptor: Pick<DataValueDescriptor, "editable">, operation: EditOperation, defaultValue?: boolean) => boolean;
24
- export declare const getRuntimeColumnWidth: (col: ColumnDescriptor, runtimeColumns: RuntimeColumnDescriptor[]) => number;
25
- export declare const applyRuntimeColumnWidthsToConfig: (tableConfig: TableConfig, columns: RuntimeColumnDescriptor[]) => TableConfig;
26
- export declare const isValidColumnAlignment: (v: string) => v is ColumnAlignment;
27
- export declare const isValidPinLocation: (v: string) => v is PinLocation;
28
- export type CalculatedColumn = {
29
- name: string;
30
- expression: string;
31
- serverDataType: VuuColumnDataType;
32
- };
33
- export declare const isVuuColumnDataType: (value: string | undefined | null) => value is VuuColumnDataType;
34
- export declare const fromServerDataType: (serverDataType: VuuColumnDataType) => DataValueTypeSimple;
35
- export declare const isNanoTimestampColumn: ({ serverDataType, }: DataValueDescriptor) => boolean;
36
- export declare const isTimestampColumn: (column: ColumnDescriptor) => boolean;
37
- export declare const isNumericColumn: ({ serverDataType, type }: ColumnDescriptor) => boolean;
38
- export declare const isDateTimeDataType: (column: ColumnDescriptor) => column is DateTimeDataValueDescriptor;
39
- export declare const isTimeDataType: (column: ColumnDescriptor) => column is TimeDataValueDescriptor;
40
- export declare const isDateTimeDataValue: (column: ColumnDescriptor) => boolean;
41
- export declare const isTimeDataValue: (column?: ColumnDescriptor) => column is TimeDataValueDescriptor;
42
- export declare const isPinned: (column: ColumnDescriptor) => boolean;
43
- export declare const hasHeadings: (column: ColumnDescriptor) => boolean;
44
- export declare const isResizing: (column: RuntimeColumnDescriptor) => boolean | undefined;
45
- export declare const isTextColumn: ({ serverDataType }: ColumnDescriptor) => boolean;
46
- export declare const toColumnDescriptor: (name: string, serverDataType?: ColumnDescriptor["serverDataType"]) => ColumnDescriptor;
47
- /**
48
- *
49
- */
50
- export declare const isTypeDescriptor: (type?: DataValueType) => type is DataValueTypeDescriptor;
51
- export declare const isColumnTypeRenderer: (renderer?: unknown) => renderer is ColumnTypeRendering;
52
- export declare const hasCustomRenderer: (type?: DataValueType) => type is DataValueTypeDescriptor;
53
- export declare const isLookupRenderer: (renderer?: unknown) => renderer is LookupRenderer;
54
- export declare const isValueListRenderer: (renderer?: unknown) => renderer is ValueListRenderer;
55
- export declare const hasValidationRules: (type?: DataValueType) => type is ColumnTypeWithValidationRules;
56
- export declare const isMappedValueTypeRenderer: (renderer?: unknown) => renderer is MappedValueTypeRenderer;
57
- export declare function buildColumnMap(columns?: readonly (ColumnDescriptor | SchemaColumn | string)[]): ColumnMap;
58
- export declare function projectUpdates(updates: number[]): number[];
59
- export declare const metadataKeys: {
60
- readonly IDX: 0;
61
- readonly RENDER_IDX: 1;
62
- readonly IS_LEAF: 2;
63
- readonly IS_EXPANDED: 3;
64
- readonly DEPTH: 4;
65
- readonly COUNT: 5;
66
- readonly KEY: 6;
67
- readonly SELECTED: 7;
68
- readonly TIMESTAMP: 8;
69
- readonly IS_NEW: 9;
70
- readonly count: 10;
71
- readonly PARENT_IDX: "parent_idx";
72
- readonly IDX_POINTER: "idx_pointer";
73
- readonly FILTER_COUNT: "filter_count";
74
- readonly NEXT_FILTER_IDX: "next_filter_idx";
75
- };
76
- export declare const flattenColumnGroup: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
77
- export declare function extractGroupColumn({ availableWidth, columns, groupBy, confirmed, }: ColumnGroupProps): [
78
- GroupColumnDescriptor | null,
79
- RuntimeColumnDescriptor[]
80
- ];
81
- export declare const isGroupColumn: (column: RuntimeColumnDescriptor) => column is GroupColumnDescriptor;
82
- /**
83
- * groupConfirmed is currently the only 'pending' attribute we use. A
84
- * value of true is only reset by a follow-up value of false. Intermediary
85
- * values of undefined are discounted.
86
- */
87
- export declare const checkConfirmationPending: (previousConfig?: TableModel) => boolean | undefined;
88
- export declare const isJsonAttribute: (value: unknown) => boolean;
89
- export declare const isJsonGroup: (column: RuntimeColumnDescriptor, dataRow: DataRow) => boolean;
90
- export declare const isJsonColumn: (column: RuntimeColumnDescriptor) => boolean;
91
- export declare const sortPinnedColumns: (columns: RuntimeColumnDescriptor[], selectionBookendWidth?: number) => RuntimeColumnDescriptor[];
92
- export declare const measurePinnedColumns: (columns: RuntimeColumnDescriptor[], selectionEndSize: number) => {
93
- pinnedWidthLeft: number;
94
- pinnedWidthRight: number;
95
- unpinnedWidth: number;
96
- };
97
- export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[]) => TableHeadings;
98
- export declare const getColumnStyle: ({ pin, pinnedOffset, pinnedWidth, width, }: RuntimeColumnDescriptor) => CSSProperties;
99
- export declare const getAllCellsInColumn: (container: HTMLElement | null, colIndex: number) => HTMLDivElement[];
100
- export type PinState = {
101
- /**
102
- * The pinned 'endPin' cell
103
- */
104
- cell: HTMLElement;
105
- /**
106
- * With multiple columns pinned, left pinned columns that follow
107
- * // the resized column. These will need pinOffset adjustments.
108
- */
109
- pinnedCells?: HTMLElement[];
110
- pinnedWidth: number;
111
- };
112
- export declare const getAriaRowIndex: (rowElement: HTMLElement | null) => number;
113
- export declare const getAriaColIndex: (cellElement: HTMLElement | null) => number;
114
- export declare const getPinStateFromElement: (cell: HTMLElement) => PinState | undefined;
115
- export declare const setAggregations: (aggregations: VuuAggregation[], column: ColumnDescriptor, aggType: VuuAggType) => VuuAggregation[];
116
- export type ColumnGroupProps = {
117
- columns: RuntimeColumnDescriptor[];
118
- groupBy: VuuGroupBy;
119
- confirmed?: boolean;
120
- availableWidth: number;
121
- };
122
- export declare const applyGroupByToColumns: (props: ColumnGroupProps) => RuntimeColumnDescriptor[];
123
- export declare const applySortToColumns: (columns: RuntimeColumnDescriptor[], sort: VuuSort) => RuntimeColumnDescriptor[];
124
- export declare const removeSort: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
125
- export declare const existingSort: (columns: RuntimeColumnDescriptor[]) => boolean;
126
- export declare const getColumnName: (name: string) => string;
127
- export declare const getColumnLabel: (column: ColumnDescriptor) => string;
128
- export declare const findColumn: (columns: RuntimeColumnDescriptor[], columnName: string) => RuntimeColumnDescriptor | undefined;
129
- export declare function updateColumn<T extends ColumnDescriptor>(columns: readonly T[], column: T): T[];
130
- export declare function updateColumn(columns: readonly RuntimeColumnDescriptor[], column: string, options: Partial<ColumnDescriptor>): RuntimeColumnDescriptor[];
131
- export declare const toDataSourceColumns: (column: ColumnDescriptor) => string;
132
- export declare const dataSourceRowToDataRowDto: (row: DataSourceRow, columnMap: ColumnMap) => VuuDataRowDto;
133
- export declare const isDataLoading: (columns: RuntimeColumnDescriptor[]) => boolean;
134
- export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[], vpStart: number, vpEnd: number) => [RuntimeColumnDescriptor[], number];
135
- export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
136
- export declare const visibleColumnAtIndex: (columns: RuntimeColumnDescriptor[], index: number) => RuntimeColumnDescriptor | undefined;
137
- export declare const getGroupIcon: (columns: RuntimeColumnDescriptor[], dataRow: DataRow) => string | undefined;
138
- export declare const getGroupValue: (columns: RuntimeColumnDescriptor[], dataRow: DataRow) => string | null;
139
- export declare const getDefaultColumnType: (serverDataType?: VuuColumnDataType) => DataValueTypeSimple;
140
- export declare const updateColumnFormatting: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, formatting: ColumnTypeFormatting) => T;
141
- export declare function updateColumnType<T extends ColumnDescriptor = ColumnDescriptor>(column: T, type: DataValueTypeSimple): T;
142
- export declare const updateColumnRenderProps: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, renderer: ColumnTypeRendering) => T;
143
- export declare const getTypeFormattingFromColumn: (column: ColumnDescriptor) => ColumnTypeFormatting;
144
- /**
145
- * Check that columnDescriptors are included in provided list of subscribec column names (unless they
146
- * atr 'client side' columns).
147
- */
148
- export declare const assertAllColumnsAreIncludedInSubscription: (columns: readonly ColumnDescriptor[], columnNames: string[]) => void;
149
- /**
150
- * Return a filter predicate that will reject columns, names of which
151
- * are not in provided list. Exception made for columns explicitly
152
- * configured as client columns.
153
- */
154
- export declare const subscribedOnly: (columnNames?: string[]) => (column: ColumnDescriptor) => boolean | undefined;
155
- /**
156
- * Called from TableSettings.ColumnList when a column is added to subscription.
157
- *
158
- * @param subscribedColumns
159
- * @param availableColumns
160
- * @param columnName
161
- * @returns
162
- */
163
- export declare const addColumnToSubscribedColumns: (subscribedColumns: readonly ColumnDescriptor[], availableColumns: readonly SchemaColumn[], columnName: string) => ColumnDescriptor[];
164
- export declare function getServerDataType(column: ColumnDescriptor): VuuColumnDataType | undefined;
165
- export declare function getServerDataType(column: ColumnDescriptor, throwIfUndefined: true): VuuColumnDataType;
166
- export declare const isCalculatedColumn: (columnName?: string) => boolean;
167
- export declare const getCalculatedColumnDetails: (column: ColumnDescriptor | string) => Partial<CalculatedColumn>;
168
- export declare const setCalculatedColumnName: (column: ColumnDescriptor, name: string) => ColumnDescriptor;
169
- export declare const setCalculatedColumnType: (column: ColumnDescriptor, serverDataType: VuuColumnDataType) => ColumnDescriptor;
170
- export declare const setCalculatedColumnExpression: (column: ColumnDescriptor, expression: string) => ColumnDescriptor;
171
- export declare const moveColumnTo: (columns: ColumnDescriptor[], column: ColumnDescriptor, newIndex: number) => ColumnDescriptor[];
172
- export declare function replaceColumn<C extends ColumnDescriptor = RuntimeColumnDescriptor>(columns: readonly C[], column: C): C[];
173
- export declare const applyDefaultColumnConfig: ({ columns: columnsProp, table }: TableSchema, getDefaultColumnConfig?: DefaultColumnConfiguration, includeVuuDefaultColumns?: boolean) => (SchemaColumn | {
174
- aggregate?: VuuAggType;
175
- align?: ColumnAlignment;
176
- allowColumnHeaderMenu?: false;
177
- className?: string;
178
- colHeaderContentRenderer?: string;
179
- colHeaderLabelRenderer?: string;
180
- exportFormatter?: (value: unknown) => string;
181
- flex?: number;
182
- getIcon?: (row: DataRow) => string | undefined;
183
- groupable?: boolean;
184
- heading?: string[];
185
- hidden?: boolean;
186
- isSystemColumn?: boolean;
187
- locked?: Exclude<PinLocation, "left"> | false;
188
- maxWidth?: number;
189
- minWidth?: number;
190
- pin?: PinLocation | false;
191
- removeable?: boolean;
192
- resizeable?: boolean;
193
- selected?: boolean;
194
- sortable?: boolean;
195
- source?: "client" | "server";
196
- status?: import("@salt-ds/core").ValidationStatus;
197
- width?: number;
198
- editableBulk?: import("@vuu-ui/vuu-data-types").BulkEdit;
199
- label?: string;
200
- required?: boolean;
201
- type?: DataValueType;
202
- editable?: import("@vuu-ui/vuu-data-types").DataEditable | undefined;
203
- name: string;
204
- serverDataType: VuuColumnDataType;
205
- })[] | readonly SchemaColumn[];
206
- export type columnOptions = {
207
- availableWidth?: number;
208
- columnLayout?: ColumnLayout;
209
- defaultWidth?: number;
210
- defaultMinWidth?: number;
211
- defaultMaxWidth?: number;
212
- defaultFlex?: number;
213
- };
214
- type ColumnLayoutOptions = Pick<columnOptions, "defaultMinWidth" | "defaultMaxWidth" | "defaultWidth">;
215
- interface StaticColumnLayoutOptions extends ColumnLayoutOptions {
216
- columnLayout: "manual" | "static";
217
- }
218
- interface FitColumnLayoutOptions extends ColumnLayoutOptions {
219
- availableWidth?: number;
220
- columnLayout: "fit";
221
- }
222
- export declare function applyWidthToColumns(columns: RuntimeColumnDescriptor[], options: StaticColumnLayoutOptions | FitColumnLayoutOptions): RuntimeColumnDescriptor[];
223
- /**
224
- * A memo compare function for cell renderers. Can be used to suppress
225
- * render where column and data are both unchanged. Avoids render
226
- * when row changes, where changes in row are unrelated to this cell.
227
- * Suitabnle only for readonly cell renderers. See below for editable
228
- * cell renderers.
229
- */
230
- export declare const dataAndColumnUnchanged: (p: TableCellRendererProps, p1: TableCellRendererProps) => boolean;
231
- /**
232
- * A memo compare function for cell renderers. Can be used to suppress
233
- * render where column, row key and data are all unchanged. Avoids render
234
- * when row changes, where changes in row are unrelated to this cell.
235
- * Suitable for editable cells. Including key in compare is not strictly
236
- * necessary for rendering, but it is important in the event that user
237
- * edits data - ensures we never have a stale key.
238
- */
239
- export declare const dataColumnAndKeyUnchanged: (p: TableCellRendererProps, p1: TableCellRendererProps) => boolean;
240
- export declare const toColumnName: (column: ColumnDescriptor) => string;
241
- export declare const isStringColumn: (column: ColumnDescriptor) => boolean;
242
- export declare const columnByAriaIndex: (columns: RuntimeColumnDescriptor[], ariaColIndex: number) => RuntimeColumnDescriptor;
243
- 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,65 +0,0 @@
1
- import { EditRuleValidator } from "@vuu-ui/vuu-data-types";
2
- import { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
3
- import { ColumnDescriptor, ColumnDescriptorCustomRenderer, ColumnTypeRendering, DataRow, HeaderCellProps, TableCellRendererProps } from "@vuu-ui/vuu-table-types";
4
- import { FunctionComponent as FC, HTMLAttributes } from "react";
5
- export interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {
6
- onConfigChange: () => void;
7
- }
8
- export type PropertyChangeHandler = (propertyName: string, propertyValue: string | number | boolean) => void;
9
- export type ColumnRenderPropsChangeHandler = (renderProps: ColumnTypeRendering) => void;
10
- export interface ConfigurationEditorProps {
11
- column: ColumnDescriptorCustomRenderer;
12
- onChangeRendering: ColumnRenderPropsChangeHandler;
13
- }
14
- export type RowClassNameGenerator = (dataRow: DataRow) => string | undefined;
15
- export type RowClassGenerator = {
16
- id: string;
17
- fn: RowClassNameGenerator;
18
- };
19
- export type ConfigEditorComponent = FC<CellConfigPanelProps>;
20
- export type layoutComponentType = "container" | "view";
21
- export type ComponentType = layoutComponentType | "cell-renderer" | "cell-config-panel" | "column-header-content-renderer" | "column-header-label-renderer" | "component" | "data-edit-validator" | "row-class-generator";
22
- /**
23
- * The CellRenderer Options provide configuration for the Column Settings panel
24
- */
25
- type CellRendererOptions = {
26
- configEditor?: string;
27
- description?: string;
28
- label?: string;
29
- serverDataType?: VuuColumnDataType | VuuColumnDataType[] | "json" | "private";
30
- userCanAssign?: boolean;
31
- };
32
- export interface CellRendererDescriptor extends CellRendererOptions {
33
- name: string;
34
- }
35
- /**
36
- * This check is performed during construction of UI from JSON. If component
37
- * is not registered, it will log a warning.
38
- */
39
- export declare const isContainer: (componentType: string) => boolean;
40
- /**
41
- * This check is performed during construction of UI from JSON. If component
42
- * is not registered, it will log a warning.
43
- */
44
- export declare const isView: (componentType: string) => boolean;
45
- /**
46
- * This check is performed during construction of UI from JSON. If component
47
- * is not registered, it will log a warning.
48
- */
49
- export declare const isLayoutComponent: (componentType: string) => componentType is layoutComponentType;
50
- export declare function registerComponent(componentName: string, component: RowClassGenerator, componentType: "row-class-generator", options?: CellRendererOptions): void;
51
- export declare function registerComponent(componentName: string, component: EditRuleValidator, componentType: "data-edit-validator", options?: CellRendererOptions): void;
52
- export declare function registerComponent(componentName: string, component: FC<any>, componentType: Omit<ComponentType, "data-edit-validator" | "row-class-generator">, options?: CellRendererOptions): void;
53
- export declare const registerConfigurationEditor: (componentName: string, configurationEditor: FC<ConfigurationEditorProps>) => void;
54
- type CellRendererDataType = VuuColumnDataType | "json";
55
- export declare const getRegisteredCellRenderers: (cellRendererDataType?: CellRendererDataType) => CellRendererDescriptor[];
56
- export declare const getLayoutComponent: (componentName: string) => FC<any>;
57
- export declare const getCellRendererOptions: (renderName: string) => CellRendererOptions | undefined;
58
- export declare function getCellRenderer(column: ColumnDescriptor): FC<TableCellRendererProps> | undefined;
59
- export declare function getColumnHeaderContentRenderer(column: ColumnDescriptor): FC<Omit<HeaderCellProps, "id" | "index">> | undefined;
60
- export declare function getColumnHeaderLabelRenderer(column: ColumnDescriptor): FC<Omit<HeaderCellProps, "id" | "index">> | undefined;
61
- export declare const getRowClassNameGenerator: (generatorId: string) => RowClassGenerator | undefined;
62
- export declare function getConfigurationEditor(configEditor?: string): FC<ConfigurationEditorProps> | undefined;
63
- export declare function getCellConfigPanelRenderer(name: string): ConfigEditorComponent | undefined;
64
- export declare function getEditRuleValidator(name: string): EditRuleValidator | undefined;
65
- export {};
@@ -1,21 +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
- isLocalData: boolean;
8
- getServerAPI: () => Promise<Pick<ServerAPI, "getTableList" | "getTableSchema" | "rpcCall">>;
9
- /**
10
- * A tableSchema would normally be requested via the serverAPI.
11
- * schemas can be injected, in which case these 'local' schemas
12
- * will be returned from the getTableSchema API call.
13
- * The key is formed from concatenation of module and tableName
14
- * from VuuTable e.g 'SIMUL:instruments'
15
- */
16
- tableSchemas?: Record<string, TableSchema>;
17
- }
18
- export declare class NullDataSourceConstructor {
19
- constructor(_: DataSourceConstructorProps);
20
- }
21
- export declare const DataContext: import("react").Context<DataContextProps>;
@@ -1,7 +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.Element;
7
- export declare const useData: () => DataContextProps;
@@ -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.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,9 +0,0 @@
1
- export declare const getCookieValue: (name: string) => string | undefined;
2
- /**
3
- * Sets a cookie value.
4
- *
5
- * @param {string} name - Cookie name
6
- * @param {string} value - Cookie value
7
- * @param {number} [days] - Optional: number of days until the cookie expires
8
- */
9
- export declare function setCookieValue(name: string, value: string, days?: number): void;
@@ -1 +0,0 @@
1
- export declare const importCSS: (path: string) => Promise<CSSStyleSheet>;
@@ -1,33 +0,0 @@
1
- import { DataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
- export type valueChangeDirection = "up1" | "up2" | "down1" | "down2" | "";
3
- export declare const UP1 = "up1";
4
- export declare const UP2 = "up2";
5
- export declare const DOWN1 = "down1";
6
- export declare const DOWN2 = "down2";
7
- export declare const stringIsValidInt: (val: string) => boolean;
8
- export declare const stringIsValidLong: (val: string) => boolean;
9
- export declare const stringIsValidDecimal: (val: string) => boolean;
10
- export declare const stringIsValidNumber: (val: string) => boolean;
11
- export declare const numericTypeOfStringValue: (val: string) => "NaN" | "double" | "int";
12
- export declare const isValidNumber: (n: unknown) => n is number;
13
- export declare const shallowEquals: (o1?: {
14
- [key: string]: unknown;
15
- }, o2?: {
16
- [key: string]: unknown;
17
- }) => boolean;
18
- export declare function getMovingValueDirection(newValue?: number, direction?: valueChangeDirection, prevValue?: number,
19
- /** the number of decimal places to take into account when highlighting a change */
20
- decimalPlaces?: number): valueChangeDirection;
21
- /**
22
- * Convert a value to integer.
23
- * If value is a number, remove any decimals.
24
- * If value is a string, parse as integer. If NaN,
25
- * return defaultValue else throw.
26
- * If value is integer numeric, return value.
27
- *
28
- * @param value
29
- * @param defaultValue
30
- * @returns
31
- */
32
- export declare function asInteger(value: number | string | undefined, defaultValue?: number): number;
33
- export declare const dataDescriptorTypeToVuuRowDataItemType: ({ serverDataType, }: DataValueDescriptor) => "string" | "number" | "boolean";
@@ -1,63 +0,0 @@
1
- import type { DataSource, DataSourceConstructorProps, DataSourceEvents, DataSourceFilter, DataSourceSubscribeCallback, DataSourceSubscribeProps, DataSourceSuspenseProps, 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 { Range } from "../range-utils";
5
- import { Filter } from "@vuu-ui/vuu-filter-types";
6
- export type ConfigWithVisualLink = WithBaseFilter<WithFullConfig> & {
7
- visualLink?: LinkDescriptorWithLabel;
8
- };
9
- export declare const defaultSuspenseProps: DataSourceSuspenseProps;
10
- export declare abstract class BaseDataSource extends EventEmitter<DataSourceEvents> implements Pick<DataSource, "config"> {
11
- #private;
12
- viewport: string;
13
- protected _clientCallback: DataSourceSubscribeCallback | undefined;
14
- protected _configWithVisualLink: ConfigWithVisualLink;
15
- protected _impendingConfigWithVisualLink: ConfigWithVisualLink | undefined;
16
- protected _range: Range;
17
- protected _size: number;
18
- protected _title: string | undefined;
19
- protected _defaultSuspenseProps: DataSourceSuspenseProps;
20
- private awaitingConfirmationOfConfigChanges;
21
- constructor({ aggregations, baseFilterSpec, columns, filterSpec, groupBy, sort, suspenseProps, title, viewport, }: Omit<DataSourceConstructorProps, "table">);
22
- subscribe({ baseFilterSpec, columns, aggregations, range, sort, groupBy, filterSpec, viewport, }: DataSourceSubscribeProps, callback: DataSourceSubscribeCallback): void;
23
- get aggregations(): VuuAggregation[];
24
- set aggregations(aggregations: VuuAggregation[]);
25
- get baseFilter(): DataSourceFilter | undefined;
26
- set baseFilter(baseFilter: DataSourceFilter | undefined);
27
- get columns(): string[];
28
- set columns(columns: string[]);
29
- get filter(): DataSourceFilter;
30
- set filter(filter: DataSourceFilter);
31
- setFilter(filter: Filter): void;
32
- clearFilter(): void;
33
- get isAwaitingConfirmationOfConfigChange(): boolean;
34
- protected confirmConfigChange(): void;
35
- get config(): WithBaseFilter<WithFullConfig>;
36
- set config(config: WithBaseFilter<WithFullConfig>);
37
- get impendingConfig(): undefined | WithBaseFilter<WithFullConfig>;
38
- /**
39
- * This can be set by subclass in cases where we want to await ACK of async request
40
- * before we go ahead and apply change to config.
41
- * It is set in place of 'config' itself and it is then the responsibility of the client
42
- * to call 'confirmConfigChange' once confirmation of the change is received.
43
- * Client can check 'isAwaitingConfirmationOfConfigChange' to see if a change is pending
44
- * confirmation.
45
- */
46
- set impendingConfig(config: undefined | WithBaseFilter<WithFullConfig>);
47
- get pageCount(): number;
48
- set pageCount(pageCount: number);
49
- get range(): Range;
50
- set range(range: Range);
51
- get size(): number;
52
- set size(size: number);
53
- get sort(): VuuSort;
54
- set sort(sort: VuuSort);
55
- get title(): string;
56
- set title(title: string);
57
- private applyConfig;
58
- freeze(): void;
59
- unfreeze(): void;
60
- get freezeTimestamp(): number | undefined;
61
- get isFrozen(): boolean;
62
- abstract rangeRequest(range: VuuRange): void;
63
- }
@@ -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,61 +0,0 @@
1
- import type { ConnectionQualityMetrics, DataSourceCallbackMessage, DataSourceConfig, DataSourceDataMessage, DataSourceRow, DataSourceVisualLinksMessage, TypeaheadSuggestionProvider, VuuUIMessageIn, VuuUIMessageInRPC, VuuUIMessageInTableMeta, VuuUIMessageOutViewport, WithBaseFilter, WithFilter, WithFullConfig, WithGroupBy, WithSort } from "@vuu-ui/vuu-data-types";
2
- import type { LinkDescriptorWithLabel, VuuColumns, VuuCreateVisualLink, VuuFilter, VuuRemoveVisualLink, VuuRowDataItemType, VuuSort, VuuTable } from "@vuu-ui/vuu-protocol-types";
3
- import type { ColumnMap } from "../column-utils";
4
- import type { ConfigWithVisualLink } from "./BaseDataSource";
5
- export declare const NoFilter: VuuFilter;
6
- export declare const NoSort: VuuSort;
7
- export declare const vanillaConfig: WithFullConfig;
8
- /**
9
- * Derive the config for a session (edit) datasource from the source (view) datasource config.
10
- * When the edit table declares its own columns, the view config's filter, groupBy, sort and
11
- * aggregations are discarded rather than inherited - they may reference view-only columns.
12
- */
13
- export declare const sessionDataSourceConfig: (sourceConfig: WithFullConfig, overrideColumns?: VuuColumns) => WithFullConfig;
14
- /**
15
- * The session table name is server generated, so only the module is compared.
16
- */
17
- export declare const assertExpectedSessionTable: (sessionTable: VuuTable, expectedTable?: VuuTable) => void;
18
- export declare const stripVisualLink: (configWithVisualLink: ConfigWithVisualLink) => WithBaseFilter<WithFullConfig>;
19
- export type DataSourceConfigChanges = {
20
- aggregationsChanged: boolean;
21
- baseFilterChanged: boolean;
22
- columnsChanged: boolean;
23
- filterChanged: boolean;
24
- groupByChanged: boolean;
25
- sortChanged: boolean;
26
- visualLinkChanged: boolean;
27
- };
28
- export type MaybeDataSourceConfigChanges = DataSourceConfigChanges & {
29
- noChanges: boolean;
30
- };
31
- type DataConfigPredicate = (config: WithBaseFilter<DataSourceConfig>, newConfig: WithBaseFilter<DataSourceConfig>) => boolean;
32
- export declare const isBaseFilterChanged: DataConfigPredicate;
33
- export declare const isFilterChanged: DataConfigPredicate;
34
- export declare const isGroupByChanged: DataConfigPredicate;
35
- export declare const NO_CONFIG_CHANGES: MaybeDataSourceConfigChanges;
36
- export declare const isConfigChanged: (config: DataSourceConfig | undefined, newConfig: DataSourceConfig | undefined) => MaybeDataSourceConfigChanges;
37
- export declare const hasGroupBy: (config?: WithBaseFilter<DataSourceConfig>) => config is WithGroupBy;
38
- export declare const hasBaseFilter: (config?: WithBaseFilter<DataSourceConfig>) => config is WithFilter;
39
- export declare const hasFilter: (config?: DataSourceConfig) => config is WithFilter;
40
- export declare const hasSort: (config?: DataSourceConfig) => config is WithSort;
41
- export declare const isTypeaheadSuggestionProvider: (source: unknown) => source is TypeaheadSuggestionProvider;
42
- export declare const isTableSchemaMessage: (message: VuuUIMessageIn) => message is VuuUIMessageInTableMeta;
43
- export declare const isConnectionQualityMetrics: (msg: object) => msg is ConnectionQualityMetrics;
44
- export declare const messageHasResult: (msg: object) => msg is VuuUIMessageInRPC;
45
- export declare const isVisualLinkMessage: (msg: unknown) => msg is VuuCreateVisualLink | VuuRemoveVisualLink;
46
- export declare const isVisualLinksMessage: (msg: unknown) => msg is DataSourceVisualLinksMessage;
47
- export declare const isViewportMessage: (msg: object) => msg is VuuUIMessageOutViewport;
48
- export type DataSourceDataMessageWithRows = Omit<DataSourceDataMessage, "rows"> & {
49
- rows: DataSourceRow[];
50
- };
51
- export type DataSourceDataMessageWithSize = Omit<DataSourceDataMessage, "size"> & {
52
- size: number;
53
- };
54
- export declare const messageHasDataRows: (message: DataSourceCallbackMessage) => message is DataSourceDataMessageWithRows;
55
- export declare const messageHasSize: (message: DataSourceCallbackMessage) => message is DataSourceDataMessageWithSize;
56
- export declare const withConfigDefaults: (config: WithBaseFilter<DataSourceConfig>) => WithBaseFilter<WithFullConfig> & {
57
- visualLink?: LinkDescriptorWithLabel;
58
- };
59
- export type Entity = Record<string, VuuRowDataItemType>;
60
- export declare const dataSourceRowToEntity: <T extends Entity = Entity>(row: DataSourceRow, columnMap: ColumnMap) => T;
61
- export {};