@onesy/ui-react 1.0.177 → 1.0.179
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/Interaction/Interaction.js +10 -10
- package/TableCell/TableCell.js +1 -1
- package/esm/Interaction/Interaction.js +9 -9
- package/esm/TableCell/TableCell.js +1 -1
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -158,7 +158,7 @@ const Interaction = props_ => {
|
|
|
158
158
|
subscription,
|
|
159
159
|
clear,
|
|
160
160
|
disabled,
|
|
161
|
-
mobileDelay =
|
|
161
|
+
mobileDelay = 150,
|
|
162
162
|
className
|
|
163
163
|
} = props;
|
|
164
164
|
const {
|
|
@@ -233,8 +233,8 @@ const Interaction = props_ => {
|
|
|
233
233
|
remove('mouse-down');
|
|
234
234
|
removeWaves();
|
|
235
235
|
};
|
|
236
|
-
const onTouchStart =
|
|
237
|
-
|
|
236
|
+
const onTouchStart = event_0 => {
|
|
237
|
+
onMouseDown(event_0);
|
|
238
238
|
onMouseIn();
|
|
239
239
|
};
|
|
240
240
|
const onTouchUp = () => {
|
|
@@ -313,19 +313,19 @@ const Interaction = props_ => {
|
|
|
313
313
|
_react.default.useEffect(() => {
|
|
314
314
|
if (disabled && refs.interactions.current.length) setInteractions([]);
|
|
315
315
|
}, [disabled]);
|
|
316
|
-
const addWave = (
|
|
316
|
+
const addWave = (event_1, overrides = {}) => {
|
|
317
317
|
const origin = overrides.origin !== undefined ? overrides.origin : refs.origin.current;
|
|
318
318
|
if (refs.wave.current && !refs.props.current.disabled) {
|
|
319
319
|
let top = 0;
|
|
320
320
|
let left = 0;
|
|
321
321
|
let width = '100%';
|
|
322
322
|
if (wave_version !== 'simple') {
|
|
323
|
-
var
|
|
324
|
-
const rect =
|
|
325
|
-
const root = (_ref = (
|
|
323
|
+
var _event_1$currentTarge, _ref;
|
|
324
|
+
const rect = event_1 === null || event_1 === void 0 || (_event_1$currentTarge = event_1.currentTarget) === null || _event_1$currentTarge === void 0 ? void 0 : _event_1$currentTarge.getBoundingClientRect();
|
|
325
|
+
const root = (_ref = (event_1 === null || event_1 === void 0 ? void 0 : event_1.currentTarget) || refs.root.current.parentNode) === null || _ref === void 0 ? void 0 : _ref.getBoundingClientRect();
|
|
326
326
|
|
|
327
327
|
// Mouse or touch event
|
|
328
|
-
const valuesEvent = !(
|
|
328
|
+
const valuesEvent = !(event_1 !== null && event_1 !== void 0 && event_1.touches) ? event_1 : event_1.touches[0];
|
|
329
329
|
const values = {
|
|
330
330
|
x: valuesEvent.x !== undefined ? valuesEvent.x : valuesEvent.clientX,
|
|
331
331
|
y: valuesEvent.y !== undefined ? valuesEvent.y : valuesEvent.clientY
|
|
@@ -334,8 +334,8 @@ const Interaction = props_ => {
|
|
|
334
334
|
values.offsetY = valuesEvent.offsetY !== undefined ? valuesEvent.offsetY : values.y - rect.y;
|
|
335
335
|
const w = root.width;
|
|
336
336
|
const h = root.height;
|
|
337
|
-
const x = origin === 'center' || !
|
|
338
|
-
const y = origin === 'center' || !
|
|
337
|
+
const x = origin === 'center' || !event_1 ? w / 2 : rect ? values.x - rect.left : values.offsetX;
|
|
338
|
+
const y = origin === 'center' || !event_1 ? h / 2 : rect ? values.y - rect.top : values.offsetY;
|
|
339
339
|
width = Math.round(Math.sqrt(
|
|
340
340
|
// Largest sub rectangle in value
|
|
341
341
|
Math.max(x ** 2 + y ** 2, Math.abs(w - x) ** 2 + y ** 2, x ** 2 + Math.abs(h - y) ** 2, Math.abs(w - x) ** 2 + Math.abs(h - y) ** 2)) * 2);
|
package/TableCell/TableCell.js
CHANGED
|
@@ -208,7 +208,7 @@ const TableCell = props_ => {
|
|
|
208
208
|
}, [sortedBy_]);
|
|
209
209
|
const onStickyMove = () => {
|
|
210
210
|
const offsetNew = refs.root.current.offsetLeft;
|
|
211
|
-
setStickyActive(refs.offset.current
|
|
211
|
+
setStickyActive(offsetNew < refs.offset.current);
|
|
212
212
|
};
|
|
213
213
|
const onStickyInit = () => {
|
|
214
214
|
if (refs.sticky.current && refs.root.current) {
|
|
@@ -150,7 +150,7 @@ const Interaction = props_ => {
|
|
|
150
150
|
subscription,
|
|
151
151
|
clear,
|
|
152
152
|
disabled,
|
|
153
|
-
mobileDelay =
|
|
153
|
+
mobileDelay = 150,
|
|
154
154
|
className
|
|
155
155
|
} = props;
|
|
156
156
|
const {
|
|
@@ -224,8 +224,8 @@ const Interaction = props_ => {
|
|
|
224
224
|
remove('mouse-down');
|
|
225
225
|
removeWaves();
|
|
226
226
|
};
|
|
227
|
-
const onTouchStart =
|
|
228
|
-
|
|
227
|
+
const onTouchStart = event_0 => {
|
|
228
|
+
onMouseDown(event_0);
|
|
229
229
|
onMouseIn();
|
|
230
230
|
};
|
|
231
231
|
const onTouchUp = () => {
|
|
@@ -303,18 +303,18 @@ const Interaction = props_ => {
|
|
|
303
303
|
React.useEffect(() => {
|
|
304
304
|
if (disabled && refs.interactions.current.length) setInteractions([]);
|
|
305
305
|
}, [disabled]);
|
|
306
|
-
const addWave = (
|
|
306
|
+
const addWave = (event_1, overrides = {}) => {
|
|
307
307
|
const origin = overrides.origin !== undefined ? overrides.origin : refs.origin.current;
|
|
308
308
|
if (refs.wave.current && !refs.props.current.disabled) {
|
|
309
309
|
let top = 0;
|
|
310
310
|
let left = 0;
|
|
311
311
|
let width = '100%';
|
|
312
312
|
if (wave_version !== 'simple') {
|
|
313
|
-
const rect =
|
|
314
|
-
const root = (
|
|
313
|
+
const rect = event_1?.currentTarget?.getBoundingClientRect();
|
|
314
|
+
const root = (event_1?.currentTarget || refs.root.current.parentNode)?.getBoundingClientRect();
|
|
315
315
|
|
|
316
316
|
// Mouse or touch event
|
|
317
|
-
const valuesEvent = !
|
|
317
|
+
const valuesEvent = !event_1?.touches ? event_1 : event_1.touches[0];
|
|
318
318
|
const values = {
|
|
319
319
|
x: valuesEvent.x !== undefined ? valuesEvent.x : valuesEvent.clientX,
|
|
320
320
|
y: valuesEvent.y !== undefined ? valuesEvent.y : valuesEvent.clientY
|
|
@@ -323,8 +323,8 @@ const Interaction = props_ => {
|
|
|
323
323
|
values.offsetY = valuesEvent.offsetY !== undefined ? valuesEvent.offsetY : values.y - rect.y;
|
|
324
324
|
const w = root.width;
|
|
325
325
|
const h = root.height;
|
|
326
|
-
const x = origin === 'center' || !
|
|
327
|
-
const y = origin === 'center' || !
|
|
326
|
+
const x = origin === 'center' || !event_1 ? w / 2 : rect ? values.x - rect.left : values.offsetX;
|
|
327
|
+
const y = origin === 'center' || !event_1 ? h / 2 : rect ? values.y - rect.top : values.offsetY;
|
|
328
328
|
width = Math.round(Math.sqrt(
|
|
329
329
|
// Largest sub rectangle in value
|
|
330
330
|
Math.max(x ** 2 + y ** 2, Math.abs(w - x) ** 2 + y ** 2, x ** 2 + Math.abs(h - y) ** 2, Math.abs(w - x) ** 2 + Math.abs(h - y) ** 2)) * 2);
|
|
@@ -199,7 +199,7 @@ const TableCell = props_ => {
|
|
|
199
199
|
}, [sortedBy_]);
|
|
200
200
|
const onStickyMove = () => {
|
|
201
201
|
const offsetNew = refs.root.current.offsetLeft;
|
|
202
|
-
setStickyActive(refs.offset.current
|
|
202
|
+
setStickyActive(offsetNew < refs.offset.current);
|
|
203
203
|
};
|
|
204
204
|
const onStickyInit = () => {
|
|
205
205
|
if (refs.sticky.current && refs.root.current) {
|
package/esm/index.js
CHANGED
package/index.js
CHANGED