@mapomodule/utils 1.0.0-alpha.10 → 1.0.0-alpha.13

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * make all modals draggable 🛸 ([57da10d](https://github.com/lotrekagency/mapo/commit/57da10d17aa31d58e55fda5385d45d43beed8c4f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.0.0-alpha.10](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-02-11)
7
18
 
8
19
 
package/index.js CHANGED
@@ -2,10 +2,12 @@ const auth = require('./helpers/auth');
2
2
  const debounce = require('./helpers/debounce');
3
3
  const formatters = require('./helpers/formatters');
4
4
  const objHelpers = require('./helpers/objHelpers');
5
+ const VDraggableModals = require('./plugins/v-draggable-modals');
5
6
 
6
7
  module.exports = {
7
8
  auth,
8
9
  debounce,
9
10
  formatters,
10
- objHelpers
11
+ objHelpers,
12
+ VDraggableModals,
11
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/utils",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.13",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -12,5 +12,5 @@
12
12
  "publishConfig": {
13
13
  "access": "public"
14
14
  },
15
- "gitHead": "283cad977741523d3a0c300ce08edf1a6855e11c"
15
+ "gitHead": "b0fac0f5ebde4c65cc5347dbb841392dc04ef5e8"
16
16
  }
@@ -0,0 +1,39 @@
1
+ module.exports = function () {
2
+ const d = {};
3
+ document.addEventListener("mousedown", e => {
4
+ const closestDialog = e.target.closest(".v-dialog.v-dialog--active");
5
+ if (e.button === 0 && closestDialog != null && e.target.classList.contains("v-card__title")) {
6
+ d.el = closestDialog;
7
+ d.mouseStartX = e.clientX;
8
+ d.mouseStartY = e.clientY;
9
+ d.elStartX = d.el.getBoundingClientRect().left;
10
+ d.elStartY = d.el.getBoundingClientRect().top;
11
+ d.el.style.position = "fixed";
12
+ d.el.style.margin = 0;
13
+ d.oldTransition = d.el.style.transition;
14
+ d.el.style.transition = "none"
15
+ }
16
+ });
17
+ document.addEventListener("mousemove", e => {
18
+ if (d.el === undefined) return;
19
+ d.el.style.left = Math.min(
20
+ Math.max(d.elStartX + e.clientX - d.mouseStartX, 0),
21
+ window.innerWidth - d.el.getBoundingClientRect().width
22
+ ) + "px";
23
+ d.el.style.top = Math.min(
24
+ Math.max(d.elStartY + e.clientY - d.mouseStartY, 0),
25
+ window.innerHeight - d.el.getBoundingClientRect().height
26
+ ) + "px";
27
+ });
28
+ document.addEventListener("mouseup", () => {
29
+ if (d.el === undefined) return;
30
+ d.el.style.transition = d.oldTransition;
31
+ d.el = undefined
32
+ });
33
+ setInterval(() => {
34
+ const dialog = document.querySelector(".v-dialog.v-dialog--active");
35
+ if (dialog === null) return;
36
+ dialog.style.left = Math.min(parseInt(dialog.style.left), window.innerWidth - dialog.getBoundingClientRect().width) + "px";
37
+ dialog.style.top = Math.min(parseInt(dialog.style.top), window.innerHeight - dialog.getBoundingClientRect().height) + "px";
38
+ }, 100);
39
+ }