Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed table header + Handle editor's right panel foldable section in search#535

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand Up@@ -275,6 +276,7 @@ const TableTd = styled.td<{
border-color: ${(props) => props.$style.border} !important;
border-width: ${(props) => props.$style.borderWidth} !important;
border-radius: ${(props) => props.$style.radius};
padding: 0 !important;

> div > div {
color: ${(props) => props.$style.text};
Expand DownExpand Up@@ -362,6 +364,9 @@ type CustomTableProps<RecordType> = Omit<TableProps<RecordType>, "components" |
viewModeResizable: boolean;
rowColorFn: RowColorViewType;
columnsStyle: TableColumnStyleType;
fixedHeader: boolean;
height?: number;
autoHeight?: boolean;
};

function TableCellView(props: {
Expand DownExpand Up@@ -533,7 +538,12 @@ function ResizeableTable<RecordType extends object>(props: CustomTableProps<Reco
{...props}
pagination={false}
columns={columns}
scroll={{ x: COL_MIN_WIDTH * columns.length }}
scroll={{
x: COL_MIN_WIDTH * columns.length,
y: props.fixedHeader && props.height && !props.autoHeight
? `${props.height - 100}px`
: undefined,
}}
></Table>
);
}
Expand All@@ -546,10 +556,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 All@@ -574,6 +584,7 @@ export function TableCompView(props: {
() => compChildren.dynamicColumnConfig.getView(),
[compChildren.dynamicColumnConfig]
);
const autoHeight = compChildren.autoHeight.getView();
const columnsAggrData = comp.columnAggrData;
const expansion = useMemo(() => compChildren.expansion.getView(), [compChildren.expansion]);
const antdColumns = useMemo(
Expand DownExpand Up@@ -665,8 +676,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@@ -690,12 +701,15 @@ export function TableCompView(props: {
onTableChange(pagination, filters, sorter, extra, comp.dispatch, onEvent);
}}
showHeader={!compChildren.hideHeader.getView()}
fixedHeader={compChildren.fixedHeader.getView()}
columns={antdColumns}
columnsStyle={columnsStyle}
viewModeResizable={compChildren.viewModeResizable.getView()}
dataSource={pageDataInfo.data}
size={compChildren.size.getView()}
tableLayout="fixed"
height={height}
autoHeight={autoHeight}
loading={
loading ||
// fixme isLoading type
Expand All@@ -709,6 +723,7 @@ export function TableCompView(props: {
{expansion.expandModalView}
</SlotConfigContext.Provider>
</TableWrapper>
</div>
</BackgroundColorContext.Provider>
);
}
View file
Open in desktop
Original file line numberDiff line numberDiff 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 All@@ -455,11 +456,15 @@ export function compTablePropertyView<T extends MultiBaseComp<TableChildrenType>
label: trans("table.tableSize"),
radioButton: true,
})}
{comp.children.hideBordered.propertyView({
label: trans("table.hideBordered"),
})}
{comp.children.hideHeader.propertyView({
label: trans("table.hideHeader"),
})}
{comp.children.hideBordered.propertyView({
label: trans("table.hideBordered"),
{comp.children.fixedHeader.propertyView({
label: trans("table.fixedHeader"),
tooltip: trans("table.fixedHeaderTooltip")
})}
</Section>
<Section name={"Row Style"}>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,7 @@ import {
BoolCodeControl,
ColorOrBoolCodeControl,
JSONObjectArrayControl,
RadiusControl,
} from "comps/controls/codeControl";
import { dropdownControl } from "comps/controls/dropdownControl";
import { eventHandlerControl } from "comps/controls/eventHandlerControl";
Expand All@@ -32,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 DownExpand Up@@ -134,6 +136,8 @@ export type RowColorViewType = (param: {
const tableChildrenMap = {
hideBordered: BoolControl,
hideHeader: BoolControl,
fixedHeader: BoolControl,
autoHeight: withDefault(AutoHeightControl, "auto"),
data: withIsLoadingMethod(JSONObjectArrayControl),
showDataLoadSpinner: withDefault(BoolPureControl, true),
columns: ColumnListComp,
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,11 +40,16 @@ function useScreenInfo() {
}

const getScreenInfo = useCallback(() => {
const {width, height } = window.screen;
const {innerWidth, innerHeight } = window;
const deviceType = getDeviceType();
const flags = getFlagsByDeviceType(deviceType);

return { width, height, deviceType, ...flags };
return {
width: innerWidth,
height: innerHeight,
deviceType,
...flags
};
}, [])

const [screenInfo, setScreenInfo] = useState<ScreenInfo>({});
Expand Down
2 changes: 2 additions & 0 deletionsclient/packages/lowcoder/src/i18n/locales/en.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1248,6 +1248,8 @@ export const en = {
type: "Type",
tableSize: "Table size",
hideHeader: "Hide table header",
fixedHeader: "Fixed table header",
fixedHeaderTooltip: "Header will be fixed for vertically scrollable table",
hideBordered: "Hide column border",
deleteColumn: "Delete column",
confirmDeleteColumn: "Confirm delete column: ",
Expand Down
2 changes: 2 additions & 0 deletionsclient/packages/lowcoder/src/i18n/locales/zh.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1174,6 +1174,8 @@ table: {
type:"类型",
tableSize:"表格尺寸",
hideHeader:"隐藏表头",
fixedHeader:"固定表头",
fixedHeaderTooltip:"垂直滚动表格的标题将被固定",
hideBordered:"隐藏列边框",
deleteColumn:"删除列",
confirmDeleteColumn:"确认删除列:",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@ import {
RightPanelContentWrapper,
} from "pages/editor/right/styledComponent";
import { tableDragClassName } from "pages/tutorials/tutorialsConstant";
import React, { useContext, useMemo, useState } from "react";
import React, { useContext,useEffect,useMemo, useState } from "react";
import styled from "styled-components";
import {
BaseSection,
Expand DownExpand Up@@ -99,6 +99,7 @@ Object.keys(uiCompCategoryNames).forEach((cat) => {
export const UICompPanel = () => {
const { onDrag, searchValue } = useContext(RightContext);
const [propertySectionState, setPropertySectionState] = useState<PropertySectionState>(initialState);
const [searchedPropertySectionState, setSearchedPropertySectionState] = useState<PropertySectionState>({});

const categories = useMemo(() => {
const cats: Record<string, [string, UICompManifest][]> = Object.fromEntries(
Expand All@@ -113,11 +114,18 @@ export const UICompPanel = () => {
}, []);

const propertySectionContextValue = useMemo<PropertySectionContextType>(() => {
const state = searchValue
? searchedPropertySectionState
: propertySectionState;
const setStateFn = searchValue
? setSearchedPropertySectionState
: setPropertySectionState;

return {
compName: stateCompName,
state: propertySectionState,
state,
toggle: (compName: string, sectionName: string) => {
setPropertySectionState((oldState) => {
setStateFn((oldState) => {
const nextSectionState: PropertySectionState = { ...oldState };
const compState = nextSectionState[compName] || {};
compState[sectionName] = compState[sectionName] === false;
Expand All@@ -126,7 +134,13 @@ export const UICompPanel = () => {
});
},
};
}, [propertySectionState]);
}, [searchValue, propertySectionState, searchedPropertySectionState]);

useEffect(() => {
if(!searchValue) {
setSearchedPropertySectionState({})
}
}, [searchValue])

const compList = useMemo(
() =>
Expand DownExpand Up@@ -187,7 +201,6 @@ export const UICompPanel = () => {

return (
<RightPanelContentWrapper>
{/* {compList.length > 0 ? compList : <EmptyCompContent />} */}
<PropertySectionContext.Provider
value={propertySectionContextValue}
>
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp