cx 24.3.6 → 24.3.7

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
@@ -16921,44 +16921,32 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
16921
16921
  },
16922
16922
  "dropzone",
16923
16923
  );
16924
+ var isDataRecord = widget.buffered
16925
+ ? function (item) {
16926
+ var _item$props;
16927
+ return (
16928
+ ((_item$props = item.props) == null ||
16929
+ (_item$props = _item$props.instance) == null ||
16930
+ (_item$props = _item$props.data) == null
16931
+ ? void 0
16932
+ : _item$props["class"]) == "cxe-grid-data"
16933
+ );
16934
+ }
16935
+ : function (item) {
16936
+ var _item$props2;
16937
+ return (_item$props2 = item.props) == null || (_item$props2 = _item$props2.record) == null
16938
+ ? void 0
16939
+ : _item$props2.type;
16940
+ };
16924
16941
  var index = 0;
16925
- while (
16926
- index < children.length &&
16927
- ((_children$index = children[index]) == null ||
16928
- (_children$index = _children$index.props) == null ||
16929
- (_children$index = _children$index.record) == null
16930
- ? void 0
16931
- : _children$index.type) != "data"
16932
- ) {
16933
- var _children$index;
16934
- index++;
16935
- }
16942
+ while (index < children.length && !isDataRecord(children[index])) index++;
16936
16943
  var count = 0;
16937
16944
  while (index < children.length && count < this.state.dropInsertionIndex) {
16938
- var _children$index2;
16939
- if (
16940
- ((_children$index2 = children[index]) == null ||
16941
- (_children$index2 = _children$index2.props) == null ||
16942
- (_children$index2 = _children$index2.record) == null
16943
- ? void 0
16944
- : _children$index2.type) == "data"
16945
- )
16946
- count++;
16945
+ if (isDataRecord(children[index])) count++;
16947
16946
  index++;
16948
16947
  }
16949
16948
  var savedIndexPos = index;
16950
- if (!this.state.dropNextToTheRowAbove)
16951
- while (
16952
- index < children.length &&
16953
- ((_children$index3 = children[index]) == null ||
16954
- (_children$index3 = _children$index3.props) == null ||
16955
- (_children$index3 = _children$index3.record) == null
16956
- ? void 0
16957
- : _children$index3.type) != "data"
16958
- ) {
16959
- var _children$index3;
16960
- index++;
16961
- }
16949
+ if (!this.state.dropNextToTheRowAbove) while (index < children.length && !isDataRecord(children[index])) index++;
16962
16950
 
16963
16951
  // do not allow insertion after the last group footer
16964
16952
  if (savedIndexPos < index && index == children.length) index = savedIndexPos;
@@ -17353,15 +17341,15 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
17353
17341
  if (dropTarget == "grid" && widget.onDrop && dropInsertionIndex != null) {
17354
17342
  e.target = {
17355
17343
  insertionIndex: start + dropInsertionIndex,
17356
- recordBefore: this.getRecordAt(start + dropInsertionIndex - 1),
17357
- recordAfter: this.getRecordAt(start + dropInsertionIndex),
17344
+ recordBefore: this.getDataRecordAt(start + dropInsertionIndex - 1),
17345
+ recordAfter: this.getDataRecordAt(start + dropInsertionIndex),
17358
17346
  dropNextToTheRowAbove: dropNextToTheRowAbove,
17359
17347
  };
17360
17348
  instance.invoke("onDrop", e, instance);
17361
17349
  } else if (dropTarget == "row") {
17362
17350
  e.target = {
17363
17351
  index: start + dropInsertionIndex,
17364
- record: this.getRecordAt(start + dropInsertionIndex),
17352
+ record: this.getDataRecordAt(start + dropInsertionIndex),
17365
17353
  };
17366
17354
  instance.invoke("onRowDrop", e, instance);
17367
17355
  } else if (dropTarget == "column" && widget.onColumnDrop) {
@@ -18034,6 +18022,14 @@ var GridComponent = /*#__PURE__*/ (function (_VDOM$Component) {
18034
18022
  }
18035
18023
  widget.selection.selectMultiple(instance.store, selection, indexes, options);
18036
18024
  };
18025
+ _proto2.getDataRecordAt = function getDataRecordAt(index) {
18026
+ var records = this.props.instance.records;
18027
+ if (!records) return this.getRecordAt(index);
18028
+ var dataRecords = records.filter(function (r) {
18029
+ return r.type == "data";
18030
+ });
18031
+ return dataRecords[index];
18032
+ };
18037
18033
  _proto2.getRecordAt = function getRecordAt(cursor) {
18038
18034
  var _this$props7 = this.props,
18039
18035
  instance = _this$props7.instance,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.3.6",
3
+ "version": "24.3.7",
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",
@@ -1594,19 +1594,23 @@ class GridComponent extends VDOM.Component {
1594
1594
  </tbody>
1595
1595
  );
1596
1596
 
1597
+ let isDataRecord = widget.buffered
1598
+ ? (item) => item.props?.instance?.data?.class == "cxe-grid-data"
1599
+ : (item) => item.props?.record?.type;
1600
+
1597
1601
  let index = 0;
1598
- while (index < children.length && children[index]?.props?.record?.type != "data") index++;
1602
+ while (index < children.length && !isDataRecord(children[index])) index++;
1599
1603
 
1600
1604
  let count = 0;
1601
1605
  while (index < children.length && count < this.state.dropInsertionIndex) {
1602
- if (children[index]?.props?.record?.type == "data") count++;
1606
+ if (isDataRecord(children[index])) count++;
1603
1607
  index++;
1604
1608
  }
1605
1609
 
1606
1610
  let savedIndexPos = index;
1607
1611
 
1608
1612
  if (!this.state.dropNextToTheRowAbove)
1609
- while (index < children.length && children[index]?.props?.record?.type != "data") index++;
1613
+ while (index < children.length && !isDataRecord(children[index])) index++;
1610
1614
 
1611
1615
  // do not allow insertion after the last group footer
1612
1616
  if (savedIndexPos < index && index == children.length) index = savedIndexPos;
@@ -2002,15 +2006,15 @@ class GridComponent extends VDOM.Component {
2002
2006
  if (dropTarget == "grid" && widget.onDrop && dropInsertionIndex != null) {
2003
2007
  e.target = {
2004
2008
  insertionIndex: start + dropInsertionIndex,
2005
- recordBefore: this.getRecordAt(start + dropInsertionIndex - 1),
2006
- recordAfter: this.getRecordAt(start + dropInsertionIndex),
2009
+ recordBefore: this.getDataRecordAt(start + dropInsertionIndex - 1),
2010
+ recordAfter: this.getDataRecordAt(start + dropInsertionIndex),
2007
2011
  dropNextToTheRowAbove,
2008
2012
  };
2009
2013
  instance.invoke("onDrop", e, instance);
2010
2014
  } else if (dropTarget == "row") {
2011
2015
  e.target = {
2012
2016
  index: start + dropInsertionIndex,
2013
- record: this.getRecordAt(start + dropInsertionIndex),
2017
+ record: this.getDataRecordAt(start + dropInsertionIndex),
2014
2018
  };
2015
2019
  instance.invoke("onRowDrop", e, instance);
2016
2020
  } else if (dropTarget == "column" && widget.onColumnDrop) {
@@ -2730,6 +2734,13 @@ class GridComponent extends VDOM.Component {
2730
2734
  widget.selection.selectMultiple(instance.store, selection, indexes, options);
2731
2735
  }
2732
2736
 
2737
+ getDataRecordAt(index) {
2738
+ let { records } = this.props.instance;
2739
+ if (!records) return this.getRecordAt(index);
2740
+ let dataRecords = records.filter((r) => r.type == "data");
2741
+ return dataRecords[index];
2742
+ }
2743
+
2733
2744
  getRecordAt(cursor) {
2734
2745
  let { instance, data } = this.props;
2735
2746
  let { records, widget } = instance;