meixioacomponent 0.2.27 → 0.2.30

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.
@@ -2,10 +2,6 @@
2
2
  //
3
3
  --hover-gray: var(--color-gray-m);
4
4
  --hover-primary: var(--color-active-primary);
5
- // 图标颜色
6
- --icon-color-d: var(--font-color-m);
7
- --icon-color-m: var(--font-color-s);
8
- --icon-color-s: var(--font-color-ds);
9
5
  // 阴影
10
6
  --shadow: 0px 2px 4px #0000001f, 0 0 6px #0000001f;
11
7
  --shadow-2: 0px 1px 1px rgba(9, 30, 66, 0.25),
@@ -58,6 +54,11 @@
58
54
  // 字体颜色
59
55
  --text-white: white;
60
56
  --text-black: #333;
57
+ --text-disabled: #a5adba;
58
+ // 图标颜色
59
+ --icon-color-d: var(--font-color-m);
60
+ --icon-color-m: var(--font-color-s);
61
+ --icon-color-s: var(--font-color-ds);
61
62
  // 选择类的背景色
62
63
  //警告色
63
64
  --color-warn: #ff991f;
@@ -69,7 +70,7 @@
69
70
  --color-info: var(--color-gray-d);
70
71
  //滚动条样式
71
72
  // hover 主题色颜色
72
- --hover-light-primary: #deebff;
73
+ --hover-light-primary: #e6eefa;
73
74
  // 选中色
74
75
  --color-selected: #213f72;
75
76
  --scrollbar-color: #4b4b4be6;
@@ -0,0 +1,48 @@
1
+ class UseResize {
2
+ constructor(parmas) {
3
+ // type 为 width/height
4
+ this.type = parmas.type;
5
+ // 目标需要改变的值
6
+ this.value = parmas.value;
7
+ // 移动的时候的事件
8
+ this.moveing = parmas.moveing;
9
+ // 结束事件
10
+ this.resizeEnd = parmas.resizeEnd;
11
+ this.x = null;
12
+ this.sub = null;
13
+ }
14
+
15
+ setListen() {
16
+ document.onmousemove = this.onResizeing;
17
+ document.onmouseup = this.onResizeEnd;
18
+ }
19
+ removeListen() {
20
+ document.onmousemove = null;
21
+ document.onmouseup = null;
22
+ }
23
+
24
+ startResize(e) {
25
+ this.setListen();
26
+ if (this.type == "width") {
27
+ this.x = e.clientX;
28
+ }
29
+ }
30
+
31
+ onResizeing = (e) => {
32
+ let type = this.type;
33
+ if (type == "width") {
34
+ const stw = this.x - e.clientX;
35
+ this.sub = this.value + stw;
36
+ this.moveing(this.sub);
37
+ }
38
+ };
39
+ onResizeEnd = (e) => {
40
+ this.removeListen();
41
+ this.value = this.sub;
42
+ if (this.resizeEnd) {
43
+ this.resizeEnd();
44
+ }
45
+ };
46
+ }
47
+
48
+ export default UseResize;
@@ -0,0 +1,84 @@
1
+ class UseDrag {
2
+ constructor(params) {
3
+ this.target = params.target;
4
+ this.handle = params.handle;
5
+ this.onDragEnd = params.onDragEnd;
6
+ this.x = null;
7
+ this.y = null;
8
+ this.minLeft = null;
9
+ this.minTop = null;
10
+ this.maxLeft = null;
11
+ this.maxTop = null;
12
+ this.styL = null;
13
+ this.styT = null;
14
+ this.setLimit();
15
+ }
16
+ setLimit() {
17
+ let target = this.target;
18
+ const screenWidth = document.body.clientWidth; // body当前宽度
19
+ const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取)
20
+ const targetWidth = target.clientWidth; // 对话框宽度
21
+ const targetheight = target.clientHeight; // 对话框高度
22
+ this.maxLeft = screenWidth - targetWidth;
23
+ this.maxTop = screenHeight - targetheight;
24
+ }
25
+
26
+ removeListen() {
27
+ document.onmousemove = null;
28
+ document.onmouseup = null;
29
+ }
30
+
31
+ startDrag(e) {
32
+ this.x = e.clientX;
33
+ this.y = e.clientY;
34
+ this.styL = this.getStyle(this.target, "left");
35
+ this.styT = this.getStyle(this.target, "top");
36
+
37
+ if (this.styL.includes("%")) {
38
+ this.styL =
39
+ +document.body.clientWidth * (+this.styL.replace(/\%/g, "") / 100);
40
+ this.styT =
41
+ +document.body.clientHeight * (+this.styT.replace(/\%/g, "") / 100);
42
+ } else {
43
+ this.styL = +this.styL.replace(/\px/g, "");
44
+ this.styT = +this.styT.replace(/\px/g, "");
45
+ }
46
+
47
+ document.onmousemove = this.mousemove;
48
+ document.onmouseup = this.dragEnd;
49
+ }
50
+ getStyle(dom, attr) {
51
+ if (window.document.currentStyle) {
52
+ return dom.currentStyle[attr];
53
+ } else {
54
+ return getComputedStyle(dom, false)[attr];
55
+ }
56
+ }
57
+ mousemove = (e) => {
58
+ let left = this.styL - (this.x - e.clientX);
59
+ let top = this.styT - (this.y - e.clientY);
60
+
61
+ if (left <= 0) {
62
+ left = 0;
63
+ } else if (left > this.maxLeft) {
64
+ left = this.maxLeft;
65
+ }
66
+
67
+ if (top <= 0) {
68
+ top = 0;
69
+ } else if (top > this.maxTop) {
70
+ top = this.maxTop;
71
+ }
72
+
73
+ this.target.style.cssText += `;left:${left}px;top:${top}px;`;
74
+ };
75
+
76
+ dragEnd = () => {
77
+ this.removeListen();
78
+ if (this.onDragEnd) {
79
+ this.onDragEnd();
80
+ }
81
+ };
82
+ }
83
+
84
+ export default UseDrag;
@@ -1,4 +1,3 @@
1
-
2
1
  import dayjs from "dayjs";
3
2
 
4
3
  export const formatDate = (dateObj, fmt = "YYYY-MM-DD hh:mm:ss") => {
@@ -184,4 +183,15 @@ export const jugeFileTypeKey = (suffix) => {
184
183
  return key;
185
184
  };
186
185
 
187
-
186
+ export const vhToNumber = (type, value) => {
187
+ if (type == "height") {
188
+ let heightValue = window.innerHeight;
189
+ console.log(heightValue);
190
+ return heightValue * (value / 100);
191
+ } else if (type == "width") {
192
+ let widthValue = window.innerWidth;
193
+ return widthValue * (value / 100);
194
+ } else {
195
+ return value;
196
+ }
197
+ };