lu-lowcode-package-form 0.10.78 → 0.10.80

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.78",
3
+ "version": "0.10.80",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -8,7 +8,7 @@ import { createPromiseWrapper } from "../../../utils"
8
8
  import { useCreation } from 'ahooks';
9
9
 
10
10
 
11
- const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsValue, shouldUpdateKey, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIconRender, rightIcon, rightIconClick, recordFieldsChange, getAllWithIds, ...props }, ref) => {
11
+ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsValue, shouldUpdateKey, value, type, defaultValue, onChange, option_label, option_value, option_search, options, request, requestParams, callError, subRequest, sub_option_label = "label", mode = "single", sub_option_value = "id", rightIconRender, rightIcon, rightIconClick, recordFieldsChange, getAllWithIds,removeLastFieldsValues, ...props }, ref) => {
12
12
  const [nOptions, setNOptions] = React.useState([])
13
13
  const [fetching, setFetching] = useState(false);
14
14
 
@@ -221,7 +221,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
221
221
 
222
222
  </OriginalSelect>
223
223
  {!props?.disabled && rightIcon}
224
- {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds })}
224
+ {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds ,removeLastFieldsValues})}
225
225
  </BaseWrapper>
226
226
  ) : (<>
227
227
  <OriginalSelect
@@ -240,7 +240,7 @@ const SearchSelect = forwardRef(({ addWrapper = true, form, fieldName, fieldsVal
240
240
 
241
241
  </OriginalSelect>
242
242
  {!props?.disabled && rightIcon}
243
- {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds })}
243
+ {!props?.disabled && typeof rightIconRender === 'function' && rightIconRender({ value, onChange, form, fieldName, recordFieldsChange,getAllWithIds,removeLastFieldsValues })}
244
244
  </>
245
245
  )
246
246
 
@@ -33,7 +33,7 @@ const TableCol = ({ children, width, hidden, ...props }) => {
33
33
  </div>
34
34
  }
35
35
 
36
- const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, initializeFormRender, recordFieldsChange, getTableWithIds, mode, isAllowCopy=false, isAllowAdd=true, ...props }) => {
36
+ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow, form, fieldName, initializeFormRender, recordFieldsChange, getTableWithIds,removeLastFieldsValues, mode, isAllowCopy=false, isAllowAdd=true, ...props }) => {
37
37
  useEffect(() => {
38
38
  // console.log("Table form reload", form)
39
39
  }, [form])
@@ -171,6 +171,7 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
171
171
  initializeFormRender,
172
172
  recordFieldsChange,
173
173
  getAllWithIds: getAllWithIds,
174
+ removeLastFieldsValues
174
175
  })}
175
176
  </Form.Item>
176
177
  }}
@@ -560,7 +560,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
560
560
 
561
561
  let childComponent
562
562
  if (isTable || isLayoutComponent) {
563
- childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, getTableWithIds, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, initializeFormRender, mode, recordFieldsChange })
563
+ childComponent = React.cloneElement(child, { onTableAddRow: handleTableAddRow, getTableWithIds, onTableRemoveRow: handleTableRemoveRow,removeLastFieldsValues, form: form, fieldName: identifier, onCustomChange, initializeFormRender, mode, recordFieldsChange })
564
564
  }
565
565
  else if (componentName === "Field.WithSingleSelect" || componentName === "Field.WithMultipleSelect" || componentName === "Show.WithTable") {
566
566
  childComponent = <Form.Item
@@ -594,7 +594,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
594
594
  {({ getFieldsValue }) => {
595
595
  const fieldsValue = getFieldsValue();
596
596
  let element = React.cloneElement(child, {
597
- onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue, initializeFormRender, recordFieldsChange,
597
+ onTableAddRow: handleTableAddRow, onTableRemoveRow: handleTableRemoveRow,removeLastFieldsValues, form: form, fieldName: identifier, onCustomChange, fieldsValue, initializeFormRender, recordFieldsChange,
598
598
  shouldUpdateKey: shouldUpdateKey.current[identifier],
599
599
  })
600
600
  return componentName === "show.WithTable" ? <>{element}</> : <Form.Item
@@ -615,7 +615,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
615
615
  name={identifier}
616
616
  rules={rules}
617
617
  >
618
- {React.cloneElement(child, { form: form, fieldName: identifier, onCustomChange, initializeFormRender, recordFieldsChange })}
618
+ {React.cloneElement(child, { form: form, fieldName: identifier, onCustomChange, initializeFormRender, recordFieldsChange,removeLastFieldsValues })}
619
619
  </Form.Item>
620
620
  }
621
621
  return (
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import { nanoid } from 'nanoid';
3
3
  import { Form, Row, Col } from 'antd';
4
4
 
5
- const LayoutFormRow = ({ children, layout, onTableAddRow, onTableRemoveRow, form, initializeFormRender,recordFieldsChange, mode }) => {
5
+ const LayoutFormRow = ({ children, layout, onTableAddRow, onTableRemoveRow, form, initializeFormRender,recordFieldsChange, mode,getTableWithIds,removeLastFieldsValues }) => {
6
6
  layout = layout || '1';
7
7
  const getColSpan = (layoutStr) => {
8
8
  const layoutArray = layoutStr.split(',').map(Number);
@@ -44,7 +44,7 @@ const LayoutFormRow = ({ children, layout, onTableAddRow, onTableRemoveRow, form
44
44
  }
45
45
  let childComponent = null
46
46
  if (componentName == 'Field.Table')
47
- childComponent = React.cloneElement(child, { onTableAddRow: onTableAddRow, onTableRemoveRow: onTableRemoveRow, form: form, fieldName: name, initializeFormRender, mode,recordFieldsChange })
47
+ childComponent = React.cloneElement(child, { onTableAddRow: onTableAddRow, onTableRemoveRow: onTableRemoveRow, form: form, fieldName: name, initializeFormRender, mode,recordFieldsChange ,getTableWithIds,removeLastFieldsValues })
48
48
  else if (componentName === "Field.WithSingleSelect" || componentName === "Field.WithMultipleSelect" || componentName === "Show.WithTable") {
49
49
  childComponent = <Form.Item
50
50
  hidden={hidden}
@@ -75,7 +75,7 @@ const LayoutFormRow = ({ children, layout, onTableAddRow, onTableRemoveRow, form
75
75
  >
76
76
  {({ getFieldsValue }) => {
77
77
  const fieldsValue = getFieldsValue();
78
- let element = React.cloneElement(child, { onTableAddRow: onTableAddRow, onTableRemoveRow: onTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue, initializeFormRender,recordFieldsChange, shouldUpdateKey: shouldUpdateKey.current[identifier] })
78
+ let element = React.cloneElement(child, { onTableAddRow: onTableAddRow, onTableRemoveRow: onTableRemoveRow, form: form, fieldName: identifier, onCustomChange, fieldsValue, initializeFormRender,recordFieldsChange,getTableWithIds,removeLastFieldsValues , shouldUpdateKey: shouldUpdateKey.current[identifier] })
79
79
  return componentName === "Show.WithTable" ? <>{element}</> : <Form.Item
80
80
  style={{ marginBottom: 0 }}
81
81
  label=""