lu-lowcode-package-form 0.11.5 → 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.5",
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
 
@@ -639,11 +642,13 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
639
642
  console.log("renderChildren")
640
643
  const childrenArray = React.Children.toArray(children);
641
644
  const groupedChildren = batchElements(
642
- childrenArray.filter(child => {
643
- const identifier = child.props.componentId || child.props.__id;
644
- return !dependencyMap.current.has(identifier) || dependencyMap.current.get(identifier)?.show;
645
- }),
646
- 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
647
652
  );
648
653
 
649
654
 
@@ -660,7 +665,8 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
660
665
  }
661
666
  const isLayoutComponent = componentName && componentName.startsWith('Layout.');
662
667
  const isTable = componentName && componentName == 'Field.Table';
663
- 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";
664
670
 
665
671
  const rules = []
666
672
  if (props.isRequired)
@@ -740,7 +746,7 @@ const FormContainer = forwardRef(({ cols = 1, children, mode = "view" }, ref) =>
740
746
  return (
741
747
  <Col
742
748
  key={identifier || `col-${index}`}
743
- span={props.calcHidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
749
+ span={hidden ? 0 : (isLayoutComponent ? 24 : 24 / cols)}
744
750
  style={{ marginBottom: 0 }}
745
751
  >
746
752
  {childComponent}