lu-lowcode-package-form 0.10.40 → 0.10.41

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lu-lowcode-package-form",
3
- "version": "0.10.40",
3
+ "version": "0.10.41",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -180,7 +180,19 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
180
180
  return needRefresh;
181
181
 
182
182
  };
183
-
183
+ const removeLastFieldsValues = (name , isTable = false)=>{
184
+ if (!lastFormValues.current) return
185
+ if (isTable) {
186
+ const lastFormValuesKeys = Object.keys(lastFormValues.current)
187
+ for (let index = 0; index < lastFormValuesKeys.length; index++) {
188
+ const key = lastFormValuesKeys[index];
189
+ if (key.includes(`${name},`)) {
190
+ delete lastFormValues.current[key]
191
+ }
192
+ }
193
+ }
194
+ else delete lastFormValues.current[name]
195
+ }
184
196
  // 处理填充规则
185
197
  const handleFillRules = (current_identifier, parentIdentifier, fieldValues, fillRules) => {
186
198
  // 获取当前变更的字段数据
@@ -221,6 +233,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
221
233
  return target_item_value
222
234
  })
223
235
  setValue = target_value
236
+ removeLastFieldsValues(target, true)
224
237
  eventEmitter.emit('reloadTable', target);
225
238
  }
226
239
  // 同级字段
@@ -394,6 +407,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
394
407
  }
395
408
  return result
396
409
  }
410
+
397
411
 
398
412
  const changedFieldsState = React.useRef({});
399
413
  const debounceHandleFieldsChange = debounce(() => {
@@ -402,10 +416,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
402
416
  lockStatus.current = 0
403
417
  let needRefresh = false;
404
418
  if (!lastFormValues.current) lastFormValues.current = {}
419
+
405
420
  for (let key in changedFieldsState.current) {
406
421
  let field = changedFieldsState.current[key];
407
- // console.log("field",field.value)
408
- // console.log("getLastFieldValue(field.name)",getLastFieldValue(field.name))
409
422
  if (!isEqual(field.value, getLastFieldValue(field.name))) {
410
423
  if (lockStatus_ != 1) {
411
424
  needRefresh = handleFieldsWith(field.name, fieldValues);