lu-lowcode-package-form 0.11.89 → 0.11.91

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.89",
3
+ "version": "0.11.91",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -281,8 +281,9 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
281
281
  ))}
282
282
  </div>
283
283
  {disabled != true && readonly != true && isAllowAdd && <Button onClick={() => {
284
+ const lastIndex = fields.length;
284
285
  add({ key: nanoid(), })
285
- typeof onTableAddRow === "function" && onTableAddRow(childrenIds);
286
+ typeof onTableAddRow === "function" && onTableAddRow(childrenIds,lastIndex);
286
287
  }} className="fmy-2">新增一行</Button>}
287
288
  </div>
288
289
  }}
@@ -444,7 +444,10 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
444
444
  setTimeout(() => {
445
445
  recordFieldsChange(changedFields, true)
446
446
  // console.log("idGroups", idGroups)
447
- if (idGroups.length > 0) idGroups.forEach(ids => { if (Array.isArray(ids) && ids.length > 0) handleTableAddRow(ids) })
447
+ if (idGroups.length > 0) idGroups.forEach(ids => {
448
+ if (Array.isArray(ids) && ids.length > 0)
449
+ handleTableAddRow(ids)
450
+ })
448
451
  }, 0)
449
452
  }
450
453
  // 处理级联显示隐藏 @return {boolean} 是否需要重新渲染表单的字段
@@ -875,13 +878,13 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
875
878
  })
876
879
  return withAllIds
877
880
  }
878
- const handleTableAddRow = (ids) => {
881
+ const handleTableAddRow = (ids,targetRowIndex = -1) => {
879
882
  let withAllIds = getTableWithIds(ids)
880
883
  const fieldValues = form.getFieldsValue();
881
884
  setTimeout(async () => {
882
885
  for (let index = 0; index < withAllIds.length; index++) {
883
886
  const withid = withAllIds[index];
884
- await handleFieldsWith(withid, fieldValues);
887
+ await handleFieldsWith(withid, fieldValues,false,null,targetRowIndex);
885
888
  }
886
889
  }, 0);
887
890
  }