Skip to content

Commit

Permalink
fix: 🧩 fix tableAttribute pagination checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
limuen committed Jun 6, 2024
1 parent 91a6298 commit eefd09c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/react-low-code/src/views/lowCode/component/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useFormHook } from "@/views/lowCode/form/hook/form";
import Operations from "@/components/Operations";
import TemplateTagList from "@/components/TemplateTagList";
import { StorageNameMap } from "@/constants/storageNames";
import { AnyObject } from "src/types";
import { AnyObject } from "@/types";
import { downloadFile, uuid } from "@limuen/utils";
import ComponentBody from "./component/ComponentBody";
import { ComponentGlobalControl, ComponentAttribute, BodyType } from "./component/ComponentGlobalControl";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DragDropContext, Droppable } from "react-beautiful-dnd";
import { IColumnType } from "../";
import { PlusOutlined } from "@ant-design/icons";
import { Button, Table } from "antd";
import { AnyObject } from "src/types";
import { AnyObject } from "@/types";
import { TableAttribute } from "./TableGlobalControl";

export interface TableBodyProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect } from "react";
import { Button, Checkbox, Form, Input, TablePaginationConfig } from "antd";
import { CloseOutlined } from "@ant-design/icons";
import Selection from "@/components/Selection";
import { Button, Checkbox, Form, Input, TablePaginationConfig } from "antd";
import GlobalControl from "@/components/GlobalControl";
import { AnyObject } from "src/types";
import { AnyObject } from "@/types";
import { shortUuid } from "@limuen/utils";

export interface TableAttribute {
Expand All @@ -13,7 +13,7 @@ export interface TableAttribute {
extension: ".tsx" | ".jsx";
attribute: {
rowKey?: string;
pagination?: TablePaginationConfig;
pagination?: false | TablePaginationConfig;
};
}

Expand All @@ -37,6 +37,10 @@ const TableGlobalControl: React.FC<TableGlobalControlProps> = ({
useEffect(() => {
form.setFieldsValue({
...tableAttribute,
attribute: {
...tableAttribute.attribute,
pagination: tableAttribute.attribute.pagination !== undefined ? tableAttribute.attribute.pagination : {}
},
dataSource: dataSource.map(item => {
if (typeof item === "string") {
return item;
Expand Down Expand Up @@ -125,7 +129,7 @@ const TableGlobalControl: React.FC<TableGlobalControlProps> = ({
</Form.List>
</Form.Item>
<Form.Item label="分页" name={["attribute", "pagination"]} valuePropName="checked">
<Checkbox />
<Checkbox checked={!!tableAttribute.attribute.pagination} />
</Form.Item>
</Selection>

Expand Down

0 comments on commit eefd09c

Please sign in to comment.