cx 26.1.13 → 26.2.0
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/build/charts/Marker.d.ts +1 -1
- package/build/charts/Marker.d.ts.map +1 -1
- package/build/charts/Marker.js +16 -6
- package/build/charts/MouseTracker.d.ts +2 -0
- package/build/charts/MouseTracker.d.ts.map +1 -1
- package/build/charts/helpers/PointReducer.d.ts +2 -2
- package/build/charts/helpers/PointReducer.d.ts.map +1 -1
- package/build/data/View.d.ts +5 -3
- package/build/data/View.d.ts.map +1 -1
- package/build/data/View.js +3 -1
- package/build/data/ops/findTreeNode.d.ts +20 -1
- package/build/data/ops/findTreeNode.d.ts.map +1 -1
- package/build/data/ops/findTreeNode.js +19 -0
- package/build/data/ops/findTreePath.d.ts +1 -1
- package/build/data/ops/findTreePath.d.ts.map +1 -1
- package/build/data/ops/findTreePath.js +1 -1
- package/build/data/ops/removeTreeNodes.d.ts +14 -1
- package/build/data/ops/removeTreeNodes.d.ts.map +1 -1
- package/build/data/ops/removeTreeNodes.js +13 -0
- package/build/data/ops/updateArray.d.ts +1 -1
- package/build/data/ops/updateArray.d.ts.map +1 -1
- package/build/data/ops/updateArray.js +1 -1
- package/build/data/ops/updateTree.d.ts +20 -1
- package/build/data/ops/updateTree.d.ts.map +1 -1
- package/build/data/ops/updateTree.js +19 -0
- package/build/jsx-runtime.d.ts +1 -0
- package/build/jsx-runtime.d.ts.map +1 -1
- package/build/jsx-runtime.js +3 -1
- package/build/svg/Rectangle.d.ts +6 -4
- package/build/svg/Rectangle.d.ts.map +1 -1
- package/build/svg/Rectangle.js +9 -7
- package/build/ui/Instance.d.ts +1 -1
- package/build/ui/Instance.d.ts.map +1 -1
- package/build/ui/Instance.js +18 -8
- package/build/ui/IsolatedScope.d.ts +2 -1
- package/build/ui/IsolatedScope.d.ts.map +1 -1
- package/build/ui/Prop.d.ts +1 -1
- package/build/ui/Prop.d.ts.map +1 -1
- package/build/ui/Widget.d.ts +2 -0
- package/build/ui/Widget.d.ts.map +1 -1
- package/build/ui/Widget.js +4 -0
- package/build/ui/adapter/GroupAdapter.d.ts +4 -4
- package/build/ui/adapter/GroupAdapter.d.ts.map +1 -1
- package/build/ui/adapter/GroupAdapter.js +4 -4
- package/build/ui/adapter/TreeAdapter.d.ts +5 -3
- package/build/ui/adapter/TreeAdapter.d.ts.map +1 -1
- package/build/ui/adapter/TreeAdapter.js +12 -5
- package/build/ui/app/startAppLoop.d.ts +2 -2
- package/build/ui/app/startAppLoop.d.ts.map +1 -1
- package/build/ui/app/startHotAppLoop.d.ts +4 -4
- package/build/ui/app/startHotAppLoop.d.ts.map +1 -1
- package/build/ui/app/startHotAppLoop.js +1 -1
- package/build/ui/batchUpdates.d.ts.map +1 -1
- package/build/ui/batchUpdates.js +3 -4
- package/build/widgets/Button.d.ts +0 -7
- package/build/widgets/Button.d.ts.map +1 -1
- package/build/widgets/HtmlElement.d.ts +2 -2
- package/build/widgets/HtmlElement.d.ts.map +1 -1
- package/build/widgets/form/Checkbox.d.ts +3 -3
- package/build/widgets/form/Checkbox.d.ts.map +1 -1
- package/build/widgets/form/Checkbox.js +11 -6
- package/build/widgets/form/DateTimeField.d.ts +4 -0
- package/build/widgets/form/DateTimeField.d.ts.map +1 -1
- package/build/widgets/form/TextField.d.ts +2 -2
- package/build/widgets/form/TextField.d.ts.map +1 -1
- package/build/widgets/grid/Grid.d.ts +20 -16
- package/build/widgets/grid/Grid.d.ts.map +1 -1
- package/build/widgets/grid/Grid.js +200 -86
- package/build/widgets/nav/Menu.d.ts +2 -0
- package/build/widgets/nav/Menu.d.ts.map +1 -1
- package/build/widgets/nav/Route.js +1 -1
- package/build/widgets/overlay/FlyweightTooltipTracker.d.ts +6 -4
- package/build/widgets/overlay/FlyweightTooltipTracker.d.ts.map +1 -1
- package/build/widgets/overlay/FlyweightTooltipTracker.js +3 -0
- package/build/widgets/overlay/Overlay.d.ts +2 -2
- package/build/widgets/overlay/Overlay.d.ts.map +1 -1
- package/dist/data.js +52 -1
- package/dist/jsx-runtime.js +4 -2
- package/dist/manifest.js +910 -904
- package/dist/svg.js +3 -0
- package/dist/ui.js +1548 -1544
- package/dist/widgets.css +1 -1
- package/dist/widgets.js +395 -4
- package/package.json +2 -2
- package/src/charts/Marker.tsx +448 -394
- package/src/charts/MouseTracker.tsx +3 -0
- package/src/charts/helpers/PointReducer.ts +2 -2
- package/src/data/View.ts +76 -19
- package/src/data/ops/findTreeNode.ts +20 -1
- package/src/data/ops/findTreePath.ts +7 -2
- package/src/data/ops/removeTreeNodes.ts +14 -1
- package/src/data/ops/updateArray.ts +4 -4
- package/src/data/ops/updateTree.ts +32 -6
- package/src/index.scss +6 -6
- package/src/jsx-runtime.spec.tsx +40 -0
- package/src/jsx-runtime.ts +87 -84
- package/src/svg/Rectangle.tsx +80 -73
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Instance.ts +142 -45
- package/src/ui/IsolatedScope.ts +4 -2
- package/src/ui/Prop.ts +141 -141
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/Widget.tsx +292 -234
- package/src/ui/adapter/ArrayAdapter.ts +229 -229
- package/src/ui/adapter/GroupAdapter.ts +8 -10
- package/src/ui/adapter/TreeAdapter.ts +75 -15
- package/src/ui/app/Url.spec.ts +1 -1
- package/src/ui/app/startAppLoop.tsx +56 -45
- package/src/ui/app/startHotAppLoop.ts +4 -4
- package/src/ui/batchUpdates.ts +16 -21
- package/src/ui/exprHelpers.ts +96 -96
- package/src/widgets/Button.tsx +0 -8
- package/src/widgets/HtmlElement.spec.tsx +100 -72
- package/src/widgets/HtmlElement.tsx +11 -10
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/Section.scss +55 -55
- package/src/widgets/drag-drop/DropZone.scss +74 -74
- package/src/widgets/form/Checkbox.tsx +296 -243
- package/src/widgets/form/DateTimeField.tsx +6 -0
- package/src/widgets/form/TextField.tsx +2 -2
- package/src/widgets/grid/Grid.scss +43 -10
- package/src/widgets/grid/Grid.tsx +4401 -3848
- package/src/widgets/nav/Menu.tsx +3 -0
- package/src/widgets/nav/Route.ts +1 -1
- package/src/widgets/overlay/FlyweightTooltipTracker.ts +15 -4
- package/src/widgets/overlay/Overlay.tsx +2 -1
- package/src/widgets/overlay/index.d.ts +11 -11
|
@@ -8,11 +8,11 @@ import { GroupAdapter } from "../../ui/adapter/GroupAdapter";
|
|
|
8
8
|
import { batchUpdates } from "../../ui/batchUpdates";
|
|
9
9
|
import { ContainerBase } from "../../ui/Container";
|
|
10
10
|
import { Cx } from "../../ui/Cx";
|
|
11
|
-
import { FocusManager, offFocusOut, oneFocusOut, unfocusElement } from "../../ui/FocusManager";
|
|
11
|
+
import { FocusManager, offFocusOut, oneFocusOut, unfocusElement, } from "../../ui/FocusManager";
|
|
12
12
|
import { Format } from "../../ui/Format";
|
|
13
|
-
import { InstanceCache } from "../../ui/Instance";
|
|
13
|
+
import { Instance, InstanceCache } from "../../ui/Instance";
|
|
14
14
|
import { Localization } from "../../ui/Localization";
|
|
15
|
-
import { PureContainer, PureContainerBase } from "../../ui/PureContainer";
|
|
15
|
+
import { PureContainer, PureContainerBase, } from "../../ui/PureContainer";
|
|
16
16
|
import { RenderingContext } from "../../ui/RenderingContext";
|
|
17
17
|
import { ResizeManager } from "../../ui/ResizeManager";
|
|
18
18
|
import { Selection } from "../../ui/selection/Selection";
|
|
@@ -43,7 +43,12 @@ import DropDownIcon from "../icons/sort-asc";
|
|
|
43
43
|
import { captureMouse2, getCursorPos } from "../overlay/captureMouse";
|
|
44
44
|
import { tooltipMouseLeave, tooltipMouseMove } from "../overlay/tooltip-ops";
|
|
45
45
|
import { createGridCellEditor } from "./createGridCellEditor";
|
|
46
|
-
import { GridRow, GridRowComponent } from "./GridRow";
|
|
46
|
+
import { GridRow, GridRowComponent, } from "./GridRow";
|
|
47
|
+
export class GridInstance extends Instance {
|
|
48
|
+
resetColumnWidths() {
|
|
49
|
+
this.setState({ colWidth: {} });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
47
52
|
export class Grid extends ContainerBase {
|
|
48
53
|
constructor(config) {
|
|
49
54
|
super(config);
|
|
@@ -90,6 +95,9 @@ export class Grid extends ContainerBase {
|
|
|
90
95
|
this.focusable = !this.selection.isDummy || this.cellEditable;
|
|
91
96
|
super.init();
|
|
92
97
|
}
|
|
98
|
+
createInstance(key, parent, parentStore) {
|
|
99
|
+
return new GridInstance(this, key, parent, parentStore);
|
|
100
|
+
}
|
|
93
101
|
initState(context, instance) {
|
|
94
102
|
instance.state = {
|
|
95
103
|
colWidth: {},
|
|
@@ -153,7 +161,11 @@ export class Grid extends ContainerBase {
|
|
|
153
161
|
Console.warn("Merged columns are only supported in grids in which rows have only one line of cells.");
|
|
154
162
|
else {
|
|
155
163
|
row.hasMergedCells = true;
|
|
156
|
-
row.mergedColumns.push({
|
|
164
|
+
row.mergedColumns.push({
|
|
165
|
+
uniqueColumnId: c.uniqueColumnId,
|
|
166
|
+
index,
|
|
167
|
+
mode: c.mergeCells,
|
|
168
|
+
});
|
|
157
169
|
}
|
|
158
170
|
}
|
|
159
171
|
if (c.resizable ||
|
|
@@ -162,7 +174,9 @@ export class Grid extends ContainerBase {
|
|
|
162
174
|
(c.header2 && c.header2.resizable) ||
|
|
163
175
|
(c.header3 && c.header3.resizable))
|
|
164
176
|
row.hasResizableColumns = true;
|
|
165
|
-
if (c.aggregate &&
|
|
177
|
+
if (c.aggregate &&
|
|
178
|
+
c.aggregateAlias &&
|
|
179
|
+
(c.aggregateField || isDefined(c.aggregateValue))) {
|
|
166
180
|
aggregates[c.aggregateAlias] = {
|
|
167
181
|
value: isDefined(c.aggregateValue)
|
|
168
182
|
? c.aggregateValue
|
|
@@ -185,7 +199,8 @@ export class Grid extends ContainerBase {
|
|
|
185
199
|
});
|
|
186
200
|
});
|
|
187
201
|
//add default footer if some columns have aggregates and grouping is not defined
|
|
188
|
-
if (!groupingData &&
|
|
202
|
+
if (!groupingData &&
|
|
203
|
+
(Object.keys(aggregates).length > 0 || this.fixedFooter || showFooter))
|
|
189
204
|
groupingData = [
|
|
190
205
|
{
|
|
191
206
|
key: {},
|
|
@@ -232,7 +247,9 @@ export class Grid extends ContainerBase {
|
|
|
232
247
|
grouping = cached.grouping;
|
|
233
248
|
}
|
|
234
249
|
let groupingChanged = instance.cache("grouping", grouping);
|
|
235
|
-
if (instance.cache("columnParams", data.columnParams) ||
|
|
250
|
+
if (instance.cache("columnParams", data.columnParams) ||
|
|
251
|
+
groupingChanged ||
|
|
252
|
+
!row) {
|
|
236
253
|
row = instance.row = this.createRowTemplate(context, data.columnParams, instance, grouping);
|
|
237
254
|
}
|
|
238
255
|
data.version = instance.v++;
|
|
@@ -267,7 +284,9 @@ export class Grid extends ContainerBase {
|
|
|
267
284
|
data.sorters = [sorter];
|
|
268
285
|
}
|
|
269
286
|
let skipDefaultSorting = this.clearableSort && instance.state.disableDefaultSort;
|
|
270
|
-
if (!skipDefaultSorting &&
|
|
287
|
+
if (!skipDefaultSorting &&
|
|
288
|
+
!isNonEmptyArray(data.sorters) &&
|
|
289
|
+
this.defaultSortField) {
|
|
271
290
|
let sorter = {
|
|
272
291
|
field: this.defaultSortField,
|
|
273
292
|
direction: this.defaultSortDirection || "ASC",
|
|
@@ -278,7 +297,9 @@ export class Grid extends ContainerBase {
|
|
|
278
297
|
if (sortField) {
|
|
279
298
|
for (let l = 1; l < 10; l++) {
|
|
280
299
|
let line = instance.row[`line${l}`];
|
|
281
|
-
let sortColumn = line &&
|
|
300
|
+
let sortColumn = line &&
|
|
301
|
+
line.columns &&
|
|
302
|
+
line.columns.find((c) => c.field == sortField);
|
|
282
303
|
if (sortColumn) {
|
|
283
304
|
data.sorters[0].value = sortColumn.sortValue || sortColumn.value;
|
|
284
305
|
data.sorters[0].comparer = sortColumn.comparer;
|
|
@@ -439,7 +460,9 @@ export class Grid extends ContainerBase {
|
|
|
439
460
|
}
|
|
440
461
|
render(context, instance, key) {
|
|
441
462
|
let { data, hasFixedColumns } = instance;
|
|
442
|
-
let fixedHeader = data.scrollable &&
|
|
463
|
+
let fixedHeader = data.scrollable &&
|
|
464
|
+
this.showHeader &&
|
|
465
|
+
this.renderHeader(context, instance, "header", true, false);
|
|
443
466
|
let fixedColumnsFixedHeader = data.scrollable &&
|
|
444
467
|
this.showHeader &&
|
|
445
468
|
hasFixedColumns &&
|
|
@@ -448,8 +471,11 @@ export class Grid extends ContainerBase {
|
|
|
448
471
|
this.renderRows(context, instance);
|
|
449
472
|
if (this.fixedFooter)
|
|
450
473
|
this.renderFixedFooter(context, instance);
|
|
451
|
-
let header = this.showHeader &&
|
|
452
|
-
|
|
474
|
+
let header = this.showHeader &&
|
|
475
|
+
this.renderHeader(context, instance, "header", false, false);
|
|
476
|
+
let fixedColumnsHeader = this.showHeader &&
|
|
477
|
+
hasFixedColumns &&
|
|
478
|
+
this.renderHeader(context, instance, "header", false, true);
|
|
453
479
|
return (_jsx(GridComponent, { instance: instance, data: instance.data, shouldUpdate: instance.shouldUpdate, header: header, fixedColumnsHeader: fixedColumnsHeader, fixedColumnsFixedHeader: fixedColumnsFixedHeader, fixedHeader: fixedHeader, fixedFooter: instance.fixedFooterVDOM, fixedColumnsFixedFooter: instance.fixedColumnsFixedFooterVDOM, children: this.renderChildren(context, instance) }, key));
|
|
454
480
|
}
|
|
455
481
|
renderResizer(instance, hdinst, header, colIndex, forPreviousColumn) {
|
|
@@ -465,9 +491,10 @@ export class Grid extends ContainerBase {
|
|
|
465
491
|
if (e.buttons != 1)
|
|
466
492
|
return;
|
|
467
493
|
let resizeOverlayEl = document.createElement("div");
|
|
468
|
-
let gridEl = e.target.parentElement.parentElement
|
|
469
|
-
.parentElement.parentElement;
|
|
470
|
-
let uniqueColId = e.currentTarget.dataset
|
|
494
|
+
let gridEl = e.target.parentElement.parentElement
|
|
495
|
+
.parentElement.parentElement.parentElement.parentElement;
|
|
496
|
+
let uniqueColId = e.currentTarget.dataset
|
|
497
|
+
.uniqueColId;
|
|
471
498
|
// if we use fixed columns, rhs resizer of the last fixed column is within regular columns header tbody
|
|
472
499
|
let headerCell = findFirstChild(gridEl, (el) => el.tagName == "TH" &&
|
|
473
500
|
el.dataset &&
|
|
@@ -476,7 +503,8 @@ export class Grid extends ContainerBase {
|
|
|
476
503
|
let initialPosition = getCursorPos(e);
|
|
477
504
|
resizeOverlayEl.className = CSS.element(baseClass, "resize-overlay");
|
|
478
505
|
resizeOverlayEl.style.width = `${initialWidth}px`;
|
|
479
|
-
resizeOverlayEl.style.left = `${headerCell.getBoundingClientRect().left -
|
|
506
|
+
resizeOverlayEl.style.left = `${headerCell.getBoundingClientRect().left -
|
|
507
|
+
gridEl.getBoundingClientRect().left}px`;
|
|
480
508
|
gridEl.appendChild(resizeOverlayEl);
|
|
481
509
|
captureMouse2(e, {
|
|
482
510
|
onMouseMove: (e) => {
|
|
@@ -570,9 +598,10 @@ export class Grid extends ContainerBase {
|
|
|
570
598
|
mods.push("aligned-" + hdwidget.align);
|
|
571
599
|
if (hdwidget.sortable && header.widget.allowSorting) {
|
|
572
600
|
mods.push("sortable");
|
|
573
|
-
if (data.sorters &&
|
|
601
|
+
if (data.sorters &&
|
|
602
|
+
data.sorters[0].field == (hdwidget.sortField || hdwidget.field)) {
|
|
574
603
|
mods.push("sorted-" + data.sorters[0].direction.toLowerCase());
|
|
575
|
-
sortIcon = _jsx(DropDownIcon, { className: CSS.element(baseClass, "column-sort-icon") });
|
|
604
|
+
sortIcon = (_jsx(DropDownIcon, { className: CSS.element(baseClass, "column-sort-icon") }));
|
|
576
605
|
}
|
|
577
606
|
}
|
|
578
607
|
let uniqueColumnId = header.data.colSpan > 1 ? null : hdwidget.uniqueColumnId;
|
|
@@ -606,7 +635,8 @@ export class Grid extends ContainerBase {
|
|
|
606
635
|
for (let c = 0; c < header.data.colSpan; c++)
|
|
607
636
|
skip[`${lineIndex + l + r}-${colIndex + c}`] = true;
|
|
608
637
|
}
|
|
609
|
-
if ((hdwidget.resizable || header.data.resizable) &&
|
|
638
|
+
if ((hdwidget.resizable || header.data.resizable) &&
|
|
639
|
+
header.data.colSpan < 2) {
|
|
610
640
|
resizer = this.renderResizer(instance, hdinst, header, colIndex);
|
|
611
641
|
}
|
|
612
642
|
if (colIndex > 0) {
|
|
@@ -623,7 +653,8 @@ export class Grid extends ContainerBase {
|
|
|
623
653
|
}
|
|
624
654
|
}
|
|
625
655
|
}
|
|
626
|
-
cls =
|
|
656
|
+
cls =
|
|
657
|
+
CSS.element(baseClass, "col-header", mods) + (cls ? " " + cls : "");
|
|
627
658
|
let onContextMenu;
|
|
628
659
|
if (this.onColumnContextMenu)
|
|
629
660
|
onContextMenu = (e) => instance.invoke("onColumnContextMenu", e, hdinst);
|
|
@@ -670,7 +701,7 @@ export class Grid extends ContainerBase {
|
|
|
670
701
|
store: store,
|
|
671
702
|
matchCursorOffset: true,
|
|
672
703
|
matchWidth: true,
|
|
673
|
-
widget: () => _jsx("div", { className: CSS.element(baseClass, "col-header-drag-clone"), children: data.text }),
|
|
704
|
+
widget: () => (_jsx("div", { className: CSS.element(baseClass, "col-header-drag-clone"), children: data.text })),
|
|
674
705
|
},
|
|
675
706
|
}, () => { });
|
|
676
707
|
}
|
|
@@ -692,14 +723,20 @@ export class Grid extends ContainerBase {
|
|
|
692
723
|
let value = column.sortValue || column.value;
|
|
693
724
|
let comparer = column.comparer;
|
|
694
725
|
let sortOptions = column.sortOptions;
|
|
695
|
-
if (header &&
|
|
726
|
+
if (header &&
|
|
727
|
+
header.allowSorting &&
|
|
728
|
+
column.sortable &&
|
|
729
|
+
(field || value || data.sortField)) {
|
|
696
730
|
let direction = column.primarySortDirection ?? "ASC";
|
|
697
731
|
if (isNonEmptyArray(data.sorters) &&
|
|
698
|
-
((!!data.sorters[0].field &&
|
|
732
|
+
((!!data.sorters[0].field &&
|
|
733
|
+
data.sorters[0].field == (field || data.sortField)) ||
|
|
699
734
|
(!!value && data.sorters[0].value == value))) {
|
|
700
|
-
if (data.sorters[0].direction == "ASC" &&
|
|
735
|
+
if (data.sorters[0].direction == "ASC" &&
|
|
736
|
+
(!this.clearableSort || direction == "ASC"))
|
|
701
737
|
direction = "DESC";
|
|
702
|
-
else if (data.sorters[0].direction == "DESC" &&
|
|
738
|
+
else if (data.sorters[0].direction == "DESC" &&
|
|
739
|
+
(!this.clearableSort || direction == "DESC"))
|
|
703
740
|
direction = "ASC";
|
|
704
741
|
else {
|
|
705
742
|
direction = null;
|
|
@@ -731,7 +768,9 @@ export class Grid extends ContainerBase {
|
|
|
731
768
|
let data = store.getData();
|
|
732
769
|
if (g.caption) {
|
|
733
770
|
let caption = g.caption(data);
|
|
734
|
-
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
771
|
+
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
772
|
+
"level-" + level,
|
|
773
|
+
]), "data-group-key": group.$key, "data-group-element": `group-caption-${level}`, children: _jsx("tr", { children: _jsx("td", { colSpan: 1000, children: caption }) }) }, `g-${level}-${group.$key}`));
|
|
735
774
|
}
|
|
736
775
|
else if (g.showCaption) {
|
|
737
776
|
let skip = 0;
|
|
@@ -747,7 +786,7 @@ export class Grid extends ContainerBase {
|
|
|
747
786
|
let v, c = ci.widget, colSpan, pad, cls = "", style = null;
|
|
748
787
|
if (c.caption) {
|
|
749
788
|
if (c.caption.children)
|
|
750
|
-
v = _jsx(Cx, { widget: c.caption.children, store: store, parentInstance: instance, subscribe: true });
|
|
789
|
+
v = (_jsx(Cx, { widget: c.caption.children, store: store, parentInstance: instance, subscribe: true }));
|
|
751
790
|
else {
|
|
752
791
|
v = c.caption.value(data);
|
|
753
792
|
let fmt = c.caption.format(data);
|
|
@@ -769,7 +808,9 @@ export class Grid extends ContainerBase {
|
|
|
769
808
|
if (colSpan > 1)
|
|
770
809
|
skip = colSpan - 1;
|
|
771
810
|
}
|
|
772
|
-
else if (c.aggregate &&
|
|
811
|
+
else if (c.aggregate &&
|
|
812
|
+
c.aggregateAliasGetter &&
|
|
813
|
+
c.caption !== false) {
|
|
773
814
|
empty = false;
|
|
774
815
|
v = c.aggregateAliasGetter(group);
|
|
775
816
|
if (isString(ci.data.format))
|
|
@@ -789,7 +830,9 @@ export class Grid extends ContainerBase {
|
|
|
789
830
|
});
|
|
790
831
|
if (lines.length == 0)
|
|
791
832
|
return null;
|
|
792
|
-
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
833
|
+
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
834
|
+
"level-" + level,
|
|
835
|
+
]), "data-group-key": group.$key, "data-group-element": `group-caption-${level}`, children: lines }, "c" + group.$key));
|
|
793
836
|
}
|
|
794
837
|
}
|
|
795
838
|
renderGroupFooter(context, instance, g, level, group, i, store, fixed, fixedColumns) {
|
|
@@ -827,7 +870,9 @@ export class Grid extends ContainerBase {
|
|
|
827
870
|
if (colSpan > 1)
|
|
828
871
|
skip = colSpan - 1;
|
|
829
872
|
}
|
|
830
|
-
else if (c.aggregate &&
|
|
873
|
+
else if (c.aggregate &&
|
|
874
|
+
c.aggregateAliasGetter &&
|
|
875
|
+
c.footer !== false) {
|
|
831
876
|
empty = false;
|
|
832
877
|
v = c.aggregateAliasGetter(group);
|
|
833
878
|
if (isString(ci.data.format))
|
|
@@ -1002,7 +1047,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1002
1047
|
};
|
|
1003
1048
|
}
|
|
1004
1049
|
getBufferStartEnd() {
|
|
1005
|
-
return this.syncBuffering
|
|
1050
|
+
return this.syncBuffering
|
|
1051
|
+
? { start: this.start, end: this.end }
|
|
1052
|
+
: this.state;
|
|
1006
1053
|
}
|
|
1007
1054
|
renderCellEditor(key, CSS, baseClass, instance, column) {
|
|
1008
1055
|
//add an inner div with fixed height in order to help IE absolutely position the contents inside
|
|
@@ -1024,7 +1071,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1024
1071
|
let { widget, isRecordSelectable, visibleColumns, isRecordDraggable, row } = instance;
|
|
1025
1072
|
let { CSS, baseClass } = widget;
|
|
1026
1073
|
let { dragSource } = data;
|
|
1027
|
-
let { dragged, cursor, cursorCellIndex, cellEdit, dropInsertionIndex, dropTarget } = this.state;
|
|
1074
|
+
let { dragged, cursor, cursorCellIndex, cellEdit, dropInsertionIndex, dropTarget, } = this.state;
|
|
1028
1075
|
let { colWidth, dimensionsVersion } = instance.state;
|
|
1029
1076
|
let { hasMergedCells } = row;
|
|
1030
1077
|
return (record, index, standalone, fixed) => {
|
|
@@ -1050,12 +1097,15 @@ class GridComponent extends VDOM.Component {
|
|
|
1050
1097
|
let wrap = (children) => {
|
|
1051
1098
|
let skipCells = {};
|
|
1052
1099
|
return (_jsx(GridRowComponent, { className: CSS.state(mod), store: store, dragSource: dragSource, instance: row, grid: instance, record: record, parent: this, cursorIndex: index, selected: row?.selected, isBeingDragged: dragged, isDraggedOver: mod.over, cursor: mod.cursor, cursorCellIndex: index == cursor && cursorCellIndex, cellEdit: index == cursor && cursorCellIndex != null && cellEdit, shouldUpdate: row?.shouldUpdate, dimensionsVersion: dimensionsVersion, fixed: fixed, useTrTag: hasMergedCells, children: children.content.map(({ key, data, content }, line) => {
|
|
1053
|
-
let cells = content.map(({ key, data, content, uniqueColumnId, merged, mergeRowSpan }, cellIndex) => {
|
|
1100
|
+
let cells = content.map(({ key, data, content, uniqueColumnId, merged, mergeRowSpan, }, cellIndex) => {
|
|
1054
1101
|
if (Boolean(data.fixed) !== fixed)
|
|
1055
1102
|
return null;
|
|
1056
1103
|
if (merged)
|
|
1057
1104
|
return null;
|
|
1058
|
-
let cellected = index == cursor &&
|
|
1105
|
+
let cellected = index == cursor &&
|
|
1106
|
+
cellIndex == cursorCellIndex &&
|
|
1107
|
+
widget.cellEditable &&
|
|
1108
|
+
line == 0;
|
|
1059
1109
|
let className = cellected
|
|
1060
1110
|
? CSS.expand(data.classNames, CSS.state("cellected"))
|
|
1061
1111
|
: data.classNames;
|
|
@@ -1091,7 +1141,11 @@ class GridComponent extends VDOM.Component {
|
|
|
1091
1141
|
if (!standalone)
|
|
1092
1142
|
return wrap(record.vdom);
|
|
1093
1143
|
return (_jsx(Cx, { instance: record.row, parentInstance: instance, options: { name: "grid-row" }, contentFactory: (x) => wrap({
|
|
1094
|
-
content: Array.isArray(x.children)
|
|
1144
|
+
content: Array.isArray(x.children)
|
|
1145
|
+
? x.children
|
|
1146
|
+
: x.children != null
|
|
1147
|
+
? [x.children]
|
|
1148
|
+
: [],
|
|
1095
1149
|
data: {},
|
|
1096
1150
|
}), params: {
|
|
1097
1151
|
...mod,
|
|
@@ -1109,8 +1163,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1109
1163
|
let { CSS, baseClass } = widget;
|
|
1110
1164
|
let { start, end } = this.getBufferStartEnd();
|
|
1111
1165
|
let cellWrap = false;
|
|
1112
|
-
if (widget.cellEditable &&
|
|
1113
|
-
|
|
1166
|
+
if (widget.cellEditable &&
|
|
1167
|
+
(widget.hasResizableColumns || hasFixedColumns)) {
|
|
1168
|
+
cellWrap = (children) => (_jsx("div", { className: "cxe-grid-cell-clip", children: children }));
|
|
1114
1169
|
}
|
|
1115
1170
|
let children = [], fixedChildren = [];
|
|
1116
1171
|
let renderRow = this.createRowRenderer(cellWrap);
|
|
@@ -1177,7 +1232,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1177
1232
|
}
|
|
1178
1233
|
else if (record.type == "group-footer") {
|
|
1179
1234
|
let g = record.grouping;
|
|
1180
|
-
if (g.showFooter &&
|
|
1235
|
+
if (g.showFooter &&
|
|
1236
|
+
(!widget.fixedFooter || start + i != instance.records.length - 1)) {
|
|
1181
1237
|
children.push(widget.renderGroupFooter(null, instance, g, record.level, record.group, record.key + "-footer", record.store, false, false));
|
|
1182
1238
|
if (hasFixedColumns)
|
|
1183
1239
|
fixedChildren.push(widget.renderGroupFooter(null, instance, g, record.level, record.group, record.key + "-footer", record.store, false, true));
|
|
@@ -1212,12 +1268,15 @@ class GridComponent extends VDOM.Component {
|
|
|
1212
1268
|
break;
|
|
1213
1269
|
case "same-value":
|
|
1214
1270
|
let prevCellInfo = getCellRenderInfo(prevRow.vdom, mergedCol.index);
|
|
1215
|
-
shouldMerge =
|
|
1271
|
+
shouldMerge =
|
|
1272
|
+
!stopMerge &&
|
|
1273
|
+
cellInfo.data.value === prevCellInfo.data.value;
|
|
1216
1274
|
break;
|
|
1217
1275
|
}
|
|
1218
1276
|
if (shouldMerge) {
|
|
1219
1277
|
cellInfo.merged = true;
|
|
1220
|
-
rowSpan[mergedCol.uniqueColumnId] =
|
|
1278
|
+
rowSpan[mergedCol.uniqueColumnId] =
|
|
1279
|
+
(rowSpan[mergedCol.uniqueColumnId] ?? 1) + 1;
|
|
1221
1280
|
}
|
|
1222
1281
|
else {
|
|
1223
1282
|
if (mergedCol.mode == "same-value")
|
|
@@ -1244,7 +1303,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1244
1303
|
}
|
|
1245
1304
|
});
|
|
1246
1305
|
}
|
|
1247
|
-
if (this.state.dropTarget == "grid" &&
|
|
1306
|
+
if (this.state.dropTarget == "grid" &&
|
|
1307
|
+
this.state.dropInsertionIndex != null) {
|
|
1248
1308
|
let dragInsertionRow = (_jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { className: CSS.element(baseClass, "dropzone"), colSpan: 1000, style: {
|
|
1249
1309
|
height: data.dropMode == "insertion" ? 0 : this.state.dropItemHeight,
|
|
1250
1310
|
} }) }) }, "dropzone"));
|
|
@@ -1277,7 +1337,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1277
1337
|
_jsx("tbody", { className: CSS.element(baseClass, "empty-text"), children: _jsx("tr", { children: _jsx("td", { colSpan: 1000, children: data.emptyText }) }) }, "empty"),
|
|
1278
1338
|
];
|
|
1279
1339
|
}
|
|
1280
|
-
else if (widget.fixedFooter &&
|
|
1340
|
+
else if (widget.fixedFooter &&
|
|
1341
|
+
(widget.buffered || !instance.fixedFooterIsGroupFooter)) {
|
|
1281
1342
|
//add fixed footer content for buffered grids
|
|
1282
1343
|
if (fixedFooter || fixedColumnsFixedFooter) {
|
|
1283
1344
|
children.push(fixedFooter);
|
|
@@ -1404,12 +1465,14 @@ class GridComponent extends VDOM.Component {
|
|
|
1404
1465
|
let { data } = this.props;
|
|
1405
1466
|
if (!isNumber(totalRecordCount)) {
|
|
1406
1467
|
totalRecordCount = (startPage - 1) * pageSize + records.length;
|
|
1407
|
-
if (!lastPage &&
|
|
1468
|
+
if (!lastPage &&
|
|
1469
|
+
records.length == (endPage - startPage + 1) * pageSize)
|
|
1408
1470
|
totalRecordCount++;
|
|
1409
1471
|
if (data.totalRecordCount > totalRecordCount)
|
|
1410
1472
|
totalRecordCount = data.totalRecordCount;
|
|
1411
1473
|
}
|
|
1412
|
-
instance.buffer.totalRecordCount = data.totalRecordCount =
|
|
1474
|
+
instance.buffer.totalRecordCount = data.totalRecordCount =
|
|
1475
|
+
totalRecordCount;
|
|
1413
1476
|
instance.buffer.records = data.records = records;
|
|
1414
1477
|
instance.buffer.page = data.page = startPage;
|
|
1415
1478
|
data.offset = (startPage - 1) * pageSize;
|
|
@@ -1460,7 +1523,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1460
1523
|
if (widget.buffered && !this.pending) {
|
|
1461
1524
|
let start = 0;
|
|
1462
1525
|
if (widget.measureRowHeights && instance.records)
|
|
1463
|
-
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) -
|
|
1526
|
+
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) -
|
|
1527
|
+
widget.bufferStep);
|
|
1464
1528
|
else if (this.rowHeight > 0)
|
|
1465
1529
|
start = Math.round(this.dom.scroller.scrollTop / this.rowHeight - widget.bufferStep);
|
|
1466
1530
|
start = Math.round(start / widget.bufferStep) * widget.bufferStep;
|
|
@@ -1569,7 +1633,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1569
1633
|
let { widget } = instance;
|
|
1570
1634
|
let grid = widget.onDropTest && instance.invoke("onDropTest", e, instance);
|
|
1571
1635
|
let row = widget.onRowDropTest && instance.invoke("onRowDropTest", e, instance);
|
|
1572
|
-
let column = widget.onColumnDropTest &&
|
|
1636
|
+
let column = widget.onColumnDropTest &&
|
|
1637
|
+
instance.invoke("onColumnDropTest", e, instance);
|
|
1573
1638
|
return (grid || row || column) && { grid, row, column };
|
|
1574
1639
|
}
|
|
1575
1640
|
onDragEnd(e) {
|
|
@@ -1588,7 +1653,10 @@ class GridComponent extends VDOM.Component {
|
|
|
1588
1653
|
//columns can be dropped anywhere, while rows only in the scrollable area
|
|
1589
1654
|
let r = getTopLevelBoundingClientRect(column ? this.dom.el : this.dom.scroller);
|
|
1590
1655
|
let { clientX, clientY } = e.cursor;
|
|
1591
|
-
if (clientX < r.left ||
|
|
1656
|
+
if (clientX < r.left ||
|
|
1657
|
+
clientX >= r.right ||
|
|
1658
|
+
clientY < r.top ||
|
|
1659
|
+
clientY >= r.bottom)
|
|
1592
1660
|
return false;
|
|
1593
1661
|
return {
|
|
1594
1662
|
over: 1000,
|
|
@@ -1616,12 +1684,16 @@ class GridComponent extends VDOM.Component {
|
|
|
1616
1684
|
//due to the order of enumeration it's possible that positions are out of order
|
|
1617
1685
|
positions.sort((a, b) => a - b);
|
|
1618
1686
|
let index = 0;
|
|
1619
|
-
while (index + 1 < positions.length &&
|
|
1687
|
+
while (index + 1 < positions.length &&
|
|
1688
|
+
ev.cursor.clientX > positions[index + 1])
|
|
1620
1689
|
index++;
|
|
1621
1690
|
let { fixedColumnCount } = this.props.instance;
|
|
1622
1691
|
this.setState({
|
|
1623
1692
|
colDropInsertionIndex: fixedColumnCount + index,
|
|
1624
|
-
colDropInsertionLeft: positions[index] -
|
|
1693
|
+
colDropInsertionLeft: positions[index] -
|
|
1694
|
+
positions[0] -
|
|
1695
|
+
this.dom.scroller.scrollLeft +
|
|
1696
|
+
this.dom.scroller.offsetLeft,
|
|
1625
1697
|
dropTarget: "column",
|
|
1626
1698
|
});
|
|
1627
1699
|
}
|
|
@@ -1670,7 +1742,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1670
1742
|
let confirmed = !grid;
|
|
1671
1743
|
if (!confirmed) {
|
|
1672
1744
|
let insertionZone = (b.bottom - b.top) / 4;
|
|
1673
|
-
confirmed =
|
|
1745
|
+
confirmed =
|
|
1746
|
+
cy > b.top + insertionZone && cy < b.bottom - insertionZone;
|
|
1674
1747
|
}
|
|
1675
1748
|
if (confirmed) {
|
|
1676
1749
|
rowOverIndex = m;
|
|
@@ -1694,9 +1767,11 @@ class GridComponent extends VDOM.Component {
|
|
|
1694
1767
|
index: start + rowOverIndex,
|
|
1695
1768
|
},
|
|
1696
1769
|
};
|
|
1697
|
-
if (widget.onRowDragOver &&
|
|
1770
|
+
if (widget.onRowDragOver &&
|
|
1771
|
+
instance.invoke("onRowDragOver", evt, instance) === false)
|
|
1698
1772
|
cancel = true;
|
|
1699
|
-
else if (rowOverIndex != this.state.dropInsertionIndex ||
|
|
1773
|
+
else if (rowOverIndex != this.state.dropInsertionIndex ||
|
|
1774
|
+
this.state.dropTarget != "row") {
|
|
1700
1775
|
this.setState({
|
|
1701
1776
|
dropInsertionIndex: rowOverIndex,
|
|
1702
1777
|
dropNextToTheRowAbove: false,
|
|
@@ -1715,9 +1790,11 @@ class GridComponent extends VDOM.Component {
|
|
|
1715
1790
|
totalRecordCount: data.totalRecordCount,
|
|
1716
1791
|
},
|
|
1717
1792
|
};
|
|
1718
|
-
if (widget.onDragOver &&
|
|
1793
|
+
if (widget.onDragOver &&
|
|
1794
|
+
instance.invoke("onDragOver", evt, instance) === false)
|
|
1719
1795
|
cancel = true;
|
|
1720
|
-
else if (s != this.state.dropInsertionIndex ||
|
|
1796
|
+
else if (s != this.state.dropInsertionIndex ||
|
|
1797
|
+
this.state.dropTarget != "grid") {
|
|
1721
1798
|
this.setState({
|
|
1722
1799
|
dropInsertionIndex: s,
|
|
1723
1800
|
dropNextToTheRowAbove: nextToTheRowAbove,
|
|
@@ -1747,7 +1824,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1747
1824
|
return this.dom.scroller;
|
|
1748
1825
|
return findScrollableParent(this.dom.table, true);
|
|
1749
1826
|
}
|
|
1750
|
-
onGetVScrollParent({ test: { grid, row, column } }) {
|
|
1827
|
+
onGetVScrollParent({ test: { grid, row, column }, }) {
|
|
1751
1828
|
if (column && !grid && !row)
|
|
1752
1829
|
return null;
|
|
1753
1830
|
let { widget } = this.props.instance;
|
|
@@ -1796,18 +1873,22 @@ class GridComponent extends VDOM.Component {
|
|
|
1796
1873
|
if (record.grouping.showCaption) {
|
|
1797
1874
|
let captionKey = "group-caption-" + record.level;
|
|
1798
1875
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1799
|
-
totalHeight +=
|
|
1876
|
+
totalHeight +=
|
|
1877
|
+
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1800
1878
|
else
|
|
1801
|
-
totalHeight +=
|
|
1879
|
+
totalHeight +=
|
|
1880
|
+
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1802
1881
|
}
|
|
1803
1882
|
break;
|
|
1804
1883
|
case "group-footer":
|
|
1805
1884
|
if (record.grouping.showFooter) {
|
|
1806
1885
|
let captionKey = "group-footer-" + record.level;
|
|
1807
1886
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1808
|
-
totalHeight +=
|
|
1887
|
+
totalHeight +=
|
|
1888
|
+
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1809
1889
|
else
|
|
1810
|
-
totalHeight +=
|
|
1890
|
+
totalHeight +=
|
|
1891
|
+
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1811
1892
|
}
|
|
1812
1893
|
break;
|
|
1813
1894
|
default:
|
|
@@ -1851,18 +1932,22 @@ class GridComponent extends VDOM.Component {
|
|
|
1851
1932
|
}
|
|
1852
1933
|
}
|
|
1853
1934
|
if (widget.scrollable) {
|
|
1854
|
-
this.scrollWidth =
|
|
1935
|
+
this.scrollWidth =
|
|
1936
|
+
this.dom.scroller.offsetWidth - this.dom.scroller.clientWidth;
|
|
1855
1937
|
let resized = false, headerHeight = 0, footerHeight = 0, rowHeight = 0;
|
|
1856
1938
|
if (this.dom.fixedTable)
|
|
1857
1939
|
syncHeaderHeights(this.dom.table.firstChild, this.dom.fixedTable.firstChild);
|
|
1858
1940
|
if (this.dom.fixedHeader) {
|
|
1859
|
-
let fixedHeaderTBody = this.dom.fixedHeader.firstChild
|
|
1941
|
+
let fixedHeaderTBody = this.dom.fixedHeader.firstChild
|
|
1942
|
+
.firstChild;
|
|
1860
1943
|
resized = widget.preciseMeasurements
|
|
1861
1944
|
? copyCellSizePrecise(this.dom.table.firstChild, fixedHeaderTBody)
|
|
1862
1945
|
: copyCellSize(this.dom.table.firstChild, fixedHeaderTBody);
|
|
1863
|
-
let scrollColumnEl = fixedHeaderTBody?.firstChild
|
|
1946
|
+
let scrollColumnEl = fixedHeaderTBody?.firstChild
|
|
1947
|
+
?.lastChild;
|
|
1864
1948
|
if (scrollColumnEl)
|
|
1865
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
1949
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
1950
|
+
this.scrollWidth + "px";
|
|
1866
1951
|
this.dom.fixedHeader.style.display = "block";
|
|
1867
1952
|
headerHeight = this.dom.fixedHeader.offsetHeight;
|
|
1868
1953
|
this.dom.scroller.style.marginTop = `${headerHeight}px`;
|
|
@@ -1883,8 +1968,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1883
1968
|
if (this.dom.fixedHeader)
|
|
1884
1969
|
this.dom.fixedHeader.style.left = fixedColumnsWidth;
|
|
1885
1970
|
this.dom.fixedColumnsFixedHeader.style.display = "block";
|
|
1886
|
-
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader
|
|
1887
|
-
?.firstElementChild;
|
|
1971
|
+
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader
|
|
1972
|
+
.firstElementChild?.firstElementChild;
|
|
1888
1973
|
if (this.dom.fixedTable.firstChild) {
|
|
1889
1974
|
resized = copyCellSize(this.dom.fixedTable.firstElementChild, fixedHeaderTBody);
|
|
1890
1975
|
}
|
|
@@ -1897,20 +1982,25 @@ class GridComponent extends VDOM.Component {
|
|
|
1897
1982
|
let dstTableBody = this.dom.fixedColumnsFixedFooter.firstElementChild
|
|
1898
1983
|
?.firstElementChild;
|
|
1899
1984
|
if (dstTableBody) {
|
|
1900
|
-
let srcTableBody = this.dom.fixedTable
|
|
1985
|
+
let srcTableBody = this.dom.fixedTable
|
|
1986
|
+
.lastElementChild;
|
|
1901
1987
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
1902
1988
|
this.dom.fixedColumnsFixedFooter.style.display = "block";
|
|
1903
1989
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
1904
1990
|
}
|
|
1905
1991
|
}
|
|
1906
1992
|
if (this.dom.fixedFooter) {
|
|
1907
|
-
let dstTableBody = this.dom.fixedFooter.firstElementChild
|
|
1993
|
+
let dstTableBody = this.dom.fixedFooter.firstElementChild
|
|
1994
|
+
?.firstElementChild;
|
|
1908
1995
|
if (dstTableBody) {
|
|
1909
|
-
let srcTableBody = this.dom.table
|
|
1996
|
+
let srcTableBody = this.dom.table
|
|
1997
|
+
.lastElementChild;
|
|
1910
1998
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
1911
|
-
let scrollColumnEl = dstTableBody.firstElementChild
|
|
1999
|
+
let scrollColumnEl = dstTableBody.firstElementChild
|
|
2000
|
+
?.lastElementChild;
|
|
1912
2001
|
if (scrollColumnEl)
|
|
1913
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
2002
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
2003
|
+
this.scrollWidth + "px";
|
|
1914
2004
|
this.dom.fixedFooter.style.display = "block";
|
|
1915
2005
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
1916
2006
|
}
|
|
@@ -1981,7 +2071,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1981
2071
|
}
|
|
1982
2072
|
if (this.dom.fixedTable) {
|
|
1983
2073
|
this.dom.fixedTable.style.marginTop = this.dom.table.style.marginTop;
|
|
1984
|
-
this.dom.fixedTable.style.marginBottom =
|
|
2074
|
+
this.dom.fixedTable.style.marginBottom =
|
|
2075
|
+
this.dom.table.style.marginBottom;
|
|
1985
2076
|
}
|
|
1986
2077
|
this.rowHeight = rowHeight;
|
|
1987
2078
|
let sortersChanged = widget.infinite && !shallowEquals(data.sorters, this.lastSorters);
|
|
@@ -2027,7 +2118,8 @@ class GridComponent extends VDOM.Component {
|
|
|
2027
2118
|
if (cellEdit != null && cellEdit != this.state.cellEdit) {
|
|
2028
2119
|
newState.cellEdit = cellEdit;
|
|
2029
2120
|
if (cellEdit &&
|
|
2030
|
-
(!visibleColumns[this.state.cursorCellIndex] ||
|
|
2121
|
+
(!visibleColumns[this.state.cursorCellIndex] ||
|
|
2122
|
+
!visibleColumns[this.state.cursorCellIndex].editor))
|
|
2031
2123
|
newState.cellEdit = false;
|
|
2032
2124
|
}
|
|
2033
2125
|
if (cellIndex != null && cellIndex != this.state.cursorCellIndex) {
|
|
@@ -2046,7 +2138,9 @@ class GridComponent extends VDOM.Component {
|
|
|
2046
2138
|
}
|
|
2047
2139
|
batchUpdates(() => {
|
|
2048
2140
|
if (select) {
|
|
2049
|
-
let start = selectRange &&
|
|
2141
|
+
let start = selectRange &&
|
|
2142
|
+
this.state.selectionStart != null &&
|
|
2143
|
+
this.state.selectionStart >= 0
|
|
2050
2144
|
? this.state.selectionStart
|
|
2051
2145
|
: index;
|
|
2052
2146
|
if (start < 0)
|
|
@@ -2096,17 +2190,21 @@ class GridComponent extends VDOM.Component {
|
|
|
2096
2190
|
FocusManager.focus(this.dom.el);
|
|
2097
2191
|
if (scrollIntoView) {
|
|
2098
2192
|
let record = this.getRecordAt(index);
|
|
2099
|
-
let item = record &&
|
|
2193
|
+
let item = record &&
|
|
2194
|
+
this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2100
2195
|
let hscroll = false;
|
|
2101
2196
|
if (item) {
|
|
2102
2197
|
if (widget.cellEditable)
|
|
2103
|
-
if (this.state.cursorCellIndex >=
|
|
2198
|
+
if (this.state.cursorCellIndex >=
|
|
2199
|
+
this.props.instance.fixedColumnCount) {
|
|
2104
2200
|
hscroll = true;
|
|
2105
|
-
item = item.firstChild.children[this.state.cursorCellIndex -
|
|
2201
|
+
item = item.firstChild.children[this.state.cursorCellIndex -
|
|
2202
|
+
this.props.instance.fixedColumnCount];
|
|
2106
2203
|
}
|
|
2107
2204
|
else {
|
|
2108
2205
|
let fixedItem = this.dom.fixedTable.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2109
|
-
let cell = fixedItem &&
|
|
2206
|
+
let cell = fixedItem &&
|
|
2207
|
+
fixedItem.firstChild.children[this.state.cursorCellIndex];
|
|
2110
2208
|
if (cell)
|
|
2111
2209
|
scrollElementIntoView(cell, false, true, 10);
|
|
2112
2210
|
}
|
|
@@ -2186,7 +2284,8 @@ class GridComponent extends VDOM.Component {
|
|
|
2186
2284
|
record = widget.mapRecord(null, instance, r, cursor - offset);
|
|
2187
2285
|
}
|
|
2188
2286
|
if (record && record.type == "data") {
|
|
2189
|
-
if (instance.isRecordSelectable &&
|
|
2287
|
+
if (instance.isRecordSelectable &&
|
|
2288
|
+
!instance.isRecordSelectable(record.data, options))
|
|
2190
2289
|
continue;
|
|
2191
2290
|
selection.push(record.data);
|
|
2192
2291
|
indexes.push(record.index);
|
|
@@ -2228,9 +2327,13 @@ class GridComponent extends VDOM.Component {
|
|
|
2228
2327
|
if (widget.onKeyDown && instance.invoke("onKeyDown", e, instance) === false)
|
|
2229
2328
|
return;
|
|
2230
2329
|
let recordInstance = this.getRecordInstanceAt(this.state.cursor);
|
|
2231
|
-
if (recordInstance &&
|
|
2330
|
+
if (recordInstance &&
|
|
2331
|
+
widget.onRowKeyDown &&
|
|
2332
|
+
instance.invoke("onRowKeyDown", e, recordInstance) === false)
|
|
2232
2333
|
return;
|
|
2233
|
-
if (widget.onCellKeyDown &&
|
|
2334
|
+
if (widget.onCellKeyDown &&
|
|
2335
|
+
widget.cellEditable &&
|
|
2336
|
+
this.state.cursorCellIndex != -1) {
|
|
2234
2337
|
if (instance.invoke("onCellKeyDown", e, instance, {
|
|
2235
2338
|
cellIndex: this.state.cursorCellIndex,
|
|
2236
2339
|
record: recordInstance,
|
|
@@ -2269,7 +2372,8 @@ class GridComponent extends VDOM.Component {
|
|
|
2269
2372
|
e.preventDefault();
|
|
2270
2373
|
let direction = e.shiftKey ? -1 : +1;
|
|
2271
2374
|
let cursor = this.state.cursor;
|
|
2272
|
-
let cellIndex = (this.state.cursorCellIndex + direction) %
|
|
2375
|
+
let cellIndex = (this.state.cursorCellIndex + direction) %
|
|
2376
|
+
instance.row.line1.columns.length;
|
|
2273
2377
|
if (cellIndex == -1) {
|
|
2274
2378
|
cellIndex += instance.row.line1.columns.length;
|
|
2275
2379
|
cursor--;
|
|
@@ -2330,7 +2434,8 @@ class GridComponent extends VDOM.Component {
|
|
|
2330
2434
|
break;
|
|
2331
2435
|
case KeyCode.right:
|
|
2332
2436
|
if (widget.cellEditable) {
|
|
2333
|
-
if (this.state.cursorCellIndex + 1 <
|
|
2437
|
+
if (this.state.cursorCellIndex + 1 <
|
|
2438
|
+
instance.row.line1.columns.length) {
|
|
2334
2439
|
this.moveCursor(this.state.cursor, {
|
|
2335
2440
|
focused: true,
|
|
2336
2441
|
cellIndex: this.state.cursorCellIndex + 1,
|
|
@@ -2375,9 +2480,13 @@ class GridComponent extends VDOM.Component {
|
|
|
2375
2480
|
let isSelected = widget.selection.getIsSelectedDelegate(store);
|
|
2376
2481
|
let selected = [];
|
|
2377
2482
|
let add = (rec, data, index, force) => {
|
|
2378
|
-
if (!data ||
|
|
2483
|
+
if (!data ||
|
|
2484
|
+
!(force || isSelected(data, index)) ||
|
|
2485
|
+
(isRecordDraggable && !isRecordDraggable(data)))
|
|
2379
2486
|
return;
|
|
2380
|
-
let mappedRecord = rec
|
|
2487
|
+
let mappedRecord = rec
|
|
2488
|
+
? { ...rec }
|
|
2489
|
+
: widget.mapRecord(null, instance, data, index);
|
|
2381
2490
|
let row = (mappedRecord.row = instance.getDetachedChild(instance.row, "DD:" + mappedRecord.key, mappedRecord.store));
|
|
2382
2491
|
row.selected = true;
|
|
2383
2492
|
selected.push(mappedRecord);
|
|
@@ -2517,7 +2626,12 @@ class GridColumnHeader extends Widget {
|
|
|
2517
2626
|
delete this.class;
|
|
2518
2627
|
if (this.header)
|
|
2519
2628
|
this.header1 = this.header;
|
|
2520
|
-
if (this.header1 ||
|
|
2629
|
+
if (this.header1 ||
|
|
2630
|
+
this.resizable ||
|
|
2631
|
+
this.width ||
|
|
2632
|
+
this.defaultWidth ||
|
|
2633
|
+
this.sortable ||
|
|
2634
|
+
this.draggable) {
|
|
2521
2635
|
if (!isObject(this.header1))
|
|
2522
2636
|
this.header1 = {
|
|
2523
2637
|
text: this.header1 || "",
|