Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vue-draggable-grid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
vue-draggable-grid
Commits
998d06b6
Commit
998d06b6
authored
2 years ago
by
Julian
Browse files
Options
Downloads
Patches
Plain Diff
Fix custom highlight element
parent
469b39d0
No related branches found
No related tags found
1 merge request
!2
Resolve "Implement basic functionality"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
example/src/App.vue
+12
-0
12 additions, 0 deletions
example/src/App.vue
src/DragGrid.vue
+20
-11
20 additions, 11 deletions
src/DragGrid.vue
with
32 additions
and
11 deletions
example/src/App.vue
+
12
−
0
View file @
998d06b6
...
@@ -62,6 +62,9 @@ import NumberCounter from "./components/NumberCounter.vue";
...
@@ -62,6 +62,9 @@ import NumberCounter from "./components/NumberCounter.vue";
<
template
#item=
"item"
>
<
template
#item=
"item"
>
<number-counter
v-model=
"item.data.num"
></number-counter>
<number-counter
v-model=
"item.data.num"
></number-counter>
</
template
>
</
template
>
<
template
#highlight
>
<div
ref=
"highlight"
class=
"custom-highlight"
>
Das hier ist das Highlight
</div>
</
template
>
</drag-grid>
</drag-grid>
<span>
← Drag here please →
</span>
<span>
← Drag here please →
</span>
<drag-grid
v-model=
"counters2"
:cols=
"3"
:rows=
"2"
context=
"counter"
>
<drag-grid
v-model=
"counters2"
:cols=
"3"
:rows=
"2"
context=
"counter"
>
...
@@ -293,6 +296,15 @@ export default {
...
@@ -293,6 +296,15 @@ export default {
justify-content
:
space-between
;
justify-content
:
space-between
;
}
}
.custom-highlight
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
background
:
aquamarine
;
width
:
100%
;
height
:
100%
;
}
.bordered
{
.bordered
{
border
:
2px
solid
grey
;
border
:
2px
solid
grey
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/DragGrid.vue
+
20
−
11
View file @
998d06b6
...
@@ -4,9 +4,11 @@
...
@@ -4,9 +4,11 @@
@
drop.prevent=
"handleDrop"
@
drop.prevent=
"handleDrop"
class=
"grid"
class=
"grid"
>
>
<slot
name=
"highlight"
>
<div
class=
"highlight-container"
ref=
"highlightContainer"
>
<div
class=
"highlight"
ref=
"highlight"
></div>
<slot
name=
"highlight"
>
</slot>
<div
class=
"highlight"
></div>
</slot>
</div>
<DragContainer
<DragContainer
v-for=
"item in value"
v-for=
"item in value"
:key=
"item.key"
:key=
"item.key"
...
@@ -101,7 +103,7 @@ export default {
...
@@ -101,7 +103,7 @@ export default {
let
coords
=
this
.
getCoords
(
event
.
layerX
,
event
.
layerY
);
let
coords
=
this
.
getCoords
(
event
.
layerX
,
event
.
layerY
);
if
(
element
.
context
!==
this
.
context
)
{
if
(
element
.
context
!==
this
.
context
)
{
this
.
$refs
.
highlight
.
style
.
display
=
"
none
"
;
this
.
$refs
.
highlight
Container
.
style
.
display
=
"
none
"
;
return
;
return
;
}
}
...
@@ -116,18 +118,18 @@ export default {
...
@@ -116,18 +118,18 @@ export default {
}
}
if
(
!
newPositionValid
)
{
if
(
!
newPositionValid
)
{
this
.
$refs
.
highlight
.
style
.
display
=
"
none
"
;
this
.
$refs
.
highlight
Container
.
style
.
display
=
"
none
"
;
return
;
return
;
}
}
this
.
$refs
.
highlight
.
style
.
display
=
"
block
"
;
this
.
$refs
.
highlight
Container
.
style
.
display
=
"
block
"
;
this
.
$refs
.
highlight
.
style
.
gridColumnStart
=
coords
.
x
+
""
;
this
.
$refs
.
highlight
Container
.
style
.
gridColumnStart
=
coords
.
x
+
""
;
this
.
$refs
.
highlight
.
style
.
gridRowStart
=
coords
.
y
+
""
;
this
.
$refs
.
highlight
Container
.
style
.
gridRowStart
=
coords
.
y
+
""
;
this
.
$refs
.
highlight
.
style
.
gridColumnEnd
=
"
span
"
+
element
.
w
;
this
.
$refs
.
highlight
Container
.
style
.
gridColumnEnd
=
"
span
"
+
element
.
w
;
this
.
$refs
.
highlight
.
style
.
gridRowEnd
=
"
span
"
+
element
.
h
;
this
.
$refs
.
highlight
Container
.
style
.
gridRowEnd
=
"
span
"
+
element
.
h
;
},
},
handleDrop
(
event
)
{
handleDrop
(
event
)
{
this
.
$refs
.
highlight
.
style
.
display
=
"
none
"
;
this
.
$refs
.
highlight
Container
.
style
.
display
=
"
none
"
;
let
data
=
event
.
dataTransfer
.
getData
(
"
vueDrag/gridItem
"
);
let
data
=
event
.
dataTransfer
.
getData
(
"
vueDrag/gridItem
"
);
let
element
=
JSON
.
parse
(
data
);
let
element
=
JSON
.
parse
(
data
);
...
@@ -194,11 +196,18 @@ export default {
...
@@ -194,11 +196,18 @@ export default {
.highlight
{
.highlight
{
background
:
darkgrey
;
background
:
darkgrey
;
border
:
grey
dashed
2px
;
border
:
grey
dashed
2px
;
width
:
100%
;
height
:
100%
}
.highlight-container
{
display
:
none
;
display
:
none
;
transition
:
all
2s
ease-in-out
;
transition
:
all
2s
ease-in-out
;
z-index
:
-1
;
z-index
:
-1
;
pointer-events
:
none
;
pointer-events
:
none
;
user-select
:
none
;
user-select
:
none
;
width
:
100%
;
height
:
100%
;
}
}
.grid
{
.grid
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment