@vuu-ui/vuu-utils 0.8.35 → 0.8.37
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/README.md +0 -0
- package/cjs/DataWindow.js +71 -0
- package/cjs/DataWindow.js.map +1 -0
- package/cjs/ThemeProvider.js +85 -0
- package/cjs/ThemeProvider.js.map +1 -0
- package/cjs/array-utils.js +87 -0
- package/cjs/array-utils.js.map +1 -0
- package/cjs/box-utils.js +10 -0
- package/cjs/box-utils.js.map +1 -0
- package/cjs/column-utils.js +810 -0
- package/cjs/column-utils.js.map +1 -0
- package/cjs/common-types.js +15 -0
- package/cjs/common-types.js.map +1 -0
- package/cjs/component-registry.js +111 -0
- package/cjs/component-registry.js.map +1 -0
- package/cjs/cookie-utils.js +10 -0
- package/cjs/cookie-utils.js.map +1 -0
- package/cjs/data-utils.js +58 -0
- package/cjs/data-utils.js.map +1 -0
- package/cjs/datasource-action-utils.js +14 -0
- package/cjs/datasource-action-utils.js.map +1 -0
- package/cjs/datasource-utils.js +178 -0
- package/cjs/datasource-utils.js.map +1 -0
- package/cjs/date/dateTimePattern.js +25 -0
- package/cjs/date/dateTimePattern.js.map +1 -0
- package/cjs/date/formatter.js +66 -0
- package/cjs/date/formatter.js.map +1 -0
- package/cjs/date/types.js +23 -0
- package/cjs/date/types.js.map +1 -0
- package/cjs/date/utils.js +10 -0
- package/cjs/date/utils.js.map +1 -0
- package/cjs/debug-utils.js +31 -0
- package/cjs/debug-utils.js.map +1 -0
- package/cjs/event-emitter.js +119 -0
- package/cjs/event-emitter.js.map +1 -0
- package/cjs/filters/filterAsQuery.js +76 -0
- package/cjs/filters/filterAsQuery.js.map +1 -0
- package/cjs/filters/utils.js +89 -0
- package/cjs/filters/utils.js.map +1 -0
- package/cjs/formatting-utils.js +66 -0
- package/cjs/formatting-utils.js.map +1 -0
- package/cjs/getUniqueId.js +6 -0
- package/cjs/getUniqueId.js.map +1 -0
- package/cjs/group-utils.js +12 -0
- package/cjs/group-utils.js.map +1 -0
- package/cjs/html-utils.js +124 -0
- package/cjs/html-utils.js.map +1 -0
- package/cjs/index.js +4 -0
- package/cjs/index.js.map +1 -0
- package/cjs/input-utils.js +10 -0
- package/cjs/input-utils.js.map +1 -0
- package/cjs/invariant.js +13 -0
- package/cjs/invariant.js.map +1 -0
- package/cjs/itemToString.js +23 -0
- package/cjs/itemToString.js.map +1 -0
- package/cjs/json-utils.js +92 -0
- package/cjs/json-utils.js.map +1 -0
- package/cjs/keyboard-utils.js +28 -0
- package/cjs/keyboard-utils.js.map +1 -0
- package/cjs/keyset.js +68 -0
- package/cjs/keyset.js.map +1 -0
- package/cjs/local-storage-utils.js +20 -0
- package/cjs/local-storage-utils.js.map +1 -0
- package/cjs/logging-utils.js +61 -0
- package/cjs/logging-utils.js.map +1 -0
- package/cjs/menu-utils.js +6 -0
- package/cjs/menu-utils.js.map +1 -0
- package/cjs/module-utils.js +12 -0
- package/cjs/module-utils.js.map +1 -0
- package/cjs/nanoid/index.js +22 -0
- package/cjs/nanoid/index.js.map +1 -0
- package/cjs/perf-utils.js +35 -0
- package/cjs/perf-utils.js.map +1 -0
- package/cjs/range-utils.js +74 -0
- package/cjs/range-utils.js.map +1 -0
- package/cjs/react-utils.js +21 -0
- package/cjs/react-utils.js.map +1 -0
- package/cjs/round-decimal.js +86 -0
- package/cjs/round-decimal.js.map +1 -0
- package/cjs/row-utils.js +84 -0
- package/cjs/row-utils.js.map +1 -0
- package/cjs/selection-utils.js +236 -0
- package/cjs/selection-utils.js.map +1 -0
- package/cjs/sort-utils.js +61 -0
- package/cjs/sort-utils.js.map +1 -0
- package/cjs/text-utils.js +21 -0
- package/cjs/text-utils.js.map +1 -0
- package/cjs/ts-utils.js +8 -0
- package/cjs/ts-utils.js.map +1 -0
- package/cjs/url-utils.js +21 -0
- package/cjs/url-utils.js.map +1 -0
- package/cjs/useId.js +9 -0
- package/cjs/useId.js.map +1 -0
- package/cjs/useLayoutEffectSkipFirst.js +17 -0
- package/cjs/useLayoutEffectSkipFirst.js.map +1 -0
- package/esm/DataWindow.js +69 -0
- package/esm/DataWindow.js.map +1 -0
- package/esm/ThemeProvider.js +78 -0
- package/esm/ThemeProvider.js.map +1 -0
- package/esm/array-utils.js +79 -0
- package/esm/array-utils.js.map +1 -0
- package/esm/box-utils.js +8 -0
- package/esm/box-utils.js.map +1 -0
- package/esm/column-utils.js +738 -0
- package/esm/column-utils.js.map +1 -0
- package/esm/common-types.js +13 -0
- package/esm/common-types.js.map +1 -0
- package/esm/component-registry.js +99 -0
- package/esm/component-registry.js.map +1 -0
- package/esm/cookie-utils.js +8 -0
- package/esm/cookie-utils.js.map +1 -0
- package/esm/data-utils.js +50 -0
- package/esm/data-utils.js.map +1 -0
- package/esm/datasource-action-utils.js +8 -0
- package/esm/datasource-action-utils.js.map +1 -0
- package/esm/datasource-utils.js +158 -0
- package/esm/datasource-utils.js.map +1 -0
- package/esm/date/dateTimePattern.js +21 -0
- package/esm/date/dateTimePattern.js.map +1 -0
- package/esm/date/formatter.js +63 -0
- package/esm/date/formatter.js.map +1 -0
- package/esm/date/types.js +20 -0
- package/esm/date/types.js.map +1 -0
- package/esm/date/utils.js +8 -0
- package/esm/date/utils.js.map +1 -0
- package/esm/debug-utils.js +29 -0
- package/esm/debug-utils.js.map +1 -0
- package/esm/event-emitter.js +117 -0
- package/esm/event-emitter.js.map +1 -0
- package/esm/filters/filterAsQuery.js +72 -0
- package/esm/filters/filterAsQuery.js.map +1 -0
- package/esm/filters/utils.js +74 -0
- package/esm/filters/utils.js.map +1 -0
- package/esm/formatting-utils.js +62 -0
- package/esm/formatting-utils.js.map +1 -0
- package/esm/getUniqueId.js +4 -0
- package/esm/getUniqueId.js.map +1 -0
- package/esm/group-utils.js +10 -0
- package/esm/group-utils.js.map +1 -0
- package/esm/html-utils.js +111 -0
- package/esm/html-utils.js.map +1 -0
- package/esm/index.js +47 -0
- package/esm/index.js.map +1 -0
- package/esm/input-utils.js +7 -0
- package/esm/input-utils.js.map +1 -0
- package/esm/invariant.js +11 -0
- package/esm/invariant.js.map +1 -0
- package/esm/itemToString.js +21 -0
- package/esm/itemToString.js.map +1 -0
- package/esm/json-utils.js +90 -0
- package/esm/json-utils.js.map +1 -0
- package/esm/keyboard-utils.js +15 -0
- package/esm/keyboard-utils.js.map +1 -0
- package/esm/keyset.js +66 -0
- package/esm/keyset.js.map +1 -0
- package/esm/local-storage-utils.js +16 -0
- package/esm/local-storage-utils.js.map +1 -0
- package/esm/logging-utils.js +58 -0
- package/esm/logging-utils.js.map +1 -0
- package/esm/menu-utils.js +4 -0
- package/esm/menu-utils.js.map +1 -0
- package/esm/module-utils.js +9 -0
- package/esm/module-utils.js.map +1 -0
- package/esm/nanoid/index.js +20 -0
- package/esm/nanoid/index.js.map +1 -0
- package/esm/perf-utils.js +32 -0
- package/esm/perf-utils.js.map +1 -0
- package/esm/range-utils.js +66 -0
- package/esm/range-utils.js.map +1 -0
- package/esm/react-utils.js +19 -0
- package/esm/react-utils.js.map +1 -0
- package/esm/round-decimal.js +84 -0
- package/esm/round-decimal.js.map +1 -0
- package/esm/row-utils.js +78 -0
- package/esm/row-utils.js.map +1 -0
- package/esm/selection-utils.js +227 -0
- package/esm/selection-utils.js.map +1 -0
- package/esm/sort-utils.js +57 -0
- package/esm/sort-utils.js.map +1 -0
- package/esm/text-utils.js +18 -0
- package/esm/text-utils.js.map +1 -0
- package/esm/ts-utils.js +6 -0
- package/esm/ts-utils.js.map +1 -0
- package/esm/url-utils.js +18 -0
- package/esm/url-utils.js.map +1 -0
- package/esm/useId.js +7 -0
- package/esm/useId.js.map +1 -0
- package/esm/useLayoutEffectSkipFirst.js +15 -0
- package/esm/useLayoutEffectSkipFirst.js.map +1 -0
- package/package.json +7 -5
- package/types/index.d.ts +1 -0
- package/types/local-storage-utils.d.ts +3 -0
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var arrayUtils = require('./array-utils.js');
|
|
4
|
+
|
|
5
|
+
const SORT_ASC = "asc";
|
|
6
|
+
const NO_HEADINGS = [];
|
|
7
|
+
const DEFAULT_COL_WIDTH = 100;
|
|
8
|
+
const DEFAULT_MAX_WIDTH = 250;
|
|
9
|
+
const DEFAULT_MIN_WIDTH = 50;
|
|
10
|
+
const AggregationType = {
|
|
11
|
+
Average: 2,
|
|
12
|
+
Count: 3,
|
|
13
|
+
Distinct: 6,
|
|
14
|
+
Sum: 1,
|
|
15
|
+
High: 4,
|
|
16
|
+
Low: 5
|
|
17
|
+
};
|
|
18
|
+
function mapSortCriteria(sortCriteria, columnMap, metadataOffset = 0) {
|
|
19
|
+
return sortCriteria.map((s) => {
|
|
20
|
+
if (typeof s === "string") {
|
|
21
|
+
return [columnMap[s] + metadataOffset, "asc"];
|
|
22
|
+
} else if (Array.isArray(s)) {
|
|
23
|
+
const [columnName, sortDir] = s;
|
|
24
|
+
return [columnMap[columnName] + metadataOffset, sortDir || SORT_ASC];
|
|
25
|
+
} else {
|
|
26
|
+
throw Error("columnUtils.mapSortCriteria invalid input");
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
const numericTypes = ["int", "long", "double"];
|
|
31
|
+
const getDefaultAlignment = (serverDataType) => serverDataType === void 0 ? "left" : numericTypes.includes(serverDataType) ? "right" : "left";
|
|
32
|
+
const isValidColumnAlignment = (v) => v === "left" || v === "right";
|
|
33
|
+
const isValidPinLocation = (v) => isValidColumnAlignment(v) || v === "floating" || v === "";
|
|
34
|
+
const VUU_COLUMN_DATA_TYPES = [
|
|
35
|
+
"long",
|
|
36
|
+
"double",
|
|
37
|
+
"int",
|
|
38
|
+
"string",
|
|
39
|
+
"char",
|
|
40
|
+
"boolean"
|
|
41
|
+
];
|
|
42
|
+
const isVuuColumnDataType = (value) => VUU_COLUMN_DATA_TYPES.includes(value);
|
|
43
|
+
const fromServerDataType = (serverDataType) => {
|
|
44
|
+
switch (serverDataType) {
|
|
45
|
+
case "double":
|
|
46
|
+
case "int":
|
|
47
|
+
case "long":
|
|
48
|
+
return "number";
|
|
49
|
+
case "boolean":
|
|
50
|
+
return "boolean";
|
|
51
|
+
default:
|
|
52
|
+
return "string";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const isNumericColumn = ({ serverDataType, type }) => {
|
|
56
|
+
if (serverDataType === "int" || serverDataType === "long" || serverDataType === "double") {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (typeof type === "string") {
|
|
60
|
+
return type === "number";
|
|
61
|
+
}
|
|
62
|
+
if (typeof type?.name === "string") {
|
|
63
|
+
return type?.name === "number";
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
};
|
|
67
|
+
const isDateTimeColumn = (column) => (isTypeDescriptor(column.type) ? column.type.name : column.type) === "date/time";
|
|
68
|
+
const isPinned = (column) => typeof column.pin === "string";
|
|
69
|
+
const hasHeadings = (column) => Array.isArray(column.heading) && column.heading.length > 0;
|
|
70
|
+
const isResizing = (column) => column.resizing;
|
|
71
|
+
const isTextColumn = ({ serverDataType }) => serverDataType === void 0 ? false : serverDataType === "char" || serverDataType === "string";
|
|
72
|
+
const toColumnDescriptor = (name) => ({
|
|
73
|
+
name
|
|
74
|
+
});
|
|
75
|
+
const isTypeDescriptor = (type) => typeof type !== "undefined" && typeof type !== "string";
|
|
76
|
+
const EMPTY_COLUMN_MAP = {};
|
|
77
|
+
const isColumnTypeRenderer = (renderer) => typeof renderer?.name !== "undefined";
|
|
78
|
+
const isLookupRenderer = (renderer) => typeof renderer?.name !== "undefined" && "lookup" in renderer;
|
|
79
|
+
const isValueListRenderer = (renderer) => typeof renderer?.name !== "undefined" && Array.isArray(renderer.values);
|
|
80
|
+
const hasValidationRules = (type) => isTypeDescriptor(type) && isColumnTypeRenderer(type.renderer) && Array.isArray(type.renderer.rules) && type.renderer.rules.length > 0;
|
|
81
|
+
const isMappedValueTypeRenderer = (renderer) => renderer !== void 0 && typeof renderer?.map !== "undefined";
|
|
82
|
+
function buildColumnMap(columns) {
|
|
83
|
+
const start = metadataKeys.count;
|
|
84
|
+
if (columns) {
|
|
85
|
+
return columns.reduce((map, column, i) => {
|
|
86
|
+
if (typeof column === "string") {
|
|
87
|
+
map[column] = start + i;
|
|
88
|
+
} else {
|
|
89
|
+
map[column.name] = start + i;
|
|
90
|
+
}
|
|
91
|
+
return map;
|
|
92
|
+
}, {});
|
|
93
|
+
} else {
|
|
94
|
+
return EMPTY_COLUMN_MAP;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function projectUpdates(updates) {
|
|
98
|
+
const results = [];
|
|
99
|
+
const metadataOffset = metadataKeys.count - 2;
|
|
100
|
+
for (let i = 0; i < updates.length; i += 3) {
|
|
101
|
+
results[i] = updates[i] + metadataOffset;
|
|
102
|
+
results[i + 1] = updates[i + 1];
|
|
103
|
+
results[i + 2] = updates[i + 2];
|
|
104
|
+
}
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
const KEY = 6;
|
|
108
|
+
const metadataKeys = {
|
|
109
|
+
IDX: 0,
|
|
110
|
+
RENDER_IDX: 1,
|
|
111
|
+
IS_LEAF: 2,
|
|
112
|
+
IS_EXPANDED: 3,
|
|
113
|
+
DEPTH: 4,
|
|
114
|
+
COUNT: 5,
|
|
115
|
+
KEY,
|
|
116
|
+
SELECTED: 7,
|
|
117
|
+
count: 8,
|
|
118
|
+
// TODO following only used in datamodel
|
|
119
|
+
PARENT_IDX: "parent_idx",
|
|
120
|
+
IDX_POINTER: "idx_pointer",
|
|
121
|
+
FILTER_COUNT: "filter_count",
|
|
122
|
+
NEXT_FILTER_IDX: "next_filter_idx"
|
|
123
|
+
};
|
|
124
|
+
const insertColumn = (columns, column) => {
|
|
125
|
+
const { originalIdx } = column;
|
|
126
|
+
if (typeof originalIdx === "number") {
|
|
127
|
+
for (let i = 0; i < columns.length; i++) {
|
|
128
|
+
const { originalIdx: colIdx = -1 } = columns[i];
|
|
129
|
+
if (colIdx > originalIdx) {
|
|
130
|
+
columns.splice(i, 0, column);
|
|
131
|
+
return columns;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
columns.push(column);
|
|
136
|
+
return columns;
|
|
137
|
+
};
|
|
138
|
+
const flattenColumnGroup = (columns) => {
|
|
139
|
+
if (columns[0]?.isGroup) {
|
|
140
|
+
const [groupColumn, ...nonGroupedColumns] = columns;
|
|
141
|
+
groupColumn.columns.forEach((groupColumn2) => {
|
|
142
|
+
insertColumn(nonGroupedColumns, groupColumn2);
|
|
143
|
+
});
|
|
144
|
+
return nonGroupedColumns;
|
|
145
|
+
} else {
|
|
146
|
+
return columns;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
function extractGroupColumn(columns, groupBy, confirmed = true) {
|
|
150
|
+
if (groupBy && groupBy.length > 0) {
|
|
151
|
+
const flattenedColumns = flattenColumnGroup(columns);
|
|
152
|
+
const [groupedColumns, rest] = flattenedColumns.reduce(
|
|
153
|
+
(result, column, i) => {
|
|
154
|
+
const [g, r] = result;
|
|
155
|
+
if (groupBy.includes(column.name)) {
|
|
156
|
+
g.push({
|
|
157
|
+
...column,
|
|
158
|
+
originalIdx: i
|
|
159
|
+
});
|
|
160
|
+
} else {
|
|
161
|
+
r.push(column);
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
},
|
|
165
|
+
[[], []]
|
|
166
|
+
);
|
|
167
|
+
if (groupedColumns.length !== groupBy.length) {
|
|
168
|
+
throw Error(
|
|
169
|
+
`extractGroupColumn: no column definition found for all groupBy cols ${JSON.stringify(
|
|
170
|
+
groupBy
|
|
171
|
+
)} `
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
const groupCount = groupBy.length;
|
|
175
|
+
const groupCols = groupBy.map((name, idx) => {
|
|
176
|
+
const column = groupedColumns.find(
|
|
177
|
+
(col) => col.name === name
|
|
178
|
+
);
|
|
179
|
+
return {
|
|
180
|
+
...column,
|
|
181
|
+
groupLevel: groupCount - idx
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
const groupCol = {
|
|
185
|
+
name: "group-col",
|
|
186
|
+
heading: ["group-col"],
|
|
187
|
+
isGroup: true,
|
|
188
|
+
columns: groupCols,
|
|
189
|
+
groupConfirmed: confirmed,
|
|
190
|
+
width: groupCols.map((c) => c.width).reduce((a, b) => a + b) + 100
|
|
191
|
+
};
|
|
192
|
+
return [groupCol, rest];
|
|
193
|
+
}
|
|
194
|
+
return [null, flattenColumnGroup(columns)];
|
|
195
|
+
}
|
|
196
|
+
const isGroupColumn = (column) => column.isGroup === true;
|
|
197
|
+
const isJsonAttribute = (value) => typeof value === "string" && value.endsWith("+");
|
|
198
|
+
const isJsonGroup = (column, row, columnMap) => column.type?.name === "json" && isJsonAttribute(row[columnMap[column.name]]);
|
|
199
|
+
const isJsonColumn = (column) => column.type?.name === "json";
|
|
200
|
+
const sortPinnedColumns = (columns) => {
|
|
201
|
+
const leftPinnedColumns = [];
|
|
202
|
+
const rightPinnedColumns = [];
|
|
203
|
+
const restColumns = [];
|
|
204
|
+
let pinnedWidthLeft = 4;
|
|
205
|
+
for (const column of columns) {
|
|
206
|
+
switch (column.pin) {
|
|
207
|
+
case "left":
|
|
208
|
+
{
|
|
209
|
+
leftPinnedColumns.push({
|
|
210
|
+
...column,
|
|
211
|
+
endPin: void 0,
|
|
212
|
+
pinnedOffset: pinnedWidthLeft
|
|
213
|
+
});
|
|
214
|
+
pinnedWidthLeft += column.width;
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case "right":
|
|
218
|
+
rightPinnedColumns.unshift(column);
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
restColumns.push(column);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (leftPinnedColumns.length) {
|
|
225
|
+
leftPinnedColumns.push({
|
|
226
|
+
...leftPinnedColumns.pop(),
|
|
227
|
+
endPin: true
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
const allColumns = leftPinnedColumns.length ? leftPinnedColumns.concat(restColumns) : restColumns;
|
|
231
|
+
if (rightPinnedColumns.length) {
|
|
232
|
+
const measuredRightPinnedColumns = [];
|
|
233
|
+
let pinnedWidthRight = 0;
|
|
234
|
+
for (const column of rightPinnedColumns) {
|
|
235
|
+
measuredRightPinnedColumns.unshift({
|
|
236
|
+
...column,
|
|
237
|
+
pinnedOffset: pinnedWidthRight
|
|
238
|
+
});
|
|
239
|
+
pinnedWidthRight += column.width;
|
|
240
|
+
}
|
|
241
|
+
measuredRightPinnedColumns[0].endPin = true;
|
|
242
|
+
return allColumns.concat(measuredRightPinnedColumns);
|
|
243
|
+
} else {
|
|
244
|
+
return allColumns;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
const measurePinnedColumns = (columns, selectionEndSize) => {
|
|
248
|
+
let pinnedWidthLeft = 0;
|
|
249
|
+
let pinnedWidthRight = 0;
|
|
250
|
+
let unpinnedWidth = 0;
|
|
251
|
+
for (const column of columns) {
|
|
252
|
+
const { hidden, pin, width } = column;
|
|
253
|
+
const visibleWidth = hidden ? 0 : width;
|
|
254
|
+
if (pin === "left") {
|
|
255
|
+
pinnedWidthLeft += visibleWidth;
|
|
256
|
+
} else if (pin === "right") {
|
|
257
|
+
pinnedWidthRight += visibleWidth;
|
|
258
|
+
} else {
|
|
259
|
+
unpinnedWidth += visibleWidth;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
pinnedWidthLeft: pinnedWidthLeft + selectionEndSize,
|
|
264
|
+
pinnedWidthRight: pinnedWidthRight + selectionEndSize,
|
|
265
|
+
unpinnedWidth
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
const getTableHeadings = (columns) => {
|
|
269
|
+
if (columns.some(hasHeadings)) {
|
|
270
|
+
const maxHeadingDepth = columns.reduce(
|
|
271
|
+
(max, { heading: heading2 }) => Math.max(max, heading2?.length ?? 0),
|
|
272
|
+
0
|
|
273
|
+
);
|
|
274
|
+
let heading = void 0;
|
|
275
|
+
const tableHeadings = [];
|
|
276
|
+
let tableHeadingsRow;
|
|
277
|
+
for (let level = 0; level < maxHeadingDepth; level++) {
|
|
278
|
+
tableHeadingsRow = [];
|
|
279
|
+
columns.forEach(({ heading: columnHeading = NO_HEADINGS, width }) => {
|
|
280
|
+
const label = columnHeading[level] ?? "";
|
|
281
|
+
if (heading && heading.label === label) {
|
|
282
|
+
heading.width += width;
|
|
283
|
+
} else {
|
|
284
|
+
heading = { label, width };
|
|
285
|
+
tableHeadingsRow.push(heading);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
tableHeadings.push(tableHeadingsRow);
|
|
289
|
+
}
|
|
290
|
+
return tableHeadings;
|
|
291
|
+
}
|
|
292
|
+
return NO_HEADINGS;
|
|
293
|
+
};
|
|
294
|
+
const getColumnStyle = ({
|
|
295
|
+
pin,
|
|
296
|
+
// the 4 is `selectionEndSize`, unfortunate if we need to be passed it from cell
|
|
297
|
+
// need to think about how to make this available
|
|
298
|
+
pinnedOffset = pin === "left" ? 0 : 4,
|
|
299
|
+
width
|
|
300
|
+
}) => pin === "left" ? {
|
|
301
|
+
left: pinnedOffset,
|
|
302
|
+
width,
|
|
303
|
+
"--pin-width": `${pinnedOffset + width - 3}px`
|
|
304
|
+
} : pin === "right" ? {
|
|
305
|
+
right: pinnedOffset,
|
|
306
|
+
width,
|
|
307
|
+
"--pin-width": `${pinnedOffset + width}px`
|
|
308
|
+
} : { width };
|
|
309
|
+
const setAggregations = (aggregations, column, aggType) => {
|
|
310
|
+
return aggregations.filter((agg) => agg.column !== column.name).concat({ column: column.name, aggType });
|
|
311
|
+
};
|
|
312
|
+
const applyGroupByToColumns = (columns, groupBy, confirmed = true) => {
|
|
313
|
+
if (groupBy.length) {
|
|
314
|
+
const [groupColumn, nonGroupedColumns] = extractGroupColumn(
|
|
315
|
+
columns,
|
|
316
|
+
groupBy,
|
|
317
|
+
confirmed
|
|
318
|
+
);
|
|
319
|
+
if (groupColumn) {
|
|
320
|
+
return [groupColumn].concat(nonGroupedColumns);
|
|
321
|
+
}
|
|
322
|
+
} else if (columns[0]?.isGroup) {
|
|
323
|
+
return flattenColumnGroup(columns);
|
|
324
|
+
}
|
|
325
|
+
return columns;
|
|
326
|
+
};
|
|
327
|
+
const applySortToColumns = (columns, sort) => columns.map((column) => {
|
|
328
|
+
const sorted = getSortType(column, sort);
|
|
329
|
+
if (sorted !== void 0) {
|
|
330
|
+
return {
|
|
331
|
+
...column,
|
|
332
|
+
sorted
|
|
333
|
+
};
|
|
334
|
+
} else if (column.sorted) {
|
|
335
|
+
return {
|
|
336
|
+
...column,
|
|
337
|
+
sorted: void 0
|
|
338
|
+
};
|
|
339
|
+
} else {
|
|
340
|
+
return column;
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
const removeSort = (columns) => columns.map((col) => col.sorted ? { ...col, sorted: void 0 } : col);
|
|
344
|
+
const existingSort = (columns) => columns.some((col) => col.sorted);
|
|
345
|
+
const getSortType = (column, { sortDefs }) => {
|
|
346
|
+
const sortDef = sortDefs.find((sortCol) => sortCol.column === column.name);
|
|
347
|
+
if (sortDef) {
|
|
348
|
+
return sortDefs.length > 1 ? (sortDefs.indexOf(sortDef) + 1) * (sortDef.sortType === "A" ? 1 : -1) : sortDef.sortType;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
const getColumnName = (name) => {
|
|
352
|
+
const pos = name.indexOf(":");
|
|
353
|
+
if (pos === -1) {
|
|
354
|
+
return name;
|
|
355
|
+
} else {
|
|
356
|
+
return name.slice(0, pos);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const getColumnLabel = (column) => {
|
|
360
|
+
if (column.label) {
|
|
361
|
+
return column.label;
|
|
362
|
+
} else if (isCalculatedColumn(column.name)) {
|
|
363
|
+
return getCalculatedColumnName(column);
|
|
364
|
+
} else {
|
|
365
|
+
return column.name;
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const findColumn = (columns, columnName) => {
|
|
369
|
+
const column = columns.find((col) => col.name === columnName);
|
|
370
|
+
if (column) {
|
|
371
|
+
return column;
|
|
372
|
+
} else {
|
|
373
|
+
const groupColumn = columns.find(
|
|
374
|
+
(col) => col.isGroup
|
|
375
|
+
);
|
|
376
|
+
if (groupColumn) {
|
|
377
|
+
return findColumn(groupColumn.columns, columnName);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
function updateColumn(columns, column, options) {
|
|
382
|
+
const targetColumn = typeof column === "string" ? columns.find((col) => col.name === column) : column;
|
|
383
|
+
if (targetColumn) {
|
|
384
|
+
const replacementColumn = options ? { ...targetColumn, ...options } : targetColumn;
|
|
385
|
+
return columns.map(
|
|
386
|
+
(col) => col.name === replacementColumn.name ? replacementColumn : col
|
|
387
|
+
);
|
|
388
|
+
} else {
|
|
389
|
+
throw Error("column-utils.replaceColun, column not found");
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const toDataSourceColumns = (column) => column.name;
|
|
393
|
+
const getRowRecord = (row, columnMap) => {
|
|
394
|
+
return Object.entries(columnMap).reduce(
|
|
395
|
+
(map, [colName, key]) => {
|
|
396
|
+
map[colName] = row[key];
|
|
397
|
+
return map;
|
|
398
|
+
},
|
|
399
|
+
{}
|
|
400
|
+
);
|
|
401
|
+
};
|
|
402
|
+
const isDataLoading = (columns) => {
|
|
403
|
+
return isGroupColumn(columns[0]) && columns[0].groupConfirmed === false;
|
|
404
|
+
};
|
|
405
|
+
const getColumnsInViewport = (columns, vpStart, vpEnd) => {
|
|
406
|
+
const visibleColumns = [];
|
|
407
|
+
let preSpan = 0;
|
|
408
|
+
let rightPinnedOnly = false;
|
|
409
|
+
for (let columnOffset = 0, i = 0; i < columns.length; i++) {
|
|
410
|
+
const column = columns[i];
|
|
411
|
+
if (column.hidden) {
|
|
412
|
+
continue;
|
|
413
|
+
} else if (rightPinnedOnly) {
|
|
414
|
+
if (column.pin === "right") {
|
|
415
|
+
visibleColumns.push(column);
|
|
416
|
+
}
|
|
417
|
+
} else if (columnOffset + column.width < vpStart) {
|
|
418
|
+
if (column.pin === "left") {
|
|
419
|
+
visibleColumns.push(column);
|
|
420
|
+
} else if (columnOffset + column.width + columns[i + 1]?.width > vpStart) {
|
|
421
|
+
visibleColumns.push(column);
|
|
422
|
+
} else {
|
|
423
|
+
preSpan += column.width;
|
|
424
|
+
}
|
|
425
|
+
} else if (columnOffset > vpEnd) {
|
|
426
|
+
rightPinnedOnly = true;
|
|
427
|
+
} else {
|
|
428
|
+
visibleColumns.push(column);
|
|
429
|
+
}
|
|
430
|
+
columnOffset += column.width;
|
|
431
|
+
}
|
|
432
|
+
return [visibleColumns, preSpan];
|
|
433
|
+
};
|
|
434
|
+
const isNotHidden = (column) => column.hidden !== true;
|
|
435
|
+
const visibleColumnAtIndex = (columns, index) => {
|
|
436
|
+
if (columns.every(isNotHidden)) {
|
|
437
|
+
return columns[index];
|
|
438
|
+
} else {
|
|
439
|
+
return columns.filter(isNotHidden).at(index);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
const { DEPTH, IS_LEAF } = metadataKeys;
|
|
443
|
+
const getGroupValueAndOffset = (columns, row, columnMap) => {
|
|
444
|
+
const { [DEPTH]: depth, [IS_LEAF]: isLeaf } = row;
|
|
445
|
+
if (isLeaf || depth > columns.length) {
|
|
446
|
+
return [null, depth === null ? 0 : Math.max(0, depth - 1)];
|
|
447
|
+
} else if (depth === 0) {
|
|
448
|
+
return ["$root", 0];
|
|
449
|
+
} else {
|
|
450
|
+
const { name, valueFormatter } = columns[depth - 1];
|
|
451
|
+
const value = valueFormatter(row[columnMap[name]]);
|
|
452
|
+
return [value, depth - 1];
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const getDefaultColumnType = (serverDataType) => {
|
|
456
|
+
switch (serverDataType) {
|
|
457
|
+
case "int":
|
|
458
|
+
case "long":
|
|
459
|
+
case "double":
|
|
460
|
+
return "number";
|
|
461
|
+
case "boolean":
|
|
462
|
+
return "boolean";
|
|
463
|
+
default:
|
|
464
|
+
return "string";
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
const updateColumnFormatting = (column, formatting) => {
|
|
468
|
+
const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
|
|
469
|
+
if (isTypeDescriptor(type)) {
|
|
470
|
+
return { ...column, type: { ...type, formatting } };
|
|
471
|
+
} else {
|
|
472
|
+
return { ...column, type: { name: type, formatting } };
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
function updateColumnType(column, type) {
|
|
476
|
+
return isTypeDescriptor(column.type) ? { ...column, type: { ...column.type, name: type } } : { ...column, type };
|
|
477
|
+
}
|
|
478
|
+
const updateColumnRenderProps = (column, renderer) => {
|
|
479
|
+
const { serverDataType, type = getDefaultColumnType(serverDataType) } = column;
|
|
480
|
+
if (isTypeDescriptor(type)) {
|
|
481
|
+
return {
|
|
482
|
+
...column,
|
|
483
|
+
type: {
|
|
484
|
+
...type,
|
|
485
|
+
// TODO do we need to preserve any existing attributes from renderer ?
|
|
486
|
+
renderer
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
} else {
|
|
490
|
+
return { ...column, type: { name: type, renderer } };
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
const NO_TYPE_SETTINGS = {};
|
|
494
|
+
const getTypeFormattingFromColumn = (column) => {
|
|
495
|
+
if (isTypeDescriptor(column.type)) {
|
|
496
|
+
return column.type.formatting ?? NO_TYPE_SETTINGS;
|
|
497
|
+
} else {
|
|
498
|
+
return NO_TYPE_SETTINGS;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
const subscribedOnly = (columnNames) => (column) => columnNames?.includes(column.name);
|
|
502
|
+
const addColumnToSubscribedColumns = (subscribedColumns, availableColumns, columnName) => {
|
|
503
|
+
const byColName = (n = columnName) => (column) => column.name === n;
|
|
504
|
+
if (subscribedColumns.findIndex(byColName()) !== -1) {
|
|
505
|
+
throw Error(
|
|
506
|
+
`column-utils, addColumnToSubscribedColumns column ${columnName} is already subscribed`
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
const indexOfAvailableColumn = availableColumns.findIndex(byColName());
|
|
510
|
+
if (indexOfAvailableColumn === -1) {
|
|
511
|
+
throw Error(
|
|
512
|
+
`column-utils, addColumnToSubscribedColumns column ${columnName} is not available`
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
const newColumn = {
|
|
516
|
+
...availableColumns[indexOfAvailableColumn]
|
|
517
|
+
};
|
|
518
|
+
let index = -1;
|
|
519
|
+
for (let i = indexOfAvailableColumn - 1; i >= 0; i--) {
|
|
520
|
+
const { name } = availableColumns[i];
|
|
521
|
+
index = subscribedColumns.findIndex(byColName(name));
|
|
522
|
+
if (index !== -1) {
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (index === -1) {
|
|
527
|
+
return [newColumn].concat(subscribedColumns);
|
|
528
|
+
} else {
|
|
529
|
+
const results = [];
|
|
530
|
+
for (let i = 0; i < subscribedColumns.length; i++) {
|
|
531
|
+
results.push(subscribedColumns[i]);
|
|
532
|
+
if (i === index) {
|
|
533
|
+
results.push(newColumn);
|
|
534
|
+
index = Number.MAX_SAFE_INTEGER;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
return results;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
const CalculatedColumnPattern = /.*:.*:.*/;
|
|
541
|
+
const isCalculatedColumn = (columnName) => columnName !== void 0 && CalculatedColumnPattern.test(columnName);
|
|
542
|
+
const getCalculatedColumnDetails = (column) => {
|
|
543
|
+
if (isCalculatedColumn(column.name)) {
|
|
544
|
+
return column.name.split(/:=?/);
|
|
545
|
+
} else {
|
|
546
|
+
throw Error(
|
|
547
|
+
`column-utils, getCalculatedColumnDetails column name ${column.name} is not valid calculated column`
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
const getCalculatedColumnName = (column) => getCalculatedColumnDetails(column)[0];
|
|
552
|
+
const getCalculatedColumnType = (column) => getCalculatedColumnDetails(column)[1];
|
|
553
|
+
const getCalculatedColumnExpression = (column) => getCalculatedColumnDetails(column)[2];
|
|
554
|
+
const setCalculatedColumnName = (column, name) => {
|
|
555
|
+
const [, type, expression] = column.name.split(":");
|
|
556
|
+
return {
|
|
557
|
+
...column,
|
|
558
|
+
name: `${name}:${type}:${expression}`
|
|
559
|
+
};
|
|
560
|
+
};
|
|
561
|
+
const setCalculatedColumnType = (column, type) => {
|
|
562
|
+
const [name, , expression] = column.name.split(":");
|
|
563
|
+
return {
|
|
564
|
+
...column,
|
|
565
|
+
name: `${name}:${type}:${expression}`
|
|
566
|
+
};
|
|
567
|
+
};
|
|
568
|
+
const setCalculatedColumnExpression = (column, expression) => {
|
|
569
|
+
const [name, type] = column.name.split(":");
|
|
570
|
+
return {
|
|
571
|
+
...column,
|
|
572
|
+
name: `${name}:${type}:=${expression}`
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
const moveColumnTo = (columns, column, newIndex) => {
|
|
576
|
+
const index = columns.findIndex((col) => col.name === column.name);
|
|
577
|
+
return arrayUtils.moveItem(columns, index, newIndex);
|
|
578
|
+
};
|
|
579
|
+
function replaceColumn(columns, column) {
|
|
580
|
+
return columns.map((col) => col.name === column.name ? column : col);
|
|
581
|
+
}
|
|
582
|
+
const applyDefaultColumnConfig = ({ columns, table }, getDefaultColumnConfig) => {
|
|
583
|
+
if (typeof getDefaultColumnConfig === "function") {
|
|
584
|
+
return columns.map((column) => {
|
|
585
|
+
const config = getDefaultColumnConfig(table.table, column.name);
|
|
586
|
+
if (config) {
|
|
587
|
+
return {
|
|
588
|
+
...column,
|
|
589
|
+
...config
|
|
590
|
+
};
|
|
591
|
+
} else {
|
|
592
|
+
return column;
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
} else {
|
|
596
|
+
return columns;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
const getColumnByName = (schema, name) => {
|
|
600
|
+
if (name === void 0) {
|
|
601
|
+
return void 0;
|
|
602
|
+
} else {
|
|
603
|
+
const column = schema.columns.find((col) => col.name === name);
|
|
604
|
+
if (column) {
|
|
605
|
+
return column;
|
|
606
|
+
} else {
|
|
607
|
+
throw Error(
|
|
608
|
+
`getColumnByName no column '${name}' in schema for ${schema.table.table}`
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
function applyWidthToColumns(columns, options) {
|
|
614
|
+
const {
|
|
615
|
+
availableWidth = 0,
|
|
616
|
+
columnLayout = "Static",
|
|
617
|
+
defaultWidth = DEFAULT_COL_WIDTH,
|
|
618
|
+
defaultMinWidth = DEFAULT_MIN_WIDTH,
|
|
619
|
+
defaultMaxWidth = DEFAULT_MAX_WIDTH
|
|
620
|
+
// defaultFlex = DEFAULT_FLEX,
|
|
621
|
+
} = options;
|
|
622
|
+
if (columnLayout === "Static") {
|
|
623
|
+
return columns.map((column) => {
|
|
624
|
+
if (typeof column.width === "number") {
|
|
625
|
+
return column;
|
|
626
|
+
} else {
|
|
627
|
+
return {
|
|
628
|
+
...column,
|
|
629
|
+
width: defaultWidth
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
} else if (columnLayout === "Fit") {
|
|
634
|
+
const { totalMinWidth, totalMaxWidth, totalWidth, flexCount } = columns.reduce(
|
|
635
|
+
(aggregated, column) => {
|
|
636
|
+
const { totalMinWidth: totalMinWidth2, totalMaxWidth: totalMaxWidth2, totalWidth: totalWidth2, flexCount: flexCount2 } = aggregated;
|
|
637
|
+
const {
|
|
638
|
+
minWidth = defaultMinWidth,
|
|
639
|
+
maxWidth = defaultMaxWidth,
|
|
640
|
+
width = defaultWidth,
|
|
641
|
+
flex = 0
|
|
642
|
+
} = column;
|
|
643
|
+
return {
|
|
644
|
+
totalMinWidth: totalMinWidth2 + minWidth,
|
|
645
|
+
totalMaxWidth: totalMaxWidth2 + maxWidth,
|
|
646
|
+
totalWidth: totalWidth2 + width,
|
|
647
|
+
flexCount: flexCount2 + flex
|
|
648
|
+
};
|
|
649
|
+
},
|
|
650
|
+
{ totalMinWidth: 0, totalMaxWidth: 0, totalWidth: 0, flexCount: 0 }
|
|
651
|
+
);
|
|
652
|
+
if (totalMinWidth > availableWidth || totalMaxWidth < availableWidth) {
|
|
653
|
+
return columns;
|
|
654
|
+
} else if (totalWidth > availableWidth) {
|
|
655
|
+
const excessWidth = totalWidth - availableWidth;
|
|
656
|
+
const inFlexMode = flexCount > 0;
|
|
657
|
+
let excessWidthPerColumn = excessWidth / (flexCount || columns.length);
|
|
658
|
+
let columnsNotYetAtMinWidth = columns.length;
|
|
659
|
+
let unassignedExcess = 0;
|
|
660
|
+
let newColumns = columns.map((column) => {
|
|
661
|
+
const {
|
|
662
|
+
minWidth = defaultMinWidth,
|
|
663
|
+
width = defaultWidth,
|
|
664
|
+
flex = 0
|
|
665
|
+
} = column;
|
|
666
|
+
if (inFlexMode && flex === 0) {
|
|
667
|
+
return column;
|
|
668
|
+
}
|
|
669
|
+
const adjustedWidth = width - excessWidthPerColumn;
|
|
670
|
+
if (adjustedWidth < minWidth) {
|
|
671
|
+
columnsNotYetAtMinWidth -= 1;
|
|
672
|
+
unassignedExcess += minWidth - adjustedWidth;
|
|
673
|
+
return { ...column, width: minWidth };
|
|
674
|
+
} else {
|
|
675
|
+
return { ...column, width: adjustedWidth };
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
if (unassignedExcess === 0) {
|
|
679
|
+
return newColumns;
|
|
680
|
+
} else {
|
|
681
|
+
excessWidthPerColumn = unassignedExcess / columnsNotYetAtMinWidth;
|
|
682
|
+
newColumns = newColumns.map((column) => {
|
|
683
|
+
const adjustedWidth = column.width - excessWidthPerColumn;
|
|
684
|
+
if (column.width !== column.minWidth) {
|
|
685
|
+
return { ...column, width: adjustedWidth };
|
|
686
|
+
} else {
|
|
687
|
+
return column;
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
return newColumns;
|
|
691
|
+
}
|
|
692
|
+
} else if (totalWidth < availableWidth) {
|
|
693
|
+
{
|
|
694
|
+
const additionalWidth = availableWidth - totalWidth;
|
|
695
|
+
const inFlexMode = flexCount > 0;
|
|
696
|
+
let additionalWidthPerColumn = additionalWidth / (flexCount || columns.length);
|
|
697
|
+
let newColumns = columns.map((column) => {
|
|
698
|
+
const {
|
|
699
|
+
maxWidth = defaultMaxWidth,
|
|
700
|
+
width = defaultWidth,
|
|
701
|
+
flex = 0
|
|
702
|
+
} = column;
|
|
703
|
+
if (inFlexMode && flex === 0) {
|
|
704
|
+
return column;
|
|
705
|
+
}
|
|
706
|
+
const adjustedWidth = width + additionalWidthPerColumn;
|
|
707
|
+
if (adjustedWidth > maxWidth) {
|
|
708
|
+
return { ...column, width: maxWidth };
|
|
709
|
+
} else {
|
|
710
|
+
return { ...column, width: adjustedWidth, canStretch: true };
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
const unassignedAdditionalColumnWidth = additionalWidth - newColumns.reduce((sum, col) => sum + col.width, 0);
|
|
714
|
+
const columnsNotYetAtMaxWidth = newColumns.filter(
|
|
715
|
+
(col) => col.canStretch
|
|
716
|
+
).length;
|
|
717
|
+
if (unassignedAdditionalColumnWidth > columnsNotYetAtMaxWidth) {
|
|
718
|
+
additionalWidthPerColumn = unassignedAdditionalColumnWidth / columnsNotYetAtMaxWidth;
|
|
719
|
+
newColumns = newColumns.map((column) => {
|
|
720
|
+
if (column.canStretch) {
|
|
721
|
+
const adjustedWidth = Math.min(
|
|
722
|
+
column.width + additionalWidthPerColumn
|
|
723
|
+
);
|
|
724
|
+
return { ...column, width: adjustedWidth };
|
|
725
|
+
} else {
|
|
726
|
+
return column;
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
return newColumns.map(({ canStretch, ...column }) => column);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return columns;
|
|
735
|
+
}
|
|
736
|
+
const dataAndColumnUnchanged = (p, p1) => p.column === p1.column && p.column.valueFormatter(p.row[p.columnMap[p.column.name]]) === p1.column.valueFormatter(p1.row[p1.columnMap[p1.column.name]]);
|
|
737
|
+
const dataColumnAndKeyUnchanged = (p, p1) => p.column === p1.column && p.row[KEY] === p1.row[KEY] && p.column.valueFormatter(p.row[p.columnMap[p.column.name]]) === p1.column.valueFormatter(p1.row[p1.columnMap[p1.column.name]]);
|
|
738
|
+
|
|
739
|
+
exports.AggregationType = AggregationType;
|
|
740
|
+
exports.addColumnToSubscribedColumns = addColumnToSubscribedColumns;
|
|
741
|
+
exports.applyDefaultColumnConfig = applyDefaultColumnConfig;
|
|
742
|
+
exports.applyGroupByToColumns = applyGroupByToColumns;
|
|
743
|
+
exports.applySortToColumns = applySortToColumns;
|
|
744
|
+
exports.applyWidthToColumns = applyWidthToColumns;
|
|
745
|
+
exports.buildColumnMap = buildColumnMap;
|
|
746
|
+
exports.dataAndColumnUnchanged = dataAndColumnUnchanged;
|
|
747
|
+
exports.dataColumnAndKeyUnchanged = dataColumnAndKeyUnchanged;
|
|
748
|
+
exports.existingSort = existingSort;
|
|
749
|
+
exports.extractGroupColumn = extractGroupColumn;
|
|
750
|
+
exports.findColumn = findColumn;
|
|
751
|
+
exports.flattenColumnGroup = flattenColumnGroup;
|
|
752
|
+
exports.fromServerDataType = fromServerDataType;
|
|
753
|
+
exports.getCalculatedColumnDetails = getCalculatedColumnDetails;
|
|
754
|
+
exports.getCalculatedColumnExpression = getCalculatedColumnExpression;
|
|
755
|
+
exports.getCalculatedColumnName = getCalculatedColumnName;
|
|
756
|
+
exports.getCalculatedColumnType = getCalculatedColumnType;
|
|
757
|
+
exports.getColumnByName = getColumnByName;
|
|
758
|
+
exports.getColumnLabel = getColumnLabel;
|
|
759
|
+
exports.getColumnName = getColumnName;
|
|
760
|
+
exports.getColumnStyle = getColumnStyle;
|
|
761
|
+
exports.getColumnsInViewport = getColumnsInViewport;
|
|
762
|
+
exports.getDefaultAlignment = getDefaultAlignment;
|
|
763
|
+
exports.getDefaultColumnType = getDefaultColumnType;
|
|
764
|
+
exports.getGroupValueAndOffset = getGroupValueAndOffset;
|
|
765
|
+
exports.getRowRecord = getRowRecord;
|
|
766
|
+
exports.getTableHeadings = getTableHeadings;
|
|
767
|
+
exports.getTypeFormattingFromColumn = getTypeFormattingFromColumn;
|
|
768
|
+
exports.hasHeadings = hasHeadings;
|
|
769
|
+
exports.hasValidationRules = hasValidationRules;
|
|
770
|
+
exports.isCalculatedColumn = isCalculatedColumn;
|
|
771
|
+
exports.isColumnTypeRenderer = isColumnTypeRenderer;
|
|
772
|
+
exports.isDataLoading = isDataLoading;
|
|
773
|
+
exports.isDateTimeColumn = isDateTimeColumn;
|
|
774
|
+
exports.isGroupColumn = isGroupColumn;
|
|
775
|
+
exports.isJsonAttribute = isJsonAttribute;
|
|
776
|
+
exports.isJsonColumn = isJsonColumn;
|
|
777
|
+
exports.isJsonGroup = isJsonGroup;
|
|
778
|
+
exports.isLookupRenderer = isLookupRenderer;
|
|
779
|
+
exports.isMappedValueTypeRenderer = isMappedValueTypeRenderer;
|
|
780
|
+
exports.isNotHidden = isNotHidden;
|
|
781
|
+
exports.isNumericColumn = isNumericColumn;
|
|
782
|
+
exports.isPinned = isPinned;
|
|
783
|
+
exports.isResizing = isResizing;
|
|
784
|
+
exports.isTextColumn = isTextColumn;
|
|
785
|
+
exports.isTypeDescriptor = isTypeDescriptor;
|
|
786
|
+
exports.isValidColumnAlignment = isValidColumnAlignment;
|
|
787
|
+
exports.isValidPinLocation = isValidPinLocation;
|
|
788
|
+
exports.isValueListRenderer = isValueListRenderer;
|
|
789
|
+
exports.isVuuColumnDataType = isVuuColumnDataType;
|
|
790
|
+
exports.mapSortCriteria = mapSortCriteria;
|
|
791
|
+
exports.measurePinnedColumns = measurePinnedColumns;
|
|
792
|
+
exports.metadataKeys = metadataKeys;
|
|
793
|
+
exports.moveColumnTo = moveColumnTo;
|
|
794
|
+
exports.projectUpdates = projectUpdates;
|
|
795
|
+
exports.removeSort = removeSort;
|
|
796
|
+
exports.replaceColumn = replaceColumn;
|
|
797
|
+
exports.setAggregations = setAggregations;
|
|
798
|
+
exports.setCalculatedColumnExpression = setCalculatedColumnExpression;
|
|
799
|
+
exports.setCalculatedColumnName = setCalculatedColumnName;
|
|
800
|
+
exports.setCalculatedColumnType = setCalculatedColumnType;
|
|
801
|
+
exports.sortPinnedColumns = sortPinnedColumns;
|
|
802
|
+
exports.subscribedOnly = subscribedOnly;
|
|
803
|
+
exports.toColumnDescriptor = toColumnDescriptor;
|
|
804
|
+
exports.toDataSourceColumns = toDataSourceColumns;
|
|
805
|
+
exports.updateColumn = updateColumn;
|
|
806
|
+
exports.updateColumnFormatting = updateColumnFormatting;
|
|
807
|
+
exports.updateColumnRenderProps = updateColumnRenderProps;
|
|
808
|
+
exports.updateColumnType = updateColumnType;
|
|
809
|
+
exports.visibleColumnAtIndex = visibleColumnAtIndex;
|
|
810
|
+
//# sourceMappingURL=column-utils.js.map
|