lu-lowcode-package-form 0.11.64 → 0.11.66

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.64",
3
+ "version": "0.11.66",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -20,6 +20,31 @@ const DragHead = ({ childrenDesc, initialWidth, changeWidth, showAction, showLab
20
20
  }
21
21
  },[initialWidth])
22
22
 
23
+ useEffect(() => {
24
+ // 创建CSS变量
25
+ document.documentElement.style.setProperty('--drag-position', '0px');
26
+
27
+ // 创建指示线DOM元素
28
+ const indicator = document.createElement('div');
29
+ indicator.id = 'column-drag-indicator';
30
+ indicator.style.cssText = `
31
+ position: fixed;
32
+ top: 0;
33
+ left: var(--drag-position);
34
+ width: 2px;
35
+ height: 100vh;
36
+ background-color: #1290ff;
37
+ pointer-events: none;
38
+ z-index: 9999;
39
+ display: none;
40
+ `;
41
+ document.body.appendChild(indicator);
42
+
43
+ return () => {
44
+ document.body.removeChild(indicator);
45
+ };
46
+ }, []);
47
+
23
48
  const getColumnWidth = (index) => {
24
49
  return headWidths[index] || 150
25
50
  }
@@ -27,11 +52,12 @@ const DragHead = ({ childrenDesc, initialWidth, changeWidth, showAction, showLab
27
52
  // 处理拖动开始
28
53
  const onResizeStart = (index) => {
29
54
  return (e, data) => {
30
- e.stopPropagation()
31
- setIsDragging(true)
32
- setResizingColumn(index)
33
- setDragPosition(e.clientX)
34
- startPositionRef.current = e.clientX
55
+ e.stopPropagation();
56
+ document.getElementById('column-drag-indicator').style.display = 'block';
57
+ // setIsDragging(true);
58
+ // setResizingColumn(index);
59
+ document.documentElement.style.setProperty('--drag-position', `${e.clientX}px`);
60
+ startPositionRef.current = e.clientX;
35
61
  }
36
62
  }
37
63
 
@@ -39,49 +65,36 @@ const DragHead = ({ childrenDesc, initialWidth, changeWidth, showAction, showLab
39
65
  const onResize = (index) => {
40
66
  return (e, { size }) => {
41
67
  e.stopPropagation()
42
- // 只在拖动过程中更新虚拟指示线位置
43
- setDragPosition(e.clientX)
68
+ requestAnimationFrame(() => {
69
+ // // 只在拖动过程中更新虚拟指示线位置
70
+ // setDragPosition(e.clientX)
71
+ document.documentElement.style.setProperty('--drag-position', `${e.clientX}px`);
72
+ });
44
73
  }
45
74
  }
46
75
 
47
76
  // 处理拖动结束
48
77
  const onResizeStop = (index) => {
49
78
  return (e, { size }) => {
79
+ document.getElementById('column-drag-indicator').style.display = 'none';
80
+
50
81
  // 更新列宽
51
- const newHeadWidths = [...headWidthsRef.current]
52
- const delta = e.clientX - startPositionRef.current
53
- const oldWidth = headWidths[index] || 150
54
- const newWidth = Math.max(50, oldWidth + delta)
55
- newHeadWidths[index] = newWidth
56
- headWidthsRef.current = newHeadWidths
57
- setHeadWidths(newHeadWidths)
58
- typeof changeWidth === 'function' && changeWidth(newHeadWidths)
82
+ const newHeadWidths = [...headWidthsRef.current];
83
+ const delta = e.clientX - startPositionRef.current;
84
+ const oldWidth = headWidths[index] || 150;
85
+ const newWidth = Math.max(50, oldWidth + delta);
86
+ newHeadWidths[index] = newWidth;
87
+ headWidthsRef.current = newHeadWidths;
88
+ setHeadWidths(newHeadWidths);
89
+ typeof changeWidth === 'function' && changeWidth(newHeadWidths);
90
+
59
91
  // 重置拖动状态
60
- setIsDragging(false)
61
- setResizingColumn(null)
92
+ // setIsDragging(false);
93
+ // setResizingColumn(null);
62
94
  }
63
95
  }
64
96
 
65
- // 虚拟指示线组件
66
- const DragIndicator = () => {
67
- if (!isDragging) return null
68
97
 
69
- const style = {
70
- position: 'fixed',
71
- top: 0,
72
- left: `${dragPosition}px`,
73
- width: '2px',
74
- height: '100vh',
75
- backgroundColor: '#1890ff',
76
- pointerEvents: 'none',
77
- zIndex: 9999
78
- }
79
-
80
- return createPortal(
81
- <div style={style}></div>,
82
- document.body
83
- )
84
- }
85
98
 
86
99
  return <><div className="fflex flex-nowrap fmin-w-full fabsolute">
87
100
  {childrenDesc.map((child, childIndex) => {
@@ -122,7 +135,8 @@ const DragHead = ({ childrenDesc, initialWidth, changeWidth, showAction, showLab
122
135
  })}
123
136
  {showAction && <div className="fsticky fright-0 fborder-b" style={{ boxShadow: "rgba(50, 50, 50, 0.15) -6px 0px 6px -6px", flex: "0 0 50px", width: "50px" }}></div>}
124
137
  </div>
125
- <DragIndicator /></>
138
+ {/* <DragIndicator /> */}
139
+ </>
126
140
  }
127
141
 
128
142
  export default DragHead
@@ -81,16 +81,18 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
81
81
  setHeadWidths(props?.columnsWidth)
82
82
  setInitialWidth(props?.columnsWidth)
83
83
  }
84
- }, [props])
84
+ }, [props?.columnsWidth])
85
85
 
86
86
  useEffect(()=>{
87
87
  console.log("Table headWidths", headWidths)
88
88
  },[headWidths])
89
89
 
90
90
  useEffect(()=>{
91
- const childrenDesc = React.Children.map(children, (child) => {
92
- return {id:child.props.componentId || child.props.__id,label:child.props.label}
91
+ let childrenDesc = React.Children.map(children, (child) => {
92
+ const hidden = (child?.props?.calcHidden || !getDependencyMapShow(child?.props?.componentId || child?.props?.__id)) && mode != "desgin";
93
+ return {id:child.props.componentId || child.props.__id,label:child.props.label, hidden }
93
94
  })
95
+ childrenDesc = childrenDesc.filter(item=>!item.hidden)
94
96
  console.log("Emit Table childrenDesc", childrenDesc)
95
97
  eventEmitter.emit("tableChildrenDesc", childrenDesc)
96
98
  setChildrenDesc(childrenDesc)