lu-lowcode-package-form 0.11.55 → 0.11.56

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.55",
3
+ "version": "0.11.56",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^4.8.1",
6
6
  "@dnd-kit/core": "^6.1.0",
@@ -3,7 +3,7 @@ import { eventEmitter } from "../../../utils/events"
3
3
  import { createPortal } from "react-dom"
4
4
  import { Resizable } from "react-resizable"
5
5
 
6
- const DragHead = ({ children, changeWidth, showAction, ...props }) => {
6
+ const DragHead = ({ children, changeWidth, showAction, showLabel = false, ...props }) => {
7
7
  const [headWidths, setHeadWidths] = useState([])
8
8
  const headWidthsRef = useRef([])
9
9
  const [isDragging, setIsDragging] = useState(false)
@@ -48,7 +48,6 @@ const DragHead = ({ children, changeWidth, showAction, ...props }) => {
48
48
  headWidthsRef.current = newHeadWidths
49
49
  setHeadWidths(newHeadWidths)
50
50
  typeof changeWidth === 'function' && changeWidth(newHeadWidths)
51
- eventEmitter.emit('changeSubTableColumnWidth', newHeadWidths)
52
51
  // 重置拖动状态
53
52
  setIsDragging(false)
54
53
  setResizingColumn(null)
@@ -108,7 +107,7 @@ const DragHead = ({ children, changeWidth, showAction, ...props }) => {
108
107
  className="fflex-1 fh-12 fflex fitems-center fpx-1 frelative"
109
108
  style={{minWidth: width}}
110
109
  >
111
-  
110
+ {showLabel?<>{child?.props?.label}</>:<>&nbsp;</>}
112
111
  </div>
113
112
  </Resizable>
114
113
  )
@@ -52,6 +52,14 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
52
52
  console.log("Table props", props)
53
53
  }, [props])
54
54
 
55
+ useEffect(()=>{
56
+ const childrenDesc = React.Children.map(children, (child) => {
57
+ return {id:child.props.componentId || child.props.__id,label:child.props.label}
58
+ })
59
+ console.log("Emit Table childrenDesc", childrenDesc)
60
+ eventEmitter.emit("tableChildrenDesc", childrenDesc)
61
+ },[children])
62
+
55
63
  const [headWidths, setHeadWidths] = useState([])
56
64
  const tableComponentId = props.componentId || props.__id
57
65
  const newidRefs = useRef(React.Children.map(children, () => nanoid()));
@@ -280,4 +288,5 @@ TableWrapper.displayName = "Table"
280
288
  export default TableWrapper;
281
289
  export { TableCol, TableAction };
282
290
 
283
- export { WithTable } from "./with-table"
291
+ export { WithTable } from "./with-table"
292
+ export { DragHead }
@@ -9,7 +9,7 @@ import { default as RadioGroup } from './field/radio/index.jsx'
9
9
  import { UploadFile,UploadImage } from './field/upload'
10
10
  import {default as Switch} from './field/switch'
11
11
  import {default as DatePicker } from './field/date-picker'
12
- import { default as Table , TableCol, WithTable } from './field/table'
12
+ import { default as Table , TableCol, WithTable, DragHead } from './field/table'
13
13
  const Field = {
14
14
  Input,
15
15
  TextArea,
@@ -37,7 +37,8 @@ const Field = {
37
37
  Custom,
38
38
  UserSelect,
39
39
  DeptSelect,
40
- PostSelect
40
+ PostSelect,
41
+ DragHead
41
42
  }
42
43
  Object.keys(Field).forEach(key => {
43
44
  Field[key].displayName = `Field.${key}`;