Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: replace maxHeight with auto/fixed Height
  • Loading branch information
raheeliftikhar5 committed Nov 30, 2023
commit 18e49cabd1dd513f61d99006e2dd9df4bbd790be
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export class TableImplComp extends TableInitComp implements IContainer {
readonly filterData: RecordType[] = [];
readonly columnAggrData: ColumnsAggrData = {};

override autoHeight(): boolean {
return this.children.autoHeight.getView();
}

private getSlotContainer() {
return this.children.expansion.children.slot.getSelectedComp().getComp().children.container;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ const TableWrapper = styled.div<{
$rowStyle: TableRowStyleType;
toolbarPosition: "above" | "below" | "close";
}>`
overflow: hidden;
max-height: 100%;
overflow-y: auto;
background: white;
border: 1px solid #d7d9e0;

Expand Down Expand Up @@ -364,7 +365,7 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
rowColorFn: RowColorViewType;
columnsStyle: TableColumnStyleType;
fixedHeader: boolean;
maxHeight: string;
height?: number;
};

function TableCellView(props: {
Expand Down Expand Up @@ -538,7 +539,7 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
columns={columns}
scroll={{
x: COL_MIN_WIDTH * columns.length,
y: props.fixedHeader ? props.maxHeight : undefined,
y: props.fixedHeader && props.height ? `${props.height - 100}px` : undefined,
}}
></Table>
);
Expand All @@ -552,10 +553,10 @@ export function TableCompView(props: {
onDownload: (fileName: string) => void;
}) {
const editorState = useContext(EditorContext);
const { width, ref } = useResizeDetector({
const { width, height, ref } = useResizeDetector({
refreshMode: "debounce",
refreshRate: 600,
handleHeight: false,
handleHeight: true,
});
const viewMode = useUserViewMode();
const compName = useContext(CompNameContext);
Expand Down Expand Up @@ -671,8 +672,8 @@ export function TableCompView(props: {

return (
<BackgroundColorContext.Provider value={style.background}>
<div ref={ref} style={{height: '100%'}}>
<TableWrapper
ref={ref}
$style={style}
$rowStyle={rowStyle}
toolbarPosition={toolbar.position}
Expand All @@ -697,13 +698,13 @@ export function TableCompView(props: {
}}
showHeader={!compChildren.hideHeader.getView()}
fixedHeader={compChildren.fixedHeader.getView()}
maxHeight={compChildren.maxHeight.getView()}
columns={antdColumns}
columnsStyle={columnsStyle}
viewModeResizable={compChildren.viewModeResizable.getView()}
dataSource={pageDataInfo.data}
size={compChildren.size.getView()}
tableLayout="fixed"
height={height}
loading={
loading ||
// fixme isLoading type
Expand All @@ -717,6 +718,7 @@ export function TableCompView(props: {
{expansion.expandModalView}
</SlotConfigContext.Provider>
</TableWrapper>
</div>
</BackgroundColorContext.Provider>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
<Section name={trans("prop.columns")}>{columnPropertyView(comp)}</Section>
<Section name={sectionNames.layout}>
{comp.children.expansion.getPropertyView()}
{comp.children.autoHeight.getPropertyView()}
{hiddenPropertyView(comp.children)}
</Section>
<Section name={trans("prop.rowSelection")}>
Expand Down Expand Up @@ -465,12 +466,6 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
label: trans("table.fixedHeader"),
tooltip: trans("table.fixedHeaderTooltip")
})}
{comp.children.fixedHeader.getView() &&
comp.children.maxHeight.propertyView({
label: trans("table.maxHeight"),
tooltip: trans("table.maxHeightTooltip")
})
}
</Section>
<Section name={"Row Style"}>
{comp.children.rowStyle.getPropertyView()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { JSONObject } from "util/jsonTypes";
import { ExpansionControl } from "./expansionControl";
import { PaginationControl } from "./paginationControl";
import { SelectionControl } from "./selectionControl";
import { AutoHeightControl } from "comps/controls/autoHeightControl";

const sizeOptions = [
{
Expand Down Expand Up @@ -136,7 +137,7 @@ const tableChildrenMap = {
hideBordered: BoolControl,
hideHeader: BoolControl,
fixedHeader: BoolControl,
maxHeight: withDefault(RadiusControl, '300px'),
autoHeight: withDefault(AutoHeightControl, "auto"),
data: withIsLoadingMethod(JSONObjectArrayControl),
showDataLoadSpinner: withDefault(BoolPureControl, true),
columns: ColumnListComp,
Expand Down
2 changes: 0 additions & 2 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1250,8 +1250,6 @@ export const en = {
hideHeader: "Hide table header",
fixedHeader: "Fixed table header",
fixedHeaderTooltip: "Header will be fixed for vertically scrollable table",
maxHeight: "Max. Height",
maxHeightTooltip: "Set max. height to make table scrollable",
hideBordered: "Hide column border",
deleteColumn: "Delete column",
confirmDeleteColumn: "Confirm delete column: ",
Expand Down
2 changes: 0 additions & 2 deletions client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,6 @@ table: {
hideHeader: "隐藏表头",
fixedHeader: "固定表头",
fixedHeaderTooltip: "垂直滚动表格的标题将被固定",
maxHeight: "最大限度。高度",
maxHeightTooltip: "设置最大值使表格可滚动的高度",
hideBordered: "隐藏列边框",
deleteColumn: "删除列",
confirmDeleteColumn: "确认删除列:",
Expand Down