Skip to content

Commit ec032de

Browse files
authored
fix issues affecting demo (#1615)
1 parent 34bbb39 commit ec032de

File tree

9 files changed

+1151
-602
lines changed

9 files changed

+1151
-602
lines changed

vuu-ui/package-lock.json

Lines changed: 724 additions & 221 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vuu-ui/packages/vuu-data-remote/next/ViewportCache.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ export class ViewportCache {
199199
}
200200

201201
// TODO do we really need it
202-
setRowCount(rowCount: number) {
203-
console.log(`[ViewportCache] setRowCount ${rowCount}`);
202+
setRowCount(_: number) {
203+
// console.log(`[ViewportCache] setRowCount ${rowCount}`);
204204
}
205205

206206
private buildKeyMap() {
@@ -213,12 +213,12 @@ export class ViewportCache {
213213
private identifyNewRows(keySetPreviousRows: Record<string, number>) {
214214
// we should avaoid the copy that happens here, just iterate the (client) rows directly
215215
const clientRows = this.getRows(this.#clientRange);
216-
for (const { rowIndex, rowKey, ts } of clientRows) {
216+
for (const { rowIndex, rowKey } of clientRows) {
217217
const prevIndex = keySetPreviousRows[rowKey];
218218
if (prevIndex === undefined) {
219-
console.log(`${rowKey} at [${rowIndex}] created at ${ts} is new`);
219+
// console.log(`${rowKey} at [${rowIndex}] created at ${ts} is new`);
220220
} else if (prevIndex !== rowIndex) {
221-
console.log(`${rowKey} at [${rowIndex}] has moved from [${prevIndex}]`);
221+
// console.log(`${rowKey} at [${rowIndex}] has moved from [${prevIndex}]`);
222222
}
223223
}
224224
}

vuu-ui/packages/vuu-data-remote/src/server-proxy/viewport.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,10 @@ export class Viewport {
950950
}
951951
}
952952

953+
const isNew = false;
954+
953955
const toClientRow = (
954-
{ rowIndex, rowKey, sel: isSelected, data }: VuuRow,
956+
{ rowIndex, rowKey, sel: isSelected, data, ts }: VuuRow,
955957
keys: KeySet,
956958
selectedRows: Selection,
957959
) => {
@@ -964,11 +966,13 @@ const toClientRow = (
964966
0,
965967
rowKey,
966968
isSelected ? getSelectionStatus(selectedRows, rowIndex) : 0,
969+
ts,
970+
isNew,
967971
].concat(data) as DataSourceRow;
968972
};
969973

970974
const toClientRowTree = (
971-
{ rowIndex, rowKey, sel: isSelected, data }: VuuRow,
975+
{ rowIndex, rowKey, sel: isSelected, data, ts }: VuuRow,
972976
keys: KeySet,
973977
selectedRows: Selection,
974978
) => {
@@ -984,5 +988,7 @@ const toClientRowTree = (
984988
count,
985989
rowKey,
986990
isSelected ? getSelectionStatus(selectedRows, rowIndex) : 0,
991+
ts,
992+
isNew,
987993
].concat(rest) as DataSourceRow;
988994
};

vuu-ui/packages/vuu-data-remote/test/server-proxy.test.ts

Lines changed: 366 additions & 366 deletions
Large diffs are not rendered by default.

vuu-ui/packages/vuu-table-extras/src/column-menu/column-menu-utils.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,28 @@ export function buildGroupMenu(
244244

245245
switch (columnGroupStatus) {
246246
case "no-groupby":
247-
case "single-groupby-other-column":
248247
return (
249248
<MenuItem
250249
data-menu-action-id="group-column"
251250
key="group-column"
252251
onClick={menuActionClickHandler}
253252
>{`Group by ${label}`}</MenuItem>
254253
);
254+
255+
case "single-groupby-other-column":
256+
menuItems.push(
257+
<MenuItem
258+
data-menu-action-id="group-column"
259+
key="group-column"
260+
onClick={menuActionClickHandler}
261+
>{`Group by ${label}`}</MenuItem>,
262+
<MenuItem
263+
data-menu-action-id="add-to-group"
264+
key="add-to-group"
265+
onClick={menuActionClickHandler}
266+
>{`Add ${label} to groupby`}</MenuItem>,
267+
);
268+
break;
255269
case "single-groupby":
256270
menuItems.push(
257271
<MenuItem

vuu-ui/packages/vuu-table-extras/src/datasource-stats/DatasourceStats.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ export const DataSourceStats = ({
6969
const to = numberFormatter.format(range.lastRowInViewport);
7070
const value = numberFormatter.format(size);
7171

72-
console.log(`range = ${JSON.stringify(range)}`);
73-
7472
if (size === 0) {
7573
return (
7674
<div className={className}>

vuu-ui/packages/vuu-table-extras/src/table-column-settings/TableSettingsPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const TableSettingsPanel = ({
7272
allowColumnLabelCase = true,
7373
allowColumnDefaultWidth = true,
7474
allowGridSeparators = true,
75-
allowCalculatedColumns,
75+
allowCalculatedColumns = true,
7676
...columnListPermissions
7777
} = permissions;
7878

vuu-ui/packages/vuu-ui-controls/src/editable/useEditableText.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export const useEditableText = <T extends string | number | boolean = string>({
5959
}));
6060
} else {
6161
setEditState((state) => ({ ...state, message: undefined }));
62+
const typedValue = getTypedValue(value, type, true);
6263
const response = await onEdit?.(
63-
{ editType: "commit", value, isValid: true },
64+
{ editType: "commit", value: typedValue, isValid: true },
6465
"commit",
6566
);
6667
if (response === true) {
@@ -76,7 +77,7 @@ export const useEditableText = <T extends string | number | boolean = string>({
7677
dispatchCustomEvent(target, "vuu-commit");
7778
}
7879
},
79-
[clientSideEditValidationCheck, editState, onEdit],
80+
[clientSideEditValidationCheck, editState, onEdit, type],
8081
);
8182

8283
const handleKeyDown = useCallback(
@@ -123,7 +124,7 @@ export const useEditableText = <T extends string | number | boolean = string>({
123124
const handleChange = useCallback<FormEventHandler>(
124125
(evt) => {
125126
const { value } = evt.target as HTMLInputElement;
126-
const typedValue = getTypedValue(value, type);
127+
const typedValue = getTypedValue(value, type, true);
127128
console.log(
128129
`[useEditableText] handleChange '${value}' typedValue ${typedValue}
129130
initial value ${initialValueRef.current}
@@ -134,7 +135,11 @@ export const useEditableText = <T extends string | number | boolean = string>({
134135
setEditState({ value });
135136

136137
onEdit?.(
137-
{ editType: "change", isValid: result?.ok !== false, value },
138+
{
139+
editType: "change",
140+
isValid: result?.ok !== false,
141+
value: typedValue,
142+
},
138143
"change",
139144
);
140145
if (result?.ok === false) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { describe, expect, it } from "vitest";
2+
import { getGroupStatus } from "../src/group-utils";
3+
4+
describe("group-utils", () => {
5+
describe("getGroupStatus", () => {
6+
it("when no groupby, it correctly identifies no-groupby", () => {
7+
expect(getGroupStatus("ccy", [])).toEqual("no-groupby");
8+
});
9+
it("it correctly identifies 'single-groupby-other-column'", () => {
10+
expect(getGroupStatus("ccy", ["exchange"])).toEqual(
11+
"single-groupby-other-column",
12+
);
13+
});
14+
it("it correctly identifies 'multi-groupby-other-columns'", () => {
15+
expect(getGroupStatus("ccy", ["exchange", "created"])).toEqual(
16+
"multi-groupby-other-columns",
17+
);
18+
});
19+
it("it correctly identifies 'single-groupby'", () => {
20+
expect(getGroupStatus("ccy", ["ccy"])).toEqual("single-groupby");
21+
});
22+
});
23+
});

0 commit comments

Comments
 (0)