emacroh5lib 1.0.12 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emacroh5lib",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
4
4
  "description": "EMacro前端组件库",
5
5
  "main": "dist/emacroh5lib.min.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -7,7 +7,7 @@ import ImageViewer from './views/ImageViewer/index.vue'
7
7
  import DragResizeView from './views/DragResizeView/index.vue'
8
8
  import MessageBoxTest from "@/components/MessageBoxTest";
9
9
 
10
- const components = [FileViewer, ImageViewer];
10
+ const components = [FileViewer, ImageViewer, DragResizeView];
11
11
 
12
12
  const install = (Vue: any) => {
13
13
  if ((install as any).installed) return;
@@ -185,7 +185,7 @@ export default {
185
185
  top: null,
186
186
  right: null,
187
187
  bottom: null,
188
- minHeight: null,
188
+ minHeight: null
189
189
  };
190
190
  },
191
191
 
@@ -208,16 +208,6 @@ export default {
208
208
  this.parentWidth = this.parentW ? this.parentW : this.parentElement.clientWidth;
209
209
  this.parentHeight = this.parentH ? this.parentH : this.parentElement.clientHeight;
210
210
 
211
- if (this.name.trim() !== '' && this.isStorage) {
212
- let info = JSON.parse(localStorage.getItem("DragResizeView_Info_" + this.name))
213
- if (info !== null) {
214
- this.x = info.left
215
- this.y = info.top
216
- this.w = info.width
217
- this.h = info.height
218
- }
219
- }
220
-
221
211
  this.left = this.x;
222
212
  this.top = this.y;
223
213
  this.right = this.parentWidth - (this.w === 'auto' ? this.$refs.container.scrollWidth : this.w) - this.left;
@@ -247,6 +237,17 @@ export default {
247
237
  cancelHandle.setAttribute('data-drag-cancel', this._uid);
248
238
  });
249
239
  }
240
+
241
+ if (this.name.trim() !== '' && this.isStorage) {
242
+ let info = JSON.parse(localStorage.getItem("DragResizeView_Info_" + this.name))
243
+ console.log("拖动", info);
244
+ if (info !== null) {
245
+ this.left = info.left
246
+ this.top = info.top
247
+ this.right = info.right
248
+ this.bottom = info.bottom
249
+ }
250
+ }
250
251
  },
251
252
 
252
253
  beforeDestroy() {
@@ -711,7 +712,8 @@ export default {
711
712
  throw "unspecified name"
712
713
  }
713
714
 
714
- localStorage.setItem("DragResizeView_Info_" + this.name, JSON.stringify(this.rect))
715
+ const info = { "left": this.rect.left, "top": this.rect.top, "right": this.right, "bottom": this.bottom }
716
+ localStorage.setItem("DragResizeView_Info_" + this.name, JSON.stringify(info))
715
717
  }
716
718
 
717
719
  },
@@ -0,0 +1,3 @@
1
+ <template src="./vue-drag-resize.html"></template>
2
+ <script src="./vue-drag-resize.ts"></script>
3
+ <style src="./vue-drag-resize.css"></style>
@@ -0,0 +1,46 @@
1
+ .vdr {
2
+ position: absolute;
3
+ box-sizing: border-box;
4
+ }
5
+ .vdr.active:before{
6
+ content: '';
7
+ width: 100%;
8
+ height: 100%;
9
+ position: absolute;
10
+ top: 0;
11
+ left: 0;
12
+ box-sizing: border-box;
13
+ outline: 1px dashed #d6d6d6;
14
+ }
15
+ .vdr-stick {
16
+ box-sizing: border-box;
17
+ position: absolute;
18
+ font-size: 1px;
19
+ background: #ffffff;
20
+ border: 1px solid #6c6c6c;
21
+ box-shadow: 0 0 2px #bbb;
22
+ }
23
+ .inactive .vdr-stick {
24
+ display: none;
25
+ }
26
+ .vdr-stick-tl, .vdr-stick-br {
27
+ cursor: nwse-resize;
28
+ }
29
+ .vdr-stick-tm, .vdr-stick-bm {
30
+ left: 50%;
31
+ cursor: ns-resize;
32
+ }
33
+ .vdr-stick-tr, .vdr-stick-bl {
34
+ cursor: nesw-resize;
35
+ }
36
+ .vdr-stick-ml, .vdr-stick-mr {
37
+ top: 50%;
38
+ cursor: ew-resize;
39
+ }
40
+ .vdr-stick.not-resizable{
41
+ display: none;
42
+ }
43
+ .content-container{
44
+ display: block;
45
+ position: relative;
46
+ }
@@ -0,0 +1,17 @@
1
+ <div class="vdr" :style="positionStyle"
2
+ :class="`${(active || isActive) ? 'active' : 'inactive'} ${contentClass ? contentClass: ''}`"
3
+ @mousedown="bodyDown($event)"
4
+ @touchstart="bodyDown($event)"
5
+ @touchend="up($event)">
6
+ <div :style="sizeStyle" class="content-container" ref="container">
7
+ <slot></slot>
8
+ </div>
9
+ <div
10
+ v-for="stick in sticks"
11
+ class="vdr-stick"
12
+ :class="['vdr-stick-' + stick, isResizable ? '' : 'not-resizable']"
13
+ @mousedown.stop.prevent="stickDown(stick, $event)"
14
+ @touchstart.stop.prevent="stickDown(stick, $event)"
15
+ :style="vdrStick(stick)">
16
+ </div>
17
+ </div>