cx 24.8.2 → 24.8.4

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/widgets.js CHANGED
@@ -4325,8 +4325,15 @@ function tooltipParentWillUnmount(parentInstance) {
4325
4325
  }
4326
4326
  }
4327
4327
  function tooltipParentDidUpdate(element, parentInstance, tooltip) {
4328
+ var _instance$data;
4328
4329
  var instance = getTooltipInstance(element, parentInstance, tooltip);
4329
- if (instance && instance.tooltipComponent)
4330
+ if (
4331
+ instance &&
4332
+ instance.visible &&
4333
+ (_instance$data = instance.data) != null &&
4334
+ _instance$data.alwaysVisible &&
4335
+ instance.tooltipComponent
4336
+ )
4330
4337
  instance.widget.updateDropdownPosition(instance, instance.tooltipComponent);
4331
4338
  }
4332
4339
  function enableTooltips() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.8.2",
3
+ "version": "24.8.4",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "main": "index.js",
6
6
  "jsnext:main": "src/index.js",
@@ -1,47 +1,43 @@
1
- import { PureContainer } from "../../ui/PureContainer";
2
-
3
- export class PointReducer extends PureContainer {
4
- explore(context, instance) {
5
- let parentPointReducer = context.pointReducer;
6
- instance.parentPointTracker = parentPointReducer;
7
- instance.accumulatorReset = false;
8
-
9
- if (!instance.pointReducer) {
10
- let onMap = this.onMap && instance.getCallback("onMap");
11
- let accumulator = {};
12
- instance.resetAccumulator = () => {
13
- accumulator = {};
14
- if (this.onInitAccumulator) instance.invoke("onInitAccumulator", accumulator, instance);
15
- };
16
-
17
- instance.pointReducer = (x, y, name, data, array, index) => {
18
- if (!instance.accumulatorReset) {
19
- instance.resetAccumulator();
20
- instance.accumulatorReset = true;
21
- }
22
- onMap(accumulator, x, y, name, data, array, index);
23
- if (parentPointReducer) parentPointReducer(x, y, name, data, array, index);
24
- };
25
- instance.write = () => {
26
- if (this.onReduce) instance.invoke("onReduce", accumulator, instance);
27
- };
28
- }
29
-
30
- context.push("pointReducer", instance.pointReducer);
31
-
32
- super.explore(context, instance);
33
- }
34
-
35
- exploreCleanup(context, instance) {
36
- context.pop("pointReducer");
37
- }
38
-
39
- prepare(context, instance) {
40
- context.push("pointReducer", instance.pointReducer);
41
- }
42
-
43
- prepareCleanup(context, instance) {
44
- context.pop("pointReducer");
45
- instance.write();
46
- }
47
- }
1
+ import { PureContainer } from "../../ui/PureContainer";
2
+
3
+ export class PointReducer extends PureContainer {
4
+ explore(context, instance) {
5
+ let parentPointReducer = context.pointReducer;
6
+ instance.parentPointTracker = parentPointReducer;
7
+
8
+ if (!instance.pointReducer) {
9
+ let onMap = this.onMap && instance.getCallback("onMap");
10
+ let accumulator = {};
11
+ instance.resetAccumulator = () => {
12
+ accumulator = {};
13
+ if (this.onInitAccumulator) instance.invoke("onInitAccumulator", accumulator, instance);
14
+ };
15
+
16
+ instance.pointReducer = (x, y, name, data, array, index) => {
17
+ onMap(accumulator, x, y, name, data, array, index);
18
+ if (parentPointReducer) parentPointReducer(x, y, name, data, array, index);
19
+ };
20
+ instance.write = () => {
21
+ if (this.onReduce) instance.invoke("onReduce", accumulator, instance);
22
+ };
23
+ }
24
+
25
+ instance.resetAccumulator();
26
+ context.push("pointReducer", instance.pointReducer);
27
+
28
+ super.explore(context, instance);
29
+ }
30
+
31
+ exploreCleanup(context, instance) {
32
+ context.pop("pointReducer");
33
+ }
34
+
35
+ prepare(context, instance) {
36
+ context.push("pointReducer", instance.pointReducer);
37
+ }
38
+
39
+ prepareCleanup(context, instance) {
40
+ context.pop("pointReducer");
41
+ instance.write();
42
+ }
43
+ }
@@ -1,61 +1,69 @@
1
- import { PointReducer } from "./PointReducer";
2
-
3
- export class SnapPointFinder extends PointReducer {
4
- declareData() {
5
- return super.declareData(...arguments, {
6
- cursorX: undefined,
7
- cursorY: undefined,
8
- snapX: undefined,
9
- snapY: undefined,
10
- snapRecord: undefined,
11
- maxDistance: undefined,
12
- });
13
- }
14
-
15
- explore(context, instance) {
16
- instance.xAxis = context.axes[this.xAxis];
17
- instance.yAxis = context.axes[this.yAxis];
18
- super.explore(context, instance);
19
- }
20
-
21
- onInitAccumulator(acc, { data, xAxis, yAxis }) {
22
- acc.cursorX = data.cursorX != null ? xAxis?.map(this.convertX(data.cursorX)) : null;
23
- acc.cursorY = data.cursorY != null ? yAxis?.map(this.convertY(data.cursorY)) : null;
24
- acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
25
- acc.snapX = null;
26
- acc.snapY = null;
27
- acc.xAxis = xAxis;
28
- acc.yAxis = yAxis;
29
- }
30
-
31
- onMap(acc, x, y, name, p) {
32
- let { xAxis, yAxis } = acc;
33
-
34
- let d = null;
35
- let cx = x != null ? xAxis?.map(this.convertX(x)) : null;
36
- let cy = y != null ? yAxis?.map(this.convertY(y)) : null;
37
-
38
- if (acc.cursorX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - acc.cursorX), 2);
39
-
40
- if (acc.cursorY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - acc.cursorY), 2);
41
-
42
- if (d != null && d < acc.dist) {
43
- acc.dist = d;
44
- acc.snapX = x;
45
- acc.snapY = y;
46
- acc.snapRecord = p;
47
- }
48
- }
49
-
50
- onReduce(acc, instance) {
51
- instance.set("snapX", acc.snapX);
52
- instance.set("snapY", acc.snapY);
53
- instance.set("snapRecord", acc.snapRecord);
54
- }
55
- }
56
-
57
- SnapPointFinder.prototype.maxDistance = 50;
58
- SnapPointFinder.prototype.convertX = (x) => x;
59
- SnapPointFinder.prototype.convertY = (y) => y;
60
- SnapPointFinder.prototype.xAxis = "x";
61
- SnapPointFinder.prototype.yAxis = "y";
1
+ import { PointReducer } from "./PointReducer";
2
+
3
+ export class SnapPointFinder extends PointReducer {
4
+ declareData() {
5
+ return super.declareData(...arguments, {
6
+ cursorX: undefined,
7
+ cursorY: undefined,
8
+ snapX: undefined,
9
+ snapY: undefined,
10
+ snapRecord: undefined,
11
+ maxDistance: undefined,
12
+ });
13
+ }
14
+
15
+ explore(context, instance) {
16
+ instance.xAxis = context.axes[this.xAxis];
17
+ instance.yAxis = context.axes[this.yAxis];
18
+ super.explore(context, instance);
19
+ }
20
+
21
+ onInitAccumulator(acc, { data, xAxis, yAxis }) {
22
+ acc.cursor = {
23
+ x: data.cursorX,
24
+ y: data.cursorY,
25
+ mapped: false,
26
+ };
27
+ acc.dist = data.maxDistance > 0 ? Math.pow(data.maxDistance, 2) : Number.POSITIVE_INFINITY;
28
+ acc.snapX = null;
29
+ acc.snapY = null;
30
+ acc.xAxis = xAxis;
31
+ acc.yAxis = yAxis;
32
+ }
33
+
34
+ onMap(acc, x, y, name, p) {
35
+ let { xAxis, yAxis, cursor } = acc;
36
+
37
+ if (!cursor.mapped) {
38
+ cursor.mappedX = cursor.x != null ? xAxis?.map(this.convertX(cursor.x)) : null;
39
+ cursor.mappedY = cursor.y != null ? yAxis?.map(this.convertY(cursor.y)) : null;
40
+ cursor.mapped = true;
41
+ }
42
+
43
+ let d = null;
44
+ let cx = x != null ? xAxis?.map(this.convertX(x)) : null;
45
+ let cy = y != null ? yAxis?.map(this.convertY(y)) : null;
46
+
47
+ if (cursor.mappedX != null && cx != null) d = (d || 0) + Math.pow(Math.abs(cx - cursor.mappedX), 2);
48
+ if (cursor.mappedY != null && cy != null) d = (d || 0) + Math.pow(Math.abs(cy - cursor.mappedY), 2);
49
+
50
+ if (d != null && d < acc.dist) {
51
+ acc.dist = d;
52
+ acc.snapX = x;
53
+ acc.snapY = y;
54
+ acc.snapRecord = p;
55
+ }
56
+ }
57
+
58
+ onReduce(acc, instance) {
59
+ instance.set("snapX", acc.snapX);
60
+ instance.set("snapY", acc.snapY);
61
+ instance.set("snapRecord", acc.snapRecord);
62
+ }
63
+ }
64
+
65
+ SnapPointFinder.prototype.maxDistance = 50;
66
+ SnapPointFinder.prototype.convertX = (x) => x;
67
+ SnapPointFinder.prototype.convertY = (y) => y;
68
+ SnapPointFinder.prototype.xAxis = "x";
69
+ SnapPointFinder.prototype.yAxis = "y";