Skip to content

Commit

Permalink
Merge pull request #22 from leefinder/feature/draggable-by-drag-mode
Browse files Browse the repository at this point in the history
feat: dragMode icon/full
  • Loading branch information
Liberty-liu authored Aug 14, 2023
2 parents 2f74026 + 0fea7c3 commit d2e8c85
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/formEditor/components/Layout/DragGable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export default defineComponent({
return (
<dragGableWrap
list={props.data}
handle=".handle"
handle=".ER-handle"
class={[ns.b(), unref(isEditModel) && ns.e('edit')]}
tag={props.tag}
item-key="id"
Expand Down
10 changes: 6 additions & 4 deletions packages/formEditor/components/Selection/selectElement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export default {
{...useAttrs()}
class={[
ns.b(),
unref(isEditModel) && ER.props.dragMode === 'full' && props.hasDrag && 'ER-handle',
!isField && ns.e('borderless'),
unref(isEditModel) && ns.e('editor'),
unref(isEditModel) && Selected.value,
Expand All @@ -287,14 +288,15 @@ export default {
ref={elementRef} onClick={unref(isEditModel) && withModifiers(handleClick, ['stop'])}
>
{slots.default()}
<span></span>
{
{!isPc.value && (<span></span>)}
{
ER.props.dragMode === 'icon' &&
unref(isEditModel) && (
<div class={[ns.e('topLeft')]}>
{props.hasDrag && (<Icon class={['handle', ns.e('dragIcon')]} icon="Rank"></Icon>)}
{props.hasDrag && (<Icon class={['ER-handle', ns.e('dragIcon')]} icon="Rank"></Icon>)}
</div>
)
}
}
{
unref(isEditModel) && (
<div class={[ns.e('bottomRight')]}>
Expand Down
5 changes: 5 additions & 0 deletions packages/formEditor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const props = defineProps(_.merge({
isShowI18n: {
type: Boolean,
default: true
},
dragMode: {
type: String,
default: 'icon',
validator: (value) => ['full', 'icon'].includes(value)
}
}, defaultProps))
const layout = {
Expand Down
3 changes: 3 additions & 0 deletions packages/theme/formEditor/Main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,6 @@
top: 0;
}
}
.ER-handle {
cursor: move;
}

0 comments on commit d2e8c85

Please sign in to comment.