Skip to content

Bug fixes #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Feb 15, 2024
Prev Previous commit
Next Next commit
Fixed changing editable column value doesn't show save button + dont …
…show custom columns in column value selector
  • Loading branch information
raheeliftikhar5 committed Feb 7, 2024
commit a6e34bdbf2c5f0ed710505aef0d1be853b39e6ad
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export const columnChildrenMap = {
isCustom: valueComp<boolean>(false),
// If it is a data column, it must be the name of the column and cannot be duplicated as a react key
dataIndex: valueComp<string>(""),
columnsList: valueComp<Array<JSONValue>>([]),
hide: BoolControl,
sortable: BoolControl,
width: NumberControl,
Expand Down Expand Up @@ -207,7 +206,7 @@ export class ColumnComp extends ColumnInitComp {
})}
<Dropdown
showSearch={true}
value={columnValue}
defaultValue={columnValue}
options={initialColumns}
label={trans("table.dataMapping")}
onChange={(value) => {
Expand Down
23 changes: 16 additions & 7 deletions client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,21 @@ function renderTitle(props: { title: string; editable: boolean }) {
);
}

function getInitialColumns(columnsAggrData: ColumnsAggrData) {
const initialColumns = Object.keys(columnsAggrData).map(column => ({
label: <span style={{textTransform: 'capitalize'}}>{column}</span>,
value: `{{currentRow.${column}}}`
}))
function getInitialColumns(
columnsAggrData: ColumnsAggrData,
customColumns: string[],
) {
let initialColumns = [];
Object.keys(columnsAggrData).forEach(column => {
if(customColumns.includes(column)) return;
initialColumns.push({
// label: <span style={{textTransform: 'capitalize'}}>{column}</span>,
label: column,
value: `{{currentRow.${column}}}`
});
});
initialColumns.push({
label: <span>Select with handlebars</span>,
label: 'Select with handlebars',
value: '{{currentCell}}',
})
return initialColumns;
Expand All @@ -283,7 +291,8 @@ export function columnsToAntdFormat(
columnsAggrData: ColumnsAggrData,
onTableEvent: (eventName: any) => void,
): Array<CustomColumnType<RecordType>> {
const initialColumns = getInitialColumns(columnsAggrData);
const customColumns = columns.filter(col => col.isCustom).map(col => col.dataIndex);
const initialColumns = getInitialColumns(columnsAggrData, customColumns);
const sortMap: Map<string | undefined, SortOrder> = new Map(
sort.map((s) => [s.column, s.desc ? "descend" : "ascend"])
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const paramsEqual = (
params1: Record<string, unknown> | undefined,
params2: Record<string, unknown> | undefined
) => {
return depthEqual(params1, params2, 3);
return depthEqual(params1, params2, 4);
};

export function withParams<TCtor extends MultiCompConstructor>(
Expand Down