Skip to content

Commit a652404

Browse files
committed
style(platform): Element: show buttons in sticky position
1 parent 1d69096 commit a652404

4 files changed

Lines changed: 72 additions & 58 deletions

File tree

doc/1.3.1.org

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@ TODO run test:
654654

655655

656656

657-
** TODO Element: after select ui control, should show buttons in fixed position
657+
# ** TODO Element: after select ui control, should show buttons in fixed position
658+
** DONE Element: show buttons in fixed position
658659

659660

660661
** TODO Inputs, Actions: sort by first char

platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/selected_ui_controls/components/SelectedUIControls.res

Lines changed: 61 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,15 @@ module Method = {
167167
Meta3dCommonlib.ArraySt.getExn(dropPos, dropPos->Meta3dCommonlib.ArraySt.length - 1),
168168
) // the drop position relative to the drop node, inside 0, top -1, bottom 1
169169

170-
dispatch(ElementAssembleStoreType.DropSelectUIControl(
171-
(service.meta3d.hasChildren, service.meta3d.serializeUIControlProtocolConfigLib),
172-
info.dropToGap, dragKey, dropKey,dropPosition))
170+
dispatch(
171+
ElementAssembleStoreType.DropSelectUIControl(
172+
(service.meta3d.hasChildren, service.meta3d.serializeUIControlProtocolConfigLib),
173+
info.dropToGap,
174+
dragKey,
175+
dropKey,
176+
dropPosition,
177+
),
178+
)
173179
}
174180

175181
// let upgradeSelectUIControl = (dispatch, isDebug, selectedKeys) => {
@@ -298,56 +304,58 @@ let make = (
298304
) = service.react.useAllSelector(. Method.useSelector)
299305

300306
<>
301-
<Space direction=#vertical size=#middle>
302-
<Space direction=#horizontal wrap=true>
303-
<Button
304-
ref={addUIControlButtonTarget}
305-
icon={<Icon.FileAddOutlined />}
306-
onClick={_ => {
307-
setIsShowUIControls(_ => true)
308-
309-
eventEmitter.emit(. EventUtils.getAddUIControlsEventName(), Obj.magic(1))
310-
}}
311-
/>
312-
<Button
313-
icon={<Icon.DeleteOutlined />}
314-
onClick={_ => {
315-
Method.unselectUIControl(dispatch, isDebug, selectedKeys)
316-
}}
317-
/>
318-
</Space>
319-
<section ref={selectedUIControlTarget->Obj.magic}>
320-
<Tree
321-
draggable=true
322-
autoExpandParent=true
323-
showIcon=true
324-
treeData={selectedUIControls
325-
->Method.convertToTreeData(service, _, selectedUIControlInspectorData)
326-
->Method.addRootTreeNode}
327-
expandedKeys={Method.getAllKeys(selectedUIControls)}
328-
// onExpand={expandedKeysValue =>
329-
// Method.onExpand((setExpandedKeys, setAutoExpandParent), expandedKeysValue)}
330-
selectedKeys
331-
onSelect={(selectedKeysValue, info: Tree.info) => {
332-
Method.onSelect(service, (dispatch, setSelectedKeys), selectedKeysValue, info)
333-
334-
// handleWhenSelectTreeNodeFunc(info.node.title)
335-
eventEmitter.emit(.
336-
EventUtils.getSelectTreeNodeEventName(),
337-
Method.findTitle(
338-
info.node.key,
339-
info.node.title,
340-
selectedUIControls,
341-
selectedUIControlInspectorData,
342-
)->Obj.magic,
343-
)
344-
}}
345-
onDrop={(info: Tree.info) => {
346-
Method.onDrop(service, dispatch, info)
347-
}}
348-
/>
349-
</section>
350-
</Space>
307+
// <Space direction=#vertical size=#middle>
308+
<section style={ReactDOM.Style.make(~position="sticky", ~top="0", ~zIndex="100", ())}>
309+
// <Space direction=#horizontal wrap=true>
310+
<Button
311+
ref={addUIControlButtonTarget}
312+
icon={<Icon.FileAddOutlined />}
313+
onClick={_ => {
314+
setIsShowUIControls(_ => true)
315+
316+
eventEmitter.emit(. EventUtils.getAddUIControlsEventName(), Obj.magic(1))
317+
}}
318+
/>
319+
<Button
320+
icon={<Icon.DeleteOutlined />}
321+
onClick={_ => {
322+
Method.unselectUIControl(dispatch, isDebug, selectedKeys)
323+
}}
324+
/>
325+
// </Space>
326+
</section>
327+
<section ref={selectedUIControlTarget->Obj.magic}>
328+
<Tree
329+
draggable=true
330+
autoExpandParent=true
331+
showIcon=true
332+
treeData={selectedUIControls
333+
->Method.convertToTreeData(service, _, selectedUIControlInspectorData)
334+
->Method.addRootTreeNode}
335+
expandedKeys={Method.getAllKeys(selectedUIControls)}
336+
// onExpand={expandedKeysValue =>
337+
// Method.onExpand((setExpandedKeys, setAutoExpandParent), expandedKeysValue)}
338+
selectedKeys
339+
onSelect={(selectedKeysValue, info: Tree.info) => {
340+
Method.onSelect(service, (dispatch, setSelectedKeys), selectedKeysValue, info)
341+
342+
// handleWhenSelectTreeNodeFunc(info.node.title)
343+
eventEmitter.emit(.
344+
EventUtils.getSelectTreeNodeEventName(),
345+
Method.findTitle(
346+
info.node.key,
347+
info.node.title,
348+
selectedUIControls,
349+
selectedUIControlInspectorData,
350+
)->Obj.magic,
351+
)
352+
}}
353+
onDrop={(info: Tree.info) => {
354+
Method.onDrop(service, dispatch, info)
355+
}}
356+
/>
357+
</section>
358+
// </Space>
351359
<Modal
352360
title={`UI Controls`}
353361
visible={isShowUIControls}

platform/frontend/src/external_layer/ui/app/assemble_space/components/element_assemble/utils/CustomDomUtils.res

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ let make = (
128128

129129
// TODO check: no duplicate name
130130

131-
<Space direction=#vertical size=#middle>
132-
<Space direction=#horizontal wrap=true>
131+
// <Space direction=#vertical size=#middle>
132+
// <Space direction=#horizontal wrap=true>
133+
<>
134+
<section style={ReactDOM.Style.make(~position="sticky", ~top="0", ~zIndex="100", ())}>
133135
<Button
134136
ref={addButtonTarget}
135137
icon={<Icon.FileAddOutlined />}
@@ -152,7 +154,8 @@ let make = (
152154
Method.removeCustom(dispatch, buildRemoveActionFunc, currentCustomName)
153155
}}
154156
/>
155-
</Space>
157+
// </Space>
158+
</section>
156159
<Tree
157160
showIcon=false
158161
autoExpandParent=false
@@ -173,5 +176,6 @@ let make = (
173176
)
174177
}}
175178
/>
176-
</Space>
179+
// </Space>
180+
</>
177181
}

platform/frontend/src/external_layer/ui/app/utils/utils/externals/antd/Antd__Space.res

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ external make: (
1010
~align: align=?,
1111
~direction: direction=?,
1212
~size: size=?,
13+
~style: ReactDOM.Style.t=?,
1314
~children: React.element=?,
1415
) => React.element = "Space"

0 commit comments

Comments
 (0)