its_ui_vite 1.1.10 → 1.1.11

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": "its_ui_vite",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "main": "./src/libIndex.js",
5
5
  "module": "./src/libIndex.js",
6
6
  "files": [
@@ -55,12 +55,25 @@ export const CClasses = {
55
55
  * @param {(positionInfo: any) => void} [closeFn=(positionInfo: any) => {}] fn
56
56
  */
57
57
 
58
- export function addTracingElement(target, moveFn = () => {}) {
59
- let timer
60
- let debounceTimer
58
+ export function addTracingElement(target, moveFn = () => {}) {
59
+ let timer;
60
+ let debounceTimer;
61
+ let positionInfo;
62
+ let lockPosition = true;
61
63
 
62
64
  const handlesEvents = ['mousemove', 'wheel', 'load', 'fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'msfullscreenchange']
63
65
 
66
+ function setPositionInfo(position, e) {
67
+ positionInfo = {
68
+ x: position.x,
69
+ y: position.y - (e?.deltaY || 0),
70
+ left: position.left,
71
+ top: position.top - (e?.deltaY || 0),
72
+ width: position.width,
73
+ height: position.height,
74
+ }
75
+ }
76
+
64
77
  function isVisible(position) {
65
78
  if (!position) return false
66
79
 
@@ -82,31 +95,48 @@ export function addTracingElement(target, moveFn = () => {}) {
82
95
  return isVisibleInWindow && isVisibleInScroll
83
96
  }
84
97
 
85
- function dispatch() {
86
- const position = target.value?.getBoundingClientRect()
87
-
98
+ function dispatch(position) {
88
99
  if (!position) return;
89
-
100
+
90
101
  const infoObj = {
91
102
  position: position,
92
103
  isVisible: isVisible(position)
93
104
  }
94
-
95
- moveFn(infoObj)
105
+ moveFn(infoObj);
96
106
  }
97
107
 
98
108
  function targetMoveHandler(e) {
99
- if (timer) return;
109
+ const position = target.value?.getBoundingClientRect();
110
+
111
+ if (!position) return;
112
+
113
+ if (lockPosition) {
114
+ setPositionInfo(position, e);
115
+ } else {
116
+ positionInfo.top = positionInfo.top - (e?.deltaY || 0);
117
+ positionInfo.y = positionInfo.y - (e?.deltaY || 0);
118
+ }
119
+
120
+ lockPosition = !e?.deltaY;
121
+
122
+ if (timer) return;
123
+ dispatch(positionInfo);
100
124
 
101
125
  timer = setTimeout(() => {
102
- timer = undefined
126
+ timer = undefined;
103
127
 
104
- dispatch()
128
+ dispatch(positionInfo);
105
129
 
106
130
  // здесь debounce т.к. не всегда привязанный элемент встает на место
107
- clearTimeout(debounceTimer)
108
- debounceTimer = setTimeout(dispatch, 200)
109
- }, 500)
131
+ clearTimeout(debounceTimer);
132
+ debounceTimer = setTimeout(() => {
133
+ const position = target.value?.getBoundingClientRect();
134
+ lockPosition = true;
135
+
136
+ setPositionInfo(position);
137
+ dispatch(positionInfo);
138
+ }, 200);
139
+ }, 100);
110
140
  }
111
141
 
112
142
  function addListeners() {
@@ -987,7 +987,7 @@ $timeWidth: 54px;
987
987
 
988
988
  position: fixed;
989
989
  z-index: var(--z-index, 999);
990
- transition: var(--transition);
990
+ transition: all .14s linear 0s;
991
991
  // transform: translate(0, 50px);
992
992
  pointer-events: none;
993
993
 
@@ -1103,7 +1103,7 @@ $timeWidth: 54px;
1103
1103
  .c-datepicker__content_wrap {
1104
1104
  position: fixed;
1105
1105
  z-index: var(--z-index, 999);
1106
- transition: var(--transition);
1106
+ transition: all .14s linear 0s;
1107
1107
  pointer-events: none;
1108
1108
 
1109
1109
  .c-datepicker {
@@ -406,7 +406,7 @@ defineExpose({
406
406
  position: fixed;
407
407
  z-index: 999;
408
408
 
409
- transition: var(--transition);
409
+ transition: all .14s linear 0s;
410
410
 
411
411
  pointer-events: none;
412
412
 
@@ -481,7 +481,7 @@ defineExpose({
481
481
  position: fixed;
482
482
  z-index: var(--z-index, 999);
483
483
 
484
- transition: var(--transition);
484
+ transition: all .14s linear 0s;
485
485
 
486
486
  pointer-events: none;
487
487
 
@@ -482,7 +482,7 @@ defineExpose({
482
482
  border-radius: 8px;
483
483
  border: 1px solid var(--green-medium);
484
484
 
485
- transition: var(--transition);
485
+ transition: all .14s linear 0s;
486
486
 
487
487
  opacity: 0;
488
488
  pointer-events: none;
@@ -230,7 +230,8 @@ function removeListener() {
230
230
 
231
231
  z-index: var(--z-index, 999);
232
232
 
233
- transition: var(--transition);
233
+ transition: all .14s linear 0s;
234
+
234
235
  pointer-events: none;
235
236
 
236
237
  // props.position