@lemonadejs/modal 2.1.1 → 2.2.0

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 CHANGED
@@ -49,6 +49,11 @@ if (! lemonade && typeof(require) === 'function') {
49
49
  if (typeof(controls.action) === 'function') {
50
50
  controls.action();
51
51
  }
52
+ // Remove cursor
53
+ if (controls.e) {
54
+ controls.e.style.cursor = '';
55
+ controls.e.classList.remove('moving');
56
+ }
52
57
  // Reset controls
53
58
  controls = {};
54
59
  // Reset state controls
@@ -82,8 +87,6 @@ if (! lemonade && typeof(require) === 'function') {
82
87
  controls.left = left
83
88
  controls.e.style.top = top + 'px';
84
89
  controls.e.style.left = left + 'px';
85
- controls.e.style.cursor = "move";
86
-
87
90
 
88
91
  state.x = x;
89
92
  state.y = y;
@@ -186,12 +189,11 @@ if (! lemonade && typeof(require) === 'function') {
186
189
  // Get the position and dimensions
187
190
  let rect = item.getBoundingClientRect();
188
191
 
189
- controls = {
190
- type: null,
191
- e: item,
192
- w: rect.width,
193
- h: rect.height,
194
- }
192
+ controls.type = null;
193
+ controls.d = null;
194
+ controls.e = item;
195
+ controls.w = rect.width;
196
+ controls.h = rect.height;
195
197
 
196
198
  // When resizable
197
199
  if (self.resizable === true) {
@@ -226,16 +228,22 @@ if (! lemonade && typeof(require) === 'function') {
226
228
  let item = self.el;
227
229
  // Get the position and dimensions
228
230
  let rect = item.getBoundingClientRect();
231
+
232
+ controls.e = item;
233
+ controls.w = rect.width;
234
+ controls.h = rect.height;
235
+
229
236
  let corner = rect.width - (x - rect.left) < 40 && (y - rect.top) < 40;
230
237
 
231
- if (self.closable === true && corner === true) {
238
+ if (self.minimizable === true && corner === true) {
239
+ self.minimized = ! self.minimized;
240
+ } else if (self.closable === true && corner === true) {
232
241
  self.closed = true;
233
- } else if (self.minimizable === true && corner === true) {
234
- self.minimized = ! item.lemon.self.minimized;
235
- } else {
242
+ } else if (! self.minimized) {
243
+ // If is not minimized
236
244
  if (controls.type === 'resize') {
237
245
  // This will be the callback when finalize the resize
238
- controls.action = function() {
246
+ controls.action = function () {
239
247
  self.width = parseInt(item.style.width);
240
248
  self.height = parseInt(item.style.height);
241
249
  }
@@ -246,22 +254,22 @@ if (! lemonade && typeof(require) === 'function') {
246
254
  if (!item.style.height) {
247
255
  item.style.height = controls.h + 'px';
248
256
  }
249
- } else {
250
- // Modal is draggable by the title
251
- if (self.draggable === true && self.title && y - rect.top < 40) {
252
- // Action
253
- controls.type = 'move';
254
- // Callback
255
- controls.action = function() {
256
- self.top = parseInt(item.style.top);
257
- self.left = parseInt(item.style.left);
258
- }
257
+
258
+ e.preventDefault();
259
+ } else if (self.draggable === true && self.title && y - rect.top < 40) {
260
+ // Action
261
+ controls.type = 'move';
262
+ // Callback
263
+ controls.action = function () {
264
+ self.top = parseInt(item.style.top);
265
+ self.left = parseInt(item.style.left);
259
266
  }
267
+ controls.e.classList.add('moving');
260
268
  }
261
269
  }
262
270
  }
263
271
 
264
- return `<div class="lm-modal" title="{{self.title}}" closed="{{self.closed}}" :closable="self.closable" :minimized="self.minimized" :minimizable="self.minimizable" :top="self.top" :left="self.left" :width="self.width" :height="self.height" onmousedown="self.mousedown(e)" onmousemove="self.mousemove(e)" tabindex="-1">${template}</div>`
272
+ return `<div class="lm-modal" title="{{self.title}}" closed="{{self.closed}}" closable="{{self.closable}}" minimizable="{{self.minimizable}}" minimized="{{self.minimized}}" :top="self.top" :left="self.left" :width="self.width" :height="self.height" onmousedown="self.mousedown(e)" onmousemove="self.mousemove(e)" tabindex="-1">${template}</div>`
265
273
  }
266
274
 
267
275
  lemonade.setComponents({ Modal: Modal });
package/dist/style.css CHANGED
@@ -12,6 +12,11 @@
12
12
  box-shadow: 0 0 4px 3px rgba(80,80,80,.1);
13
13
  opacity: 1;
14
14
  transition: opacity 0.5s ease;
15
+ will-change: transform;
16
+ }
17
+
18
+ .lm-modal.moving {
19
+ cursor: move !important;
15
20
  }
16
21
 
17
22
  @media only screen and (max-width : 800px) {
@@ -82,7 +87,6 @@
82
87
  font-size: 24px;
83
88
  }
84
89
 
85
-
86
90
  .lm-modal[title=""]::before {
87
91
  display: none;
88
92
  }
@@ -92,18 +96,16 @@
92
96
  }
93
97
 
94
98
  .lm-modal[minimized="true"] {
95
- bottom: 0;
96
- min-height: 0px;
99
+ bottom: 10px;
100
+ min-height: 0;
97
101
  height: 45px !important;
98
- }
99
-
100
- .lm-modal[minimized="true"]::before {
101
- height: 100%;
102
- cursor: pointer;
102
+ top: initial !important;
103
+ left: initial !important;
104
+ overflow: hidden;
103
105
  }
104
106
 
105
107
  .lm-modal[minimized="true"]::after {
106
- content: '';
108
+ content: 'open_in_full';
107
109
  }
108
110
 
109
111
  @keyframes slide-bottom-in {
package/package.json CHANGED
@@ -13,8 +13,8 @@
13
13
  "modal js"
14
14
  ],
15
15
  "dependencies": {
16
- "lemonadejs": "^3.3.2"
16
+ "lemonadejs": "^3.4.0"
17
17
  },
18
18
  "main": "dist/index.js",
19
- "version": "2.1.1"
19
+ "version": "2.2.0"
20
20
  }