Skip to content

Commit

Permalink
Merge pull request finos#1374 from finos/fix-editable-dialog
Browse files Browse the repository at this point in the history
Fix editable dialog
  • Loading branch information
heswell authored Jun 3, 2024
2 parents 758be09 + 78dbc7f commit b78c2e2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 137 deletions.
4 changes: 4 additions & 0 deletions vuu-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions vuu-ui/packages/vuu-popups/src/dialog/Dialog.css

This file was deleted.

105 changes: 0 additions & 105 deletions vuu-ui/packages/vuu-popups/src/dialog/Dialog.tsx

This file was deleted.

1 change: 0 additions & 1 deletion vuu-ui/packages/vuu-popups/src/dialog/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./Dialog";
export * from "./useDialog";
2 changes: 1 addition & 1 deletion vuu-ui/packages/vuu-popups/src/dialog/useDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const useDialog = () => {
);

const dialog = dialogState ? (
<Dialog className="vuuDialog" open={true} onOpenChange={handleOpenChange}>
<Dialog open={true} onOpenChange={handleOpenChange}>
<DialogHeader header={dialogState.title} />
<DialogContent>{dialogState.content}</DialogContent>
{dialogState.hideCloseButton !== true ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ export const SessionEditingForm = ({
const initialDataRef = useRef<FormValues>();
const dataStatusRef = useRef(Status.uninitialised);

const ds = getDataSource(dataSourceProp, schema);
const { columns } = ds;
const columnMap = buildColumnMap(ds.columns);

const dataSource = useMemo(() => {
const ds = getDataSource(dataSourceProp, schema);
const { columns } = ds;
const columnMap = buildColumnMap(ds.columns);

const applyServerData = (data: VuuDataRow) => {
if (columnMap) {
const values: { [key: string]: VuuRowDataItemType } = {};
Expand All @@ -222,16 +222,15 @@ export const SessionEditingForm = ({
}
});
return ds;
}, [columnMap, columns, ds]);
}, [dataSourceProp, schema]);

const id = useIdMemo(idProp);

const handleChange = useCallback<ChangeEventHandler<HTMLInputElement>>(
(evt) => {
const [field, value] = getFieldNameAndValue(evt);
// const { type } = getField(fields, field);
// const typedValue = getTypedValue(value, type);
const typedValue = value;
const { type } = getField(fields, field);
const typedValue = getTypedValue(value, type);
setValues((values = {}) => {
const newValues = {
...values,
Expand All @@ -246,7 +245,7 @@ export const SessionEditingForm = ({
return newValues;
});
},
[]
[fields]
);

const handleBlur = useCallback<FocusEventHandler<HTMLInputElement>>(
Expand All @@ -255,9 +254,7 @@ export const SessionEditingForm = ({
const rowKey = values?.[keyField];
// TODO link this with client side validation if we're going to use it
const { type } = getField(fields, field);
const clientTypedValue = getTypedValue(value, type, true);
console.log(`client typed value ${clientTypedValue}`);
const typedValue = value;
const typedValue = getTypedValue(value, type, true);
if (typeof rowKey === "string") {
dataSource
.menuRpcCall({
Expand Down

0 comments on commit b78c2e2

Please sign in to comment.