lu-lowcode-package-form 0.10.43 → 0.10.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.10.43",
3
+ "version": "0.10.44",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
package/src/App.jsx CHANGED
@@ -265,7 +265,7 @@ function App() {
265
265
  </Field.Table>
266
266
  </Layout.FormRow>
267
267
  <Layout.FormRow layout={'1'}>
268
- <Field.Table label="子表格" __id="table" >
268
+ <Field.Table label="子表格" __id="table" isAllowAdd={false} isAllowCopy={false} >
269
269
 
270
270
  <Field.WithSingleSelect
271
271
  isRequired={true} ref={testRef}
@@ -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, isAllowCopy=true, isAllowAdd=true, ...props }) => {
34
34
  useEffect(() => {
35
35
  // console.log("Table form reload", form)
36
36
  }, [form])
@@ -169,12 +169,12 @@ 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
- <CopyOutlined className="fcursor-pointer" onClick={() => {
172
+ {isAllowCopy && <CopyOutlined className="fcursor-pointer" onClick={() => {
173
173
  let tableValues = form.getFieldValue(fieldName)
174
174
  const copyRow = {...tableValues[index]}
175
175
  tableValues.splice(index + 1, 0, copyRow)
176
176
  form?.setFieldValue(fieldName, tableValues)
177
- }} />
177
+ }} />}
178
178
  <Popconfirm
179
179
  title="删除确认"
180
180
  description="确定要删除这一行吗?"
@@ -191,7 +191,7 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
191
191
  </div>
192
192
  ))}
193
193
  </div>
194
- {disabled != true && readonly != true && <Button onClick={() => {
194
+ {disabled != true && readonly != true && isAllowAdd && <Button onClick={() => {
195
195
  add({ key: nanoid() })
196
196
  typeof onTableAddRow === "function" && onTableAddRow(childrenIds);
197
197
  }} className="fmy-2">新增一行</Button>}