cx 26.7.5 → 26.7.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/widgets/grid/Grid.d.ts.map +1 -1
- package/build/widgets/grid/Grid.js +25 -12
- package/build/widgets/index.d.ts +15 -16
- package/build/widgets/index.d.ts.map +1 -1
- package/build/widgets/index.js +15 -17
- package/dist/manifest.js +739 -739
- package/dist/widgets.js +3148 -351
- package/package.json +1 -1
- package/src/widgets/grid/Grid.tsx +26 -14
- package/src/widgets/index.ts +41 -63
package/package.json
CHANGED
|
@@ -919,10 +919,13 @@ export class Grid<T = unknown> extends ContainerBase<GridConfig<T>, GridInstance
|
|
|
919
919
|
|
|
920
920
|
let sortField = null;
|
|
921
921
|
|
|
922
|
-
|
|
922
|
+
// rebuild sorters from the sortField/sortDirection bindings only if a sort field
|
|
923
|
+
// is actually set; sorts identified by a value selector (columns without a field)
|
|
924
|
+
// live in data.sorters/state.sorters and cannot round-trip through a field name
|
|
925
|
+
if (isDefined(this.sortField) && isDefined(this.sortDirection) && data.sortField) {
|
|
923
926
|
let sorter = {
|
|
924
927
|
field: data.sortField,
|
|
925
|
-
direction: data.sortDirection,
|
|
928
|
+
direction: data.sortDirection || "ASC",
|
|
926
929
|
};
|
|
927
930
|
sortField = data.sortField;
|
|
928
931
|
data.sorters = [sorter];
|
|
@@ -939,11 +942,11 @@ export class Grid<T = unknown> extends ContainerBase<GridConfig<T>, GridInstance
|
|
|
939
942
|
}
|
|
940
943
|
|
|
941
944
|
if (sortField) {
|
|
942
|
-
for (let l =
|
|
945
|
+
for (let l = 0; l < 10; l++) {
|
|
943
946
|
let line = instance.row[`line${l}`];
|
|
944
|
-
let sortColumn = line && line.columns && line.columns.find((c: any) => c.field == sortField);
|
|
947
|
+
let sortColumn = line && line.columns && line.columns.find((c: any) => (c.sortField || c.field) == sortField);
|
|
945
948
|
if (sortColumn) {
|
|
946
|
-
data.sorters[0].value = sortColumn.sortValue
|
|
949
|
+
data.sorters[0].value = isDefined(sortColumn.sortValue) ? sortColumn.sortValue : sortColumn.value;
|
|
947
950
|
data.sorters[0].comparer = sortColumn.comparer;
|
|
948
951
|
data.sorters[0].sortOptions = sortColumn.sortOptions;
|
|
949
952
|
break;
|
|
@@ -1307,8 +1310,18 @@ export class Grid<T = unknown> extends ContainerBase<GridConfig<T>, GridInstance
|
|
|
1307
1310
|
|
|
1308
1311
|
if (hdwidget.sortable && header.widget.allowSorting) {
|
|
1309
1312
|
mods.push("sortable");
|
|
1310
|
-
|
|
1311
|
-
|
|
1313
|
+
let sorter = data.sorters && data.sorters[0];
|
|
1314
|
+
let sortColumnField = hdwidget.sortField || hdwidget.field;
|
|
1315
|
+
let sortColumnValue = isDefined(hdwidget.sortValue) ? hdwidget.sortValue : hdwidget.value;
|
|
1316
|
+
// a sort is identified by its (field, value selector) pair, so columns
|
|
1317
|
+
// sorting by the same field through different value selectors don't both match
|
|
1318
|
+
let sorted =
|
|
1319
|
+
sorter &&
|
|
1320
|
+
!!sorter.direction &&
|
|
1321
|
+
(sortColumnField ? sorter.field == sortColumnField : !sorter.field && isDefined(sortColumnValue)) &&
|
|
1322
|
+
sorter.value === sortColumnValue;
|
|
1323
|
+
if (sorted) {
|
|
1324
|
+
mods.push("sorted-" + sorter.direction.toLowerCase());
|
|
1312
1325
|
sortIcon = <DropDownIcon className={CSS.element(baseClass, "column-sort-icon")} />;
|
|
1313
1326
|
}
|
|
1314
1327
|
}
|
|
@@ -1481,17 +1494,16 @@ export class Grid<T = unknown> extends ContainerBase<GridConfig<T>, GridInstance
|
|
|
1481
1494
|
let header = column.components[`header${headerLine + 1}`];
|
|
1482
1495
|
|
|
1483
1496
|
let field = column.sortField || column.field;
|
|
1484
|
-
let value = column.sortValue
|
|
1497
|
+
let value = isDefined(column.sortValue) ? column.sortValue : column.value;
|
|
1485
1498
|
let comparer = column.comparer;
|
|
1486
1499
|
let sortOptions = column.sortOptions;
|
|
1487
1500
|
|
|
1488
|
-
if (header && header.allowSorting && column.sortable && (field || value
|
|
1501
|
+
if (header && header.allowSorting && column.sortable && (field || isDefined(value))) {
|
|
1489
1502
|
let direction = column.primarySortDirection ?? "ASC";
|
|
1490
|
-
if
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
) {
|
|
1503
|
+
// the column matches the active sorter only if both the field and the value
|
|
1504
|
+
// selector are the same; two columns may sort by the same field through
|
|
1505
|
+
// different value selectors and represent different sorts
|
|
1506
|
+
if (isNonEmptyArray(data.sorters) && data.sorters[0].field == field && data.sorters[0].value === value) {
|
|
1495
1507
|
if (data.sorters[0].direction == "ASC" && (!this.clearableSort || direction == "ASC")) direction = "DESC";
|
|
1496
1508
|
else if (data.sorters[0].direction == "DESC" && (!this.clearableSort || direction == "DESC"))
|
|
1497
1509
|
direction = "ASC";
|
package/src/widgets/index.ts
CHANGED
|
@@ -1,63 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export * from "./
|
|
40
|
-
|
|
41
|
-
export * from "./
|
|
42
|
-
export * from "./DocumentTitle";
|
|
43
|
-
export * from "./List";
|
|
44
|
-
export * from "./Sandbox";
|
|
45
|
-
export * from "./CxCredit";
|
|
46
|
-
export * from "./Heading";
|
|
47
|
-
export * from "./Section";
|
|
48
|
-
export * from "./FlexBox";
|
|
49
|
-
export * from "./Icon";
|
|
50
|
-
export * from "./ProgressBar";
|
|
51
|
-
export * from "./Resizer";
|
|
52
|
-
export * from "./HighlightedSearchText";
|
|
53
|
-
export * from "./autoFocus";
|
|
54
|
-
export * from "./ReactElementWrapper";
|
|
55
|
-
|
|
56
|
-
export * from "./icons/index";
|
|
57
|
-
export * from "./overlay/index";
|
|
58
|
-
export * from "./nav/index";
|
|
59
|
-
export * from "./form/index";
|
|
60
|
-
export * from "./grid/index";
|
|
61
|
-
export * from "./drag-drop/index";
|
|
62
|
-
|
|
63
|
-
export * from "./enableAllInternalDependencies";
|
|
1
|
+
export { Widget } from "../ui/Widget";
|
|
2
|
+
export { Text } from "../ui/Text";
|
|
3
|
+
export { StaticText } from "../ui/StaticText";
|
|
4
|
+
export { PureContainer } from "../ui/PureContainer";
|
|
5
|
+
export { IsolatedScope } from "../ui/IsolatedScope";
|
|
6
|
+
export { DetachedScope } from "../ui/DetachedScope";
|
|
7
|
+
export { Restate, PrivateStore } from "../ui/Restate";
|
|
8
|
+
export { DataProxy } from "../ui/DataProxy";
|
|
9
|
+
export { Content } from "../ui/layout/Content";
|
|
10
|
+
export { ContentPlaceholder, ContentPlaceholderScope } from "../ui/layout/ContentPlaceholder";
|
|
11
|
+
export { LabelsTopLayout, LabelsTopLayoutCell } from "../ui/layout/LabelsTopLayout";
|
|
12
|
+
export { LabelsLeftLayout } from "../ui/layout/LabelsLeftLayout";
|
|
13
|
+
export { ContentResolver } from "../ui/ContentResolver";
|
|
14
|
+
export { Rescope } from "../ui/Rescope";
|
|
15
|
+
export { Repeater } from "../ui/Repeater";
|
|
16
|
+
|
|
17
|
+
export * from "./cx";
|
|
18
|
+
export * from "./HtmlElement";
|
|
19
|
+
export * from "./Button";
|
|
20
|
+
export * from "./DocumentTitle";
|
|
21
|
+
export * from "./List";
|
|
22
|
+
export * from "./Sandbox";
|
|
23
|
+
export * from "./CxCredit";
|
|
24
|
+
export * from "./Heading";
|
|
25
|
+
export * from "./Section";
|
|
26
|
+
export * from "./FlexBox";
|
|
27
|
+
export * from "./Icon";
|
|
28
|
+
export * from "./ProgressBar";
|
|
29
|
+
export * from "./Resizer";
|
|
30
|
+
export * from "./HighlightedSearchText";
|
|
31
|
+
export * from "./autoFocus";
|
|
32
|
+
export * from "./ReactElementWrapper";
|
|
33
|
+
|
|
34
|
+
export * from "./icons/index";
|
|
35
|
+
export * from "./overlay/index";
|
|
36
|
+
export * from "./nav/index";
|
|
37
|
+
export * from "./form/index";
|
|
38
|
+
export * from "./grid/index";
|
|
39
|
+
export * from "./drag-drop/index";
|
|
40
|
+
|
|
41
|
+
export * from "./enableAllInternalDependencies";
|