cx 26.3.5 → 26.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +94 -192
- 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 +819 -810
- package/dist/widgets.css +15 -7
- package/dist/widgets.js +38 -20
- 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 +7 -3
- 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;
|
|
@@ -1457,6 +1408,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1457
1408
|
pageRecords.forEach((page) => {
|
|
1458
1409
|
if (Array.isArray(page)) {
|
|
1459
1410
|
records.push(...page);
|
|
1411
|
+
lastPage = records.length < pageSize;
|
|
1460
1412
|
}
|
|
1461
1413
|
else {
|
|
1462
1414
|
if (!Array.isArray(page.records))
|
|
@@ -1470,17 +1422,18 @@ class GridComponent extends VDOM.Component {
|
|
|
1470
1422
|
let { data } = this.props;
|
|
1471
1423
|
if (!isNumber(totalRecordCount)) {
|
|
1472
1424
|
totalRecordCount = (startPage - 1) * pageSize + records.length;
|
|
1473
|
-
if (!lastPage
|
|
1474
|
-
records.length == (endPage - startPage + 1) * pageSize)
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1425
|
+
if (!lastPage) {
|
|
1426
|
+
if (records.length == (endPage - startPage + 1) * pageSize)
|
|
1427
|
+
totalRecordCount++;
|
|
1428
|
+
if (data.totalRecordCount > totalRecordCount)
|
|
1429
|
+
totalRecordCount = data.totalRecordCount;
|
|
1430
|
+
}
|
|
1478
1431
|
}
|
|
1479
|
-
instance.buffer.totalRecordCount = data.totalRecordCount =
|
|
1480
|
-
totalRecordCount;
|
|
1432
|
+
instance.buffer.totalRecordCount = data.totalRecordCount = totalRecordCount;
|
|
1481
1433
|
instance.buffer.records = data.records = records;
|
|
1482
1434
|
instance.buffer.page = data.page = startPage;
|
|
1483
1435
|
data.offset = (startPage - 1) * pageSize;
|
|
1436
|
+
data.empty = totalRecordCount == 0;
|
|
1484
1437
|
instance.store.silently(() => {
|
|
1485
1438
|
instance.set("records", records);
|
|
1486
1439
|
instance.set("page", startPage);
|
|
@@ -1501,7 +1454,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1501
1454
|
.catch((error) => {
|
|
1502
1455
|
this.loading = false;
|
|
1503
1456
|
if (widget.onLoadingError)
|
|
1504
|
-
instance.invoke(
|
|
1457
|
+
instance.invoke("onLoadingError", error, instance);
|
|
1505
1458
|
});
|
|
1506
1459
|
}, 30);
|
|
1507
1460
|
if (startPage < this.loadingStartPage || endPage > this.loadingEndPage) {
|
|
@@ -1528,8 +1481,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1528
1481
|
if (widget.buffered && !this.pending) {
|
|
1529
1482
|
let start = 0;
|
|
1530
1483
|
if (widget.measureRowHeights && instance.records)
|
|
1531
|
-
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) -
|
|
1532
|
-
widget.bufferStep);
|
|
1484
|
+
start = Math.max(0, this.estimateStart(instance.records, this.dom.scroller.scrollTop) - widget.bufferStep);
|
|
1533
1485
|
else if (this.rowHeight > 0)
|
|
1534
1486
|
start = Math.round(this.dom.scroller.scrollTop / this.rowHeight - widget.bufferStep);
|
|
1535
1487
|
start = Math.round(start / widget.bufferStep) * widget.bufferStep;
|
|
@@ -1638,8 +1590,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1638
1590
|
let { widget } = instance;
|
|
1639
1591
|
let grid = widget.onDropTest && instance.invoke("onDropTest", e, instance);
|
|
1640
1592
|
let row = widget.onRowDropTest && instance.invoke("onRowDropTest", e, instance);
|
|
1641
|
-
let column = widget.onColumnDropTest &&
|
|
1642
|
-
instance.invoke("onColumnDropTest", e, instance);
|
|
1593
|
+
let column = widget.onColumnDropTest && instance.invoke("onColumnDropTest", e, instance);
|
|
1643
1594
|
return (grid || row || column) && { grid, row, column };
|
|
1644
1595
|
}
|
|
1645
1596
|
onDragEnd(e) {
|
|
@@ -1658,10 +1609,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1658
1609
|
//columns can be dropped anywhere, while rows only in the scrollable area
|
|
1659
1610
|
let r = getTopLevelBoundingClientRect(column ? this.dom.el : this.dom.scroller);
|
|
1660
1611
|
let { clientX, clientY } = e.cursor;
|
|
1661
|
-
if (clientX < r.left ||
|
|
1662
|
-
clientX >= r.right ||
|
|
1663
|
-
clientY < r.top ||
|
|
1664
|
-
clientY >= r.bottom)
|
|
1612
|
+
if (clientX < r.left || clientX >= r.right || clientY < r.top || clientY >= r.bottom)
|
|
1665
1613
|
return false;
|
|
1666
1614
|
return {
|
|
1667
1615
|
over: 1000,
|
|
@@ -1689,16 +1637,12 @@ class GridComponent extends VDOM.Component {
|
|
|
1689
1637
|
//due to the order of enumeration it's possible that positions are out of order
|
|
1690
1638
|
positions.sort((a, b) => a - b);
|
|
1691
1639
|
let index = 0;
|
|
1692
|
-
while (index + 1 < positions.length &&
|
|
1693
|
-
ev.cursor.clientX > positions[index + 1])
|
|
1640
|
+
while (index + 1 < positions.length && ev.cursor.clientX > positions[index + 1])
|
|
1694
1641
|
index++;
|
|
1695
1642
|
let { fixedColumnCount } = this.props.instance;
|
|
1696
1643
|
this.setState({
|
|
1697
1644
|
colDropInsertionIndex: fixedColumnCount + index,
|
|
1698
|
-
colDropInsertionLeft: positions[index] -
|
|
1699
|
-
positions[0] -
|
|
1700
|
-
this.dom.scroller.scrollLeft +
|
|
1701
|
-
this.dom.scroller.offsetLeft,
|
|
1645
|
+
colDropInsertionLeft: positions[index] - positions[0] - this.dom.scroller.scrollLeft + this.dom.scroller.offsetLeft,
|
|
1702
1646
|
dropTarget: "column",
|
|
1703
1647
|
});
|
|
1704
1648
|
}
|
|
@@ -1747,8 +1691,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1747
1691
|
let confirmed = !grid;
|
|
1748
1692
|
if (!confirmed) {
|
|
1749
1693
|
let insertionZone = (b.bottom - b.top) / 4;
|
|
1750
|
-
confirmed =
|
|
1751
|
-
cy > b.top + insertionZone && cy < b.bottom - insertionZone;
|
|
1694
|
+
confirmed = cy > b.top + insertionZone && cy < b.bottom - insertionZone;
|
|
1752
1695
|
}
|
|
1753
1696
|
if (confirmed) {
|
|
1754
1697
|
rowOverIndex = m;
|
|
@@ -1772,11 +1715,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1772
1715
|
index: start + rowOverIndex,
|
|
1773
1716
|
},
|
|
1774
1717
|
};
|
|
1775
|
-
if (widget.onRowDragOver &&
|
|
1776
|
-
instance.invoke("onRowDragOver", evt, instance) === false)
|
|
1718
|
+
if (widget.onRowDragOver && instance.invoke("onRowDragOver", evt, instance) === false)
|
|
1777
1719
|
cancel = true;
|
|
1778
|
-
else if (rowOverIndex != this.state.dropInsertionIndex ||
|
|
1779
|
-
this.state.dropTarget != "row") {
|
|
1720
|
+
else if (rowOverIndex != this.state.dropInsertionIndex || this.state.dropTarget != "row") {
|
|
1780
1721
|
this.setState({
|
|
1781
1722
|
dropInsertionIndex: rowOverIndex,
|
|
1782
1723
|
dropNextToTheRowAbove: false,
|
|
@@ -1795,11 +1736,9 @@ class GridComponent extends VDOM.Component {
|
|
|
1795
1736
|
totalRecordCount: data.totalRecordCount,
|
|
1796
1737
|
},
|
|
1797
1738
|
};
|
|
1798
|
-
if (widget.onDragOver &&
|
|
1799
|
-
instance.invoke("onDragOver", evt, instance) === false)
|
|
1739
|
+
if (widget.onDragOver && instance.invoke("onDragOver", evt, instance) === false)
|
|
1800
1740
|
cancel = true;
|
|
1801
|
-
else if (s != this.state.dropInsertionIndex ||
|
|
1802
|
-
this.state.dropTarget != "grid") {
|
|
1741
|
+
else if (s != this.state.dropInsertionIndex || this.state.dropTarget != "grid") {
|
|
1803
1742
|
this.setState({
|
|
1804
1743
|
dropInsertionIndex: s,
|
|
1805
1744
|
dropNextToTheRowAbove: nextToTheRowAbove,
|
|
@@ -1829,7 +1768,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1829
1768
|
return this.dom.scroller;
|
|
1830
1769
|
return findScrollableParent(this.dom.table, true);
|
|
1831
1770
|
}
|
|
1832
|
-
onGetVScrollParent({ test: { grid, row, column }
|
|
1771
|
+
onGetVScrollParent({ test: { grid, row, column } }) {
|
|
1833
1772
|
if (column && !grid && !row)
|
|
1834
1773
|
return null;
|
|
1835
1774
|
let { widget } = this.props.instance;
|
|
@@ -1878,22 +1817,18 @@ class GridComponent extends VDOM.Component {
|
|
|
1878
1817
|
if (record.grouping.showCaption) {
|
|
1879
1818
|
let captionKey = "group-caption-" + record.level;
|
|
1880
1819
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1881
|
-
totalHeight +=
|
|
1882
|
-
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1820
|
+
totalHeight += this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1883
1821
|
else
|
|
1884
|
-
totalHeight +=
|
|
1885
|
-
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1822
|
+
totalHeight += this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1886
1823
|
}
|
|
1887
1824
|
break;
|
|
1888
1825
|
case "group-footer":
|
|
1889
1826
|
if (record.grouping.showFooter) {
|
|
1890
1827
|
let captionKey = "group-footer-" + record.level;
|
|
1891
1828
|
if (`${captionKey}-${record.group.$key}` in this.rowHeights)
|
|
1892
|
-
totalHeight +=
|
|
1893
|
-
this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1829
|
+
totalHeight += this.rowHeights[`${captionKey}-${record.group.$key}`];
|
|
1894
1830
|
else
|
|
1895
|
-
totalHeight +=
|
|
1896
|
-
this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1831
|
+
totalHeight += this.heightStats.estimate(captionKey) ?? avgDataRowHeight;
|
|
1897
1832
|
}
|
|
1898
1833
|
break;
|
|
1899
1834
|
default:
|
|
@@ -1937,22 +1872,18 @@ class GridComponent extends VDOM.Component {
|
|
|
1937
1872
|
}
|
|
1938
1873
|
}
|
|
1939
1874
|
if (widget.scrollable) {
|
|
1940
|
-
this.scrollWidth =
|
|
1941
|
-
this.dom.scroller.offsetWidth - this.dom.scroller.clientWidth;
|
|
1875
|
+
this.scrollWidth = this.dom.scroller.offsetWidth - this.dom.scroller.clientWidth;
|
|
1942
1876
|
let resized = false, headerHeight = 0, footerHeight = 0, rowHeight = 0;
|
|
1943
1877
|
if (this.dom.fixedTable)
|
|
1944
1878
|
syncHeaderHeights(this.dom.table.firstChild, this.dom.fixedTable.firstChild);
|
|
1945
1879
|
if (this.dom.fixedHeader) {
|
|
1946
|
-
let fixedHeaderTBody = this.dom.fixedHeader.firstChild
|
|
1947
|
-
.firstChild;
|
|
1880
|
+
let fixedHeaderTBody = this.dom.fixedHeader.firstChild.firstChild;
|
|
1948
1881
|
resized = widget.preciseMeasurements
|
|
1949
1882
|
? copyCellSizePrecise(this.dom.table.firstChild, fixedHeaderTBody)
|
|
1950
1883
|
: copyCellSize(this.dom.table.firstChild, fixedHeaderTBody);
|
|
1951
|
-
let scrollColumnEl = fixedHeaderTBody?.firstChild
|
|
1952
|
-
?.lastChild;
|
|
1884
|
+
let scrollColumnEl = fixedHeaderTBody?.firstChild?.lastChild;
|
|
1953
1885
|
if (scrollColumnEl)
|
|
1954
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
1955
|
-
this.scrollWidth + "px";
|
|
1886
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth = this.scrollWidth + "px";
|
|
1956
1887
|
this.dom.fixedHeader.style.display = "block";
|
|
1957
1888
|
headerHeight = this.dom.fixedHeader.offsetHeight;
|
|
1958
1889
|
this.dom.scroller.style.marginTop = `${headerHeight}px`;
|
|
@@ -1973,8 +1904,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1973
1904
|
if (this.dom.fixedHeader)
|
|
1974
1905
|
this.dom.fixedHeader.style.left = fixedColumnsWidth;
|
|
1975
1906
|
this.dom.fixedColumnsFixedHeader.style.display = "block";
|
|
1976
|
-
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader
|
|
1977
|
-
|
|
1907
|
+
let fixedHeaderTBody = this.dom.fixedColumnsFixedHeader.firstElementChild
|
|
1908
|
+
?.firstElementChild;
|
|
1978
1909
|
if (this.dom.fixedTable.firstChild) {
|
|
1979
1910
|
resized = copyCellSize(this.dom.fixedTable.firstElementChild, fixedHeaderTBody);
|
|
1980
1911
|
}
|
|
@@ -1987,25 +1918,20 @@ class GridComponent extends VDOM.Component {
|
|
|
1987
1918
|
let dstTableBody = this.dom.fixedColumnsFixedFooter.firstElementChild
|
|
1988
1919
|
?.firstElementChild;
|
|
1989
1920
|
if (dstTableBody) {
|
|
1990
|
-
let srcTableBody = this.dom.fixedTable
|
|
1991
|
-
.lastElementChild;
|
|
1921
|
+
let srcTableBody = this.dom.fixedTable.lastElementChild;
|
|
1992
1922
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
1993
1923
|
this.dom.fixedColumnsFixedFooter.style.display = "block";
|
|
1994
1924
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
1995
1925
|
}
|
|
1996
1926
|
}
|
|
1997
1927
|
if (this.dom.fixedFooter) {
|
|
1998
|
-
let dstTableBody = this.dom.fixedFooter.firstElementChild
|
|
1999
|
-
?.firstElementChild;
|
|
1928
|
+
let dstTableBody = this.dom.fixedFooter.firstElementChild?.firstElementChild;
|
|
2000
1929
|
if (dstTableBody) {
|
|
2001
|
-
let srcTableBody = this.dom.table
|
|
2002
|
-
.lastElementChild;
|
|
1930
|
+
let srcTableBody = this.dom.table.lastElementChild;
|
|
2003
1931
|
copyCellSize(srcTableBody, dstTableBody, fixedFooterOverlap);
|
|
2004
|
-
let scrollColumnEl = dstTableBody.firstElementChild
|
|
2005
|
-
?.lastElementChild;
|
|
1932
|
+
let scrollColumnEl = dstTableBody.firstElementChild?.lastElementChild;
|
|
2006
1933
|
if (scrollColumnEl)
|
|
2007
|
-
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth =
|
|
2008
|
-
this.scrollWidth + "px";
|
|
1934
|
+
scrollColumnEl.style.minWidth = scrollColumnEl.style.maxWidth = this.scrollWidth + "px";
|
|
2009
1935
|
this.dom.fixedFooter.style.display = "block";
|
|
2010
1936
|
footerHeight = this.dom.fixedFooter.offsetHeight;
|
|
2011
1937
|
}
|
|
@@ -2076,8 +2002,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2076
2002
|
}
|
|
2077
2003
|
if (this.dom.fixedTable) {
|
|
2078
2004
|
this.dom.fixedTable.style.marginTop = this.dom.table.style.marginTop;
|
|
2079
|
-
this.dom.fixedTable.style.marginBottom =
|
|
2080
|
-
this.dom.table.style.marginBottom;
|
|
2005
|
+
this.dom.fixedTable.style.marginBottom = this.dom.table.style.marginBottom;
|
|
2081
2006
|
}
|
|
2082
2007
|
this.rowHeight = rowHeight;
|
|
2083
2008
|
let sortersChanged = widget.infinite && !shallowEquals(data.sorters, this.lastSorters);
|
|
@@ -2123,8 +2048,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2123
2048
|
if (cellEdit != null && cellEdit != this.state.cellEdit) {
|
|
2124
2049
|
newState.cellEdit = cellEdit;
|
|
2125
2050
|
if (cellEdit &&
|
|
2126
|
-
(!visibleColumns[this.state.cursorCellIndex] ||
|
|
2127
|
-
!visibleColumns[this.state.cursorCellIndex].editor))
|
|
2051
|
+
(!visibleColumns[this.state.cursorCellIndex] || !visibleColumns[this.state.cursorCellIndex].editor))
|
|
2128
2052
|
newState.cellEdit = false;
|
|
2129
2053
|
}
|
|
2130
2054
|
if (cellIndex != null && cellIndex != this.state.cursorCellIndex) {
|
|
@@ -2143,9 +2067,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2143
2067
|
}
|
|
2144
2068
|
batchUpdates(() => {
|
|
2145
2069
|
if (select) {
|
|
2146
|
-
let start = selectRange &&
|
|
2147
|
-
this.state.selectionStart != null &&
|
|
2148
|
-
this.state.selectionStart >= 0
|
|
2070
|
+
let start = selectRange && this.state.selectionStart != null && this.state.selectionStart >= 0
|
|
2149
2071
|
? this.state.selectionStart
|
|
2150
2072
|
: index;
|
|
2151
2073
|
if (start < 0)
|
|
@@ -2195,21 +2117,17 @@ class GridComponent extends VDOM.Component {
|
|
|
2195
2117
|
FocusManager.focus(this.dom.el);
|
|
2196
2118
|
if (scrollIntoView) {
|
|
2197
2119
|
let record = this.getRecordAt(index);
|
|
2198
|
-
let item = record &&
|
|
2199
|
-
this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2120
|
+
let item = record && this.dom.table.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2200
2121
|
let hscroll = false;
|
|
2201
2122
|
if (item) {
|
|
2202
2123
|
if (widget.cellEditable)
|
|
2203
|
-
if (this.state.cursorCellIndex >=
|
|
2204
|
-
this.props.instance.fixedColumnCount) {
|
|
2124
|
+
if (this.state.cursorCellIndex >= this.props.instance.fixedColumnCount) {
|
|
2205
2125
|
hscroll = true;
|
|
2206
|
-
item = item.firstChild.children[this.state.cursorCellIndex -
|
|
2207
|
-
this.props.instance.fixedColumnCount];
|
|
2126
|
+
item = item.firstChild.children[this.state.cursorCellIndex - this.props.instance.fixedColumnCount];
|
|
2208
2127
|
}
|
|
2209
2128
|
else {
|
|
2210
2129
|
let fixedItem = this.dom.fixedTable.querySelector(`tbody[data-record-key="${record.key}"]`);
|
|
2211
|
-
let cell = fixedItem &&
|
|
2212
|
-
fixedItem.firstChild.children[this.state.cursorCellIndex];
|
|
2130
|
+
let cell = fixedItem && fixedItem.firstChild.children[this.state.cursorCellIndex];
|
|
2213
2131
|
if (cell)
|
|
2214
2132
|
scrollElementIntoView(cell, false, true, 10);
|
|
2215
2133
|
}
|
|
@@ -2289,8 +2207,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2289
2207
|
record = widget.mapRecord(null, instance, r, cursor - offset);
|
|
2290
2208
|
}
|
|
2291
2209
|
if (record && record.type == "data") {
|
|
2292
|
-
if (instance.isRecordSelectable &&
|
|
2293
|
-
!instance.isRecordSelectable(record.data, options))
|
|
2210
|
+
if (instance.isRecordSelectable && !instance.isRecordSelectable(record.data, options))
|
|
2294
2211
|
continue;
|
|
2295
2212
|
selection.push(record.data);
|
|
2296
2213
|
indexes.push(record.index);
|
|
@@ -2332,13 +2249,9 @@ class GridComponent extends VDOM.Component {
|
|
|
2332
2249
|
if (widget.onKeyDown && instance.invoke("onKeyDown", e, instance) === false)
|
|
2333
2250
|
return;
|
|
2334
2251
|
let recordInstance = this.getRecordInstanceAt(this.state.cursor);
|
|
2335
|
-
if (recordInstance &&
|
|
2336
|
-
widget.onRowKeyDown &&
|
|
2337
|
-
instance.invoke("onRowKeyDown", e, recordInstance) === false)
|
|
2252
|
+
if (recordInstance && widget.onRowKeyDown && instance.invoke("onRowKeyDown", e, recordInstance) === false)
|
|
2338
2253
|
return;
|
|
2339
|
-
if (widget.onCellKeyDown &&
|
|
2340
|
-
widget.cellEditable &&
|
|
2341
|
-
this.state.cursorCellIndex != -1) {
|
|
2254
|
+
if (widget.onCellKeyDown && widget.cellEditable && this.state.cursorCellIndex != -1) {
|
|
2342
2255
|
if (instance.invoke("onCellKeyDown", e, instance, {
|
|
2343
2256
|
cellIndex: this.state.cursorCellIndex,
|
|
2344
2257
|
record: recordInstance,
|
|
@@ -2377,8 +2290,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2377
2290
|
e.preventDefault();
|
|
2378
2291
|
let direction = e.shiftKey ? -1 : +1;
|
|
2379
2292
|
let cursor = this.state.cursor;
|
|
2380
|
-
let cellIndex = (this.state.cursorCellIndex + direction) %
|
|
2381
|
-
instance.row.line1.columns.length;
|
|
2293
|
+
let cellIndex = (this.state.cursorCellIndex + direction) % instance.row.line1.columns.length;
|
|
2382
2294
|
if (cellIndex == -1) {
|
|
2383
2295
|
cellIndex += instance.row.line1.columns.length;
|
|
2384
2296
|
cursor--;
|
|
@@ -2439,8 +2351,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2439
2351
|
break;
|
|
2440
2352
|
case KeyCode.right:
|
|
2441
2353
|
if (widget.cellEditable) {
|
|
2442
|
-
if (this.state.cursorCellIndex + 1 <
|
|
2443
|
-
instance.row.line1.columns.length) {
|
|
2354
|
+
if (this.state.cursorCellIndex + 1 < instance.row.line1.columns.length) {
|
|
2444
2355
|
this.moveCursor(this.state.cursor, {
|
|
2445
2356
|
focused: true,
|
|
2446
2357
|
cellIndex: this.state.cursorCellIndex + 1,
|
|
@@ -2485,13 +2396,9 @@ class GridComponent extends VDOM.Component {
|
|
|
2485
2396
|
let isSelected = widget.selection.getIsSelectedDelegate(store);
|
|
2486
2397
|
let selected = [];
|
|
2487
2398
|
let add = (rec, data, index, force) => {
|
|
2488
|
-
if (!data ||
|
|
2489
|
-
!(force || isSelected(data, index)) ||
|
|
2490
|
-
(isRecordDraggable && !isRecordDraggable(data)))
|
|
2399
|
+
if (!data || !(force || isSelected(data, index)) || (isRecordDraggable && !isRecordDraggable(data)))
|
|
2491
2400
|
return;
|
|
2492
|
-
let mappedRecord = rec
|
|
2493
|
-
? { ...rec }
|
|
2494
|
-
: widget.mapRecord(null, instance, data, index);
|
|
2401
|
+
let mappedRecord = rec ? { ...rec } : widget.mapRecord(null, instance, data, index);
|
|
2495
2402
|
let row = (mappedRecord.row = instance.getDetachedChild(instance.row, "DD:" + mappedRecord.key, mappedRecord.store));
|
|
2496
2403
|
row.selected = true;
|
|
2497
2404
|
selected.push(mappedRecord);
|
|
@@ -2631,12 +2538,7 @@ class GridColumnHeader extends Widget {
|
|
|
2631
2538
|
delete this.class;
|
|
2632
2539
|
if (this.header)
|
|
2633
2540
|
this.header1 = this.header;
|
|
2634
|
-
if (this.header1 ||
|
|
2635
|
-
this.resizable ||
|
|
2636
|
-
this.width ||
|
|
2637
|
-
this.defaultWidth ||
|
|
2638
|
-
this.sortable ||
|
|
2639
|
-
this.draggable) {
|
|
2541
|
+
if (this.header1 || this.resizable || this.width || this.defaultWidth || this.sortable || this.draggable) {
|
|
2640
2542
|
if (!isObject(this.header1))
|
|
2641
2543
|
this.header1 = {
|
|
2642
2544
|
text: this.header1 || "",
|