lu-lowcode-package-form 0.10.42 → 0.10.43
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js +286 -286
- package/dist/index.es.js +27934 -27459
- package/package.json +1 -1
- package/src/App.jsx +5 -1
- package/src/components/field/base.jsx +1 -1
- package/src/components/field/table/index.jsx +21 -7
package/package.json
CHANGED
package/src/App.jsx
CHANGED
@@ -259,7 +259,11 @@ function App() {
|
|
259
259
|
<Layout.FormRow layout={'1'}>
|
260
260
|
<Field.Number label="测试规则" isRequired={true} __id="ceshi_rule1" />
|
261
261
|
</Layout.FormRow>
|
262
|
-
|
262
|
+
<Layout.FormRow layout={'1'}>
|
263
|
+
<Field.Table label="子表格" __id="table2" >
|
264
|
+
<Field.Number label="测试规则2" __id="ceshi_rule2" />
|
265
|
+
</Field.Table>
|
266
|
+
</Layout.FormRow>
|
263
267
|
<Layout.FormRow layout={'1'}>
|
264
268
|
<Field.Table label="子表格" __id="table" >
|
265
269
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
2
|
-
import { Button, Form, Input } from "antd";
|
3
|
-
import { DeleteOutlined } from "@ant-design/icons";
|
2
|
+
import { Button, Form, Input,Popconfirm } from "antd";
|
3
|
+
import { CopyOutlined, DeleteOutlined } from "@ant-design/icons";
|
4
4
|
import { BaseWrapper } from "../base.jsx"
|
5
5
|
import { type } from "@testing-library/user-event/dist/type/index.js";
|
6
6
|
import { nanoid } from "nanoid";
|
@@ -11,7 +11,7 @@ const TableAction = ({ label, subTableIndex, children, subTableHead = false, ...
|
|
11
11
|
return <div className="fw-12 ">
|
12
12
|
<div className="frelative fw-full fh-full fflex fflex-col foverflow-hidden">
|
13
13
|
{label && subTableHead && <div className='fh-12 ffont-semibold fbg-[#fafafa] ftext-sm fflex fflex-nowrap ftext-nowrap fjustify-between fitems-center fpx-2 fborder-b'>{label}</div>}
|
14
|
-
<div className="fw-full fflex-1 fflex fitems-center fjustify-center fp-2 fbox-border ">
|
14
|
+
<div className="fw-full fflex-1 fflex fitems-center fjustify-center fp-2 fbox-border fgap-2 ">
|
15
15
|
{children}
|
16
16
|
</div>
|
17
17
|
</div>
|
@@ -30,7 +30,7 @@ const TableCol = ({ children, width, hidden, ...props }) => {
|
|
30
30
|
</div>
|
31
31
|
}
|
32
32
|
|
33
|
-
const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, initializeFormRender,recordFieldsChange, mode, ...props }) => {
|
33
|
+
const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, initializeFormRender, recordFieldsChange, mode, ...props }) => {
|
34
34
|
useEffect(() => {
|
35
35
|
// console.log("Table form reload", form)
|
36
36
|
}, [form])
|
@@ -169,10 +169,24 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
|
|
169
169
|
</TableCol>
|
170
170
|
})}
|
171
171
|
{disabled != true && readonly != true && <TableAction subTableHead={index == 0} key={`row_${index}_action`} subTable={true} subTableIndex={index} label={"操作"}>
|
172
|
-
<
|
173
|
-
|
174
|
-
|
172
|
+
<CopyOutlined className="fcursor-pointer" onClick={() => {
|
173
|
+
let tableValues = form.getFieldValue(fieldName)
|
174
|
+
const copyRow = {...tableValues[index]}
|
175
|
+
tableValues.splice(index + 1, 0, copyRow)
|
176
|
+
form?.setFieldValue(fieldName, tableValues)
|
175
177
|
}} />
|
178
|
+
<Popconfirm
|
179
|
+
title="删除确认"
|
180
|
+
description="确定要删除这一行吗?"
|
181
|
+
onConfirm={() => {
|
182
|
+
remove(index)
|
183
|
+
typeof onTableRemoveRow === "function" && onTableRemoveRow(childrenIds);
|
184
|
+
}}
|
185
|
+
okText="确定"
|
186
|
+
cancelText="取消"
|
187
|
+
>
|
188
|
+
<DeleteOutlined className="fcursor-pointer ftext-red-500" />
|
189
|
+
</Popconfirm>
|
176
190
|
</TableAction>}
|
177
191
|
</div>
|
178
192
|
))}
|