cx 26.9.1 → 26.9.3

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
@@ -5533,10 +5533,14 @@ class OverlayBase extends ContainerBase$1 {
5533
5533
  }
5534
5534
  } else if (context.options.dismiss) instance.dismiss = context.options.dismiss;
5535
5535
  if (instance.dismiss) {
5536
- context.push("parentOptions", {
5536
+ let parentOptions = {
5537
5537
  ...context.parentOptions,
5538
5538
  dismiss: instance.dismiss,
5539
- });
5539
+ };
5540
+ context.push("parentOptions", parentOptions);
5541
+ // The overlay's own instance captured parentOptions before this point, so
5542
+ // a controller attached to the overlay would not see its own dismiss.
5543
+ instance.parentOptions = parentOptions;
5540
5544
  }
5541
5545
  if (instance.cache("dismiss", instance.dismiss)) instance.markShouldUpdate(context);
5542
5546
  context.push("parentPositionChangeEvent", instance.positionChangeSubscribers);
@@ -9547,7 +9551,7 @@ class Field extends PureContainerBase$1 {
9547
9551
  }
9548
9552
  if (this.help != null) {
9549
9553
  let helpConfig = {};
9550
- if (this.help.isComponentType) helpConfig = this.help;
9554
+ if (this.help.isComponentType === true) helpConfig = this.help;
9551
9555
  else if (isSelector(this.help)) helpConfig.text = this.help;
9552
9556
  else Object.assign(helpConfig, this.help);
9553
9557
  this.help = HelpText.create(helpConfig);
@@ -9561,7 +9565,7 @@ class Field extends PureContainerBase$1 {
9561
9565
  style: this.labelStyle,
9562
9566
  class: this.labelClass,
9563
9567
  };
9564
- if (this.label.isComponentType) labelConfig = this.label;
9568
+ if (this.label.isComponentType === true) labelConfig = this.label;
9565
9569
  else if (isSelector(this.label)) labelConfig.text = this.label;
9566
9570
  else Object.assign(labelConfig, this.label);
9567
9571
  this.label = Label.create(labelConfig);
@@ -13187,7 +13191,7 @@ class LabeledContainer extends FieldGroup {
13187
13191
  asterisk: this.asterisk,
13188
13192
  required: true,
13189
13193
  };
13190
- if (this.label.isComponentType) labelConfig = this.label;
13194
+ if (this.label.isComponentType === true) labelConfig = this.label;
13191
13195
  else if (isSelector(this.label)) labelConfig.text = this.label;
13192
13196
  else Object.assign(labelConfig, this.label);
13193
13197
  this.label = Widget$1.create(labelConfig);
@@ -18271,7 +18275,7 @@ class Grid extends ContainerBase$1 {
18271
18275
  },
18272
18276
  });
18273
18277
  }
18274
- renderHeader(context, instance, key, fixed, fixedColumns) {
18278
+ renderHeader(context, instance, key, fixed, fixedColumns, repeated) {
18275
18279
  let { data, widget, header } = instance;
18276
18280
  let { CSS, baseClass } = widget;
18277
18281
  let headerRows = [];
@@ -18427,13 +18431,15 @@ class Grid extends ContainerBase$1 {
18427
18431
  }
18428
18432
  });
18429
18433
  if (headerRows.length == 0) return null;
18430
- return jsx(
18431
- "tbody",
18434
+ //headers repeated for each group sit between the data rows, where a second thead
18435
+ //would not be allowed
18436
+ return VDOM$2.createElement(
18437
+ repeated ? "tbody" : "thead",
18432
18438
  {
18439
+ key: "h" + key,
18433
18440
  className: CSS.element(baseClass, "header"),
18434
- children: headerRows,
18435
18441
  },
18436
- "h" + key,
18442
+ headerRows,
18437
18443
  );
18438
18444
  }
18439
18445
  onHeaderMouseMove(e, column, columnInstance, gridInstance, headerLine) {
@@ -18541,6 +18547,7 @@ class Grid extends ContainerBase$1 {
18541
18547
  children: jsx("tr", {
18542
18548
  children: jsx("td", {
18543
18549
  colSpan: 1000,
18550
+ role: "columnheader",
18544
18551
  children: caption,
18545
18552
  }),
18546
18553
  }),
@@ -18605,6 +18612,7 @@ class Grid extends ContainerBase$1 {
18605
18612
  {
18606
18613
  className: cls,
18607
18614
  colSpan: colSpan,
18615
+ role: c.caption ? "columnheader" : undefined,
18608
18616
  style: style,
18609
18617
  children: v,
18610
18618
  },
@@ -18771,9 +18779,9 @@ class Grid extends ContainerBase$1 {
18771
18779
  ),
18772
18780
  );
18773
18781
  if (g.showHeader) {
18774
- record.vdom.push(this.renderHeader(context, instance, record.key + "-header", false, false));
18782
+ record.vdom.push(this.renderHeader(context, instance, record.key + "-header", false, false, true));
18775
18783
  if (hasFixedColumns)
18776
- record.fixedVdom.push(this.renderHeader(context, instance, record.key + "-header", false, true));
18784
+ record.fixedVdom.push(this.renderHeader(context, instance, record.key + "-header", false, true, true));
18777
18785
  }
18778
18786
  }
18779
18787
  if (record.type == "group-footer") {
@@ -19107,6 +19115,29 @@ class GridComponent extends VDOM$2.Component {
19107
19115
  );
19108
19116
  };
19109
19117
  }
19118
+ groupLooseRows(items) {
19119
+ let { CSS, baseClass } = this.props.instance.widget;
19120
+ let result = [];
19121
+ for (let i = 0; i < items.length; i++) {
19122
+ if (!items[i]?.props?.useTrTag) {
19123
+ result.push(items[i]);
19124
+ continue;
19125
+ }
19126
+ let start = i;
19127
+ while (i + 1 < items.length && items[i + 1]?.props?.useTrTag) i++;
19128
+ result.push(
19129
+ jsx(
19130
+ "tbody",
19131
+ {
19132
+ className: CSS.element(baseClass, "row-group"),
19133
+ children: items.slice(start, i + 1),
19134
+ },
19135
+ `rows-${items[start].key}`,
19136
+ ),
19137
+ );
19138
+ }
19139
+ return result;
19140
+ }
19110
19141
  render() {
19111
19142
  let { instance, data, fixedFooter, fixedColumnsFixedFooter } = this.props;
19112
19143
  let { widget, hasFixedColumns } = instance;
@@ -19353,6 +19384,12 @@ class GridComponent extends VDOM$2.Component {
19353
19384
  if (hasFixedColumns) fixedChildren.push(fixedColumnsFixedFooter);
19354
19385
  }
19355
19386
  }
19387
+ //grids with merged cells render rows as tr elements, as rowspan cannot cross row group
19388
+ //boundaries, so consecutive rows have to share a tbody instead of getting one each
19389
+ if (instance.row.hasMergedCells) {
19390
+ children = this.groupLooseRows(children);
19391
+ if (hasFixedColumns) fixedChildren = this.groupLooseRows(fixedChildren);
19392
+ }
19356
19393
  let shouldRenderFixedFooter = widget.scrollable && (fixedFooter || fixedColumnsFixedFooter);
19357
19394
  if (hasFixedColumns) {
19358
19395
  fixedColumnsContent.push(
@@ -20250,16 +20287,18 @@ class GridComponent extends VDOM$2.Component {
20250
20287
  if (this.state.focused && !this.state.cellEdit && wasCellEditing) FocusManager.focus(this.dom.el);
20251
20288
  if (scrollIntoView) {
20252
20289
  let record = this.getRecordAt(index);
20253
- let item = record && this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
20290
+ //rows are tbody elements, except in grids with merged cells, where they are tr
20291
+ let cellsOf = (rowEl) => (rowEl.tagName == "TR" ? rowEl : rowEl.firstChild).children;
20292
+ let item = record && this.dom.table.querySelector(`[data-record-key="${record.key}"]`);
20254
20293
  let hscroll = false;
20255
20294
  if (item) {
20256
20295
  if (widget.cellEditable)
20257
20296
  if (this.state.cursorCellIndex >= this.props.instance.fixedColumnCount) {
20258
20297
  hscroll = true;
20259
- item = item.firstChild.children[this.state.cursorCellIndex - this.props.instance.fixedColumnCount];
20298
+ item = cellsOf(item)[this.state.cursorCellIndex - this.props.instance.fixedColumnCount];
20260
20299
  } else {
20261
- let fixedItem = this.dom.fixedTable.querySelector(`tbody[data-record-key="${record.key}"]`);
20262
- let cell = fixedItem && fixedItem.firstChild.children[this.state.cursorCellIndex];
20300
+ let fixedItem = this.dom.fixedTable.querySelector(`[data-record-key="${record.key}"]`);
20301
+ let cell = fixedItem && cellsOf(fixedItem)[this.state.cursorCellIndex];
20263
20302
  if (cell) scrollElementIntoView(cell, false, true, 10);
20264
20303
  }
20265
20304
  scrollElementIntoView(item, true, hscroll, widget.cellEditable ? 10 : 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "26.9.1",
3
+ "version": "26.9.3",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "exports": {
6
6
  "./data": {
package/src/data/index.ts CHANGED
@@ -1,31 +1,31 @@
1
- export * from "./Binding";
2
- export * from "./Expression";
3
- export * from "./StringTemplate";
4
- export * from "./View";
5
- export * from "./SubscribableView";
6
- export * from "./Store";
7
- export * from "./ExposedRecordView";
8
- export * from "./ExposedValueView";
9
- export * from "./ReadOnlyDataView";
10
- export * from "./ZoomIntoPropertyView";
11
- export * from "./StructuredSelector";
12
- export * from "./computable";
13
- export * from "./getSelector";
14
- export * from "./isSelector";
15
- export * from "./Grouper";
16
- export * from "./comparer";
17
- export * from "./enableFatArrowExpansion";
18
- export * from "./ops/index";
19
- export * from "./diff/index";
20
- export * from "./Ref";
21
- export * from "./ArrayRef";
22
- export * from "./StoreProxy";
23
- export * from "./AugmentedViewBase";
24
- export * from "./ArrayElementView";
25
- export * from "./getAccessor";
26
- export * from "./defaultCompare";
27
- export * from "./NestedDataView";
28
- export * from "./AggregateFunction";
29
-
30
- export * from "./createAccessorModelProxy";
31
- export * from "./Selector";
1
+ export * from "./Binding";
2
+ export * from "./Expression";
3
+ export * from "./StringTemplate";
4
+ export * from "./View";
5
+ export * from "./SubscribableView";
6
+ export * from "./Store";
7
+ export * from "./ExposedRecordView";
8
+ export * from "./ExposedValueView";
9
+ export * from "./ReadOnlyDataView";
10
+ export * from "./ZoomIntoPropertyView";
11
+ export * from "./StructuredSelector";
12
+ export * from "./computable";
13
+ export * from "./getSelector";
14
+ export * from "./isSelector";
15
+ export * from "./Grouper";
16
+ export * from "./comparer";
17
+ export * from "./enableFatArrowExpansion";
18
+ export * from "./ops/index";
19
+ export * from "./diff/index";
20
+ export * from "./Ref";
21
+ export * from "./ArrayRef";
22
+ export * from "./StoreProxy";
23
+ export * from "./AugmentedViewBase";
24
+ export * from "./ArrayElementView";
25
+ export * from "./getAccessor";
26
+ export * from "./defaultCompare";
27
+ export * from "./NestedDataView";
28
+ export * from "./AggregateFunction";
29
+
30
+ export * from "./createAccessorModelProxy";
31
+ export * from "./Selector";