lu-lowcode-package-form 0.11.21 → 0.11.23

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.11.21",
3
+ "version": "0.11.23",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -21,6 +21,14 @@ const TableAction = ({ label, subTableIndex, children, subTableHead = false, ...
21
21
  </div>
22
22
  }
23
23
 
24
+ const RowID = ({value,onChange,...props}) => {
25
+ useEffect(() => {
26
+ if (!value) onChange(nanoid())
27
+ }, [value])
28
+ return (
29
+ <Input {...props} value={value} onChange={onChange} hidden={true} />
30
+ )
31
+ }
24
32
 
25
33
  const TableCol = ({ children, width, hidden, ...props }) => {
26
34
  const [sWidth, setSWidth] = useState(0);
@@ -100,7 +108,9 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
100
108
  </div>}
101
109
  {fields.map((field, index) => (
102
110
  <div key={`${tableId}.${field.key}`} className=" fflex flex-nowrap fmin-w-full ">
103
-
111
+ <Form.Item hidden={true} name={[field.name, "__id"]}>
112
+ <RowID />
113
+ </Form.Item>
104
114
  {React.Children.map(children, (child, childIndex) => {
105
115
  let { props } = child;
106
116
  const col_id = child?.props?.componentId || child?.props?.__id || childIndex;
@@ -224,7 +234,7 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
224
234
  ))}
225
235
  </div>
226
236
  {disabled != true && readonly != true && isAllowAdd && <Button onClick={() => {
227
- add({ key: nanoid() })
237
+ add({ key: nanoid(), })
228
238
  typeof onTableAddRow === "function" && onTableAddRow(childrenIds);
229
239
  }} className="fmy-2">新增一行</Button>}
230
240
  </div>
@@ -446,6 +446,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
446
446
  const handleFieldsWithFill = async (fieldValues, child, parentIdentifier, componentName) => {
447
447
  // console.log("handleFieldsWithFill child.identifier", child.identifier)
448
448
  // console.log("handleFieldsWithFill parentIdentifier", parentIdentifier)
449
+ console.log("handleFieldsWithFill componentName", componentName)
449
450
  const withFill = child?.component?.props.withFill;
450
451
  const withDataFetch = child?.component?.props.withDataFetch;
451
452
  let withFillIndex = 0
@@ -487,12 +488,19 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
487
488
  filter_value = filter_value[withFillIndex]
488
489
  }
489
490
  }
490
- if (componentName == "Field.WithSingleSelect" && filter_value) {
491
- if (typeof filter_value === "string") {
491
+ if (filter_value && typeof filter_value === "string") {
492
+ try {
492
493
  filter_value = JSON.parse(filter_value)
494
+ } catch (error) {
493
495
  }
494
- filter_value = filter_value?.value
495
496
  }
497
+ if (filter_value?.value) filter_value = filter_value.value
498
+ // if (componentName == "Field.WithSingleSelect" && filter_value) {
499
+ // if (typeof filter_value === "string") {
500
+ // filter_value = JSON.parse(filter_value)
501
+ // }
502
+ // filter_value = filter_value?.value
503
+ // }
496
504
  params.filter[condition_column.column_name] = filter_value
497
505
  }
498
506