cx 24.3.3 → 24.3.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
@@ -15775,10 +15775,7 @@ var Grid = /*#__PURE__*/ (function (_Container) {
15775
15775
  var headerTBody = e.target.parentElement.parentElement.parentElement;
15776
15776
  var uniqueColId = e.currentTarget.dataset.uniqueColId;
15777
15777
  var headerCell = findFirstChild(headerTBody, function (el) {
15778
- var _el$dataset;
15779
- return (
15780
- el.tagName == "TH" && ((_el$dataset = el.dataset) == null ? void 0 : _el$dataset.uniqueColId) == uniqueColId
15781
- );
15778
+ return el.tagName == "TH" && el.dataset && el.dataset.uniqueColId == uniqueColId;
15782
15779
  });
15783
15780
  var scrollAreaEl = headerTBody.parentElement.parentElement;
15784
15781
  var gridEl = scrollAreaEl.parentElement;
@@ -16535,6 +16532,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
16535
16532
  cursorCellIndex: 0,
16536
16533
  focused: widget.focused,
16537
16534
  dropInsertionIndex: null,
16535
+ dropNextToTheRowAbove: null,
16538
16536
  start: 0,
16539
16537
  end: end,
16540
16538
  };
@@ -16921,7 +16919,48 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
16921
16919
  },
16922
16920
  "dropzone",
16923
16921
  );
16924
- children.splice(this.state.dropInsertionIndex, 0, dragInsertionRow);
16922
+ var index = 0;
16923
+ while (
16924
+ index < children.length &&
16925
+ ((_children$index = children[index]) == null ||
16926
+ (_children$index = _children$index.props) == null ||
16927
+ (_children$index = _children$index.record) == null
16928
+ ? void 0
16929
+ : _children$index.type) != "data"
16930
+ ) {
16931
+ var _children$index;
16932
+ index++;
16933
+ }
16934
+ var count = 0;
16935
+ while (count < this.state.dropInsertionIndex) {
16936
+ var _children$index2;
16937
+ if (
16938
+ ((_children$index2 = children[index]) == null ||
16939
+ (_children$index2 = _children$index2.props) == null ||
16940
+ (_children$index2 = _children$index2.record) == null
16941
+ ? void 0
16942
+ : _children$index2.type) == "data"
16943
+ )
16944
+ count++;
16945
+ index++;
16946
+ }
16947
+ var savedIndexPos = index;
16948
+ if (!this.state.dropNextToTheRowAbove)
16949
+ while (
16950
+ index < children.length &&
16951
+ ((_children$index3 = children[index]) == null ||
16952
+ (_children$index3 = _children$index3.props) == null ||
16953
+ (_children$index3 = _children$index3.record) == null
16954
+ ? void 0
16955
+ : _children$index3.type) != "data"
16956
+ ) {
16957
+ var _children$index3;
16958
+ index++;
16959
+ }
16960
+
16961
+ // do not allow insertion after the last group footer
16962
+ if (savedIndexPos < index && index == children.length) index = savedIndexPos;
16963
+ children.splice(index, 0, dragInsertionRow);
16925
16964
  }
16926
16965
  var content = [],
16927
16966
  fixedColumnsContent = [];
@@ -17307,12 +17346,14 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17307
17346
  start = _this$getBufferStartE2.start;
17308
17347
  var _this$state2 = this.state,
17309
17348
  dropInsertionIndex = _this$state2.dropInsertionIndex,
17310
- dropTarget = _this$state2.dropTarget;
17349
+ dropTarget = _this$state2.dropTarget,
17350
+ dropNextToTheRowAbove = _this$state2.dropNextToTheRowAbove;
17311
17351
  if (dropTarget == "grid" && widget.onDrop && dropInsertionIndex != null) {
17312
17352
  e.target = {
17313
17353
  insertionIndex: start + dropInsertionIndex,
17314
17354
  recordBefore: this.getRecordAt(start + dropInsertionIndex - 1),
17315
17355
  recordAfter: this.getRecordAt(start + dropInsertionIndex),
17356
+ dropNextToTheRowAbove: dropNextToTheRowAbove,
17316
17357
  };
17317
17358
  instance.invoke("onDrop", e, instance);
17318
17359
  } else if (dropTarget == "row") {
@@ -17432,6 +17473,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17432
17473
  var parentOffset = getParentFrameBoundingClientRect(this.dom.scroller);
17433
17474
  var cy = ev.cursor.clientY - parentOffset.top;
17434
17475
  var rowOverIndex = null;
17476
+ var nextToTheRowAbove = false;
17435
17477
  while (s < e) {
17436
17478
  m = Math.floor((s + e) / 2);
17437
17479
  b = nodes[m].getBoundingClientRect();
@@ -17467,8 +17509,10 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17467
17509
  break;
17468
17510
  }
17469
17511
  }
17470
- if (cy > (b.bottom + b.top) / 2) s = e = m + 1;
17471
- else s = e = m;
17512
+ if (cy > (b.bottom + b.top) / 2) {
17513
+ s = e = m + 1;
17514
+ nextToTheRowAbove = true;
17515
+ } else s = e = m;
17472
17516
  }
17473
17517
  }
17474
17518
  var cancel = false;
@@ -17483,6 +17527,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17483
17527
  else if (rowOverIndex != this.state.dropInsertionIndex || this.state.dropTarget != "row") {
17484
17528
  this.setState({
17485
17529
  dropInsertionIndex: rowOverIndex,
17530
+ dropNextToTheRowAbove: false,
17486
17531
  dropItemHeight: ev.source.height - 1,
17487
17532
  dropTarget: "row",
17488
17533
  });
@@ -17500,6 +17545,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17500
17545
  else if (s != this.state.dropInsertionIndex || this.state.dropTarget != "grid") {
17501
17546
  this.setState({
17502
17547
  dropInsertionIndex: s,
17548
+ dropNextToTheRowAbove: nextToTheRowAbove,
17503
17549
  dropItemHeight: ev.source.height - 1,
17504
17550
  dropTarget: "grid",
17505
17551
  });
@@ -17508,6 +17554,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17508
17554
  if (cancel) {
17509
17555
  this.setState({
17510
17556
  dropInsertionIndex: null,
17557
+ dropNextToTheRowAbove: null,
17511
17558
  dropTarget: null,
17512
17559
  });
17513
17560
  }
@@ -17515,6 +17562,7 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17515
17562
  _proto2.onDragLeave = function onDragLeave(e) {
17516
17563
  this.setState({
17517
17564
  dropInsertionIndex: null,
17565
+ dropNextToTheRowAbove: null,
17518
17566
  dropTarget: null,
17519
17567
  });
17520
17568
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.3.3",
3
+ "version": "24.3.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,96 +1,96 @@
1
- import { Instance } from "./../../ui/Instance.d";
2
- import * as Cx from "../../core";
3
- import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
4
-
5
- export interface AxisProps extends BoundedObjectProps {
6
- /** Set to `true` for vertical axes. */
7
- vertical?: boolean;
8
-
9
- /** Used as a secondary axis. Displayed at the top/right. */
10
- secondary?: boolean;
11
-
12
- /** When set to `true`, the values are displayed in descending order. */
13
- inverted?: Cx.BooleanProp;
14
-
15
- /** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
16
- hidden?: boolean;
17
-
18
- tickSize?: number;
19
- minTickDistance?: number;
20
- minLabelDistanceVertical?: number;
21
- minLabelDistanceHorizontal?: number;
22
-
23
- /** Distance between labels and the axis. */
24
- labelOffset?: number | string;
25
-
26
- /** Label rotation angle in degrees. */
27
- labelRotation?: Cx.Prop<number | string>;
28
-
29
- /** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
30
- labelAnchor?: "start" | "end" | "middle" | "auto";
31
-
32
- /** Horizontal text offset. */
33
- labelDx?: number | string;
34
-
35
- /** Vertical text offset which can be used for vertical alignment. */
36
- labelDy?: number | string;
37
-
38
- /** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
39
- labelWrap?: boolean;
40
-
41
- /**
42
- * Used for vertical adjustment of multi-line labels. Default value is `auto` which means
43
- * that value is initialized based on axis configuration. Value `0` means that label will grow towards
44
- * the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
45
- * `-0.5` will make labels vertically centered.
46
- */
47
- labelLineCountDyFactor?: number | string;
48
-
49
- /**
50
- * Used for vertical adjustment of multi-line labels. Default value is 1 which means
51
- * that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
52
- */
53
- labelLineHeight?: number | string;
54
-
55
- /** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
56
- labelMaxLineLength?: number;
57
-
58
- /** Set to true to hide the axis labels. */
59
- hideLabels?: boolean;
60
-
61
- /** Set to true to hide the axis line. */
62
- hideLine?: boolean;
63
-
64
- /** Set to true to hide the axis ticks. */
65
- hideTicks?: boolean;
66
-
67
- /** Additional CSS style to be applied to the axis line. */
68
- lineStyle?: Cx.StyleProp;
69
-
70
- /** Additional CSS style to be applied to the axis ticks. */
71
- tickStyle?: Cx.StyleProp;
72
-
73
- /** Additional CSS style to be applied to the axis labels. */
74
- labelStyle?: Cx.StyleProp;
75
-
76
- /** Additional CSS class to be applied to the axis line. */
77
- lineClass?: Cx.ClassProp;
78
-
79
- /** Additional CSS class to be applied to the axis ticks. */
80
- tickClass?: Cx.ClassProp;
81
-
82
- /** Additional CSS class to be applied to the axis labels. */
83
- labelClass?: Cx.ClassProp;
84
-
85
- onMeasured?: (info: any, instance: Instance) => void;
86
-
87
- /** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
88
- onCreateLabelFormatter?:
89
- | string
90
- | ((
91
- context: any,
92
- instance: Instance
93
- ) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
94
- }
95
-
96
- export class Axis extends BoundedObject {}
1
+ import { Instance } from "./../../ui/Instance.d";
2
+ import * as Cx from "../../core";
3
+ import { BoundedObject, BoundedObjectProps } from "../../svg/BoundedObject";
4
+
5
+ export interface AxisProps extends BoundedObjectProps {
6
+ /** Set to `true` for vertical axes. */
7
+ vertical?: boolean;
8
+
9
+ /** Used as a secondary axis. Displayed at the top/right. */
10
+ secondary?: boolean;
11
+
12
+ /** When set to `true`, the values are displayed in descending order. */
13
+ inverted?: Cx.BooleanProp;
14
+
15
+ /** When set to `true`, rendering of visual elements of the axis, such as ticks and labels, is skipped, but their function is preserved. */
16
+ hidden?: boolean;
17
+
18
+ tickSize?: number;
19
+ minTickDistance?: number;
20
+ minLabelDistanceVertical?: number;
21
+ minLabelDistanceHorizontal?: number;
22
+
23
+ /** Distance between labels and the axis. */
24
+ labelOffset?: number | string;
25
+
26
+ /** Label rotation angle in degrees. */
27
+ labelRotation?: Cx.Prop<number | string>;
28
+
29
+ /** Label text-anchor value. Allowed values are start, end and middle. Default value is set based on the value of vertical and secondary flags. */
30
+ labelAnchor?: "start" | "end" | "middle" | "auto";
31
+
32
+ /** Horizontal text offset. */
33
+ labelDx?: number | string;
34
+
35
+ /** Vertical text offset which can be used for vertical alignment. */
36
+ labelDy?: number | string;
37
+
38
+ /** Set to `true` to break long labels into multiple lines. Default value is `false`. Text is split at space characters. See also `labelMaxLineLength` and `labelLineCountDyFactor`. */
39
+ labelWrap?: boolean;
40
+
41
+ /**
42
+ * Used for vertical adjustment of multi-line labels. Default value is `auto` which means
43
+ * that value is initialized based on axis configuration. Value `0` means that label will grow towards
44
+ * the bottom of the screen. Value `-1` will make labels to grow towards the top of the screen.
45
+ * `-0.5` will make labels vertically centered.
46
+ */
47
+ labelLineCountDyFactor?: number | string;
48
+
49
+ /**
50
+ * Used for vertical adjustment of multi-line labels. Default value is 1 which means
51
+ * that labels are stacked without any space between them. Value of 1.4 will add 40% of the label height as a space between labels.
52
+ */
53
+ labelLineHeight?: number | string;
54
+
55
+ /** If `labelWrap` is on, this number is used as a measure to split labels into multiple lines. Default value is `10`. */
56
+ labelMaxLineLength?: number;
57
+
58
+ /** Set to true to hide the axis labels. */
59
+ hideLabels?: boolean;
60
+
61
+ /** Set to true to hide the axis line. */
62
+ hideLine?: boolean;
63
+
64
+ /** Set to true to hide the axis ticks. */
65
+ hideTicks?: boolean;
66
+
67
+ /** Additional CSS style to be applied to the axis line. */
68
+ lineStyle?: Cx.StyleProp;
69
+
70
+ /** Additional CSS style to be applied to the axis ticks. */
71
+ tickStyle?: Cx.StyleProp;
72
+
73
+ /** Additional CSS style to be applied to the axis labels. */
74
+ labelStyle?: Cx.StyleProp;
75
+
76
+ /** Additional CSS class to be applied to the axis line. */
77
+ lineClass?: Cx.ClassProp;
78
+
79
+ /** Additional CSS class to be applied to the axis ticks. */
80
+ tickClass?: Cx.ClassProp;
81
+
82
+ /** Additional CSS class to be applied to the axis labels. */
83
+ labelClass?: Cx.ClassProp;
84
+
85
+ onMeasured?: (info: any, instance: Instance) => void;
86
+
87
+ /** A function used to create a formatter function for axis labels. See Complex Labels example in the CxJS documentation for more info. */
88
+ onCreateLabelFormatter?:
89
+ | string
90
+ | ((
91
+ context: any,
92
+ instance: Instance
93
+ ) => (formattedValue: string, value: any) => { text: string; style?: any; className?: string }[]);
94
+ }
95
+
96
+ export class Axis extends BoundedObject {}