cx 24.0.1 → 24.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/charts.js +169 -235
- package/dist/data.js +42 -85
- package/dist/hooks.js +1 -1
- package/dist/manifest.js +705 -705
- package/dist/svg.js +47 -97
- package/dist/ui.js +180 -242
- package/dist/util.js +9 -7
- package/dist/widgets.js +1199 -1481
- package/package.json +1 -1
- package/src/widgets/grid/Grid.d.ts +3 -0
- package/src/widgets/grid/Grid.js +44 -43
package/package.json
CHANGED
|
@@ -385,6 +385,9 @@ interface GridProps<T = unknown> extends StyledContainerProps {
|
|
|
385
385
|
|
|
386
386
|
/** Callback to create a function that can be used to check whether a record is draggable. */
|
|
387
387
|
onCreateIsRecordDraggable?: (params: any, instance: Instance) => (record: T) => boolean;
|
|
388
|
+
|
|
389
|
+
/** Callback function to get grid component and instance references on component init. */
|
|
390
|
+
onRef?: string | ((element: any, instance: Instance) => void);
|
|
388
391
|
}
|
|
389
392
|
|
|
390
393
|
interface GridCellInfo {
|
package/src/widgets/grid/Grid.js
CHANGED
|
@@ -68,7 +68,7 @@ export class Grid extends Container {
|
|
|
68
68
|
tabIndex: undefined,
|
|
69
69
|
columnParams: { structured: true },
|
|
70
70
|
},
|
|
71
|
-
selection
|
|
71
|
+
selection,
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -162,10 +162,10 @@ export class Grid extends Container {
|
|
|
162
162
|
value: isDefined(c.aggregateValue)
|
|
163
163
|
? c.aggregateValue
|
|
164
164
|
: isDefined(c.value)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
? c.value
|
|
166
|
+
: c.aggregateField
|
|
167
|
+
? { bind: this.recordName + "." + c.aggregateField }
|
|
168
|
+
: null,
|
|
169
169
|
weight:
|
|
170
170
|
c.weight != null
|
|
171
171
|
? c.weight
|
|
@@ -197,7 +197,7 @@ export class Grid extends Container {
|
|
|
197
197
|
grouping[0].showFooter = true;
|
|
198
198
|
if (grouping[0].key && Object.keys(grouping[0].key).length > 0)
|
|
199
199
|
Console.warn(
|
|
200
|
-
"First grouping level in grids with a fixed footer must group all data. The key field should be omitted."
|
|
200
|
+
"First grouping level in grids with a fixed footer must group all data. The key field should be omitted.",
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -212,7 +212,7 @@ export class Grid extends Container {
|
|
|
212
212
|
sortOptions: this.sortOptions,
|
|
213
213
|
groupings: grouping,
|
|
214
214
|
},
|
|
215
|
-
this.dataAdapter
|
|
215
|
+
this.dataAdapter,
|
|
216
216
|
);
|
|
217
217
|
|
|
218
218
|
instance.dataAdapter.initInstance(context, instance);
|
|
@@ -524,7 +524,7 @@ export class Grid extends Container {
|
|
|
524
524
|
|
|
525
525
|
let headerCell = findFirstChild(
|
|
526
526
|
headerTBody,
|
|
527
|
-
(el) => el.tagName == "TH" && el.dataset?.uniqueColId == uniqueColId
|
|
527
|
+
(el) => el.tagName == "TH" && el.dataset?.uniqueColId == uniqueColId,
|
|
528
528
|
);
|
|
529
529
|
let scrollAreaEl = headerTBody.parentElement.parentElement;
|
|
530
530
|
let gridEl = scrollAreaEl.parentElement;
|
|
@@ -738,7 +738,7 @@ export class Grid extends Container {
|
|
|
738
738
|
{tool}
|
|
739
739
|
{prevColumnResizer}
|
|
740
740
|
{resizer}
|
|
741
|
-
</th
|
|
741
|
+
</th>,
|
|
742
742
|
);
|
|
743
743
|
}
|
|
744
744
|
});
|
|
@@ -748,7 +748,7 @@ export class Grid extends Container {
|
|
|
748
748
|
if (result[0]) {
|
|
749
749
|
if (fixed && !fixedColumns) {
|
|
750
750
|
result[0].push(
|
|
751
|
-
<th key="dummy" rowSpan={result.length} className={CSS.element(baseClass, "col-header")}
|
|
751
|
+
<th key="dummy" rowSpan={result.length} className={CSS.element(baseClass, "col-header")} />,
|
|
752
752
|
);
|
|
753
753
|
}
|
|
754
754
|
|
|
@@ -757,7 +757,7 @@ export class Grid extends Container {
|
|
|
757
757
|
{result.map((h, i) => (
|
|
758
758
|
<tr key={i}>{h}</tr>
|
|
759
759
|
))}
|
|
760
|
-
</tbody
|
|
760
|
+
</tbody>,
|
|
761
761
|
);
|
|
762
762
|
}
|
|
763
763
|
});
|
|
@@ -797,7 +797,7 @@ export class Grid extends Container {
|
|
|
797
797
|
widget: () => <div className={CSS.element(baseClass, "col-header-drag-clone")}>{data.text}</div>,
|
|
798
798
|
},
|
|
799
799
|
},
|
|
800
|
-
() => {}
|
|
800
|
+
() => {},
|
|
801
801
|
);
|
|
802
802
|
}
|
|
803
803
|
}
|
|
@@ -1066,8 +1066,8 @@ export class Grid extends Container {
|
|
|
1066
1066
|
record.group,
|
|
1067
1067
|
record.key + "-caption",
|
|
1068
1068
|
record.store,
|
|
1069
|
-
false
|
|
1070
|
-
)
|
|
1069
|
+
false,
|
|
1070
|
+
),
|
|
1071
1071
|
);
|
|
1072
1072
|
|
|
1073
1073
|
if (hasFixedColumns)
|
|
@@ -1080,8 +1080,8 @@ export class Grid extends Container {
|
|
|
1080
1080
|
record.group,
|
|
1081
1081
|
record.key + "-caption",
|
|
1082
1082
|
record.store,
|
|
1083
|
-
true
|
|
1084
|
-
)
|
|
1083
|
+
true,
|
|
1084
|
+
),
|
|
1085
1085
|
);
|
|
1086
1086
|
|
|
1087
1087
|
if (g.showHeader) {
|
|
@@ -1103,7 +1103,7 @@ export class Grid extends Container {
|
|
|
1103
1103
|
record.key + "-footer",
|
|
1104
1104
|
record.store,
|
|
1105
1105
|
false,
|
|
1106
|
-
false
|
|
1106
|
+
false,
|
|
1107
1107
|
);
|
|
1108
1108
|
if (hasFixedColumns)
|
|
1109
1109
|
record.fixedVdom = this.renderGroupFooter(
|
|
@@ -1115,7 +1115,7 @@ export class Grid extends Container {
|
|
|
1115
1115
|
record.key + "-footer",
|
|
1116
1116
|
record.store,
|
|
1117
1117
|
false,
|
|
1118
|
-
true
|
|
1118
|
+
true,
|
|
1119
1119
|
);
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
@@ -1146,7 +1146,7 @@ export class Grid extends Container {
|
|
|
1146
1146
|
record.key + "-footer",
|
|
1147
1147
|
record.store,
|
|
1148
1148
|
true,
|
|
1149
|
-
false
|
|
1149
|
+
false,
|
|
1150
1150
|
);
|
|
1151
1151
|
|
|
1152
1152
|
if (hasFixedColumns)
|
|
@@ -1159,7 +1159,7 @@ export class Grid extends Container {
|
|
|
1159
1159
|
record.key + "-footer",
|
|
1160
1160
|
record.store,
|
|
1161
1161
|
true,
|
|
1162
|
-
true
|
|
1162
|
+
true,
|
|
1163
1163
|
);
|
|
1164
1164
|
}
|
|
1165
1165
|
|
|
@@ -1482,7 +1482,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1482
1482
|
],
|
|
1483
1483
|
},
|
|
1484
1484
|
},
|
|
1485
|
-
start + i
|
|
1485
|
+
start + i,
|
|
1486
1486
|
);
|
|
1487
1487
|
} else {
|
|
1488
1488
|
let record = instance.records
|
|
@@ -1507,8 +1507,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1507
1507
|
record.group,
|
|
1508
1508
|
record.key + "-caption",
|
|
1509
1509
|
record.store,
|
|
1510
|
-
false
|
|
1511
|
-
)
|
|
1510
|
+
false,
|
|
1511
|
+
),
|
|
1512
1512
|
);
|
|
1513
1513
|
|
|
1514
1514
|
if (hasFixedColumns)
|
|
@@ -1521,8 +1521,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1521
1521
|
record.group,
|
|
1522
1522
|
record.key + "-caption",
|
|
1523
1523
|
record.store,
|
|
1524
|
-
true
|
|
1525
|
-
)
|
|
1524
|
+
true,
|
|
1525
|
+
),
|
|
1526
1526
|
);
|
|
1527
1527
|
}
|
|
1528
1528
|
} else if (record.type == "group-footer") {
|
|
@@ -1538,8 +1538,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1538
1538
|
record.key + "-footer",
|
|
1539
1539
|
record.store,
|
|
1540
1540
|
false,
|
|
1541
|
-
false
|
|
1542
|
-
)
|
|
1541
|
+
false,
|
|
1542
|
+
),
|
|
1543
1543
|
);
|
|
1544
1544
|
|
|
1545
1545
|
if (hasFixedColumns)
|
|
@@ -1553,8 +1553,8 @@ class GridComponent extends VDOM.Component {
|
|
|
1553
1553
|
record.key + "-footer",
|
|
1554
1554
|
record.store,
|
|
1555
1555
|
false,
|
|
1556
|
-
true
|
|
1557
|
-
)
|
|
1556
|
+
true,
|
|
1557
|
+
),
|
|
1558
1558
|
);
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
@@ -1631,7 +1631,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1631
1631
|
{fixedChildren}
|
|
1632
1632
|
</table>
|
|
1633
1633
|
</div>
|
|
1634
|
-
</div
|
|
1634
|
+
</div>,
|
|
1635
1635
|
);
|
|
1636
1636
|
}
|
|
1637
1637
|
|
|
@@ -1649,13 +1649,14 @@ class GridComponent extends VDOM.Component {
|
|
|
1649
1649
|
<table
|
|
1650
1650
|
ref={(el) => {
|
|
1651
1651
|
this.dom.table = el;
|
|
1652
|
+
if (this.props.instance.widget.onRef) this.props.instance.invoke("onRef", el, this.props.instance);
|
|
1652
1653
|
}}
|
|
1653
1654
|
>
|
|
1654
1655
|
{this.props.header}
|
|
1655
1656
|
{children}
|
|
1656
1657
|
</table>
|
|
1657
1658
|
</div>
|
|
1658
|
-
</div
|
|
1659
|
+
</div>,
|
|
1659
1660
|
);
|
|
1660
1661
|
|
|
1661
1662
|
if (this.props.fixedHeader)
|
|
@@ -1671,7 +1672,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1671
1672
|
}}
|
|
1672
1673
|
>
|
|
1673
1674
|
<table>{this.props.fixedHeader}</table>
|
|
1674
|
-
</div
|
|
1675
|
+
</div>,
|
|
1675
1676
|
);
|
|
1676
1677
|
|
|
1677
1678
|
if (this.props.fixedColumnsFixedHeader)
|
|
@@ -1687,7 +1688,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1687
1688
|
}}
|
|
1688
1689
|
>
|
|
1689
1690
|
<table>{this.props.fixedColumnsFixedHeader}</table>
|
|
1690
|
-
</div
|
|
1691
|
+
</div>,
|
|
1691
1692
|
);
|
|
1692
1693
|
|
|
1693
1694
|
if (shouldRenderFixedFooter) {
|
|
@@ -1700,7 +1701,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1700
1701
|
className={CSS.element(baseClass, "fixed-footer")}
|
|
1701
1702
|
>
|
|
1702
1703
|
<table>{fixedFooter}</table>
|
|
1703
|
-
</div
|
|
1704
|
+
</div>,
|
|
1704
1705
|
);
|
|
1705
1706
|
|
|
1706
1707
|
if (hasFixedColumns)
|
|
@@ -1713,7 +1714,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1713
1714
|
className={CSS.element(baseClass, "fixed-fixed-footer")}
|
|
1714
1715
|
>
|
|
1715
1716
|
<table>{fixedColumnsFixedFooter}</table>
|
|
1716
|
-
</div
|
|
1717
|
+
</div>,
|
|
1717
1718
|
);
|
|
1718
1719
|
}
|
|
1719
1720
|
|
|
@@ -1806,7 +1807,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1806
1807
|
filterParams: data.filterParams,
|
|
1807
1808
|
state: this.prevFetchRecordsState,
|
|
1808
1809
|
},
|
|
1809
|
-
instance
|
|
1810
|
+
instance,
|
|
1810
1811
|
);
|
|
1811
1812
|
promises.push(Promise.resolve(result));
|
|
1812
1813
|
}
|
|
@@ -1827,7 +1828,7 @@ class GridComponent extends VDOM.Component {
|
|
|
1827
1828
|
} else {
|
|
1828
1829
|
if (!Array.isArray(page.records))
|
|
1829
1830
|
throw new Error(
|
|
1830
|
-
"onFetchRecords should return an array of records or an object with results inside records property."
|
|
1831
|
+
"onFetchRecords should return an array of records or an object with results inside records property.",
|
|
1831
1832
|
);
|
|
1832
1833
|
totalRecordCount = page.totalRecordCount;
|
|
1833
1834
|
lastPage = page.lastPage;
|
|
@@ -2079,7 +2080,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2079
2080
|
let { CSS, baseClass } = widget;
|
|
2080
2081
|
let rowClass = CSS.element(baseClass, "data");
|
|
2081
2082
|
let nodes = Array.from(this.dom.table.children).filter(
|
|
2082
|
-
(node) => node.className && node.className.indexOf(rowClass) != -1
|
|
2083
|
+
(node) => node.className && node.className.indexOf(rowClass) != -1,
|
|
2083
2084
|
);
|
|
2084
2085
|
let { start } = this.getBufferStartEnd();
|
|
2085
2086
|
|
|
@@ -2487,7 +2488,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2487
2488
|
|
|
2488
2489
|
moveCursor(
|
|
2489
2490
|
index,
|
|
2490
|
-
{ focused, hover, scrollIntoView, select, selectRange, selectOptions, cellIndex, cellEdit, cancelEdit } = {}
|
|
2491
|
+
{ focused, hover, scrollIntoView, select, selectRange, selectOptions, cellIndex, cellEdit, cancelEdit } = {},
|
|
2491
2492
|
) {
|
|
2492
2493
|
let { widget, visibleColumns } = this.props.instance;
|
|
2493
2494
|
if (!widget.selectable && !widget.cellEditable) return;
|
|
@@ -2551,7 +2552,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2551
2552
|
oldData: this.cellEditUndoData,
|
|
2552
2553
|
field: visibleColumns[prevState.cursorCellIndex].field,
|
|
2553
2554
|
},
|
|
2554
|
-
record
|
|
2555
|
+
record,
|
|
2555
2556
|
);
|
|
2556
2557
|
this.cellEditUndoData = newData;
|
|
2557
2558
|
}
|
|
@@ -2571,7 +2572,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2571
2572
|
data: cellEditUndoData,
|
|
2572
2573
|
field: visibleColumns[futureState.cursorCellIndex].field,
|
|
2573
2574
|
},
|
|
2574
|
-
record
|
|
2575
|
+
record,
|
|
2575
2576
|
) === false
|
|
2576
2577
|
)
|
|
2577
2578
|
return;
|
|
@@ -2886,7 +2887,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2886
2887
|
let row = (mappedRecord.row = instance.getDetachedChild(
|
|
2887
2888
|
instance.row,
|
|
2888
2889
|
"DD:" + mappedRecord.key,
|
|
2889
|
-
mappedRecord.store
|
|
2890
|
+
mappedRecord.store,
|
|
2890
2891
|
));
|
|
2891
2892
|
row.selected = true;
|
|
2892
2893
|
selected.push(mappedRecord);
|
|
@@ -2933,7 +2934,7 @@ class GridComponent extends VDOM.Component {
|
|
|
2933
2934
|
this.setState({
|
|
2934
2935
|
dragged: false,
|
|
2935
2936
|
});
|
|
2936
|
-
}
|
|
2937
|
+
},
|
|
2937
2938
|
);
|
|
2938
2939
|
|
|
2939
2940
|
this.setState({
|