lu-lowcode-package-form 0.11.4 → 0.11.6

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.4",
3
+ "version": "0.11.6",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -7,7 +7,7 @@ import { nanoid } from 'nanoid';
7
7
  import { eventEmitter } from '../../utils/events'
8
8
 
9
9
 
10
- function batchElements(elements, groupSize) {
10
+ function batchElements(elements, groupSize,dmap) {
11
11
  const groupedElements = [];
12
12
  let tempArray = [];
13
13
 
@@ -29,7 +29,11 @@ function batchElements(elements, groupSize) {
29
29
  groupedElements.push([element]);
30
30
  } else {
31
31
  tempArray.push(element);
32
- const visibleElementsCount = tempArray.filter(el => !el?.props?.calcHidden).length;
32
+ const visibleElementsCount = tempArray.filter(el => {
33
+ const identifier = el.props?.componentId || el.props?.__id;
34
+ const isShow = !dmap.has(identifier) || dmap.get(identifier)?.show;
35
+ return isShow && !el?.props?.calcHidden
36
+ }).length;
33
37
  if (visibleElementsCount === groupSize) {
34
38
  groupedElements.push(tempArray);
35
39
  tempArray = [];
@@ -41,7 +45,6 @@ function batchElements(elements, groupSize) {
41
45
  fillWithReactElement(groupSize, tempArray);
42
46
  groupedElements.push(tempArray);
43
47
  }
44
-
45
48
  return groupedElements;
46
49
  }
47
50
 
@@ -573,7 +576,9 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
573
576
  if (!isEqual(field.value || "", getLastFieldValue(field.name) || "")) {
574
577
  if (lockStatus_ != 1) {
575
578
  console.log("handleFieldsWith field.name", field.name)
576
- needRefresh = await handleFieldsWith(field.name, fieldValues);
579
+ let needRefresh_ = await handleFieldsWith(field.name, fieldValues);
580
+ needRefresh = needRefresh || needRefresh_
581
+
577
582
  }
578
583
  lastFormValues.current[field.name] = field.value;
579
584
  }
@@ -637,11 +642,13 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
637
642
  console.log("renderChildren")
638
643
  const childrenArray = React.Children.toArray(children);
639
644
  const groupedChildren = batchElements(
640
- childrenArray.filter(child => {
641
- const identifier = child.props.componentId || child.props.__id;
642
- return !dependencyMap.current.has(identifier) || dependencyMap.current.get(identifier)?.show;
643
- }),
644
- cols
645
+ childrenArray,
646
+ // childrenArray.filter(child => {
647
+ // const identifier = child.props.componentId || child.props.__id;
648
+ // return !dependencyMap.current.has(identifier) || dependencyMap.current.get(identifier)?.show;
649
+ // }),
650
+ cols,
651
+ dependencyMap.current
645
652
  );
646
653
 
647
654
 
@@ -658,7 +665,8 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
658
665
  }
659
666
  const isLayoutComponent = componentName && componentName.startsWith('Layout.');
660
667
  const isTable = componentName && componentName == 'Field.Table';
661
- const hidden = props.calcHidden && mode != "desgin";
668
+ const isShow = !dependencyMap.current.has(identifier) || dependencyMap.current.get(identifier)?.show;
669
+ const hidden = (props.calcHidden || !isShow) && mode != "desgin";
662
670
 
663
671
  const rules = []
664
672
  if (props.isRequired)
@@ -738,7 +746,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
738
746
  return (
739
747
  <Col
740
748
  key={identifier || `col-${index}`}
741
- span={props.calcHidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
749
+ span={hidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
742
750
  style={{ marginBottom: 0 }}
743
751
  >
744
752
  {childComponent}