@vuu-ui/vuu-utils 3.3.0 → 3.3.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.0",
2
+ "version": "3.3.2",
3
3
  "author": "heswell",
4
4
  "main": "./src/index.js",
5
5
  "license": "Apache-2.0",
@@ -15,14 +15,14 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@dnd-kit/react": "^0.1.21",
18
- "@vuu-ui/vuu-data-types": "3.3.0",
19
- "@vuu-ui/vuu-table-types": "3.3.0",
20
- "@vuu-ui/vuu-filter-types": "3.3.0",
21
- "@vuu-ui/vuu-protocol-types": "3.3.0"
18
+ "@vuu-ui/vuu-data-types": "3.3.2",
19
+ "@vuu-ui/vuu-table-types": "3.3.2",
20
+ "@vuu-ui/vuu-filter-types": "3.3.2",
21
+ "@vuu-ui/vuu-protocol-types": "3.3.2"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@internationalized/date": "^3.0.0",
25
- "@vuu-ui/vuu-filter-parser": "3.3.0",
25
+ "@vuu-ui/vuu-filter-parser": "3.3.2",
26
26
  "clsx": "^2.0.0",
27
27
  "react": "^19.2.3",
28
28
  "react-dom": "^19.2.3"
@@ -11,6 +11,16 @@ const vanillaConfig = {
11
11
  groupBy: [],
12
12
  sort: NoSort
13
13
  };
14
+ const sessionDataSourceConfig = (sourceConfig, overrideColumns)=>{
15
+ if (void 0 === overrideColumns) return sourceConfig;
16
+ return {
17
+ ...vanillaConfig,
18
+ columns: overrideColumns
19
+ };
20
+ };
21
+ const assertExpectedSessionTable = (sessionTable, expectedTable)=>{
22
+ if (expectedTable && expectedTable.module !== sessionTable.module) throw Error(`[datasource-utils] session table ${sessionTable.module}/${sessionTable.table} does not match expected edit table module ${expectedTable.module}`);
23
+ };
14
24
  const stripVisualLink = (configWithVisualLink)=>{
15
25
  if (!configWithVisualLink.visualLink) return configWithVisualLink;
16
26
  {
@@ -145,4 +155,4 @@ const dataSourceRowToEntity = (row, columnMap)=>Object.entries(columnMap).reduce
145
155
  ...entity,
146
156
  [name]: row[index]
147
157
  }), {});
148
- export { NO_CONFIG_CHANGES, NoFilter, NoSort, dataSourceRowToEntity, hasBaseFilter, hasFilter, hasGroupBy, hasSort, isBaseFilterChanged, isConfigChanged, isConnectionQualityMetrics, isFilterChanged, isGroupByChanged, isTableSchemaMessage, isTypeaheadSuggestionProvider, isViewportMessage, isVisualLinkMessage, isVisualLinksMessage, messageHasDataRows, messageHasResult, messageHasSize, stripVisualLink, vanillaConfig, withConfigDefaults };
158
+ export { NO_CONFIG_CHANGES, NoFilter, NoSort, assertExpectedSessionTable, dataSourceRowToEntity, hasBaseFilter, hasFilter, hasGroupBy, hasSort, isBaseFilterChanged, isConfigChanged, isConnectionQualityMetrics, isFilterChanged, isGroupByChanged, isTableSchemaMessage, isTypeaheadSuggestionProvider, isViewportMessage, isVisualLinkMessage, isVisualLinksMessage, messageHasDataRows, messageHasResult, messageHasSize, sessionDataSourceConfig, stripVisualLink, vanillaConfig, withConfigDefaults };
@@ -177,6 +177,7 @@ export declare const applyDefaultColumnConfig: ({ columns: columnsProp, table }:
177
177
  className?: string | undefined;
178
178
  colHeaderContentRenderer?: string | undefined;
179
179
  colHeaderLabelRenderer?: string | undefined;
180
+ exportFormatter?: ((value: unknown) => string) | undefined;
180
181
  flex?: number | undefined;
181
182
  getIcon?: ((row: DataRow) => string | undefined) | undefined;
182
183
  groupable?: boolean | undefined;
@@ -1,10 +1,20 @@
1
1
  import type { ConnectionQualityMetrics, DataSourceCallbackMessage, DataSourceConfig, DataSourceDataMessage, DataSourceRow, DataSourceVisualLinksMessage, TypeaheadSuggestionProvider, VuuUIMessageIn, VuuUIMessageInRPC, VuuUIMessageInTableMeta, VuuUIMessageOutViewport, WithBaseFilter, WithFilter, WithFullConfig, WithGroupBy, WithSort } from "@vuu-ui/vuu-data-types";
2
- import type { LinkDescriptorWithLabel, VuuCreateVisualLink, VuuFilter, VuuRemoveVisualLink, VuuRowDataItemType, VuuSort } from "@vuu-ui/vuu-protocol-types";
2
+ import type { LinkDescriptorWithLabel, VuuColumns, VuuCreateVisualLink, VuuFilter, VuuRemoveVisualLink, VuuRowDataItemType, VuuSort, VuuTable } from "@vuu-ui/vuu-protocol-types";
3
3
  import type { ColumnMap } from "../column-utils";
4
4
  import type { ConfigWithVisualLink } from "./BaseDataSource";
5
5
  export declare const NoFilter: VuuFilter;
6
6
  export declare const NoSort: VuuSort;
7
7
  export declare const vanillaConfig: WithFullConfig;
8
+ /**
9
+ * Derive the config for a session (edit) datasource from the source (view) datasource config.
10
+ * When the edit table declares its own columns, the view config's filter, groupBy, sort and
11
+ * aggregations are discarded rather than inherited - they may reference view-only columns.
12
+ */
13
+ export declare const sessionDataSourceConfig: (sourceConfig: WithFullConfig, overrideColumns?: VuuColumns) => WithFullConfig;
14
+ /**
15
+ * The session table name is server generated, so only the module is compared.
16
+ */
17
+ export declare const assertExpectedSessionTable: (sessionTable: VuuTable, expectedTable?: VuuTable) => void;
8
18
  export declare const stripVisualLink: (configWithVisualLink: ConfigWithVisualLink) => WithBaseFilter<WithFullConfig>;
9
19
  export type DataSourceConfigChanges = {
10
20
  aggregationsChanged: boolean;
@@ -51,6 +51,7 @@ export declare const stripFilterFromColumns: (columns: RuntimeColumnDescriptor[]
51
51
  allowColumnHeaderMenu?: false;
52
52
  colHeaderContentRenderer?: string;
53
53
  colHeaderLabelRenderer?: string;
54
+ exportFormatter?: (value: unknown) => string;
54
55
  getIcon?: (row: import("@vuu-ui/vuu-table-types").DataRow) => string | undefined;
55
56
  groupable?: boolean;
56
57
  hidden?: boolean;