@lemonadejs/contextmenu 1.0.7 → 1.0.8
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.js +3 -2
- package/dist/react.js +37 -0
- package/dist/style.css +0 -17
- package/dist/vue.js +45 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -140,7 +140,7 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
let template = `<Modal :closed="true" :ref="self.modal" :responsive="false" :auto-adjust="true" :onclose="self.onclose" :focus="false" :layers="false">
|
|
143
|
+
let template = `<Modal :overflow="true" :closed="true" :ref="self.modal" :responsive="false" :auto-adjust="true" :onclose="self.onclose" :focus="false" :layers="false">
|
|
144
144
|
<div class="lm-menu-submenu">
|
|
145
145
|
<Item :loop="self.options" />
|
|
146
146
|
</div>
|
|
@@ -344,7 +344,8 @@ if (! Modal && typeof (require) === 'function') {
|
|
|
344
344
|
self.root.addEventListener("contextmenu", function(e) {
|
|
345
345
|
let [x,y] = getCoords(e);
|
|
346
346
|
// Open the context menu
|
|
347
|
-
|
|
347
|
+
var scrollPosition = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
|
|
348
|
+
self.open(self.options, x, y+scrollPosition, e);
|
|
348
349
|
e.preventDefault();
|
|
349
350
|
e.stopImmediatePropagation();
|
|
350
351
|
});
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { useRef, useEffect } from "react";
|
|
3
|
+
import Component from './index';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
export default React.forwardRef((props, mainReference) => {
|
|
8
|
+
// Dom element
|
|
9
|
+
const Ref = useRef(null);
|
|
10
|
+
|
|
11
|
+
// Get the properties for the spreadsheet
|
|
12
|
+
let options = { ...props };
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
if (!Ref.current.innerHTML) {
|
|
17
|
+
mainReference.current = Component(Ref.current, options);
|
|
18
|
+
}
|
|
19
|
+
}, []);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
for (let key in props) {
|
|
23
|
+
if (props.hasOwnProperty(key) && mainReference.current.hasOwnProperty(key)) {
|
|
24
|
+
if (props[key] !== mainReference.current[key]) {
|
|
25
|
+
mainReference.current[key] = props[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [props])
|
|
30
|
+
|
|
31
|
+
let prop = {
|
|
32
|
+
ref: Ref,
|
|
33
|
+
style: { height: '100%', width: '100%' }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return React.createElement("div", prop);
|
|
37
|
+
})
|
package/dist/style.css
CHANGED
|
@@ -5,29 +5,12 @@
|
|
|
5
5
|
border-radius: 4px;
|
|
6
6
|
box-shadow: 0 2px 6px 2px rgba(60,64,67,.2);
|
|
7
7
|
max-height: 300px;
|
|
8
|
-
overflow-y: auto;
|
|
9
|
-
|
|
10
8
|
width: initial;
|
|
11
9
|
height: initial;
|
|
12
10
|
min-width: 250px;
|
|
13
11
|
min-height: initial;
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
.lm-menu .lm-modal::-webkit-scrollbar {
|
|
17
|
-
width: 12px;
|
|
18
|
-
height: 12px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.lm-menu .lm-modal::-webkit-scrollbar-track {
|
|
22
|
-
border: 1px solid #fff;
|
|
23
|
-
background: #eee;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.lm-menu .lm-modal::-webkit-scrollbar-thumb {
|
|
27
|
-
border: 1px solid #fff;
|
|
28
|
-
background: #888;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
14
|
.lm-menu-submenu {
|
|
32
15
|
padding-top: 1px;
|
|
33
16
|
padding-bottom: 1px;
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { h } from 'vue';
|
|
2
|
+
import component from "./index";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
mounted() {
|
|
8
|
+
let options = {
|
|
9
|
+
...this.$attrs
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
this.el = this.$refs.container;
|
|
13
|
+
|
|
14
|
+
this.current = component(this.$refs.container, options);
|
|
15
|
+
},
|
|
16
|
+
setup() {
|
|
17
|
+
let containerProps = {
|
|
18
|
+
ref: 'container',
|
|
19
|
+
style: {
|
|
20
|
+
width: '100%',
|
|
21
|
+
height: '100%',
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return () => h('div', containerProps);
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
$attrs: {
|
|
28
|
+
deep: true,
|
|
29
|
+
handler() {
|
|
30
|
+
this.updateState();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
updateState() {
|
|
36
|
+
for (let key in this.$attrs) {
|
|
37
|
+
if (this.$attrs.hasOwnProperty(key) && this.current.hasOwnProperty(key)) {
|
|
38
|
+
if (this.$attrs[key] !== this.current[key]) {
|
|
39
|
+
this.current[key] = this.$attrs[key];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"build": "webpack --config webpack.config.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lemonadejs/modal": "^2.
|
|
18
|
-
"lemonadejs": "^
|
|
17
|
+
"@lemonadejs/modal": "^2.4.4",
|
|
18
|
+
"lemonadejs": "^4.0.7"
|
|
19
19
|
},
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"version": "1.0.
|
|
22
|
+
"version": "1.0.8"
|
|
23
23
|
}
|