Skip to content

Commit adb3de6

Browse files
Merge pull request #28 from johndatserakis/jd-add-divider
Add divider support
2 parents bf63a8f + a53a3a0 commit adb3de6

9 files changed

+43
-12
lines changed

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,12 @@ Note - make sure to use `@click.prevent.stop` (or `@contextmenu.prevent.stop` fo
9595

9696
| prop | type | description | required |
9797
|---------|-------|--------------------------------|---|
98-
| elementId | String | Unique String that acts as the id of your menu. | Yes |
99-
| options | Array | Array of menu options to show. Component will use the `name` parameter as the label. | Yes |
100-
| options.name | Array | Label for the option. | Yes |
101-
| options.class | String | A custom class that will be applied to the option. | No |
102-
| ref | String | Unique String that allows you to show the menu on command. | Yes |
98+
| elementId | String | Unique String that acts as the id of your menu. | Yes |
99+
| options | Array | Array of menu options to show. Component will use the `name` parameter as the label. | Yes |
100+
| options.name | Array | Label for the option. | Yes |
101+
| options.class | String | A custom class that will be applied to the option. | No |
102+
| options.type | String | Only one possible value at the moment - `divider`. Pass this to set the object as a divider. | No |
103+
| ref | String | Unique String that allows you to show the menu on command. | Yes |
103104

104105
### Methods
105106

@@ -115,7 +116,7 @@ Note - make sure to use `@click.prevent.stop` (or `@contextmenu.prevent.stop` fo
115116

116117
### SASS Structure
117118

118-
```sass
119+
```scss
119120
.vue-simple-context-menu {
120121
&--active {
121122
}
@@ -124,6 +125,8 @@ Note - make sure to use `@click.prevent.stop` (or `@contextmenu.prevent.stop` fo
124125
&:hover {
125126
}
126127
}
128+
129+
&__divider {}
127130
}
128131
```
129132

dist/vue-simple-context-menu.css

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-simple-context-menu.esm.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,12 @@ var __vue_render__ = function() {
197197
{
198198
key: index,
199199
staticClass: "vue-simple-context-menu__item",
200-
class: option.class,
200+
class: [
201+
option.class,
202+
option.type === "divider"
203+
? "vue-simple-context-menu__divider"
204+
: ""
205+
],
201206
on: {
202207
click: function($event) {
203208
$event.stopPropagation();

dist/vue-simple-context-menu.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-simple-context-menu.umd.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@
203203
{
204204
key: index,
205205
staticClass: "vue-simple-context-menu__item",
206-
class: option.class,
206+
class: [
207+
option.class,
208+
option.type === "divider"
209+
? "vue-simple-context-menu__divider"
210+
: ""
211+
],
207212
on: {
208213
click: function($event) {
209214
$event.stopPropagation();

docs/build.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/App.vue

+3
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ export default {
163163
name: 'Duplicate',
164164
slug: 'duplicate'
165165
},
166+
{
167+
type: 'divider'
168+
},
166169
{
167170
name: 'Edit',
168171
slug: 'edit'

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-simple-context-menu",
3-
"version": "3.2.0",
3+
"version": "3.3.0",
44
"description": "Simple context-menu component built for Vue. Works well with both left and right clicks. Nothing too fancy, just works and is simple to use.",
55
"author": "John Datserakis <johndatserakis@gmail.com>",
66
"license": "MIT",

src/vue-simple-context-menu.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
:key="index"
1111
@click.stop="optionClicked(option)"
1212
class="vue-simple-context-menu__item"
13-
:class="option.class"
13+
:class="[option.class, (option.type === 'divider' ? 'vue-simple-context-menu__divider' : '')]"
1414
>
1515
{{option.name}}
1616
</li>
@@ -146,6 +146,14 @@ $black: #333;
146146
}
147147
}
148148
149+
&__divider {
150+
height: 10px;
151+
background-color: $grey;
152+
padding: 4px 0;
153+
background-clip: content-box;
154+
pointer-events: none;
155+
}
156+
149157
// Have to use the element so we can make use of `first-of-type` and
150158
// `last-of-type`
151159
li {

0 commit comments

Comments
 (0)