lu-lowcode-package-form 0.11.54 → 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/dist/index.cjs.js +213 -213
- package/dist/index.es.js +7280 -7265
- package/package.json +1 -1
- package/src/components/field/table/drag-head.jsx +4 -5
- package/src/components/field/table/index.jsx +12 -3
- package/src/components/index.jsx +3 -2
package/package.json
CHANGED
@@ -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, ...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, ...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)
|
@@ -98,7 +97,7 @@ const DragHead = ({ children, changeWidth, ...props }) => {
|
|
98
97
|
height: '100%',
|
99
98
|
width: '8px',
|
100
99
|
cursor: 'col-resize',
|
101
|
-
zIndex:
|
100
|
+
zIndex: 9999
|
102
101
|
}}
|
103
102
|
/>
|
104
103
|
}
|
@@ -108,12 +107,12 @@ const DragHead = ({ children, changeWidth, ...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}</>:<> </>}
|
112
111
|
</div>
|
113
112
|
</Resizable>
|
114
113
|
)
|
115
114
|
})}
|
116
|
-
<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>
|
115
|
+
{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>}
|
117
116
|
</div>
|
118
117
|
<DragIndicator /></>
|
119
118
|
}
|
@@ -51,7 +51,15 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
|
|
51
51
|
useEffect(() => {
|
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()));
|
@@ -132,7 +140,7 @@ const Table = ({ children, onTableAddRow, disabled, readonly, onTableRemoveRow,
|
|
132
140
|
return <div className="fw-full ">
|
133
141
|
|
134
142
|
<div className="fw-full frelative fmin-h-20 foverflow-x-auto" style={{ position: 'relative' }}>
|
135
|
-
<DragHead changeWidth={handleChangeWidth}>{children}</DragHead>
|
143
|
+
<DragHead changeWidth={handleChangeWidth} showAction={disabled != true && readonly != true}>{children}</DragHead>
|
136
144
|
{fields.length === 0 && <div key={`tableHead`} className="fborder-b fflex flex-nowrap fmin-w-full ">
|
137
145
|
{React.Children.map(children, (child, childIndex) => {
|
138
146
|
const hidden = (child?.props?.calcHidden || !getDependencyMapShow(child?.props?.componentId || child?.props?.__id)) && mode != "desgin";
|
@@ -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 }
|
package/src/components/index.jsx
CHANGED
@@ -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}`;
|