@vuu-ui/vuu-utils 0.8.22-debug → 0.8.23-debug
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.
- package/cjs/index.js +1139 -83
- package/cjs/index.js.map +4 -4
- package/esm/index.js +1130 -74
- package/esm/index.js.map +4 -4
- package/package.json +5 -5
- package/types/column-utils.d.ts +42 -9
- package/types/date/formatter.d.ts +2 -0
- package/types/date/index.d.ts +2 -1
- package/types/date/utils.d.ts +2 -0
- package/types/filters/filterAsQuery.d.ts +5 -0
- package/types/filters/index.d.ts +2 -0
- package/types/{filter-utils.d.ts → filters/utils.d.ts} +3 -6
- package/types/formatting-utils.d.ts +1 -2
- package/types/index.d.ts +3 -1
- package/types/keyset.d.ts +4 -3
- package/types/module-utils.d.ts +9 -0
- package/types/range-utils.d.ts +2 -1
- package/types/react-utils.d.ts +2 -0
- /package/types/date/{helpers.d.ts → dateTimePattern.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuu-ui/vuu-utils",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.23-debug",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@vuu-ui/vuu-data-types": "0.8.
|
|
8
|
-
"@vuu-ui/vuu-table-types": "0.8.
|
|
9
|
-
"@vuu-ui/vuu-filter-types": "0.8.
|
|
10
|
-
"@vuu-ui/vuu-protocol-types": "0.8.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.8.23-debug",
|
|
8
|
+
"@vuu-ui/vuu-table-types": "0.8.23-debug",
|
|
9
|
+
"@vuu-ui/vuu-filter-types": "0.8.23-debug",
|
|
10
|
+
"@vuu-ui/vuu-protocol-types": "0.8.23-debug"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"react": ">=17.0.2",
|
package/types/column-utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DataSourceFilter, DataSourceRow, SchemaColumn, TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
2
|
import type { Filter } from "@vuu-ui/vuu-filter-types";
|
|
3
3
|
import type { VuuAggregation, VuuAggType, VuuColumnDataType, VuuDataRow, VuuGroupBy, VuuRowRecord, VuuSort } from "@vuu-ui/vuu-protocol-types";
|
|
4
|
-
import type { ColumnAlignment, ColumnDescriptor, ColumnType, ColumnTypeDescriptor, ColumnTypeFormatting, ColumnTypeRendering, ColumnTypeSimple, ColumnTypeWithValidationRules, DefaultColumnConfiguration, GroupColumnDescriptor, LookupRenderer, MappedValueTypeRenderer, PinLocation, RuntimeColumnDescriptor, TableHeadings, ValueListRenderer, DateTimeColumnDescriptor } from "@vuu-ui/vuu-table-types";
|
|
4
|
+
import type { ColumnAlignment, ColumnDescriptor, ColumnType, ColumnTypeDescriptor, ColumnTypeFormatting, ColumnTypeRendering, ColumnTypeSimple, ColumnTypeWithValidationRules, DefaultColumnConfiguration, GroupColumnDescriptor, LookupRenderer, MappedValueTypeRenderer, PinLocation, RuntimeColumnDescriptor, TableHeadings, ValueListRenderer, DateTimeColumnDescriptor, TableCellRendererProps } from "@vuu-ui/vuu-table-types";
|
|
5
5
|
import type { CSSProperties } from "react";
|
|
6
6
|
/**
|
|
7
7
|
* ColumnMap provides a lookup of the index position of a data item within a row
|
|
@@ -18,7 +18,6 @@ export declare function mapSortCriteria(sortCriteria: SortCriteriaItem[], column
|
|
|
18
18
|
export declare const getDefaultAlignment: (serverDataType?: VuuColumnDataType) => ColumnAlignment;
|
|
19
19
|
export declare const isValidColumnAlignment: (v: string) => v is ColumnAlignment;
|
|
20
20
|
export declare const isValidPinLocation: (v: string) => v is PinLocation;
|
|
21
|
-
export declare const isKeyedColumn: (column: ColumnDescriptor) => column is RuntimeColumnDescriptor;
|
|
22
21
|
export declare const fromServerDataType: (serverDataType: VuuColumnDataType) => ColumnTypeSimple;
|
|
23
22
|
export declare const isNumericColumn: ({ serverDataType, type }: ColumnDescriptor) => boolean;
|
|
24
23
|
export declare const isDateTimeColumn: (column: ColumnDescriptor) => column is DateTimeColumnDescriptor;
|
|
@@ -57,9 +56,14 @@ export declare const flattenColumnGroup: (columns: RuntimeColumnDescriptor[]) =>
|
|
|
57
56
|
export declare function extractGroupColumn(columns: RuntimeColumnDescriptor[], groupBy?: VuuGroupBy, confirmed?: boolean): [GroupColumnDescriptor | null, RuntimeColumnDescriptor[]];
|
|
58
57
|
export declare const isGroupColumn: (column: RuntimeColumnDescriptor) => column is GroupColumnDescriptor;
|
|
59
58
|
export declare const isJsonAttribute: (value: unknown) => boolean;
|
|
60
|
-
export declare const isJsonGroup: (column: RuntimeColumnDescriptor, row: VuuDataRow) => boolean;
|
|
59
|
+
export declare const isJsonGroup: (column: RuntimeColumnDescriptor, row: VuuDataRow, columnMap: ColumnMap) => boolean;
|
|
61
60
|
export declare const isJsonColumn: (column: RuntimeColumnDescriptor) => boolean;
|
|
62
61
|
export declare const sortPinnedColumns: (columns: RuntimeColumnDescriptor[]) => RuntimeColumnDescriptor[];
|
|
62
|
+
export declare const measurePinnedColumns: (columns: RuntimeColumnDescriptor[], selectionEndSize: number) => {
|
|
63
|
+
pinnedWidthLeft: number;
|
|
64
|
+
pinnedWidthRight: number;
|
|
65
|
+
unpinnedWidth: number;
|
|
66
|
+
};
|
|
63
67
|
export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[]) => TableHeadings;
|
|
64
68
|
export declare const getColumnStyle: ({ pin, pinnedOffset, width, }: RuntimeColumnDescriptor) => CSSProperties;
|
|
65
69
|
export declare const setAggregations: (aggregations: VuuAggregation[], column: RuntimeColumnDescriptor, aggType: VuuAggType) => VuuAggregation[];
|
|
@@ -70,17 +74,18 @@ export declare const applyFilterToColumns: (columns: RuntimeColumnDescriptor[],
|
|
|
70
74
|
export declare const isFilteredColumn: (column: RuntimeColumnDescriptor) => boolean;
|
|
71
75
|
export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]) => {
|
|
72
76
|
align?: "left" | "right" | undefined;
|
|
73
|
-
CellRenderer?: import("react").FunctionComponent<
|
|
77
|
+
CellRenderer?: import("react").FunctionComponent<TableCellRendererProps> | undefined;
|
|
74
78
|
HeaderCellLabelRenderer?: import("react").FunctionComponent<import("@vuu-ui/vuu-table-types").HeaderCellProps> | undefined;
|
|
75
79
|
HeaderCellContentRenderer?: import("react").FunctionComponent<import("@vuu-ui/vuu-table-types").HeaderCellProps> | undefined;
|
|
80
|
+
canStretch?: boolean | undefined;
|
|
76
81
|
className?: string | undefined;
|
|
77
|
-
clientSideEditValidationCheck?:
|
|
82
|
+
clientSideEditValidationCheck?: any;
|
|
78
83
|
endPin?: true | undefined;
|
|
79
84
|
flex?: number | undefined;
|
|
80
85
|
heading?: string[] | undefined;
|
|
86
|
+
index?: number | undefined;
|
|
81
87
|
isGroup?: boolean | undefined;
|
|
82
88
|
isSystemColumn?: boolean | undefined;
|
|
83
|
-
key: number;
|
|
84
89
|
label: string;
|
|
85
90
|
locked?: boolean | undefined;
|
|
86
91
|
marginLeft?: number | undefined;
|
|
@@ -91,18 +96,19 @@ export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]
|
|
|
91
96
|
resizing?: boolean | undefined;
|
|
92
97
|
sortable?: boolean | undefined;
|
|
93
98
|
sorted?: import("@vuu-ui/vuu-table-types").ColumnSort | undefined;
|
|
94
|
-
|
|
95
|
-
valueFormatter: ValueFormatter;
|
|
99
|
+
valueFormatter: import("@vuu-ui/vuu-table-types").ValueFormatter;
|
|
96
100
|
width: number;
|
|
97
101
|
aggregate?: VuuAggType | undefined;
|
|
98
102
|
colHeaderContentRenderer?: string | undefined;
|
|
99
103
|
colHeaderLabelRenderer?: string | undefined;
|
|
100
104
|
editable?: boolean | undefined;
|
|
101
105
|
hidden?: boolean | undefined;
|
|
106
|
+
maxWidth?: number | undefined;
|
|
102
107
|
minWidth?: number | undefined;
|
|
103
108
|
name: string;
|
|
104
109
|
pin?: PinLocation | undefined;
|
|
105
110
|
serverDataType?: VuuColumnDataType | undefined;
|
|
111
|
+
type?: ColumnType | undefined;
|
|
106
112
|
}[];
|
|
107
113
|
export declare const getColumnName: (name: string) => string;
|
|
108
114
|
export declare const getColumnLabel: (column: ColumnDescriptor) => string;
|
|
@@ -115,7 +121,7 @@ export declare const isDataLoading: (columns: RuntimeColumnDescriptor[]) => bool
|
|
|
115
121
|
export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[], vpStart: number, vpEnd: number) => [RuntimeColumnDescriptor[], number];
|
|
116
122
|
export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
|
|
117
123
|
export declare const visibleColumnAtIndex: (columns: RuntimeColumnDescriptor[], index: number) => RuntimeColumnDescriptor | undefined;
|
|
118
|
-
export declare const getGroupValueAndOffset: (columns: RuntimeColumnDescriptor[], row: DataSourceRow) => [unknown, number];
|
|
124
|
+
export declare const getGroupValueAndOffset: (columns: RuntimeColumnDescriptor[], row: DataSourceRow, columnMap: ColumnMap) => [unknown, number];
|
|
119
125
|
export declare const getDefaultColumnType: (serverDataType?: VuuColumnDataType) => ColumnTypeSimple;
|
|
120
126
|
export declare const updateColumnFormatting: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, formatting: ColumnTypeFormatting) => T;
|
|
121
127
|
export declare function updateColumnType<T extends ColumnDescriptor = ColumnDescriptor>(column: T, type: ColumnTypeSimple): T;
|
|
@@ -140,3 +146,30 @@ export declare const moveColumnTo: (columns: ColumnDescriptor[], column: ColumnD
|
|
|
140
146
|
export declare function replaceColumn<C extends ColumnDescriptor = RuntimeColumnDescriptor>(columns: C[], column: C): C[];
|
|
141
147
|
export declare const applyDefaultColumnConfig: ({ columns, table }: TableSchema, getDefaultColumnConfig?: DefaultColumnConfiguration) => SchemaColumn[];
|
|
142
148
|
export declare const getColumnByName: (schema: TableSchema, name?: string) => SchemaColumn | undefined;
|
|
149
|
+
export type ColumnLayout = "Static" | "Fit";
|
|
150
|
+
export type columnOptions = {
|
|
151
|
+
availableWidth?: number;
|
|
152
|
+
columnLayout?: ColumnLayout;
|
|
153
|
+
defaultWidth?: number;
|
|
154
|
+
defaultMinWidth?: number;
|
|
155
|
+
defaultMaxWidth?: number;
|
|
156
|
+
defaultFlex?: number;
|
|
157
|
+
};
|
|
158
|
+
export declare function applyWidthToColumns(columns: RuntimeColumnDescriptor[], options: {
|
|
159
|
+
columnLayout: "Static";
|
|
160
|
+
defaultMinWidth?: number;
|
|
161
|
+
defaultMaxWidth?: number;
|
|
162
|
+
defaultWidth?: number;
|
|
163
|
+
} | {
|
|
164
|
+
columnLayout: "Fit";
|
|
165
|
+
availableWidth?: number;
|
|
166
|
+
defaultMinWidth?: number;
|
|
167
|
+
defaultMaxWidth?: number;
|
|
168
|
+
defaultWidth?: number;
|
|
169
|
+
}): RuntimeColumnDescriptor[];
|
|
170
|
+
/**
|
|
171
|
+
* A memo compare function for cell renderers. Can be used to suppress
|
|
172
|
+
* render where column and data are both unchanged. Avoids render
|
|
173
|
+
* when row changes, where changes in row are unrelated to this cell.
|
|
174
|
+
*/
|
|
175
|
+
export declare const dataAndColumnUnchanged: (p: TableCellRendererProps, p1: TableCellRendererProps) => boolean;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { DateFormatter } from "@internationalized/date";
|
|
1
2
|
import { DateTimePattern } from "./types";
|
|
2
3
|
export declare function formatDate(pattern: DateTimePattern): (d: Date) => string;
|
|
4
|
+
export declare function getDateFormatter(locale: string, options?: Intl.DateTimeFormatOptions): DateFormatter;
|
package/types/date/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export * from "./formatter";
|
|
2
2
|
export { isDateTimePattern, type DateTimePattern, supportedDateTimePatterns, } from "./types";
|
|
3
|
-
export {
|
|
3
|
+
export { toCalendarDate } from "./utils";
|
|
4
|
+
export { dateTimePattern, defaultPatternsByType, fallbackDateTimePattern, } from "./dateTimePattern";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ColumnDescriptorsByName, Filter, SingleValueFilterClause } from "@vuu-ui/vuu-filter-types";
|
|
2
|
+
export declare const filterAsQuery: (f: Filter, opts?: {
|
|
3
|
+
columnsByName?: ColumnDescriptorsByName;
|
|
4
|
+
}) => string;
|
|
5
|
+
export declare function dateFilterAsQuery(f: SingleValueFilterClause<number>): string;
|
|
@@ -3,14 +3,11 @@ import { AndFilter, Filter, FilterClauseOp, FilterWithPartialClause, MultiClause
|
|
|
3
3
|
export declare const isValidFilterClauseOp: (op?: string) => op is FilterClauseOp;
|
|
4
4
|
export declare const isNamedFilter: (f?: Filter) => boolean;
|
|
5
5
|
export declare const isSingleValueFilter: (f?: Partial<Filter>) => f is SingleValueFilterClause<string | number | boolean>;
|
|
6
|
-
export declare const isFilterClause: (f?: Partial<Filter>) => f is
|
|
7
|
-
export declare const isMultiValueFilter: (f?: Partial<Filter>) => f is MultiValueFilterClause
|
|
8
|
-
export declare const isInFilter: (f: Partial<Filter>) => f is MultiValueFilterClause
|
|
6
|
+
export declare const isFilterClause: (f?: Partial<Filter>) => f is SingleValueFilterClause<string | number | boolean> | MultiValueFilterClause<number[] | string[] | boolean[]>;
|
|
7
|
+
export declare const isMultiValueFilter: (f?: Partial<Filter>) => f is MultiValueFilterClause<number[] | string[] | boolean[]>;
|
|
8
|
+
export declare const isInFilter: (f: Partial<Filter>) => f is MultiValueFilterClause<number[] | string[] | boolean[]>;
|
|
9
9
|
export declare const isAndFilter: (f: Partial<Filter>) => f is AndFilter;
|
|
10
10
|
export declare const isOrFilter: (f: Partial<Filter>) => f is OrFilter;
|
|
11
11
|
export declare const isCompleteFilter: (filter: Partial<Filter>) => filter is Filter;
|
|
12
12
|
export declare function isMultiClauseFilter(f?: Partial<Filter> | FilterWithPartialClause): f is MultiClauseFilter;
|
|
13
|
-
export declare const filterValue: (value: string | number | boolean) => string | number | boolean;
|
|
14
|
-
export declare const quotedStrings: (value: string | number | boolean) => string | number | boolean;
|
|
15
|
-
export declare const filterAsQuery: (f: Filter) => string;
|
|
16
13
|
export declare const removeColumnFromFilter: (column: RuntimeColumnDescriptor, filter: Filter) => [Filter | undefined, string];
|
package/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export * from "./datasource-action-utils";
|
|
|
10
10
|
export * from "./datasource-utils";
|
|
11
11
|
export * from "./date";
|
|
12
12
|
export * from "./debug-utils";
|
|
13
|
-
export * from "./
|
|
13
|
+
export * from "./filters";
|
|
14
14
|
export * from "./html-utils";
|
|
15
15
|
export * from "./event-emitter";
|
|
16
16
|
export * from "./formatting-utils";
|
|
@@ -24,7 +24,9 @@ export * from "./keyboard-utils";
|
|
|
24
24
|
export * from "./keyset";
|
|
25
25
|
export * from "./logging-utils";
|
|
26
26
|
export * from "./menu-utils";
|
|
27
|
+
export * from "./module-utils";
|
|
27
28
|
export * from "./nanoid";
|
|
29
|
+
export * from "./react-utils";
|
|
28
30
|
export * from "./round-decimal";
|
|
29
31
|
export * from "./perf-utils";
|
|
30
32
|
export * from "./range-utils";
|
package/types/keyset.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { VuuRange } from "@vuu-ui/vuu-protocol-types";
|
|
2
2
|
export declare class KeySet {
|
|
3
3
|
private keys;
|
|
4
|
-
private free;
|
|
5
4
|
private nextKeyValue;
|
|
5
|
+
private range;
|
|
6
6
|
constructor(range: VuuRange);
|
|
7
|
-
next(): number;
|
|
8
|
-
|
|
7
|
+
next(free?: number[]): number;
|
|
8
|
+
private init;
|
|
9
|
+
reset(range: VuuRange): boolean;
|
|
9
10
|
keyFor(rowIndex: number): number;
|
|
10
11
|
toDebugString(): string;
|
|
11
12
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type ReactComponent = {
|
|
3
|
+
(props?: any): JSX.Element;
|
|
4
|
+
};
|
|
5
|
+
export declare const isModule: (entity: Module | ReactComponent) => entity is Module<ReactComponent>;
|
|
6
|
+
export interface Module<T = ReactComponent> {
|
|
7
|
+
[key: string]: Module<T> | T;
|
|
8
|
+
}
|
|
9
|
+
export declare const assertModuleExportsAtLeastOneComponent: (module: Module) => void;
|
package/types/range-utils.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ interface FromToRange {
|
|
|
9
9
|
to: number;
|
|
10
10
|
}
|
|
11
11
|
export declare const NULL_RANGE: VuuRange;
|
|
12
|
-
export declare
|
|
12
|
+
export declare const rangesAreSame: (r1: VuuRange | undefined, r2: VuuRange | undefined) => boolean;
|
|
13
|
+
export declare function getFullRange({ from, to }: VuuRange, bufferSize?: number, totalRowCount?: number): FromToRange;
|
|
13
14
|
export declare function resetRange({ from, to, bufferSize }: VuuRange): VuuRange;
|
|
14
15
|
export declare const withinRange: (value: number, { from, to }: VuuRange) => boolean;
|
|
15
16
|
export declare const rangeNewItems: ({ from: from1, to: to1 }: VuuRange, newRange: VuuRange) => VuuRange;
|
|
File without changes
|