@visns-studio/visns-components 6.3.7 → 6.3.8
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/package.json +1 -1
- package/src/components/DataGrid.jsx +35 -5
package/package.json
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
92
92
|
},
|
|
93
93
|
"name": "@visns-studio/visns-components",
|
|
94
|
-
"version": "6.3.
|
|
94
|
+
"version": "6.3.8",
|
|
95
95
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
96
96
|
"main": "src/index.js",
|
|
97
97
|
"files": [
|
|
@@ -659,11 +659,11 @@ const DataGrid = forwardRef(
|
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
// Opt-in grouped display (ajaxSetting.treeGroupBy {key,
|
|
662
|
-
// column, parentFields,
|
|
663
|
-
// defaultCollapsed, icons}): consecutive rows
|
|
664
|
-
// non-empty `key` value get a synthetic summary
|
|
665
|
-
// row inserted above them. `parentFields` are lifted
|
|
666
|
-
// the first row onto the parent and blanked on the
|
|
662
|
+
// column, parentFields, parentFieldAliases, countLabel,
|
|
663
|
+
// collapsible, defaultCollapsed, icons}): consecutive rows
|
|
664
|
+
// sharing a non-empty `key` value get a synthetic summary
|
|
665
|
+
// parent row inserted above them. `parentFields` are lifted
|
|
666
|
+
// from the first row onto the parent and blanked on the
|
|
667
667
|
// children, so shared details display once; children get
|
|
668
668
|
// an "↳" prefix in the display column. Single rows stay
|
|
669
669
|
// plain — unlike the grid's own groupBy, which forces a
|
|
@@ -678,6 +678,7 @@ const DataGrid = forwardRef(
|
|
|
678
678
|
key: treeKey,
|
|
679
679
|
column: treeDisplayColumn,
|
|
680
680
|
parentFields = [],
|
|
681
|
+
parentFieldAliases = {},
|
|
681
682
|
countLabel,
|
|
682
683
|
collapsible,
|
|
683
684
|
defaultCollapsed,
|
|
@@ -722,6 +723,35 @@ const DataGrid = forwardRef(
|
|
|
722
723
|
});
|
|
723
724
|
});
|
|
724
725
|
|
|
726
|
+
// `parentFieldAliases` ({columnField:
|
|
727
|
+
// sourceField}): the parent shows a DIFFERENT
|
|
728
|
+
// field in a column than its children do, so
|
|
729
|
+
// one column can carry the per-member value on
|
|
730
|
+
// members and the group's summary on the
|
|
731
|
+
// parent instead of spending a second column
|
|
732
|
+
// on the summary alone.
|
|
733
|
+
//
|
|
734
|
+
// Unlike `parentFields` this deliberately does
|
|
735
|
+
// NOT blank the column on the children — the
|
|
736
|
+
// members' own values are the reason the
|
|
737
|
+
// column exists. (Listing the same field in
|
|
738
|
+
// both would blank it on the children and
|
|
739
|
+
// defeat that, so pick one.)
|
|
740
|
+
//
|
|
741
|
+
// Distinct from `countLabel` too, which
|
|
742
|
+
// templates a summary from the child COUNT and
|
|
743
|
+
// so can only produce one fixed wording. An
|
|
744
|
+
// alias reads a field the backend computed,
|
|
745
|
+
// which is what it takes for the summary to
|
|
746
|
+
// vary with the data ("2 Headers" for one kind
|
|
747
|
+
// of group, "2 Stations" for another).
|
|
748
|
+
Object.entries(parentFieldAliases).forEach(
|
|
749
|
+
([columnField, sourceField]) => {
|
|
750
|
+
parent[columnField] =
|
|
751
|
+
children[0]?.[sourceField];
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
|
|
725
755
|
// Mark children for styling (getRowStyle) and
|
|
726
756
|
// prefix their display value so nesting reads
|
|
727
757
|
children.forEach((child) => {
|