@vuu-ui/vuu-utils 0.13.111-alpha.2 → 0.13.111
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/packages/vuu-utils/src/column-utils.js +25 -135
- package/cjs/packages/vuu-utils/src/column-utils.js.map +1 -1
- package/cjs/packages/vuu-utils/src/html-utils.js.map +1 -1
- package/cjs/packages/vuu-utils/src/index.js +0 -6
- package/cjs/packages/vuu-utils/src/index.js.map +1 -1
- package/cjs/packages/vuu-utils/src/protocol-message-utils.js +0 -4
- package/cjs/packages/vuu-utils/src/protocol-message-utils.js.map +1 -1
- package/esm/packages/vuu-utils/src/column-utils.js +26 -132
- package/esm/packages/vuu-utils/src/column-utils.js.map +1 -1
- package/esm/packages/vuu-utils/src/html-utils.js.map +1 -1
- package/esm/packages/vuu-utils/src/index.js +2 -2
- package/esm/packages/vuu-utils/src/protocol-message-utils.js +1 -3
- package/esm/packages/vuu-utils/src/protocol-message-utils.js.map +1 -1
- package/package.json +6 -6
- package/types/column-utils.d.ts +2 -18
- package/types/filters/filter-utils.d.ts +1 -2
- package/types/html-utils.d.ts +1 -1
- package/types/protocol-message-utils.d.ts +1 -3
|
@@ -110,9 +110,6 @@ exports.extractGroupColumn = columnUtils.extractGroupColumn;
|
|
|
110
110
|
exports.findColumn = columnUtils.findColumn;
|
|
111
111
|
exports.flattenColumnGroup = columnUtils.flattenColumnGroup;
|
|
112
112
|
exports.fromServerDataType = columnUtils.fromServerDataType;
|
|
113
|
-
exports.getAllCellsInColumn = columnUtils.getAllCellsInColumn;
|
|
114
|
-
exports.getAriaColIndex = columnUtils.getAriaColIndex;
|
|
115
|
-
exports.getAriaRowIndex = columnUtils.getAriaRowIndex;
|
|
116
113
|
exports.getCalculatedColumnDetails = columnUtils.getCalculatedColumnDetails;
|
|
117
114
|
exports.getColumnLabel = columnUtils.getColumnLabel;
|
|
118
115
|
exports.getColumnName = columnUtils.getColumnName;
|
|
@@ -122,7 +119,6 @@ exports.getDefaultAlignment = columnUtils.getDefaultAlignment;
|
|
|
122
119
|
exports.getDefaultColumnType = columnUtils.getDefaultColumnType;
|
|
123
120
|
exports.getGroupIcon = columnUtils.getGroupIcon;
|
|
124
121
|
exports.getGroupValue = columnUtils.getGroupValue;
|
|
125
|
-
exports.getPinStateFromElement = columnUtils.getPinStateFromElement;
|
|
126
122
|
exports.getRuntimeColumnWidth = columnUtils.getRuntimeColumnWidth;
|
|
127
123
|
exports.getTableHeadings = columnUtils.getTableHeadings;
|
|
128
124
|
exports.getTypeFormattingFromColumn = columnUtils.getTypeFormattingFromColumn;
|
|
@@ -375,9 +371,7 @@ exports.isLoginResponse = protocolMessageUtils.isLoginResponse;
|
|
|
375
371
|
exports.isOpenDialogAction = protocolMessageUtils.isOpenDialogAction;
|
|
376
372
|
exports.isOpenSessionTableDialogMessage = protocolMessageUtils.isOpenSessionTableDialogMessage;
|
|
377
373
|
exports.isRequestResponse = protocolMessageUtils.isRequestResponse;
|
|
378
|
-
exports.isRpcError = protocolMessageUtils.isRpcError;
|
|
379
374
|
exports.isRpcServiceRequest = protocolMessageUtils.isRpcServiceRequest;
|
|
380
|
-
exports.isRpcSuccess = protocolMessageUtils.isRpcSuccess;
|
|
381
375
|
exports.isSelectRequest = protocolMessageUtils.isSelectRequest;
|
|
382
376
|
exports.isSelectSuccessWithRowCount = protocolMessageUtils.isSelectSuccessWithRowCount;
|
|
383
377
|
exports.isSessionTable = protocolMessageUtils.isSessionTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -31,8 +31,6 @@ const isRpcServiceRequest = (message) => message.type === "RPC_REQUEST";
|
|
|
31
31
|
const hasViewPortContext = (message) => message.context.type === "VIEWPORT_CONTEXT";
|
|
32
32
|
const isVuuMenuRpcRequest = (message) => MENU_RPC_TYPES.includes(message["type"]);
|
|
33
33
|
const isLoginResponse = (message) => message !== null && typeof message === "object" && "type" in message && (message.type === "LOGIN_SUCCESS" || message.type === "LOGIN_FAIL");
|
|
34
|
-
const isRpcSuccess = (rpcResult) => rpcResult?.type === "SUCCESS_RESULT";
|
|
35
|
-
const isRpcError = (rpcResult) => rpcResult?.type === "ERROR_RESULT";
|
|
36
34
|
const isRequestResponse = (message) => "requestId" in message;
|
|
37
35
|
const isOpenSessionTableDialogMessage = (rpcResponse) => rpcResponse.type === "VIEW_PORT_MENU_RESP" && isOpenDialogAction(rpcResponse.action) && "tableSchema" in rpcResponse.action;
|
|
38
36
|
const isOpenDialogAction = (action) => action !== void 0 && action.type === "OPEN_DIALOG_ACTION";
|
|
@@ -69,9 +67,7 @@ exports.isLoginResponse = isLoginResponse;
|
|
|
69
67
|
exports.isOpenDialogAction = isOpenDialogAction;
|
|
70
68
|
exports.isOpenSessionTableDialogMessage = isOpenSessionTableDialogMessage;
|
|
71
69
|
exports.isRequestResponse = isRequestResponse;
|
|
72
|
-
exports.isRpcError = isRpcError;
|
|
73
70
|
exports.isRpcServiceRequest = isRpcServiceRequest;
|
|
74
|
-
exports.isRpcSuccess = isRpcSuccess;
|
|
75
71
|
exports.isSelectRequest = isSelectRequest;
|
|
76
72
|
exports.isSelectSuccessWithRowCount = isSelectSuccessWithRowCount;
|
|
77
73
|
exports.isSessionTable = isSessionTable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-message-utils.js","sources":["../../../../../../packages/vuu-utils/src/protocol-message-utils.ts"],"sourcesContent":["import type {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n TableSchema,\n VuuUiMessageInRequestResponse,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuRpcMenuRequest,\n OpenDialogAction,\n VuuRpcRequest,\n VuuRpcResponse,\n VuuRpcMenuSuccess,\n VuuTable,\n VuuViewportRpcTypeaheadRequest,\n VuuRpcServiceRequest,\n ViewportRpcContext,\n OpenComponentInDialogAction,\n VuuLoginSuccessResponse,\n SelectRequest,\n SelectResponse,\n SelectSuccessWithRowCount,\n VuuViewportCreateSuccessResponse,\n VuuViewportCreateResponse,\n InvalidTokenReason,\n InvalidSessionReason,\n LoginErrorMessage,\n
|
|
1
|
+
{"version":3,"file":"protocol-message-utils.js","sources":["../../../../../../packages/vuu-utils/src/protocol-message-utils.ts"],"sourcesContent":["import type {\n MenuRpcAction,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n RpcResponse,\n TableSchema,\n VuuUiMessageInRequestResponse,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n VuuRpcMenuRequest,\n OpenDialogAction,\n VuuRpcRequest,\n VuuRpcResponse,\n VuuRpcMenuSuccess,\n VuuTable,\n VuuViewportRpcTypeaheadRequest,\n VuuRpcServiceRequest,\n ViewportRpcContext,\n OpenComponentInDialogAction,\n VuuLoginSuccessResponse,\n SelectRequest,\n SelectResponse,\n SelectSuccessWithRowCount,\n VuuViewportCreateSuccessResponse,\n VuuViewportCreateResponse,\n InvalidTokenReason,\n InvalidSessionReason,\n LoginErrorMessage,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport { isView as componentInRegistry } from \"./component-registry\";\n\nconst MENU_RPC_TYPES = [\n \"VIEW_PORT_MENUS_SELECT_RPC\",\n \"VIEW_PORT_MENU_TABLE_RPC\",\n \"VIEW_PORT_MENU_ROW_RPC\",\n \"VIEW_PORT_MENU_CELL_RPC\",\n];\n\nexport const INVALID_SESSION: InvalidSessionReason = \"Invalid session\";\nexport const SESSION_LIMIT_EXCEEDED: InvalidSessionReason =\n \"User session limit exceeded\";\nexport const INVALID_TOKEN: InvalidTokenReason = \"Invalid token\";\nexport const TOKEN_EXPIRED: InvalidTokenReason = \"Token has expired\";\n\nconst InvalidLoginMessages: string[] = [\n INVALID_SESSION,\n SESSION_LIMIT_EXCEEDED,\n INVALID_TOKEN,\n TOKEN_EXPIRED,\n];\n\nexport const isLoginErrorMessage = (\n message: unknown,\n): message is LoginErrorMessage =>\n typeof message === \"string\" && InvalidLoginMessages.includes(message);\n\nexport const isSelectRequest = (message: object): message is SelectRequest =>\n message &&\n typeof message === \"object\" &&\n \"type\" in message &&\n (message.type === \"SELECT_ROW\" ||\n message.type === \"DESELECT_ROW\" ||\n message.type === \"SELECT_ROW_RANGE\" ||\n message.type === \"SELECT_ALL\" ||\n message.type === \"DESELECT_ALL\");\n\nexport const isSelectSuccessWithRowCount = (\n response: SelectResponse | SelectSuccessWithRowCount,\n): response is SelectSuccessWithRowCount =>\n [\n \"SELECT_ROW_SUCCESS\",\n \"DESELECT_ROW_SUCCESS\",\n \"SELECT_ROW_RANGE_SUCCESS\",\n \"SELECT_ALL_SUCCESS\",\n \"DESELECT_ALL_SUCCESS\",\n ].includes(response.type ?? \"\") &&\n typeof (response as SelectSuccessWithRowCount).selectedRowCount === \"number\";\n\nexport const isRpcServiceRequest = (message: {\n type: string;\n}): message is VuuRpcServiceRequest | Omit<VuuRpcServiceRequest, \"context\"> =>\n message.type === \"RPC_REQUEST\";\n\nexport const hasViewPortContext = (\n message: VuuRpcServiceRequest,\n): message is VuuRpcServiceRequest<ViewportRpcContext> =>\n message.context.type === \"VIEWPORT_CONTEXT\";\n\nexport const isVuuMenuRpcRequest = (\n message: VuuRpcRequest | Omit<VuuRpcRequest, \"vpId\">,\n): message is VuuRpcMenuRequest => MENU_RPC_TYPES.includes(message[\"type\"]);\n\nexport const isLoginResponse = (\n message: unknown,\n): message is VuuLoginSuccessResponse =>\n message !== null &&\n typeof message === \"object\" &&\n \"type\" in message &&\n (message.type === \"LOGIN_SUCCESS\" || message.type === \"LOGIN_FAIL\");\n\nexport const isRequestResponse = (\n message: object,\n): message is VuuUiMessageInRequestResponse => \"requestId\" in message;\n\nexport const isOpenSessionTableDialogMessage = (\n rpcResponse: RpcResponse,\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n rpcResponse.type === \"VIEW_PORT_MENU_RESP\" &&\n isOpenDialogAction(rpcResponse.action) &&\n \"tableSchema\" in rpcResponse.action;\n\nexport const isOpenDialogAction = (\n action?: MenuRpcAction,\n): action is OpenDialogAction =>\n action !== undefined && action.type === \"OPEN_DIALOG_ACTION\";\n\nexport const isTypeaheadRequest = (\n request: Omit<VuuRpcRequest, \"vpId\">,\n): request is Omit<VuuViewportRpcTypeaheadRequest, \"vpId\"> => {\n return (\n isRpcServiceRequest(request) &&\n (request.rpcName === \"getUniqueFieldValues\" ||\n request.rpcName === \"getUniqueFieldValuesStartingWith\")\n );\n};\n\nexport const isCreateVpSuccess = (\n response: VuuViewportCreateResponse,\n): response is VuuViewportCreateSuccessResponse =>\n response.type === \"CREATE_VP_SUCCESS\";\n\nexport const isSessionTable = (table?: unknown) => {\n if (\n table !== null &&\n typeof table === \"object\" &&\n \"table\" in table &&\n \"module\" in table\n ) {\n return (table as VuuTable).table.startsWith(\"session\");\n }\n return false;\n};\n\nexport function isActionMessage(\n rpcResponse: VuuRpcResponse,\n): rpcResponse is VuuRpcMenuSuccess;\nexport function isActionMessage(\n rpcResponse: Omit<VuuRpcResponse, \"vpId\">,\n): rpcResponse is Omit<VuuRpcMenuSuccess, \"vpId\">;\nexport function isActionMessage(\n rpcResponse: VuuRpcResponse | Omit<VuuRpcResponse, \"vpId\">,\n) {\n return rpcResponse.type === \"VIEW_PORT_MENU_RESP\";\n}\n\nexport function isSessionTableActionMessage(\n rpcResponse: VuuRpcResponse,\n): rpcResponse is VuuRpcMenuSuccess<\n OpenDialogAction & {\n tableSchema: TableSchema;\n }\n>;\nexport function isSessionTableActionMessage(\n rpcResponse: Omit<VuuRpcResponse, \"vpId\">,\n): rpcResponse is Omit<\n VuuRpcMenuSuccess<\n OpenDialogAction & {\n tableSchema: TableSchema;\n }\n >,\n \"vpId\"\n>;\nexport function isSessionTableActionMessage(\n rpcResponse: VuuRpcResponse | Omit<VuuRpcResponse, \"vpId\">,\n): rpcResponse is VuuRpcMenuSuccess<\n OpenDialogAction & {\n tableSchema: TableSchema;\n }\n> {\n return (\n isActionMessage(rpcResponse) &&\n isOpenDialogAction(rpcResponse.action) &&\n isSessionTable(rpcResponse.action.table) &&\n rpcResponse.action?.renderComponent === \"inline-form\"\n );\n}\n\nexport function isCustomComponentActionMessage(\n rpcResponse: VuuRpcResponse | Omit<VuuRpcResponse, \"vpId\">,\n): rpcResponse is VuuRpcMenuSuccess<\n OpenComponentInDialogAction & {\n tableSchema: TableSchema;\n }\n> {\n return (\n isActionMessage(rpcResponse) &&\n isOpenDialogAction(rpcResponse.action) &&\n isSessionTable(rpcResponse.action.table) &&\n typeof rpcResponse.action.renderComponent === \"string\" &&\n componentInRegistry(rpcResponse.action.renderComponent)\n );\n}\n"],"names":["componentInRegistry"],"mappings":";;;;AA+BA,MAAM,cAAiB,GAAA;AAAA,EACrB,4BAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA;AACF,CAAA;AAEO,MAAM,eAAwC,GAAA;AAC9C,MAAM,sBACX,GAAA;AACK,MAAM,aAAoC,GAAA;AAC1C,MAAM,aAAoC,GAAA;AAEjD,MAAM,oBAAiC,GA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-1,5 +1,4 @@
|
|
|
1
1
|
import { moveItem } from './array-utils.js';
|
|
2
|
-
import { queryClosest } from './html-utils.js';
|
|
3
2
|
|
|
4
3
|
const SORT_ASC = "asc";
|
|
5
4
|
const NO_HEADINGS = [];
|
|
@@ -251,18 +250,18 @@ const checkConfirmationPending = (previousConfig) => {
|
|
|
251
250
|
const isJsonAttribute = (value) => typeof value === "string" && (value.endsWith("{") || value.endsWith("["));
|
|
252
251
|
const isJsonGroup = (column, row, columnMap) => column.type?.name === "json" && isJsonAttribute(row[columnMap[column.name]]);
|
|
253
252
|
const isJsonColumn = (column) => column.type?.name === "json";
|
|
254
|
-
const sortPinnedColumns = (columns
|
|
253
|
+
const sortPinnedColumns = (columns) => {
|
|
255
254
|
const leftPinnedColumns = [];
|
|
256
255
|
const rightPinnedColumns = [];
|
|
257
256
|
const restColumns = [];
|
|
258
|
-
let pinnedWidthLeft =
|
|
257
|
+
let pinnedWidthLeft = 4;
|
|
259
258
|
for (const column of columns) {
|
|
260
259
|
switch (column.pin) {
|
|
261
260
|
case "left":
|
|
262
261
|
{
|
|
263
262
|
leftPinnedColumns.push({
|
|
264
263
|
...column,
|
|
265
|
-
|
|
264
|
+
endPin: void 0,
|
|
266
265
|
pinnedOffset: pinnedWidthLeft
|
|
267
266
|
});
|
|
268
267
|
pinnedWidthLeft += column.width;
|
|
@@ -279,13 +278,13 @@ const sortPinnedColumns = (columns, selectionBookendWidth = 0) => {
|
|
|
279
278
|
if (leftPinnedColumns.length) {
|
|
280
279
|
leftPinnedColumns.push({
|
|
281
280
|
...leftPinnedColumns.pop(),
|
|
282
|
-
|
|
281
|
+
endPin: true
|
|
283
282
|
});
|
|
284
283
|
}
|
|
285
|
-
|
|
284
|
+
const allColumns = leftPinnedColumns.length ? leftPinnedColumns.concat(restColumns) : restColumns;
|
|
286
285
|
if (rightPinnedColumns.length) {
|
|
287
286
|
const measuredRightPinnedColumns = [];
|
|
288
|
-
let pinnedWidthRight =
|
|
287
|
+
let pinnedWidthRight = 0;
|
|
289
288
|
for (const column of rightPinnedColumns) {
|
|
290
289
|
measuredRightPinnedColumns.unshift({
|
|
291
290
|
...column,
|
|
@@ -293,20 +292,11 @@ const sortPinnedColumns = (columns, selectionBookendWidth = 0) => {
|
|
|
293
292
|
});
|
|
294
293
|
pinnedWidthRight += column.width;
|
|
295
294
|
}
|
|
296
|
-
measuredRightPinnedColumns[
|
|
297
|
-
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
for (let i = 0; i < allColumns.length; i++) {
|
|
301
|
-
if (allColumns[i].ariaColIndex !== i + 1) {
|
|
302
|
-
allColumns[i] = {
|
|
303
|
-
...allColumns[i],
|
|
304
|
-
ariaColIndex: i + 1
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
295
|
+
measuredRightPinnedColumns[0].endPin = true;
|
|
296
|
+
return allColumns.concat(measuredRightPinnedColumns);
|
|
297
|
+
} else {
|
|
298
|
+
return allColumns;
|
|
308
299
|
}
|
|
309
|
-
return allColumns;
|
|
310
300
|
};
|
|
311
301
|
const measurePinnedColumns = (columns, selectionEndSize) => {
|
|
312
302
|
let pinnedWidthLeft = 0;
|
|
@@ -357,115 +347,19 @@ const getTableHeadings = (columns) => {
|
|
|
357
347
|
};
|
|
358
348
|
const getColumnStyle = ({
|
|
359
349
|
pin,
|
|
360
|
-
|
|
361
|
-
|
|
350
|
+
// the 4 is `selectionEndSize`, unfortunate if we need to be passed it from cell
|
|
351
|
+
// need to think about how to make this available
|
|
352
|
+
pinnedOffset = pin === "left" ? 0 : 4,
|
|
362
353
|
width
|
|
363
|
-
}) => {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
left: pinnedOffset,
|
|
373
|
-
width
|
|
374
|
-
};
|
|
375
|
-
} else if (pinnedWidth && pin === "right") {
|
|
376
|
-
return {
|
|
377
|
-
right: pinnedOffset,
|
|
378
|
-
width,
|
|
379
|
-
"--pin-width": `${pinnedWidth - 5}px`
|
|
380
|
-
};
|
|
381
|
-
} else if (pin === "right") {
|
|
382
|
-
return {
|
|
383
|
-
right: pinnedOffset,
|
|
384
|
-
width
|
|
385
|
-
};
|
|
386
|
-
} else {
|
|
387
|
-
return { width };
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
const getPinnedWidthFromElement = (cell) => {
|
|
391
|
-
const cellStyle = getComputedStyle(cell);
|
|
392
|
-
return parseInt(cellStyle.getPropertyValue("--pin-width"));
|
|
393
|
-
};
|
|
394
|
-
const getAllCellsInColumn = (container, colIndex) => {
|
|
395
|
-
const byColIndex = `[aria-colindex='${colIndex}']`;
|
|
396
|
-
return Array.from(
|
|
397
|
-
container?.querySelectorAll(
|
|
398
|
-
`.vuuTableCell${byColIndex},.vuuTableHeaderCell${byColIndex},.vuuTableGroupHeaderCell${byColIndex}`
|
|
399
|
-
) ?? []
|
|
400
|
-
);
|
|
401
|
-
};
|
|
402
|
-
const getAriaRowIndex = (rowElement) => {
|
|
403
|
-
const rowIndex = rowElement?.ariaRowIndex;
|
|
404
|
-
if (rowIndex != null) {
|
|
405
|
-
const index = parseInt(rowIndex);
|
|
406
|
-
if (!isNaN(index)) {
|
|
407
|
-
return index;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return -1;
|
|
411
|
-
};
|
|
412
|
-
const getAriaColIndex = (cellElement) => {
|
|
413
|
-
const colIndex = cellElement?.ariaColIndex;
|
|
414
|
-
if (colIndex != null) {
|
|
415
|
-
const index = parseInt(colIndex);
|
|
416
|
-
if (!isNaN(index)) {
|
|
417
|
-
return index;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
return -1;
|
|
421
|
-
};
|
|
422
|
-
const getPinDetails = (cell, className) => {
|
|
423
|
-
if (cell.classList.contains("vuuEndPin")) {
|
|
424
|
-
return {
|
|
425
|
-
cell,
|
|
426
|
-
pinnedWidth: getPinnedWidthFromElement(cell)
|
|
427
|
-
};
|
|
428
|
-
} else {
|
|
429
|
-
const endPin = cell.parentElement?.querySelector(
|
|
430
|
-
`.${className}.vuuEndPin`
|
|
431
|
-
);
|
|
432
|
-
if (endPin) {
|
|
433
|
-
let pinnedCells = void 0;
|
|
434
|
-
if (className === "vuuPinLeft") {
|
|
435
|
-
const container = queryClosest(
|
|
436
|
-
cell,
|
|
437
|
-
".vuuTable-table",
|
|
438
|
-
true
|
|
439
|
-
);
|
|
440
|
-
const startIndex = getAriaColIndex(cell);
|
|
441
|
-
const endIndex = getAriaColIndex(endPin);
|
|
442
|
-
pinnedCells = [];
|
|
443
|
-
for (let colIndex = startIndex + 1; colIndex <= endIndex; colIndex++) {
|
|
444
|
-
pinnedCells = pinnedCells?.concat(
|
|
445
|
-
getAllCellsInColumn(container, colIndex)
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
console.log({ pinnedCells });
|
|
450
|
-
return {
|
|
451
|
-
cell: endPin,
|
|
452
|
-
pinnedCells,
|
|
453
|
-
pinnedWidth: getPinnedWidthFromElement(endPin)
|
|
454
|
-
};
|
|
455
|
-
} else {
|
|
456
|
-
throw Error(
|
|
457
|
-
"[column-utils] getPinDetailsFromElement, no endPin on multi column pin"
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
const getPinStateFromElement = (cell) => {
|
|
463
|
-
if (cell.classList.contains("vuuPinLeft")) {
|
|
464
|
-
return getPinDetails(cell, "vuuPinLeft");
|
|
465
|
-
} else if (cell.classList.contains("vuuPinRight")) {
|
|
466
|
-
return getPinDetails(cell, "vuuPinRight");
|
|
467
|
-
}
|
|
468
|
-
};
|
|
354
|
+
}) => pin === "left" ? {
|
|
355
|
+
left: pinnedOffset,
|
|
356
|
+
width,
|
|
357
|
+
"--pin-width": `${pinnedOffset + width - 3}px`
|
|
358
|
+
} : pin === "right" ? {
|
|
359
|
+
right: pinnedOffset,
|
|
360
|
+
width,
|
|
361
|
+
"--pin-width": `${pinnedOffset + width}px`
|
|
362
|
+
} : { width };
|
|
469
363
|
const setAggregations = (aggregations, column, aggType) => {
|
|
470
364
|
return aggregations.filter((agg) => agg.column !== column.name).concat({ column: column.name, aggType });
|
|
471
365
|
};
|
|
@@ -567,10 +461,10 @@ const getColumnsInViewport = (columns, vpStart, vpEnd) => {
|
|
|
567
461
|
const column = columns[i];
|
|
568
462
|
if (column.hidden) {
|
|
569
463
|
continue;
|
|
570
|
-
} else if (column.pin === "right") {
|
|
571
|
-
visibleColumns.push(column);
|
|
572
464
|
} else if (rightPinnedOnly) {
|
|
573
|
-
|
|
465
|
+
if (column.pin === "right") {
|
|
466
|
+
visibleColumns.push(column);
|
|
467
|
+
}
|
|
574
468
|
} else if (columnOffset + column.width < vpStart) {
|
|
575
469
|
if (column.pin === "left") {
|
|
576
470
|
visibleColumns.push(column);
|
|
@@ -935,5 +829,5 @@ const columnByAriaIndex = (columns, ariaColIndex) => {
|
|
|
935
829
|
throw Error(`no column with aria-colIndex ${ariaColIndex}`);
|
|
936
830
|
};
|
|
937
831
|
|
|
938
|
-
export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, assertAllColumnsAreIncludedInSubscription, buildColumnMap, checkConfirmationPending, columnByAriaIndex, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType,
|
|
832
|
+
export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, assertAllColumnsAreIncludedInSubscription, buildColumnMap, checkConfirmationPending, columnByAriaIndex, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupIcon, getGroupValue, getRuntimeColumnWidth, getTableHeadings, getTypeFormattingFromColumn, hasCustomRenderer, hasHeadings, hasValidationRules, isCalculatedColumn, isColumnTypeRenderer, isDataLoading, isDateTimeDataType, isDateTimeDataValue, isGroupColumn, isJsonAttribute, isJsonColumn, isJsonGroup, isLookupRenderer, isMappedValueTypeRenderer, isNotHidden, isNumericColumn, isPinned, isResizing, isStringColumn, isTextColumn, isTimeDataValue, isTimestampColumn, isTypeDescriptor, isValidColumnAlignment, isValidPinLocation, isValueListRenderer, isVuuColumnDataType, mapSortCriteria, measurePinnedColumns, metadataKeys, moveColumnTo, projectUpdates, removeSort, reorderColumnItems, replaceColumn, setAggregations, setCalculatedColumnExpression, setCalculatedColumnName, setCalculatedColumnType, sortPinnedColumns, subscribedOnly, toColumnDescriptor, toColumnName, toDataSourceColumns, updateColumn, updateColumnFormatting, updateColumnRenderProps, updateColumnType, visibleColumnAtIndex };
|
|
939
833
|
//# sourceMappingURL=column-utils.js.map
|