@vuu-ui/vuu-utils 4.1.0 → 5.0.0-alpha.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 (95) hide show
  1. package/package.json +10 -11
  2. package/src/column-utils.js +16 -6
  3. package/src/component-registry.js +2 -2
  4. package/src/event-emitter.js +3 -1
  5. package/src/feature-utils.js +7 -7
  6. package/src/index.js +1 -0
  7. package/src/react-utils.js +2 -8
  8. package/src/table-schema-utils.js +5 -6
  9. package/src/tree-utils.js +2 -2
  10. package/types/column-utils.d.ts +5 -3
  11. package/types/component-registry.d.ts +4 -4
  12. package/types/feature-utils.d.ts +29 -19
  13. package/types/filters/filter-utils.d.ts +1 -0
  14. package/types/index.d.ts +1 -0
  15. package/types/react-utils.d.ts +1 -1
  16. package/types/sort-utils.d.ts +2 -2
  17. package/types/table-schema-utils.d.ts +2 -2
  18. package/types/tree-types.d.ts +5 -0
  19. package/types/src/Clock.d.ts +0 -20
  20. package/types/src/PageVisibilityObserver.d.ts +0 -36
  21. package/types/src/ScaledDecimal.d.ts +0 -12
  22. package/types/src/ShellContext.d.ts +0 -11
  23. package/types/src/ThemeProvider.d.ts +0 -32
  24. package/types/src/array-utils.d.ts +0 -16
  25. package/types/src/box-utils.d.ts +0 -24
  26. package/types/src/broadcast-channel.d.ts +0 -16
  27. package/types/src/column-utils.d.ts +0 -243
  28. package/types/src/common-types.d.ts +0 -6
  29. package/types/src/component-registry.d.ts +0 -65
  30. package/types/src/context-definitions/DataContext.d.ts +0 -21
  31. package/types/src/context-definitions/DataProvider.d.ts +0 -7
  32. package/types/src/context-definitions/DataSourceProvider.d.ts +0 -12
  33. package/types/src/context-definitions/WorkspaceContext.d.ts +0 -17
  34. package/types/src/cookie-utils.d.ts +0 -9
  35. package/types/src/css-utils.d.ts +0 -1
  36. package/types/src/data-utils.d.ts +0 -33
  37. package/types/src/datasource/BaseDataSource.d.ts +0 -63
  38. package/types/src/datasource/datasource-action-utils.d.ts +0 -7
  39. package/types/src/datasource/datasource-filter-utils.d.ts +0 -2
  40. package/types/src/datasource/datasource-utils.d.ts +0 -61
  41. package/types/src/date/date-utils.d.ts +0 -39
  42. package/types/src/date/dateTimePattern.d.ts +0 -8
  43. package/types/src/date/formatter.d.ts +0 -9
  44. package/types/src/date/index.d.ts +0 -4
  45. package/types/src/date/types.d.ts +0 -29
  46. package/types/src/debug-utils.d.ts +0 -9
  47. package/types/src/edit-utils.d.ts +0 -2
  48. package/types/src/errors.d.ts +0 -2
  49. package/types/src/event-emitter.d.ts +0 -21
  50. package/types/src/feature-utils.d.ts +0 -110
  51. package/types/src/filters/filter-utils.d.ts +0 -75
  52. package/types/src/filters/filterAsQuery.d.ts +0 -8
  53. package/types/src/filters/index.d.ts +0 -2
  54. package/types/src/form-utils.d.ts +0 -37
  55. package/types/src/formatting-utils.d.ts +0 -14
  56. package/types/src/getUniqueId.d.ts +0 -1
  57. package/types/src/group-utils.d.ts +0 -10
  58. package/types/src/html-utils.d.ts +0 -21
  59. package/types/src/index.d.ts +0 -76
  60. package/types/src/input-utils.d.ts +0 -2
  61. package/types/src/invariant.d.ts +0 -1
  62. package/types/src/itemToString.d.ts +0 -2
  63. package/types/src/json-types.d.ts +0 -52
  64. package/types/src/json-utils.d.ts +0 -6
  65. package/types/src/keyboard-utils.d.ts +0 -15
  66. package/types/src/keyset.d.ts +0 -16
  67. package/types/src/layout-types.d.ts +0 -22
  68. package/types/src/list-utils.d.ts +0 -2
  69. package/types/src/local-storage-utils.d.ts +0 -4
  70. package/types/src/logging-utils.d.ts +0 -45
  71. package/types/src/module-utils.d.ts +0 -8
  72. package/types/src/nanoid/index.d.ts +0 -1
  73. package/types/src/perf-utils.d.ts +0 -5
  74. package/types/src/promise-utils.d.ts +0 -8
  75. package/types/src/protocol-message-utils.d.ts +0 -43
  76. package/types/src/range-utils.d.ts +0 -29
  77. package/types/src/react-utils.d.ts +0 -15
  78. package/types/src/round-decimal.d.ts +0 -4
  79. package/types/src/row-utils.d.ts +0 -28
  80. package/types/src/selection-utils.d.ts +0 -9
  81. package/types/src/shell-layout-types.d.ts +0 -15
  82. package/types/src/sort-utils.d.ts +0 -11
  83. package/types/src/table-schema-utils.d.ts +0 -5
  84. package/types/src/text-utils.d.ts +0 -10
  85. package/types/src/theme-utils.d.ts +0 -14
  86. package/types/src/tree-types.d.ts +0 -9
  87. package/types/src/tree-utils.d.ts +0 -9
  88. package/types/src/ts-utils.d.ts +0 -20
  89. package/types/src/typeahead-utils.d.ts +0 -1
  90. package/types/src/url-utils.d.ts +0 -3
  91. package/types/src/useId.d.ts +0 -1
  92. package/types/src/useLayoutEffectSkipFirst.d.ts +0 -2
  93. package/types/src/useResizeObserver.d.ts +0 -15
  94. package/types/src/useStateRef.d.ts +0 -2
  95. package/types/src/user-types.d.ts +0 -3
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "version": "4.1.0",
2
+ "version": "5.0.0-alpha.2",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "types": "types/index.d.ts",
7
+ "type": "module",
7
8
  "scripts": {
8
- "build:dev": "node ../../scripts/run-build.mjs",
9
9
  "build": "node ../../scripts/run-build-rslib.ts",
10
10
  "test": "vitest run",
11
11
  "type-defs": "node ../../scripts/build-type-defs.mjs"
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@dnd-kit/react": "^0.5.0",
18
- "@vuu-ui/vuu-data-types": "4.1.0",
19
- "@vuu-ui/vuu-table-types": "4.1.0",
20
- "@vuu-ui/vuu-filter-types": "4.1.0",
21
- "@vuu-ui/vuu-protocol-types": "4.1.0"
18
+ "@vuu-ui/vuu-data-types": "5.0.0-alpha.2",
19
+ "@vuu-ui/vuu-table-types": "5.0.0-alpha.2",
20
+ "@vuu-ui/vuu-filter-types": "5.0.0-alpha.2",
21
+ "@vuu-ui/vuu-protocol-types": "5.0.0-alpha.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "4.1.0",
25
+ "@vuu-ui/vuu-filter-parser": "5.0.0-alpha.2",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -36,12 +36,11 @@
36
36
  ],
37
37
  "exports": {
38
38
  ".": {
39
+ "types": "./types/index.d.ts",
39
40
  "import": "./src/index.js",
40
- "default": "./src/index.js",
41
- "types": "./types/index.d.ts"
41
+ "default": "./src/index.js"
42
42
  }
43
43
  },
44
44
  "module": "./src/index.js",
45
- "name": "@vuu-ui/vuu-utils",
46
- "type": "module"
45
+ "name": "@vuu-ui/vuu-utils"
47
46
  }
@@ -1,8 +1,8 @@
1
1
  import { moveItem } from "./array-utils.js";
2
2
  import { getTemporalInfo } from "./date/temporal.js";
3
3
  import { queryClosest } from "./html-utils.js";
4
- const SORT_ASC = "asc";
5
4
  const NO_HEADINGS = [];
5
+ const SORT_ASC = "asc";
6
6
  const DEFAULT_COL_WIDTH = 100;
7
7
  const DEFAULT_MAX_WIDTH = 250;
8
8
  const DEFAULT_MIN_WIDTH = 50;
@@ -314,7 +314,7 @@ const measurePinnedColumns = (columns, selectionEndSize)=>{
314
314
  unpinnedWidth
315
315
  };
316
316
  };
317
- const getTableHeadings = (columns)=>{
317
+ const getTableHeadings = (columns, selectionBookendWidth = 0)=>{
318
318
  if (columns.some(hasHeadings)) {
319
319
  const maxHeadingDepth = columns.reduce((max, { heading })=>Math.max(max, heading?.length ?? 0), 0);
320
320
  let heading;
@@ -322,8 +322,9 @@ const getTableHeadings = (columns)=>{
322
322
  let tableHeadingsRow;
323
323
  for(let level = 0; level < maxHeadingDepth; level++){
324
324
  tableHeadingsRow = [];
325
- columns.forEach(({ heading: columnHeading = NO_HEADINGS, width })=>{
325
+ columns.forEach(({ heading: columnHeading = NO_HEADINGS, hidden, width })=>{
326
326
  const label = columnHeading[level] ?? "";
327
+ if (hidden) return;
327
328
  if (heading && heading.label === label) heading.width += width;
328
329
  else {
329
330
  heading = {
@@ -335,6 +336,10 @@ const getTableHeadings = (columns)=>{
335
336
  });
336
337
  tableHeadings.push(tableHeadingsRow);
337
338
  }
339
+ if (selectionBookendWidth > 0) tableHeadings.forEach((tableHeading)=>{
340
+ tableHeading[0].width += selectionBookendWidth;
341
+ tableHeading[tableHeading.length - 1].width += selectionBookendWidth;
342
+ });
338
343
  return tableHeadings;
339
344
  }
340
345
  return NO_HEADINGS;
@@ -526,6 +531,11 @@ const getGroupIcon = (columns, dataRow)=>{
526
531
  return getIcon?.(dataRow);
527
532
  }
528
533
  };
534
+ const getGroupAdornment = (columns, dataRow)=>{
535
+ const { depth, isLeaf } = dataRow;
536
+ if (isLeaf || 0 === depth || depth > columns.length) return null;
537
+ return columns[depth - 1].getGroupAdornment?.(dataRow) ?? null;
538
+ };
529
539
  const getGroupValue = (columns, dataRow)=>{
530
540
  const { depth, isLeaf } = dataRow;
531
541
  if (isLeaf || depth > columns.length) return null;
@@ -644,7 +654,7 @@ const getCalculatedColumnDetails = (column)=>{
644
654
  serverDataType: isVuuColumnDataType(serverDataType) ? serverDataType : void 0
645
655
  };
646
656
  }
647
- throw Error("column.name is nor a calculated column");
657
+ throw Error('column.name is not a calculated column');
648
658
  };
649
659
  const setCalculatedColumnName = (column, name)=>{
650
660
  const [, type, expression] = column.name.split(":");
@@ -791,7 +801,7 @@ const stretchColumnsToFillAvailableSpace = (columns, availableWidth, totalWidth,
791
801
  return adjustedColumns;
792
802
  };
793
803
  const dataAndColumnUnchanged = (p, p1)=>p.column === p1.column && p.column.valueFormatter(p.dataRow[p.column.name]) === p1.column.valueFormatter(p1.dataRow[p1.column.name]);
794
- const dataColumnAndKeyUnchanged = (p, p1)=>p.column === p1.column && p.dataRow.key === p1.dataRow.key && p.column.valueFormatter(p.dataRow[p.column.name]) === p1.column.valueFormatter(p1.dataRow[p1.column.name]);
804
+ const dataColumnAndKeyUnchanged = (p, p1)=>p.column === p1.column && p.dataRow.key === p1.dataRow.key && p.dataRow.vuu_action === p1.dataRow.vuu_action && p.column.valueFormatter(p.dataRow[p.column.name]) === p1.column.valueFormatter(p1.dataRow[p1.column.name]);
795
805
  const toColumnName = (column)=>column.name;
796
806
  const isStringColumn = (column)=>"string" === column.serverDataType;
797
807
  const columnByAriaIndex = (columns, ariaColIndex)=>{
@@ -802,4 +812,4 @@ const columnByAriaIndex = (columns, ariaColIndex)=>{
802
812
  }
803
813
  throw Error(`no column with aria-colIndex ${ariaColIndex}`);
804
814
  };
805
- export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, assertAllColumnsAreIncludedInSubscription, buildColumnMap, checkConfirmationPending, columnByAriaIndex, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getAllCellsInColumn, getAriaColIndex, getAriaRowIndex, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupIcon, getGroupValue, getPinStateFromElement, getRuntimeColumnWidth, getServerDataType, getTableHeadings, getTypeFormattingFromColumn, hasCustomRenderer, hasHeadings, hasValidationRules, isCalculatedColumn, isColumnTypeRenderer, isDataLoading, isDataValueEditable, isDateTimeDataType, isDateTimeDataValue, isGroupColumn, isJsonAttribute, isJsonColumn, isJsonGroup, isLookupRenderer, isMappedValueTypeRenderer, isNanoTimestampColumn, isNotHidden, isNumericColumn, isPinned, isResizing, isStringColumn, isTemporalColumn, isTextColumn, isTimeDataType, isTimeDataValue, isTimeDataValueWithMilliseconds, isTimestampColumn, isTypeDescriptor, isValidColumnAlignment, isValidPinLocation, isValueListRenderer, isVuuColumnDataType, mapSortCriteria, measurePinnedColumns, metadataKeys, moveColumnTo, projectUpdates, removeSort, replaceColumn, setAggregations, setCalculatedColumnExpression, setCalculatedColumnName, setCalculatedColumnType, sortPinnedColumns, subscribedOnly, toColumnDescriptor, toColumnName, toDataSourceColumns, updateColumn, updateColumnFormatting, updateColumnRenderProps, updateColumnType, visibleColumnAtIndex };
815
+ export { AggregationType, NO_HEADINGS, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, assertAllColumnsAreIncludedInSubscription, buildColumnMap, checkConfirmationPending, columnByAriaIndex, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getAllCellsInColumn, getAriaColIndex, getAriaRowIndex, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupAdornment, getGroupIcon, getGroupValue, getPinStateFromElement, getRuntimeColumnWidth, getServerDataType, getTableHeadings, getTypeFormattingFromColumn, hasCustomRenderer, hasHeadings, hasValidationRules, isCalculatedColumn, isColumnTypeRenderer, isDataLoading, isDataValueEditable, isDateTimeDataType, isDateTimeDataValue, isGroupColumn, isJsonAttribute, isJsonColumn, isJsonGroup, isLookupRenderer, isMappedValueTypeRenderer, isNanoTimestampColumn, isNotHidden, isNumericColumn, isPinned, isResizing, isStringColumn, isTemporalColumn, isTextColumn, isTimeDataType, isTimeDataValue, isTimeDataValueWithMilliseconds, isTimestampColumn, isTypeDescriptor, isValidColumnAlignment, isValidPinLocation, isValueListRenderer, isVuuColumnDataType, mapSortCriteria, measurePinnedColumns, metadataKeys, moveColumnTo, projectUpdates, removeSort, replaceColumn, setAggregations, setCalculatedColumnExpression, setCalculatedColumnName, setCalculatedColumnType, sortPinnedColumns, subscribedOnly, toColumnDescriptor, toColumnName, toDataSourceColumns, updateColumn, updateColumnFormatting, updateColumnRenderProps, updateColumnType, visibleColumnAtIndex };
@@ -1,4 +1,4 @@
1
- import { hasCustomRenderer, isColumnTypeRenderer, isTemporalColumn, isTypeDescriptor } from "./column-utils.js";
1
+ import { hasCustomRenderer, isColumnTypeRenderer, isDataValueEditable, isTemporalColumn, isTypeDescriptor } from "./column-utils.js";
2
2
  const containersSet = new Set();
3
3
  const viewsSet = new Set();
4
4
  const layoutComponentsMap = new Map();
@@ -77,7 +77,7 @@ function getEditRuleValidator(name) {
77
77
  function dataCellRenderer(column) {
78
78
  if ("boolean" === column.serverDataType && !hasCustomRenderer(column.type)) return cellRenderersMap.get("checkbox-cell");
79
79
  if (column.editable && !hasCustomRenderer(column.type) && isTemporalColumn(column) && cellRenderersMap.has("temporal-input-cell")) return cellRenderersMap.get("temporal-input-cell");
80
- if (column.editable && !hasCustomRenderer(column.type)) return cellRenderersMap.get("input-cell");
80
+ if (isDataValueEditable(column, "update") && !hasCustomRenderer(column.type)) return cellRenderersMap.get("input-cell");
81
81
  if (isTypeDescriptor(column.type) && isColumnTypeRenderer(column.type.renderer)) return cellRenderersMap.get(column.type.renderer?.name);
82
82
  if ("boolean" === column.serverDataType) return cellRenderersMap.get("checkbox-cell");
83
83
  }
@@ -59,7 +59,9 @@ class EventEmitter {
59
59
  return listeners === listener;
60
60
  }
61
61
  invokeHandler(handler, args) {
62
- if (isArrayOfListeners(handler)) handler.slice().forEach((listener)=>this.invokeHandler(listener, args));
62
+ if (isArrayOfListeners(handler)) handler.slice().forEach((listener)=>{
63
+ this.invokeHandler(listener, args);
64
+ });
63
65
  else switch(args.length){
64
66
  case 0:
65
67
  handler();
@@ -1,7 +1,7 @@
1
- import { partition } from "./array-utils.js";
2
- import { wordify } from "./text-utils.js";
3
1
  import react from "react";
2
+ import { partition } from "./array-utils.js";
4
3
  import { getLayoutComponent } from "./component-registry.js";
4
+ import { wordify } from "./text-utils.js";
5
5
  const env = process.env.NODE_ENV;
6
6
  const importFeatureByUrl = (url)=>import(/* @vite-ignore */ url);
7
7
  let featureImporter = importFeatureByUrl;
@@ -16,13 +16,11 @@ function featureFromJson({ type }) {
16
16
  if (void 0 === componentType) throw Error(`layoutUtils unable to create feature component from JSON, unknown type ${type}`);
17
17
  return react.createElement(componentType);
18
18
  }
19
- const isCustomFeature = (feature)=>"vuu-features" === feature.leftNavLocation;
19
+ const isCustomFeature = (feature)=>(feature.leftNavLocation ?? "vuu-features") === "vuu-features";
20
20
  const isWildcardSchema = (vuuTables)=>"*" === vuuTables;
21
21
  const isVuuTables = (vuuTables)=>Array.isArray(vuuTables);
22
22
  const hasFilterTableFeatureProps = (props)=>"object" == typeof props.ComponentProps && null !== props.ComponentProps && "tableSchema" in props.ComponentProps;
23
- const isSameTable = (t1, t2)=>{
24
- t1.module === t2.module && (t1.table, t2.table);
25
- };
23
+ const isSameTable = (t1, t2)=>t1.module === t2.module && t1.table === t2.table;
26
24
  const byModule = (schema1, schema2)=>{
27
25
  const m1 = schema1.table.module.toLowerCase();
28
26
  const m2 = schema2.table.module.toLowerCase();
@@ -80,7 +78,9 @@ const getCustomAndTableFeatures = (dynamicFeatures, tableSchemas)=>{
80
78
  map[`${vuuTable.table}Schema`] = tableSchemas.find((tableSchema)=>isSameTable(vuuTable, tableSchema.table));
81
79
  return map;
82
80
  }, {}),
83
- ViewProps: viewProps
81
+ ...void 0 === viewProps ? {} : {
82
+ ViewProps: viewProps
83
+ }
84
84
  });
85
85
  } else customFeatures.push(feature);
86
86
  }
package/src/index.js CHANGED
@@ -14,6 +14,7 @@ export * from "./datasource/datasource-utils.js";
14
14
  export * from "./date/index.js";
15
15
  export * from "./debug-utils.js";
16
16
  export * from "./event-emitter.js";
17
+ export * from "./errors.js";
17
18
  export * from "./feature-utils.js";
18
19
  export * from "./filters/index.js";
19
20
  export * from "./form-utils.js";
@@ -1,14 +1,8 @@
1
1
  import { Children, isValidElement, useEffect, useMemo, useRef } from "react";
2
2
  const EMPTY_ARRAY = [];
3
3
  const asReactElements = (children)=>{
4
- const isArray = Array.isArray(children);
5
- const count = isArray ? children.length : Children.count(children);
6
- if (isArray && children.every(isValidElement)) return children;
7
- if (1 === count && !isArray && isValidElement(children)) return [
8
- children
9
- ];
10
- if (count > 1) return children;
11
- return EMPTY_ARRAY;
4
+ const elements = Children.toArray(children).filter(isValidElement);
5
+ return 0 === elements.length ? EMPTY_ARRAY : elements;
12
6
  };
13
7
  const useIsMounted = (id = "")=>{
14
8
  const isMountedRef = useRef(false);
@@ -1,9 +1,3 @@
1
- const toSchemaColumn = ({ editable, name, required, serverDataType = "string" })=>({
2
- editable,
3
- name,
4
- required,
5
- serverDataType
6
- });
7
1
  const getVuuTable = (schemaTable)=>{
8
2
  if (!schemaTable.session) return schemaTable;
9
3
  {
@@ -14,4 +8,9 @@ const getVuuTable = (schemaTable)=>{
14
8
  };
15
9
  }
16
10
  };
11
+ const toSchemaColumn = ({ editable, name, serverDataType = 'string' })=>({
12
+ editable: true === editable || 'object' == typeof editable,
13
+ name,
14
+ serverDataType
15
+ });
17
16
  export { getVuuTable, toSchemaColumn };
package/src/tree-utils.js CHANGED
@@ -35,9 +35,9 @@ const addChildValues = (rows, treeSourceNodes, cols, iconProvider, index = {
35
35
  type: "string"
36
36
  });
37
37
  for(let i = 0; i < treeSourceNodes.length; i++, index.value += 1){
38
- const { childNodes, icon, label, nodeData } = treeSourceNodes[i];
38
+ const { childNodes, icon, keySegment = treeSourceNodes[i].label, label, nodeData } = treeSourceNodes[i];
39
39
  const blanks = Array(depth - 1).fill("");
40
- const fullKey = `${keyBase}|${label}`;
40
+ const fullKey = `${keyBase}|${keySegment}`;
41
41
  const row = [
42
42
  index.value,
43
43
  index.value,
@@ -1,8 +1,8 @@
1
1
  import type { DataSourceRow, DataValueDescriptor, DataValueType, DataValueTypeSimple, DateTimeDataValueDescriptor, SchemaColumn, TableSchema, TimeDataValueDescriptor } from "@vuu-ui/vuu-data-types";
2
2
  import type { VuuAggType, VuuAggregation, VuuColumnDataType, VuuDataRowDto, VuuGroupBy, VuuSort } from "@vuu-ui/vuu-protocol-types";
3
- import { TableModel } from "@vuu-ui/vuu-table";
4
3
  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";
4
+ import type { TableModel } from "@vuu-ui/vuu-table";
5
+ import type { CSSProperties, ReactNode } from "react";
6
6
  /**
7
7
  * ColumnMap provides a lookup of the index position of a data item within a row
8
8
  * by column name.
@@ -13,6 +13,7 @@ export interface ColumnMap {
13
13
  export interface ReverseColumnMap {
14
14
  [columnIndex: number]: string;
15
15
  }
16
+ export declare const NO_HEADINGS: TableHeadings;
16
17
  export type SortCriteriaItem = string | [string, "asc"];
17
18
  export declare const AggregationType: {
18
19
  [key: string]: VuuAggType;
@@ -129,7 +130,7 @@ export declare const measurePinnedColumns: (columns: RuntimeColumnDescriptor[],
129
130
  pinnedWidthRight: number;
130
131
  unpinnedWidth: number;
131
132
  };
132
- export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[]) => TableHeadings;
133
+ export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[], selectionBookendWidth?: number) => TableHeadings;
133
134
  export declare const getColumnStyle: ({ pin, pinnedOffset, pinnedWidth, width, }: RuntimeColumnDescriptor) => CSSProperties;
134
135
  export declare const getAllCellsInColumn: (container: HTMLElement | null, colIndex: number) => HTMLDivElement[];
135
136
  export type PinState = {
@@ -170,6 +171,7 @@ export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[],
170
171
  export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
171
172
  export declare const visibleColumnAtIndex: (columns: RuntimeColumnDescriptor[], index: number) => RuntimeColumnDescriptor | undefined;
172
173
  export declare const getGroupIcon: (columns: RuntimeColumnDescriptor[], dataRow: DataRow) => string | undefined;
174
+ export declare const getGroupAdornment: (columns: RuntimeColumnDescriptor[], dataRow: DataRow) => ReactNode;
173
175
  export declare const getGroupValue: (columns: RuntimeColumnDescriptor[], dataRow: DataRow) => string | null;
174
176
  export declare const getDefaultColumnType: (serverDataType?: VuuColumnDataType) => DataValueTypeSimple;
175
177
  export declare const updateColumnFormatting: <T extends ColumnDescriptor = ColumnDescriptor>(column: T, formatting: ColumnTypeFormatting) => T;
@@ -1,7 +1,7 @@
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";
1
+ import type { EditRuleValidator } from "@vuu-ui/vuu-data-types";
2
+ import type { VuuColumnDataType } from "@vuu-ui/vuu-protocol-types";
3
+ import type { ColumnDescriptor, ColumnDescriptorCustomRenderer, ColumnTypeRendering, DataRow, HeaderCellProps, TableCellRendererProps } from "@vuu-ui/vuu-table-types";
4
+ import type { FunctionComponent as FC, HTMLAttributes } from "react";
5
5
  export interface CellConfigPanelProps extends HTMLAttributes<HTMLDivElement> {
6
6
  onConfigChange: () => void;
7
7
  }
@@ -1,9 +1,9 @@
1
- import type { TableSchema } from "@vuu-ui/vuu-data-types";
1
+ import type { RemoteModuleConnection, TableSchema } from "@vuu-ui/vuu-data-types";
2
2
  import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
3
3
  import type { ListOption } from "@vuu-ui/vuu-table-types";
4
4
  import React, { type ReactElement } from "react";
5
5
  export type PathMap = {
6
- [key: string]: Pick<DynamicFeatureDescriptor, "css" | "url">;
6
+ [key: string]: string;
7
7
  };
8
8
  export type Environment = "development" | "production";
9
9
  export declare const env: Environment;
@@ -21,12 +21,11 @@ export interface DynamicFeatureProps<P extends object | undefined = object> {
21
21
  ViewProps?: ViewConfig;
22
22
  css?: string;
23
23
  height?: number;
24
+ mfComponent: string;
25
+ mfScope: string;
26
+ mfUrl: string;
27
+ vuu?: RemoteModuleConnection;
24
28
  title?: string;
25
- /**
26
- The url of javascript bundle to lazily load. Bundle must provide a default export
27
- and that export must be a React component.
28
- */
29
- url: string;
30
29
  width?: number;
31
30
  }
32
31
  export type FeatureModule = {
@@ -47,20 +46,30 @@ declare global {
47
46
  const vuuConfig: Promise<VuuConfig>;
48
47
  }
49
48
  export interface DynamicFeatureDescriptor {
50
- /**
51
- * url for css file for feature
52
- */
53
- css?: string;
49
+ description: string;
54
50
  featureProps?: {
55
51
  vuuTables?: "*" | VuuTable[];
56
52
  };
57
- leftNavLocation: "vuu-features" | "vuu-tables";
53
+ id: string;
54
+ leftNavLocation?: "vuu-features" | "vuu-tables";
55
+ location: string;
58
56
  name: string;
59
- title: string;
60
57
  /**
61
- * url for javascript bundle to load feature
58
+ * Module federation - the name of remote component to be imported
62
59
  */
63
- url: string;
60
+ mfComponent: string;
61
+ /**
62
+ * Module federation - the identifier of remote module
63
+ */
64
+ mfScope: string;
65
+ /**
66
+ * Module federation - the url of remote module manifest
67
+ */
68
+ mfUrl: string;
69
+ path: string;
70
+ title: string;
71
+ vuu?: RemoteModuleConnection;
72
+ version: number;
64
73
  viewProps?: ViewConfig;
65
74
  }
66
75
  export interface StaticFeatureDescriptor {
@@ -79,10 +88,11 @@ export declare function featureFromJson({ type }: {
79
88
  type: string;
80
89
  }): ReactElement;
81
90
  export interface VuuConfig {
82
- features: DynamicFeatures;
83
- authUrl?: string;
84
- websocketUrl: string;
91
+ authUrl: string;
92
+ moduleRegistryUrl: string;
93
+ restUrl: string;
85
94
  ssl: boolean;
95
+ websocketUrl: string;
86
96
  }
87
97
  /**
88
98
  * We currently categorize 'features' simply by the leftNavLocation
@@ -96,7 +106,7 @@ export interface FeaturePropsWithFilterTableFeature extends Omit<DynamicFeatureP
96
106
  ComponentProps: FilterTableFeatureProps;
97
107
  }
98
108
  export declare const hasFilterTableFeatureProps: (props: DynamicFeatureProps) => props is FeaturePropsWithFilterTableFeature;
99
- export declare const isSameTable: (t1: VuuTable, t2: VuuTable) => void;
109
+ export declare const isSameTable: (t1: VuuTable, t2: VuuTable) => boolean;
100
110
  export declare const byModule: (schema1: TableSchema, schema2: TableSchema) => -1 | 0 | 1;
101
111
  export type GetFeaturePaths = (params: {
102
112
  env: Environment;
@@ -29,6 +29,7 @@ export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]
29
29
  exportable?: boolean;
30
30
  exportFormatter?: (value: unknown, row: import("@vuu-ui/vuu-table-types").RowAccessor) => string;
31
31
  getIcon?: (row: import("@vuu-ui/vuu-table-types").DataRow) => string | undefined;
32
+ getGroupAdornment?: (row: import("@vuu-ui/vuu-table-types").DataRow) => import("react").ReactNode;
32
33
  groupable?: boolean;
33
34
  hidden?: boolean;
34
35
  locked?: Exclude<import("@vuu-ui/vuu-table-types").PinLocation, "left"> | false;
package/types/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export * from "./debug-utils";
21
21
  export { isInlineEditingSession } from "./edit-utils";
22
22
  export { StaleUpdateError } from "./errors";
23
23
  export * from "./event-emitter";
24
+ export * from "./errors";
24
25
  export * from "./feature-utils";
25
26
  export * from "./filters";
26
27
  export * from "./form-utils";
@@ -1,4 +1,4 @@
1
- import { ReactElement, ReactNode, SetStateAction } from "react";
1
+ import { type ReactElement, type ReactNode, type SetStateAction } from "react";
2
2
  export declare const asReactElements: (children: ReactNode) => ReactElement[];
3
3
  export declare const useIsMounted: (id?: string) => import("react").RefObject<boolean>;
4
4
  export declare const isSimpleStateValue: <T>(arg: SetStateAction<T>) => arg is T;
@@ -1,5 +1,5 @@
1
- import { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
- import { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
1
+ import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
+ import type { VuuSort, VuuSortType } from "@vuu-ui/vuu-protocol-types";
3
3
  export declare const toggleOrApplySort: ({ sortDefs }: VuuSort, { name: column }: ColumnDescriptor, extendSort?: boolean, sortType?: VuuSortType) => VuuSort;
4
4
  export declare const setSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
5
5
  export declare const addSortColumn: ({ sortDefs }: VuuSort, column: ColumnDescriptor, sortType?: "A" | "D") => VuuSort;
@@ -1,5 +1,5 @@
1
- import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
2
1
  import type { SchemaColumn, TableSchemaTable } from "@vuu-ui/vuu-data-types";
3
2
  import type { VuuTable } from "@vuu-ui/vuu-protocol-types";
4
- export declare const toSchemaColumn: ({ editable, name, required, serverDataType, }: ColumnDescriptor) => SchemaColumn;
3
+ import type { ColumnDescriptor } from "@vuu-ui/vuu-table-types";
5
4
  export declare const getVuuTable: (schemaTable: TableSchemaTable) => VuuTable;
5
+ export declare const toSchemaColumn: ({ editable, name, serverDataType }: ColumnDescriptor) => SchemaColumn;
@@ -4,6 +4,11 @@ export interface TreeSourceNode<T = unknown> {
4
4
  icon?: string;
5
5
  header?: boolean;
6
6
  label: string;
7
+ /**
8
+ * Segment used to build the row key for this node, defaults to label.
9
+ * Allows a display label to differ from a stable key.
10
+ */
11
+ keySegment?: string;
7
12
  childNodes?: TreeSourceNode<T>[];
8
13
  /** node is rendered expanded initially */
9
14
  expanded?: boolean;
@@ -1,20 +0,0 @@
1
- export interface ClockProps {
2
- year?: number;
3
- month?: number;
4
- day?: number;
5
- hours?: number;
6
- minutes?: number;
7
- seconds?: number;
8
- milliseconds?: number;
9
- }
10
- export type ClockTimeUnit = "minutes" | "seconds" | "ms";
11
- export declare class Clock {
12
- #private;
13
- constructor(props?: ClockProps);
14
- goBack(value: number, units?: ClockTimeUnit): this;
15
- advance(value: number, units?: ClockTimeUnit): this;
16
- set showCurrentTime(value: boolean);
17
- toString(): string;
18
- get now(): number;
19
- get date(): Date;
20
- }
@@ -1,36 +0,0 @@
1
- import { EventEmitter } from "./event-emitter";
2
- export type PageVisibilityEvents = {
3
- /**
4
- * emits when page has been hidden for this period of time
5
- */
6
- "inactive-timeout": () => void;
7
- /**
8
- * emits when page is hidden
9
- */
10
- hidden: () => void;
11
- /**
12
- * emits when page is made visible
13
- */
14
- visible: () => void;
15
- /**
16
- * emits when page visibility status changes
17
- */
18
- visibilityChange: (hidden: boolean) => void;
19
- };
20
- export interface PageVisibilityObserverConstructorProps {
21
- /**
22
- * timeout period in seconds. Defaults to zero which will never timeout
23
- */
24
- inactiveTimeout?: number;
25
- onHidden?: () => void;
26
- onInactiveTimeout?: () => void;
27
- onVisible?: () => void;
28
- onVisibilityChange?: () => void;
29
- }
30
- export declare class PageVisibilityObserver extends EventEmitter<PageVisibilityEvents> {
31
- #private;
32
- visibilityChangeHandler: () => void;
33
- constructor({ inactiveTimeout, onHidden, onInactiveTimeout, onVisibilityChange, onVisible, }?: PageVisibilityObserverConstructorProps);
34
- clear(): void;
35
- private set hidden(value);
36
- }
@@ -1,12 +0,0 @@
1
- export declare class ScaledDecimal {
2
- protected readonly value: string;
3
- private readonly decimals;
4
- constructor(value: string, decimals?: number);
5
- get asLong(): string;
6
- toJSON(): string;
7
- toString(): string;
8
- }
9
- export declare const ScaledDecimal2: (value: string) => ScaledDecimal;
10
- export declare const ScaledDecimal4: (value: string) => ScaledDecimal;
11
- export declare const ScaledDecimal6: (value: string) => ScaledDecimal;
12
- export declare const ScaledDecimal8: (value: string) => ScaledDecimal;
@@ -1,11 +0,0 @@
1
- import type { RpcResponseHandler } from "@vuu-ui/vuu-data-types";
2
- import type { DefaultColumnConfiguration, DefaultTableConfiguration } from "@vuu-ui/vuu-table-types";
3
- import { LookupTableProvider } from "./feature-utils";
4
- export interface ShellContextProps {
5
- getDefaultColumnConfig?: DefaultColumnConfiguration;
6
- getDefaultTableConfig?: DefaultTableConfiguration;
7
- getLookupValues?: LookupTableProvider;
8
- handleRpcResponse?: RpcResponseHandler;
9
- }
10
- export declare const ShellContext: import("react").Context<ShellContextProps>;
11
- export declare const useShellContext: () => ShellContextProps;
@@ -1,32 +0,0 @@
1
- import { type ReactNode } from "react";
2
- export declare const DEFAULT_DENSITY: Density;
3
- export declare const DEFAULT_THEME = "salt-theme";
4
- export declare const DEFAULT_THEME_MODE: ThemeMode;
5
- export type Density = "high" | "medium" | "low" | "touch";
6
- export type ThemeMode = "light" | "dark";
7
- export type TargetElement = "root" | "scope" | "child";
8
- export interface ThemeContextProps {
9
- density: Density;
10
- theme: string;
11
- themeMode: ThemeMode;
12
- }
13
- export declare const ThemeContext: import("react").Context<ThemeContextProps>;
14
- export type ThemeClasses = [string, string, ThemeMode];
15
- export type ThemeAttributes = {
16
- themeClass: string;
17
- densityClass: string;
18
- dataMode: ThemeMode;
19
- };
20
- export declare const useThemeAttributes: (themeAttributes?: ThemeAttributes) => [string, string, ThemeMode];
21
- interface ThemeProviderProps {
22
- applyThemeClasses?: boolean;
23
- children: ReactNode;
24
- density?: Density;
25
- theme?: string;
26
- themeMode?: ThemeMode;
27
- }
28
- export declare function ThemeProvider({ applyThemeClasses, children, theme: themeProp, themeMode: themeModeProp, density: densityProp, }: ThemeProviderProps): import("react").JSX.Element;
29
- export declare namespace ThemeProvider {
30
- var displayName: string;
31
- }
32
- export {};
@@ -1,16 +0,0 @@
1
- export type PartitionTest<T> = (value: T, index: number) => boolean;
2
- export declare function partition<T>(array: T[], test: PartitionTest<T>, pass?: T[], fail?: T[]): [T[], T[]];
3
- export declare function itemsChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
4
- export declare function itemsOrOrderChanged<T = unknown>(currentItems: T[], newItems: T[], identityProperty?: string): boolean;
5
- export declare const moveItemDeprecated: <T = unknown>(items: T[], item: T, moveTo: number) => T[];
6
- export declare const moveItem: <T = unknown>(items: T[], fromIndex: number, toIndex: number) => T[];
7
- export declare const getAddedItems: <T>(values: undefined | T[], newValues: T[]) => T[];
8
- export declare const getMissingItems: <T, I>(sourceItems: T[], items: I[], identity: (s: T) => I) => I[];
9
- /**
10
- * Given an ordered list of item names, return items in same order
11
- */
12
- export declare const reorderItems: <T extends {
13
- name: string;
14
- } = {
15
- name: string;
16
- }>(originalItems: readonly T[], orderedNames: string[]) => T[];
@@ -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 {};