cx 26.3.5 → 26.3.6
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/helpers/SnapPointFinder.d.ts +2 -2
- package/build/charts/helpers/SnapPointFinder.d.ts.map +1 -1
- package/build/charts/helpers/ValueAtFinder.d.ts +4 -4
- package/build/charts/helpers/ValueAtFinder.d.ts.map +1 -1
- package/build/charts/helpers/ValueAtFinder.js +2 -5
- package/build/data/createAccessorModelProxy.d.ts +6 -11
- package/build/data/createAccessorModelProxy.d.ts.map +1 -1
- package/build/data/createAccessorModelProxy.js +1 -3
- package/build/jsx-runtime.d.ts +2 -1
- package/build/jsx-runtime.d.ts.map +1 -1
- package/build/ui/createFunctionalComponent.d.ts +4 -1
- package/build/ui/createFunctionalComponent.d.ts.map +1 -1
- package/build/widgets/form/Calendar.d.ts +1 -0
- package/build/widgets/form/Calendar.d.ts.map +1 -1
- package/build/widgets/form/Calendar.js +14 -22
- package/build/widgets/form/TimeList.d.ts +3 -1
- package/build/widgets/form/TimeList.d.ts.map +1 -1
- package/build/widgets/grid/Grid.d.ts +3 -3
- package/build/widgets/grid/Grid.d.ts.map +1 -1
- package/build/widgets/grid/Grid.js +86 -188
- package/build/widgets/index.d.ts +3 -1
- package/build/widgets/index.d.ts.map +1 -1
- package/build/widgets/index.js +3 -1
- package/build/widgets/nav/Tab.d.ts.map +1 -1
- package/build/widgets/nav/Tab.js +9 -5
- package/build/widgets/overlay/Overlay.d.ts +1 -1
- package/build/widgets/overlay/Overlay.d.ts.map +1 -1
- package/build/widgets/overlay/Overlay.js +10 -19
- package/build/widgets/overlay/Window.d.ts.map +1 -1
- package/build/widgets/overlay/Window.js +5 -11
- package/dist/charts.css +256 -256
- package/dist/manifest.js +722 -713
- package/dist/widgets.css +15 -7
- package/dist/widgets.js +31 -17
- package/package.json +1 -1
- package/src/charts/BarGraph.scss +31 -31
- package/src/charts/Legend.scss +57 -57
- package/src/charts/LegendEntry.scss +35 -35
- package/src/charts/LineGraph.scss +28 -28
- package/src/charts/helpers/SnapPointFinder.ts +136 -136
- package/src/charts/helpers/ValueAtFinder.ts +72 -72
- package/src/data/createAccessorModelProxy.ts +66 -66
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/adapter/ArrayAdapter.ts +229 -229
- package/src/ui/exprHelpers.ts +96 -96
- package/src/util/scss/include.scss +69 -69
- package/src/widgets/Button.maps.scss +103 -103
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/form/Calendar.tsx +772 -772
- package/src/widgets/form/ColorField.scss +112 -112
- package/src/widgets/form/DateTimeField.scss +111 -111
- package/src/widgets/form/LookupField.scss +228 -228
- package/src/widgets/form/MonthField.scss +113 -113
- package/src/widgets/form/NumberField.scss +72 -72
- package/src/widgets/form/Select.scss +104 -104
- package/src/widgets/form/TextField.scss +66 -66
- package/src/widgets/form/variables.scss +110 -110
- package/src/widgets/grid/Grid.tsx +4264 -4264
- package/src/widgets/grid/variables.scss +47 -47
- package/src/widgets/index.ts +63 -63
- package/src/widgets/nav/Tab.ts +122 -122
- package/src/widgets/overlay/Overlay.tsx +1028 -1028
- package/src/widgets/overlay/Window.tsx +320 -320
- package/src/widgets/variables.scss +61 -61
|
@@ -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
|
|
11
|
+
import { FocusManager, offFocusOut, oneFocusOut, unfocusElement } from "../../ui/FocusManager";
|
|
12
12
|
import { Format } from "../../ui/Format";
|
|
13
13
|
import { Instance, InstanceCache } from "../../ui/Instance";
|
|
14
14
|
import { Localization } from "../../ui/Localization";
|
|
15
|
-
import { PureContainer, PureContainerBase
|
|
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,7 @@ 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
|
|
46
|
+
import { GridRow, GridRowComponent } from "./GridRow";
|
|
47
47
|
export class GridInstance extends Instance {
|
|
48
48
|
resetColumnWidths() {
|
|
49
49
|
this.setState({ colWidth: {} });
|
|
@@ -179,9 +179,7 @@ export class Grid extends ContainerBase {
|
|
|
179
179
|
(c.header2 && c.header2.resizable) ||
|
|
180
180
|
(c.header3 && c.header3.resizable))
|
|
181
181
|
row.hasResizableColumns = true;
|
|
182
|
-
if (c.aggregate &&
|
|
183
|
-
c.aggregateAlias &&
|
|
184
|
-
(c.aggregateField || isDefined(c.aggregateValue))) {
|
|
182
|
+
if (c.aggregate && c.aggregateAlias && (c.aggregateField || isDefined(c.aggregateValue))) {
|
|
185
183
|
aggregates[c.aggregateAlias] = {
|
|
186
184
|
value: isDefined(c.aggregateValue)
|
|
187
185
|
? c.aggregateValue
|
|
@@ -204,8 +202,7 @@ export class Grid extends ContainerBase {
|
|
|
204
202
|
});
|
|
205
203
|
});
|
|
206
204
|
//add default footer if some columns have aggregates and grouping is not defined
|
|
207
|
-
if (!groupingData &&
|
|
208
|
-
(Object.keys(aggregates).length > 0 || this.fixedFooter || showFooter))
|
|
205
|
+
if (!groupingData && (Object.keys(aggregates).length > 0 || this.fixedFooter || showFooter))
|
|
209
206
|
groupingData = [
|
|
210
207
|
{
|
|
211
208
|
key: {},
|
|
@@ -252,9 +249,7 @@ export class Grid extends ContainerBase {
|
|
|
252
249
|
grouping = cached.grouping;
|
|
253
250
|
}
|
|
254
251
|
let groupingChanged = instance.cache("grouping", grouping);
|
|
255
|
-
if (instance.cache("columnParams", data.columnParams) ||
|
|
256
|
-
groupingChanged ||
|
|
257
|
-
!row) {
|
|
252
|
+
if (instance.cache("columnParams", data.columnParams) || groupingChanged || !row) {
|
|
258
253
|
row = instance.row = this.createRowTemplate(context, data.columnParams, instance, grouping);
|
|
259
254
|
}
|
|
260
255
|
data.version = instance.v++;
|
|
@@ -289,9 +284,7 @@ export class Grid extends ContainerBase {
|
|
|
289
284
|
data.sorters = [sorter];
|
|
290
285
|
}
|
|
291
286
|
let skipDefaultSorting = this.clearableSort && instance.state.disableDefaultSort;
|
|
292
|
-
if (!skipDefaultSorting &&
|
|
293
|
-
!isNonEmptyArray(data.sorters) &&
|
|
294
|
-
this.defaultSortField) {
|
|
287
|
+
if (!skipDefaultSorting && !isNonEmptyArray(data.sorters) && this.defaultSortField) {
|
|
295
288
|
let sorter = {
|
|
296
289
|
field: this.defaultSortField,
|
|
297
290
|
direction: this.defaultSortDirection || "ASC",
|
|
@@ -302,9 +295,7 @@ export class Grid extends ContainerBase {
|
|
|
302
295
|
if (sortField) {
|
|
303
296
|
for (let l = 1; l < 10; l++) {
|
|
304
297
|
let line = instance.row[`line${l}`];
|
|
305
|
-
let sortColumn = line &&
|
|
306
|
-
line.columns &&
|
|
307
|
-
line.columns.find((c) => c.field == sortField);
|
|
298
|
+
let sortColumn = line && line.columns && line.columns.find((c) => c.field == sortField);
|
|
308
299
|
if (sortColumn) {
|
|
309
300
|
data.sorters[0].value = sortColumn.sortValue || sortColumn.value;
|
|
310
301
|
data.sorters[0].comparer = sortColumn.comparer;
|
|
@@ -465,9 +456,7 @@ export class Grid extends ContainerBase {
|
|
|
465
456
|
}
|
|
466
457
|
render(context, instance, key) {
|
|
467
458
|
let { data, hasFixedColumns } = instance;
|
|
468
|
-
let fixedHeader = data.scrollable &&
|
|
469
|
-
this.showHeader &&
|
|
470
|
-
this.renderHeader(context, instance, "header", true, false);
|
|
459
|
+
let fixedHeader = data.scrollable && this.showHeader && this.renderHeader(context, instance, "header", true, false);
|
|
471
460
|
let fixedColumnsFixedHeader = data.scrollable &&
|
|
472
461
|
this.showHeader &&
|
|
473
462
|
hasFixedColumns &&
|
|
@@ -476,11 +465,8 @@ export class Grid extends ContainerBase {
|
|
|
476
465
|
this.renderRows(context, instance);
|
|
477
466
|
if (this.fixedFooter)
|
|
478
467
|
this.renderFixedFooter(context, instance);
|
|
479
|
-
let header = this.showHeader &&
|
|
480
|
-
|
|
481
|
-
let fixedColumnsHeader = this.showHeader &&
|
|
482
|
-
hasFixedColumns &&
|
|
483
|
-
this.renderHeader(context, instance, "header", false, true);
|
|
468
|
+
let header = this.showHeader && this.renderHeader(context, instance, "header", false, false);
|
|
469
|
+
let fixedColumnsHeader = this.showHeader && hasFixedColumns && this.renderHeader(context, instance, "header", false, true);
|
|
484
470
|
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));
|
|
485
471
|
}
|
|
486
472
|
renderResizer(instance, hdinst, header, colIndex, forPreviousColumn) {
|
|
@@ -496,10 +482,9 @@ export class Grid extends ContainerBase {
|
|
|
496
482
|
if (e.buttons != 1)
|
|
497
483
|
return;
|
|
498
484
|
let resizeOverlayEl = document.createElement("div");
|
|
499
|
-
let gridEl = e.target.parentElement.parentElement
|
|
500
|
-
.parentElement.parentElement
|
|
501
|
-
let uniqueColId = e.currentTarget.dataset
|
|
502
|
-
.uniqueColId;
|
|
485
|
+
let gridEl = e.target.parentElement.parentElement.parentElement.parentElement
|
|
486
|
+
.parentElement.parentElement;
|
|
487
|
+
let uniqueColId = e.currentTarget.dataset.uniqueColId;
|
|
503
488
|
// if we use fixed columns, rhs resizer of the last fixed column is within regular columns header tbody
|
|
504
489
|
let headerCell = findFirstChild(gridEl, (el) => el.tagName == "TH" &&
|
|
505
490
|
el.dataset &&
|
|
@@ -508,8 +493,7 @@ export class Grid extends ContainerBase {
|
|
|
508
493
|
let initialPosition = getCursorPos(e);
|
|
509
494
|
resizeOverlayEl.className = CSS.element(baseClass, "resize-overlay");
|
|
510
495
|
resizeOverlayEl.style.width = `${initialWidth}px`;
|
|
511
|
-
resizeOverlayEl.style.left = `${headerCell.getBoundingClientRect().left -
|
|
512
|
-
gridEl.getBoundingClientRect().left}px`;
|
|
496
|
+
resizeOverlayEl.style.left = `${headerCell.getBoundingClientRect().left - gridEl.getBoundingClientRect().left}px`;
|
|
513
497
|
gridEl.appendChild(resizeOverlayEl);
|
|
514
498
|
captureMouse2(e, {
|
|
515
499
|
onMouseMove: (e) => {
|
|
@@ -603,10 +587,9 @@ export class Grid extends ContainerBase {
|
|
|
603
587
|
mods.push("aligned-" + hdwidget.align);
|
|
604
588
|
if (hdwidget.sortable && header.widget.allowSorting) {
|
|
605
589
|
mods.push("sortable");
|
|
606
|
-
if (data.sorters &&
|
|
607
|
-
data.sorters[0].field == (hdwidget.sortField || hdwidget.field)) {
|
|
590
|
+
if (data.sorters && data.sorters[0].field == (hdwidget.sortField || hdwidget.field)) {
|
|
608
591
|
mods.push("sorted-" + data.sorters[0].direction.toLowerCase());
|
|
609
|
-
sortIcon =
|
|
592
|
+
sortIcon = _jsx(DropDownIcon, { className: CSS.element(baseClass, "column-sort-icon") });
|
|
610
593
|
}
|
|
611
594
|
}
|
|
612
595
|
let uniqueColumnId = header.data.colSpan > 1 ? null : hdwidget.uniqueColumnId;
|
|
@@ -640,8 +623,7 @@ export class Grid extends ContainerBase {
|
|
|
640
623
|
for (let c = 0; c < header.data.colSpan; c++)
|
|
641
624
|
skip[`${lineIndex + l + r}-${colIndex + c}`] = true;
|
|
642
625
|
}
|
|
643
|
-
if ((hdwidget.resizable || header.data.resizable) &&
|
|
644
|
-
header.data.colSpan < 2) {
|
|
626
|
+
if ((hdwidget.resizable || header.data.resizable) && header.data.colSpan < 2) {
|
|
645
627
|
resizer = this.renderResizer(instance, hdinst, header, colIndex);
|
|
646
628
|
}
|
|
647
629
|
if (colIndex > 0) {
|
|
@@ -658,8 +640,7 @@ export class Grid extends ContainerBase {
|
|
|
658
640
|
}
|
|
659
641
|
}
|
|
660
642
|
}
|
|
661
|
-
cls =
|
|
662
|
-
CSS.element(baseClass, "col-header", mods) + (cls ? " " + cls : "");
|
|
643
|
+
cls = CSS.element(baseClass, "col-header", mods) + (cls ? " " + cls : "");
|
|
663
644
|
let onContextMenu;
|
|
664
645
|
if (this.onColumnContextMenu)
|
|
665
646
|
onContextMenu = (e) => instance.invoke("onColumnContextMenu", e, hdinst);
|
|
@@ -706,7 +687,7 @@ export class Grid extends ContainerBase {
|
|
|
706
687
|
store: store,
|
|
707
688
|
matchCursorOffset: true,
|
|
708
689
|
matchWidth: true,
|
|
709
|
-
widget: () =>
|
|
690
|
+
widget: () => _jsx("div", { className: CSS.element(baseClass, "col-header-drag-clone"), children: data.text }),
|
|
710
691
|
},
|
|
711
692
|
}, () => { });
|
|
712
693
|
}
|
|
@@ -728,20 +709,14 @@ export class Grid extends ContainerBase {
|
|
|
728
709
|
let value = column.sortValue || column.value;
|
|
729
710
|
let comparer = column.comparer;
|
|
730
711
|
let sortOptions = column.sortOptions;
|
|
731
|
-
if (header &&
|
|
732
|
-
header.allowSorting &&
|
|
733
|
-
column.sortable &&
|
|
734
|
-
(field || value || data.sortField)) {
|
|
712
|
+
if (header && header.allowSorting && column.sortable && (field || value || data.sortField)) {
|
|
735
713
|
let direction = column.primarySortDirection ?? "ASC";
|
|
736
714
|
if (isNonEmptyArray(data.sorters) &&
|
|
737
|
-
((!!data.sorters[0].field &&
|
|
738
|
-
data.sorters[0].field == (field || data.sortField)) ||
|
|
715
|
+
((!!data.sorters[0].field && data.sorters[0].field == (field || data.sortField)) ||
|
|
739
716
|
(!!value && data.sorters[0].value == value))) {
|
|
740
|
-
if (data.sorters[0].direction == "ASC" &&
|
|
741
|
-
(!this.clearableSort || direction == "ASC"))
|
|
717
|
+
if (data.sorters[0].direction == "ASC" && (!this.clearableSort || direction == "ASC"))
|
|
742
718
|
direction = "DESC";
|
|
743
|
-
else if (data.sorters[0].direction == "DESC" &&
|
|
744
|
-
(!this.clearableSort || direction == "DESC"))
|
|
719
|
+
else if (data.sorters[0].direction == "DESC" && (!this.clearableSort || direction == "DESC"))
|
|
745
720
|
direction = "ASC";
|
|
746
721
|
else {
|
|
747
722
|
direction = null;
|
|
@@ -773,9 +748,7 @@ export class Grid extends ContainerBase {
|
|
|
773
748
|
let data = store.getData();
|
|
774
749
|
if (g.caption) {
|
|
775
750
|
let caption = g.caption(data);
|
|
776
|
-
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
777
|
-
"level-" + level,
|
|
778
|
-
]), "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}`));
|
|
751
|
+
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", ["level-" + level]), "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}`));
|
|
779
752
|
}
|
|
780
753
|
else if (g.showCaption) {
|
|
781
754
|
let skip = 0;
|
|
@@ -791,7 +764,7 @@ export class Grid extends ContainerBase {
|
|
|
791
764
|
let v, c = ci.widget, colSpan, pad, cls = "", style = null;
|
|
792
765
|
if (c.caption) {
|
|
793
766
|
if (c.caption.children)
|
|
794
|
-
v =
|
|
767
|
+
v = _jsx(Cx, { widget: c.caption.children, store: store, parentInstance: instance, subscribe: true });
|
|
795
768
|
else {
|
|
796
769
|
v = c.caption.value(data);
|
|
797
770
|
let fmt = c.caption.format(data);
|
|
@@ -813,9 +786,7 @@ export class Grid extends ContainerBase {
|
|
|
813
786
|
if (colSpan > 1)
|
|
814
787
|
skip = colSpan - 1;
|
|
815
788
|
}
|
|
816
|
-
else if (c.aggregate &&
|
|
817
|
-
c.aggregateAliasGetter &&
|
|
818
|
-
c.caption !== false) {
|
|
789
|
+
else if (c.aggregate && c.aggregateAliasGetter && c.caption !== false) {
|
|
819
790
|
empty = false;
|
|
820
791
|
v = c.aggregateAliasGetter(group);
|
|
821
792
|
if (isString(ci.data.format))
|
|
@@ -835,9 +806,7 @@ export class Grid extends ContainerBase {
|
|
|
835
806
|
});
|
|
836
807
|
if (lines.length == 0)
|
|
837
808
|
return null;
|
|
838
|
-
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", [
|
|
839
|
-
"level-" + level,
|
|
840
|
-
]), "data-group-key": group.$key, "data-group-element": `group-caption-${level}`, children: lines }, "c" + group.$key));
|
|
809
|
+
return (_jsx("tbody", { className: CSS.element(baseClass, "group-caption", ["level-" + level]), "data-group-key": group.$key, "data-group-element": `group-caption-${level}`, children: lines }, "c" + group.$key));
|
|
841
810
|
}
|
|
842
811
|
}
|
|
843
812
|
renderGroupFooter(context, instance, g, level, group, i, store, fixed, fixedColumns) {
|
|
@@ -875,9 +844,7 @@ export class Grid extends ContainerBase {
|
|
|
875
844
|
if (colSpan > 1)
|
|
876
845
|
skip = colSpan - 1;
|
|
877
846
|
}
|
|
878
|
-
else if (c.aggregate &&
|
|
879
|
-
c.aggregateAliasGetter &&
|
|
880
|
-
c.footer !== false) {
|
|
847
|
+
else if (c.aggregate && c.aggregateAliasGetter && c.footer !== false) {
|
|
881
848
|
empty = false;
|
|
882
849
|
v = c.aggregateAliasGetter(group);
|
|
883
850
|
if (isString(ci.data.format))
|
|
@@ -1052,9 +1019,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1052
1019
|
};
|
|
1053
1020
|
}
|
|
1054
1021
|
getBufferStartEnd() {
|
|
1055
|
-
return this.syncBuffering
|
|
1056
|
-
? { start: this.start, end: this.end }
|
|
1057
|
-
: this.state;
|
|
1022
|
+
return this.syncBuffering ? { start: this.start, end: this.end } : this.state;
|
|
1058
1023
|
}
|
|
1059
1024
|
renderCellEditor(key, CSS, baseClass, instance, column) {
|
|
1060
1025
|
//add an inner div with fixed height in order to help IE absolutely position the contents inside
|
|
@@ -1076,7 +1041,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1076
1041
|
let { widget, isRecordSelectable, visibleColumns, isRecordDraggable, row } = instance;
|
|
1077
1042
|
let { CSS, baseClass } = widget;
|
|
1078
1043
|
let { dragSource } = data;
|
|
1079
|
-
let { dragged, cursor, cursorCellIndex, cellEdit, dropInsertionIndex, dropTarget
|
|
1044
|
+
let { dragged, cursor, cursorCellIndex, cellEdit, dropInsertionIndex, dropTarget } = this.state;
|
|
1080
1045
|
let { colWidth, dimensionsVersion } = instance.state;
|
|
1081
1046
|
let { hasMergedCells } = row;
|
|
1082
1047
|
return (record, index, standalone, fixed) => {
|
|
@@ -1102,15 +1067,12 @@ class GridComponent extends VDOM.Component {
|
|
|
1102
1067
|
let wrap = (children) => {
|
|
1103
1068
|
let skipCells = {};
|
|
1104
1069
|
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) => {
|
|
1105
|
-
let cells = content.map(({ key, data, content, uniqueColumnId, merged, mergeRowSpan
|
|
1070
|
+
let cells = content.map(({ key, data, content, uniqueColumnId, merged, mergeRowSpan }, cellIndex) => {
|
|
1106
1071
|
if (Boolean(data.fixed) !== fixed)
|
|
1107
1072
|
return null;
|
|
1108
1073
|
if (merged)
|
|
1109
1074
|
return null;
|
|
1110
|
-
let cellected = index == cursor &&
|
|
1111
|
-
cellIndex == cursorCellIndex &&
|
|
1112
|
-
widget.cellEditable &&
|
|
1113
|
-
line == 0;
|
|
1075
|
+
let cellected = index == cursor && cellIndex == cursorCellIndex && widget.cellEditable && line == 0;
|
|
1114
1076
|
let className = cellected
|
|
1115
1077
|
? CSS.expand(data.classNames, CSS.state("cellected"))
|
|
1116
1078
|
: data.classNames;
|
|
@@ -1146,11 +1108,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1146
1108
|
if (!standalone)
|
|
1147
1109
|
return wrap(record.vdom);
|
|
1148
1110
|
return (_jsx(Cx, { instance: record.row, parentInstance: instance, options: { name: "grid-row" }, contentFactory: (x) => wrap({
|
|
1149
|
-
content: Array.isArray(x.children)
|
|
1150
|
-
? x.children
|
|
1151
|
-
: x.children != null
|
|
1152
|
-
? [x.children]
|
|
1153
|
-
: [],
|
|
1111
|
+
content: Array.isArray(x.children) ? x.children : x.children != null ? [x.children] : [],
|
|
1154
1112
|
data: {},
|
|
1155
1113
|
}), params: {
|
|
1156
1114
|
...mod,
|
|
@@ -1168,9 +1126,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1168
1126
|
let { CSS, baseClass } = widget;
|
|
1169
1127
|
let { start, end } = this.getBufferStartEnd();
|
|
1170
1128
|
let cellWrap = false;
|
|
1171
|
-
if (widget.cellEditable &&
|
|
1172
|
-
|
|
1173
|
-
cellWrap = (children) => (_jsx("div", { className: "cxe-grid-cell-clip", children: children }));
|
|
1129
|
+
if (widget.cellEditable && (widget.hasResizableColumns || hasFixedColumns)) {
|
|
1130
|
+
cellWrap = (children) => _jsx("div", { className: "cxe-grid-cell-clip", children: children });
|
|
1174
1131
|
}
|
|
1175
1132
|
let children = [], fixedChildren = [];
|
|
1176
1133
|
let renderRow = this.createRowRenderer(cellWrap);
|
|
@@ -1237,8 +1194,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1237
1194
|
}
|
|
1238
1195
|
else if (record.type == "group-footer") {
|
|
1239
1196
|
let g = record.grouping;
|
|
1240
|
-
if (g.showFooter &&
|
|
1241
|
-
(!widget.fixedFooter || start + i != instance.records.length - 1)) {
|
|
1197
|
+
if (g.showFooter && (!widget.fixedFooter || start + i != instance.records.length - 1)) {
|
|
1242
1198
|
children.push(widget.renderGroupFooter(null, instance, g, record.level, record.group, record.key + "-footer", record.store, false, false));
|
|
1243
1199
|
if (hasFixedColumns)
|
|
1244
1200
|
fixedChildren.push(widget.renderGroupFooter(null, instance, g, record.level, record.group, record.key + "-footer", record.store, false, true));
|
|
@@ -1273,15 +1229,12 @@ class GridComponent extends VDOM.Component {
|
|
|
1273
1229
|
break;
|
|
1274
1230
|
case "same-value":
|
|
1275
1231
|
let prevCellInfo = getCellRenderInfo(prevRow.vdom, mergedCol.index);
|
|
1276
|
-
shouldMerge =
|
|
1277
|
-
!stopMerge &&
|
|
1278
|
-
cellInfo.data.value === prevCellInfo.data.value;
|
|
1232
|
+
shouldMerge = !stopMerge && cellInfo.data.value === prevCellInfo.data.value;
|
|
1279
1233
|
break;
|
|
1280
1234
|
}
|
|
1281
1235
|
if (shouldMerge) {
|
|
1282
1236
|
cellInfo.merged = true;
|
|
1283
|
-
rowSpan[mergedCol.uniqueColumnId] =
|
|
1284
|
-
(rowSpan[mergedCol.uniqueColumnId] ?? 1) + 1;
|
|
1237
|
+
rowSpan[mergedCol.uniqueColumnId] = (rowSpan[mergedCol.uniqueColumnId] ?? 1) + 1;
|
|
1285
1238
|
}
|
|
1286
1239
|
else {
|
|
1287
1240
|
if (mergedCol.mode == "same-value")
|
|
@@ -1308,8 +1261,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1308
1261
|
}
|
|
1309
1262
|
});
|
|
1310
1263
|
}
|
|
1311
|
-
if (this.state.dropTarget == "grid" &&
|
|
1312
|
-
this.state.dropInsertionIndex != null) {
|
|
1264
|
+
if (this.state.dropTarget == "grid" && this.state.dropInsertionIndex != null) {
|
|
1313
1265
|
let dragInsertionRow = (_jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { className: CSS.element(baseClass, "dropzone"), colSpan: 1000, style: {
|
|
1314
1266
|
height: data.dropMode == "insertion" ? 0 : this.state.dropItemHeight,
|
|
1315
1267
|
} }) }) }, "dropzone"));
|
|
@@ -1342,8 +1294,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1342
1294
|
_jsx("tbody", { className: CSS.element(baseClass, "empty-text"), children: _jsx("tr", { children: _jsx("td", { colSpan: 1000, children: data.emptyText }) }) }, "empty"),
|
|
1343
1295
|
];
|
|
1344
1296
|
}
|
|
1345
|
-
else if (widget.fixedFooter &&
|
|
1346
|
-
(widget.buffered || !instance.fixedFooterIsGroupFooter)) {
|
|
1297
|
+
else if (widget.fixedFooter && (widget.buffered || !instance.fixedFooterIsGroupFooter)) {
|
|
1347
1298
|
//add fixed footer content for buffered grids
|
|
1348
1299
|
if (fixedFooter || fixedColumnsFixedFooter) {
|
|
1349
1300
|
children.push(fixedFooter);
|
|
@@ -1354,14 +1305,14 @@ class GridComponent extends VDOM.Component {
|
|
|
1354
1305
|
let shouldRenderFixedFooter = widget.scrollable && (fixedFooter || fixedColumnsFixedFooter);
|
|
1355
1306
|
if (hasFixedColumns) {
|
|
1356
1307
|
fixedColumnsContent.push(_jsx("div", { ref: this.fixedScrollerRef, className: CSS.element(baseClass, "fixed-scroll-area", {
|
|
1357
|
-
"fixed-header": !!this.props.
|
|
1308
|
+
"fixed-header": !!this.props.fixedHeader,
|
|
1358
1309
|
"fixed-footer": shouldRenderFixedFooter,
|
|
1359
1310
|
}), children: _jsx("div", { className: CSS.element(baseClass, "fixed-table-wrapper"), children: _jsxs("table", { ref: (el) => {
|
|
1360
1311
|
this.dom.fixedTable = el;
|
|
1361
1312
|
}, children: [this.props.fixedColumnsHeader, fixedChildren] }) }) }, "fixedscroller"));
|
|
1362
1313
|
}
|
|
1363
1314
|
content.push(_jsx("div", { ref: this.scrollerRef, onScroll: this.onScroll.bind(this), className: CSS.element(baseClass, "scroll-area", {
|
|
1364
|
-
"fixed-header": !!this.props.
|
|
1315
|
+
"fixed-header": !!this.props.fixedHeader,
|
|
1365
1316
|
"fixed-footer": shouldRenderFixedFooter,
|
|
1366
1317
|
}), children: _jsx("div", { className: CSS.element(baseClass, "table-wrapper"), children: _jsxs("table", { ref: (el) => {
|
|
1367
1318
|
this.dom.table = el;
|
|
@@ -1470,14 +1421,12 @@ class GridComponent extends VDOM.Component {
|
|
|
1470
1421
|
let { data } = this.props;
|
|
1471
1422
|
if (!isNumber(totalRecordCount)) {
|
|
1472
1423
|
totalRecordCount = (startPage - 1) * pageSize + records.length;
|
|
1473
|
-
if (!lastPage &&
|
|
1474
|
-
records.length == (endPage - startPage + 1) * pageSize)
|
|
1424
|
+
if (!lastPage && records.length == (endPage - startPage + 1) * pageSize)
|
|
1475
1425
|
totalRecordCount++;
|
|
1476
1426
|
if (data.totalRecordCount > totalRecordCount)
|
|
1477
1427
|
totalRecordCount = data.totalRecordCount;
|
|
1478
1428
|
}
|
|
1479
|
-
instance.buffer.totalRecordCount = data.totalRecordCount =
|
|
1480
|
-
totalRecordCount;
|
|
1429
|
+
instance.buffer.totalRecordCount = data.totalRecordCount = totalRecordCount;
|
|
1481
1430
|
instance.buffer.records = data.records = records;
|
|
1482
1431
|
instance.buffer.page = data.page = startPage;
|
|
1483
1432
|
data.offset = (startPage - 1) * pageSize;
|
|
@@ -1528,8 +1477,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1528
1477
|
if (widget.buffered && !this.pending) {
|
|
1529
1478
|
let start = 0;
|
|
1530
1479
|
if (widget.measureRowHeights && instance.records)
|
|
1531
|
-
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) -
|
|
1532
|
-
widget.bufferStep);
|
|
1480
|
+
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) - widget.bufferStep);
|
|
1533
1481
|
else if (this.rowHeight > 0)
|
|
1534
1482
|
start = Math.round(this.dom.scroller.scrollTop / this.rowHeight - widget.bufferStep);
|
|
1535
1483
|
start = Math.round(start / widget.bufferStep) * widget.bufferStep;
|
|
@@ -1638,8 +1586,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1638
1586
|
let { widget } = instance;
|
|
1639
1587
|
let grid = widget.onDropTest && instance.invoke("onDropTest", e, instance);
|
|
1640
1588
|
let row = widget.onRowDropTest && instance.invoke("onRowDropTest", e, instance);
|
|
1641
|
-
let column = widget.onColumnDropTest &&
|
|
1642
|
-
instance.invoke("onColumnDropTest", e, instance);
|
|
1589
|
+
let column = widget.onColumnDropTest && instance.invoke("onColumnDropTest", e, instance);
|
|
1643
1590
|
return (grid || row || column) && { grid, row, column };
|
|
1644
1591
|
}
|
|
1645
1592
|
onDragEnd(e) {
|
|
@@ -1658,10 +1605,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1658
1605
|
//columns can be dropped anywhere, while rows only in the scrollable area
|
|
1659
1606
|
let r = getTopLevelBoundingClientRect(column ? this.dom.el : this.dom.scroller);
|
|
1660
1607
|
let { clientX, clientY } = e.cursor;
|
|
1661
|
-
if (clientX < r.left ||
|
|
1662
|
-
clientX >= r.right ||
|
|
1663
|
-
clientY < r.top ||
|
|
1664
|
-
clientY >= r.bottom)
|
|
1608
|
+
if (clientX < r.left || clientX >= r.right || clientY < r.top || clientY >= r.bottom)
|
|
1665
1609
|
return false;
|
|
1666
1610
|
return {
|
|
1667
1611
|
over: 1000,
|
|
@@ -1689,16 +1633,12 @@ class GridComponent extends VDOM.Component {
|
|
|
1689
1633
|
//due to the order of enumeration it's possible that positions are out of order
|
|
1690
1634
|
positions.sort((a, b) => a - b);
|
|
1691
1635
|
let index = 0;
|
|
1692
|
-
while (index + 1 < positions.length &&
|
|
1693
|
-
ev.cursor.clientX > positions[index + 1])
|
|
1636
|
+
while (index + 1 < positions.length && ev.cursor.clientX > positions[index + 1])
|
|
1694
1637
|
index++;
|
|
1695
1638
|
let { fixedColumnCount } = this.props.instance;
|
|
1696
1639
|
this.setState({
|
|
1697
1640
|
colDropInsertionIndex: fixedColumnCount + index,
|
|
1698
|
-
colDropInsertionLeft: positions[index] -
|
|
1699
|
-
positions[0] -
|
|
1700
|
-
this.dom.scroller.scrollLeft +
|
|
1701
|
-
this.dom.scroller.offsetLeft,
|
|
1641
|
+
colDropInsertionLeft: positions[index] - positions[0] - this.dom.scroller.scrollLeft + this.dom.scroller.offsetLeft,
|
|
1702
1642
|
dropTarget: "column",
|
|
1703
1643
|
});
|
|
1704
1644
|
}
|
|
@@ -1747,8 +1687,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1747
1687
|
let confirmed = !grid;
|
|
1748
1688
|
if (!confirmed) {
|
|
1749
1689
|
let insertionZone = (b.bottom - b.top) / 4;
|
|
1750
|
-
confirmed =
|
|
1751
|
-
cy > b.top + insertionZone && cy < b.bottom - insertionZone;
|
|
1690
|
+
confirmed = cy > b.top + insertionZone && cy < b.bottom - insertionZone;
|
|
1752
1691
|
}
|
|
1753
1692
|
if (confirmed) {
|
|
1754
1693
|
rowOverIndex = m;
|
|
@@ -1772,11 +1711,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1772
1711
|
index: start + rowOverIndex,
|
|
1773
1712
|
},
|
|
1774
1713
|
};
|
|
1775
|
-
if (widget.onRowDragOver &&
|
|
1776
|
-
instance.invoke("onRowDragOver", evt, instance) === false)
|
|
1714
|
+
if (widget.onRowDragOver && instance.invoke("onRowDragOver", evt, instance) === false)
|
|
1777
1715
|
cancel = true;
|
|
1778
|
-
else if (rowOverIndex != this.state.dropInsertionIndex ||
|
|
1779
|
-
this.state.dropTarget != "row") {
|
|
1716
|
+
else if (rowOverIndex != this.state.dropInsertionIndex || this.state.dropTarget != "row") {
|
|
1780
1717
|
this.setState({
|
|
1781
1718
|
dropInsertionIndex: rowOverIndex,
|
|
1782
1719
|
dropNextToTheRowAbove: false,
|
|
@@ -1795,11 +1732,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1795
1732
|
totalRecordCount: data.totalRecordCount,
|
|
1796
1733
|
},
|
|
1797
1734
|
};
|
|
1798
|
-
if (widget.onDragOver &&
|
|
1799
|
-
instance.invoke("onDragOver", evt, instance) === false)
|
|
1735
|
+
if (widget.onDragOver && instance.invoke("onDragOver", evt, instance) === false)
|
|
1800
1736
|
cancel = true;
|
|
1801
|
-
else if (s != this.state.dropInsertionIndex ||
|
|
1802
|
-
this.state.dropTarget != "grid") {
|
|
1737
|
+
else if (s != this.state.dropInsertionIndex || this.state.dropTarget != "grid") {
|
|
1803
1738
|
this.setState({
|
|
1804
1739
|
dropInsertionIndex: s,
|
|
1805
1740
|
dropNextToTheRowAbove: nextToTheRowAbove,
|
|
@@ -1829,7 +1764,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1829
1764
|
return this.dom.scroller;
|
|
1830
1765
|
return findScrollableParent(this.dom.table, true);
|
|
1831
1766
|
}
|
|
1832
|
-
onGetVScrollParent({ test: { grid, row, column }
|
|
1767
|
+
onGetVScrollParent({ test: { grid, row, column } }) {
|
|
1833
1768
|
if (column && !grid && !row)
|
|
1834
1769
|
return null;
|
|
1835
1770
|
let { widget } = this.props.instance;
|
|
@@ -1878,22 +1813,18 @@ class GridComponent extends VDOM.Component {
|
|
|
1878
1813
|
if (record.grouping.showCaption) {
|
|
1879
1814
|
let captionKey = "group-caption-" + record.level;
|
|
1880
1815
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1881
|
-
totalHeight +=
|
|
1882
|
-
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1816
|
+
totalHeight += this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1883
1817
|
else
|
|
1884
|
-
totalHeight +=
|
|
1885
|
-
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1818
|
+
totalHeight += this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1886
1819
|
}
|
|
1887
1820
|
break;
|
|
1888
1821
|
case "group-footer":
|
|
1889
1822
|
if (record.grouping.showFooter) {
|
|
1890
1823
|
let captionKey = "group-footer-" + record.level;
|
|
1891
1824
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1892
|
-
totalHeight +=
|
|
1893
|
-
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1825
|
+
totalHeight += this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1894
1826
|
else
|
|
1895
|
-
totalHeight +=
|
|
1896
|
-
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1827
|
+
totalHeight += this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1897
1828
|
}
|
|
1898
1829
|
break;
|
|
1899
1830
|
default:
|
|
@@ -1937,22 +1868,18 @@ class GridComponent extends VDOM.Component {
|
|
|
1937
1868
|
}
|
|
1938
1869
|
}
|
|
1939
1870
|
if (widget.scrollable) {
|
|
1940
|
-
this.scrollWidth =
|
|
1941
|
-
this.dom.scroller.offsetWidth - this.dom.scroller.clientWidth;
|
|
1871
|
+
this.scrollWidth = this.dom.scroller.offsetWidth - this.dom.scroller.clientWidth;
|
|
1942
1872
|
let resized = false, headerHeight = 0, footerHeight = 0, rowHeight = 0;
|
|
1943
1873
|
if (this.dom.fixedTable)
|
|
1944
1874
|
syncHeaderHeights(this.dom.table.firstChild, this.dom.fixedTable.firstChild);
|
|
1945
1875
|
if (this.dom.fixedHeader) {
|
|
1946
|
-
let fixedHeaderTBody = this.dom.fixedHeader.firstChild
|
|
1947
|
-
.firstChild;
|
|
1876
|
+
let fixedHeaderTBody = this.dom.fixedHeader.firstChild.firstChild;
|
|
1948
1877
|
resized = widget.preciseMeasurements
|
|
1949
1878
|
? copyCellSizePrecise(this.dom.table.firstChild, fixedHeaderTBody)
|
|
1950
1879
|
: copyCellSize(this.dom.table.firstChild, fixedHeaderTBody);
|
|
1951
|
-
let scrollColumnEl = fixedHeaderTBody?.firstChild
|
|
1952
|
-
?.lastChild;
|
|
1880
|
+
let scrollColumnEl = fixedHeaderTBody?.firstChild?.lastChild;
|
|
1953
1881
|
if (scrollColumnEl)
|
|
1954
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
1955
|
-
this.scrollWidth + "px";
|
|
1882
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth = this.scrollWidth + "px";
|
|
1956
1883
|
this.dom.fixedHeader.style.display = "block";
|
|
1957
1884
|
headerHeight = this.dom.fixedHeader.offsetHeight;
|
|
1958
1885
|
this.dom.scroller.style.marginTop = `${headerHeight}px`;
|
|
@@ -1973,8 +1900,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1973
1900
|
if (this.dom.fixedHeader)
|
|
1974
1901
|
this.dom.fixedHeader.style.left = fixedColumnsWidth;
|
|
1975
1902
|
this.dom.fixedColumnsFixedHeader.style.display = "block";
|
|
1976
|
-
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader
|
|
1977
|
-
|
|
1903
|
+
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader.firstElementChild
|
|
1904
|
+
?.firstElementChild;
|
|
1978
1905
|
if (this.dom.fixedTable.firstChild) {
|
|
1979
1906
|
resized = copyCellSize(this.dom.fixedTable.firstElementChild, fixedHeaderTBody);
|
|
1980
1907
|
}
|
|
@@ -1987,25 +1914,20 @@ class GridComponent extends VDOM.Component {
|
|
|
1987
1914
|
let dstTableBody = this.dom.fixedColumnsFixedFooter.firstElementChild
|
|
1988
1915
|
?.firstElementChild;
|
|
1989
1916
|
if (dstTableBody) {
|
|
1990
|
-
let srcTableBody = this.dom.fixedTable
|
|
1991
|
-
.lastElementChild;
|
|
1917
|
+
let srcTableBody = this.dom.fixedTable.lastElementChild;
|
|
1992
1918
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
1993
1919
|
this.dom.fixedColumnsFixedFooter.style.display = "block";
|
|
1994
1920
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
1995
1921
|
}
|
|
1996
1922
|
}
|
|
1997
1923
|
if (this.dom.fixedFooter) {
|
|
1998
|
-
let dstTableBody = this.dom.fixedFooter.firstElementChild
|
|
1999
|
-
?.firstElementChild;
|
|
1924
|
+
let dstTableBody = this.dom.fixedFooter.firstElementChild?.firstElementChild;
|
|
2000
1925
|
if (dstTableBody) {
|
|
2001
|
-
let srcTableBody = this.dom.table
|
|
2002
|
-
.lastElementChild;
|
|
1926
|
+
let srcTableBody = this.dom.table.lastElementChild;
|
|
2003
1927
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
2004
|
-
let scrollColumnEl = dstTableBody.firstElementChild
|
|
2005
|
-
?.lastElementChild;
|
|
1928
|
+
let scrollColumnEl = dstTableBody.firstElementChild?.lastElementChild;
|
|
2006
1929
|
if (scrollColumnEl)
|
|
2007
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
2008
|
-
this.scrollWidth + "px";
|
|
1930
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth = this.scrollWidth + "px";
|
|
2009
1931
|
this.dom.fixedFooter.style.display = "block";
|
|
2010
1932
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
2011
1933
|
}
|
|
@@ -2076,8 +1998,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2076
1998
|
}
|
|
2077
1999
|
if (this.dom.fixedTable) {
|
|
2078
2000
|
this.dom.fixedTable.style.marginTop = this.dom.table.style.marginTop;
|
|
2079
|
-
this.dom.fixedTable.style.marginBottom =
|
|
2080
|
-
this.dom.table.style.marginBottom;
|
|
2001
|
+
this.dom.fixedTable.style.marginBottom = this.dom.table.style.marginBottom;
|
|
2081
2002
|
}
|
|
2082
2003
|
this.rowHeight = rowHeight;
|
|
2083
2004
|
let sortersChanged = widget.infinite && !shallowEquals(data.sorters, this.lastSorters);
|
|
@@ -2123,8 +2044,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2123
2044
|
if (cellEdit != null && cellEdit != this.state.cellEdit) {
|
|
2124
2045
|
newState.cellEdit = cellEdit;
|
|
2125
2046
|
if (cellEdit &&
|
|
2126
|
-
(!visibleColumns[this.state.cursorCellIndex] ||
|
|
2127
|
-
!visibleColumns[this.state.cursorCellIndex].editor))
|
|
2047
|
+
(!visibleColumns[this.state.cursorCellIndex] || !visibleColumns[this.state.cursorCellIndex].editor))
|
|
2128
2048
|
newState.cellEdit = false;
|
|
2129
2049
|
}
|
|
2130
2050
|
if (cellIndex != null && cellIndex != this.state.cursorCellIndex) {
|
|
@@ -2143,9 +2063,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2143
2063
|
}
|
|
2144
2064
|
batchUpdates(() => {
|
|
2145
2065
|
if (select) {
|
|
2146
|
-
let start = selectRange &&
|
|
2147
|
-
this.state.selectionStart != null &&
|
|
2148
|
-
this.state.selectionStart >= 0
|
|
2066
|
+
let start = selectRange && this.state.selectionStart != null && this.state.selectionStart >= 0
|
|
2149
2067
|
? this.state.selectionStart
|
|
2150
2068
|
: index;
|
|
2151
2069
|
if (start < 0)
|
|
@@ -2195,21 +2113,17 @@ class GridComponent extends VDOM.Component {
|
|
|
2195
2113
|
FocusManager.focus(this.dom.el);
|
|
2196
2114
|
if (scrollIntoView) {
|
|
2197
2115
|
let record = this.getRecordAt(index);
|
|
2198
|
-
let item = record &&
|
|
2199
|
-
this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2116
|
+
let item = record && this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2200
2117
|
let hscroll = false;
|
|
2201
2118
|
if (item) {
|
|
2202
2119
|
if (widget.cellEditable)
|
|
2203
|
-
if (this.state.cursorCellIndex >=
|
|
2204
|
-
this.props.instance.fixedColumnCount) {
|
|
2120
|
+
if (this.state.cursorCellIndex >= this.props.instance.fixedColumnCount) {
|
|
2205
2121
|
hscroll = true;
|
|
2206
|
-
item = item.firstChild.children[this.state.cursorCellIndex -
|
|
2207
|
-
this.props.instance.fixedColumnCount];
|
|
2122
|
+
item = item.firstChild.children[this.state.cursorCellIndex - this.props.instance.fixedColumnCount];
|
|
2208
2123
|
}
|
|
2209
2124
|
else {
|
|
2210
2125
|
let fixedItem = this.dom.fixedTable.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2211
|
-
let cell = fixedItem &&
|
|
2212
|
-
fixedItem.firstChild.children[this.state.cursorCellIndex];
|
|
2126
|
+
let cell = fixedItem && fixedItem.firstChild.children[this.state.cursorCellIndex];
|
|
2213
2127
|
if (cell)
|
|
2214
2128
|
scrollElementIntoView(cell, false, true, 10);
|
|
2215
2129
|
}
|
|
@@ -2289,8 +2203,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2289
2203
|
record = widget.mapRecord(null, instance, r, cursor - offset);
|
|
2290
2204
|
}
|
|
2291
2205
|
if (record && record.type == "data") {
|
|
2292
|
-
if (instance.isRecordSelectable &&
|
|
2293
|
-
!instance.isRecordSelectable(record.data, options))
|
|
2206
|
+
if (instance.isRecordSelectable && !instance.isRecordSelectable(record.data, options))
|
|
2294
2207
|
continue;
|
|
2295
2208
|
selection.push(record.data);
|
|
2296
2209
|
indexes.push(record.index);
|
|
@@ -2332,13 +2245,9 @@ class GridComponent extends VDOM.Component {
|
|
|
2332
2245
|
if (widget.onKeyDown && instance.invoke("onKeyDown", e, instance) === false)
|
|
2333
2246
|
return;
|
|
2334
2247
|
let recordInstance = this.getRecordInstanceAt(this.state.cursor);
|
|
2335
|
-
if (recordInstance &&
|
|
2336
|
-
widget.onRowKeyDown &&
|
|
2337
|
-
instance.invoke("onRowKeyDown", e, recordInstance) === false)
|
|
2248
|
+
if (recordInstance && widget.onRowKeyDown && instance.invoke("onRowKeyDown", e, recordInstance) === false)
|
|
2338
2249
|
return;
|
|
2339
|
-
if (widget.onCellKeyDown &&
|
|
2340
|
-
widget.cellEditable &&
|
|
2341
|
-
this.state.cursorCellIndex != -1) {
|
|
2250
|
+
if (widget.onCellKeyDown && widget.cellEditable && this.state.cursorCellIndex != -1) {
|
|
2342
2251
|
if (instance.invoke("onCellKeyDown", e, instance, {
|
|
2343
2252
|
cellIndex: this.state.cursorCellIndex,
|
|
2344
2253
|
record: recordInstance,
|
|
@@ -2377,8 +2286,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2377
2286
|
e.preventDefault();
|
|
2378
2287
|
let direction = e.shiftKey ? -1 : +1;
|
|
2379
2288
|
let cursor = this.state.cursor;
|
|
2380
|
-
let cellIndex = (this.state.cursorCellIndex + direction) %
|
|
2381
|
-
instance.row.line1.columns.length;
|
|
2289
|
+
let cellIndex = (this.state.cursorCellIndex + direction) % instance.row.line1.columns.length;
|
|
2382
2290
|
if (cellIndex == -1) {
|
|
2383
2291
|
cellIndex += instance.row.line1.columns.length;
|
|
2384
2292
|
cursor--;
|
|
@@ -2439,8 +2347,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2439
2347
|
break;
|
|
2440
2348
|
case KeyCode.right:
|
|
2441
2349
|
if (widget.cellEditable) {
|
|
2442
|
-
if (this.state.cursorCellIndex + 1 <
|
|
2443
|
-
instance.row.line1.columns.length) {
|
|
2350
|
+
if (this.state.cursorCellIndex + 1 < instance.row.line1.columns.length) {
|
|
2444
2351
|
this.moveCursor(this.state.cursor, {
|
|
2445
2352
|
focused: true,
|
|
2446
2353
|
cellIndex: this.state.cursorCellIndex + 1,
|
|
@@ -2485,13 +2392,9 @@ class GridComponent extends VDOM.Component {
|
|
|
2485
2392
|
let isSelected = widget.selection.getIsSelectedDelegate(store);
|
|
2486
2393
|
let selected = [];
|
|
2487
2394
|
let add = (rec, data, index, force) => {
|
|
2488
|
-
if (!data ||
|
|
2489
|
-
!(force || isSelected(data, index)) ||
|
|
2490
|
-
(isRecordDraggable && !isRecordDraggable(data)))
|
|
2395
|
+
if (!data || !(force || isSelected(data, index)) || (isRecordDraggable && !isRecordDraggable(data)))
|
|
2491
2396
|
return;
|
|
2492
|
-
let mappedRecord = rec
|
|
2493
|
-
? { ...rec }
|
|
2494
|
-
: widget.mapRecord(null, instance, data, index);
|
|
2397
|
+
let mappedRecord = rec ? { ...rec } : widget.mapRecord(null, instance, data, index);
|
|
2495
2398
|
let row = (mappedRecord.row = instance.getDetachedChild(instance.row, "DD:" + mappedRecord.key, mappedRecord.store));
|
|
2496
2399
|
row.selected = true;
|
|
2497
2400
|
selected.push(mappedRecord);
|
|
@@ -2631,12 +2534,7 @@ class GridColumnHeader extends Widget {
|
|
|
2631
2534
|
delete this.class;
|
|
2632
2535
|
if (this.header)
|
|
2633
2536
|
this.header1 = this.header;
|
|
2634
|
-
if (this.header1 ||
|
|
2635
|
-
this.resizable ||
|
|
2636
|
-
this.width ||
|
|
2637
|
-
this.defaultWidth ||
|
|
2638
|
-
this.sortable ||
|
|
2639
|
-
this.draggable) {
|
|
2537
|
+
if (this.header1 || this.resizable || this.width || this.defaultWidth || this.sortable || this.draggable) {
|
|
2640
2538
|
if (!isObject(this.header1))
|
|
2641
2539
|
this.header1 = {
|
|
2642
2540
|
text: this.header1 || "",
|