@onehat/ui 0.3.181 → 0.3.183

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.181",
3
+ "version": "0.3.183",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -686,6 +686,7 @@ export function ComboComponent(props) {
686
686
  h={UiGlobals.mode === UI_MODE_WEB ? styles.FORM_COMBO_MENU_HEIGHT + 'px' : null}
687
687
  newEntityDisplayValue={newEntityDisplayValue}
688
688
  disablePresetButtons={!isEditor}
689
+ alternateRowBackgrounds={false}
689
690
  onChangeSelection={(selection) => {
690
691
 
691
692
  if (Repository && selection[0]?.isPhantom) {
@@ -121,6 +121,7 @@ function GridComponent(props) {
121
121
  flex,
122
122
  bg = '#fff',
123
123
  verifyCanEdit,
124
+ alternateRowBackgrounds = true,
124
125
  alternatingInterval = 2,
125
126
 
126
127
  // withComponent
@@ -410,7 +411,7 @@ function GridComponent(props) {
410
411
  }
411
412
  } else if (showHovers && isHovered) {
412
413
  mixWith = styles.GRID_ROW_HOVER_BG;
413
- } else if (index % alternatingInterval === 0) { // i.e. every second line, or every third line
414
+ } else if (alternateRowBackgrounds && index % alternatingInterval === 0) { // i.e. every second line, or every third line
414
415
  mixWith = styles.GRID_ROW_ALTERNATE_BG;
415
416
  }
416
417
  if (mixWith) {
@@ -138,7 +138,15 @@ export default function withSecondaryEditor(WrappedComponent, isTree = false) {
138
138
  } else {
139
139
  // Set repository to sort by id DESC and switch to page 1, so this new entity is guaranteed to show up on the current page, even after saving
140
140
  const currentSorter = SecondaryRepository.sorters[0];
141
- if (currentSorter.name !== SecondaryRepository.schema.model.idProperty || currentSorter.direction !== 'DESC') {
141
+ if (currentSorter.name.match(/__sort_order$/)) { // when it's using a sort column, keep using it
142
+ if (currentSorter.direction !== 'DESC') {
143
+ SecondaryRepository.pauseEvents();
144
+ SecondaryRepository.sort(currentSorter.name, 'DESC');
145
+ SecondaryRepository.setPage(1);
146
+ SecondaryRepository.resumeEvents();
147
+ await SecondaryRepository.reload();
148
+ }
149
+ } else if (currentSorter.name !== SecondaryRepository.schema.model.idProperty || currentSorter.direction !== 'DESC') {
142
150
  SecondaryRepository.pauseEvents();
143
151
  SecondaryRepository.sort(SecondaryRepository.schema.model.idProperty, 'DESC');
144
152
  SecondaryRepository.setPage(1);
@@ -135,7 +135,15 @@ export default function withEditor(WrappedComponent, isTree = false) {
135
135
  } else {
136
136
  // Set repository to sort by id DESC and switch to page 1, so this new entity is guaranteed to show up on the current page, even after saving
137
137
  const currentSorter = Repository.sorters[0];
138
- if (currentSorter.name !== Repository.schema.model.idProperty || currentSorter.direction !== 'DESC') {
138
+ if (currentSorter.name.match(/__sort_order$/)) { // when it's using a sort column, keep using it
139
+ if (currentSorter.direction !== 'DESC') {
140
+ Repository.pauseEvents();
141
+ Repository.sort(currentSorter.name, 'DESC');
142
+ Repository.setPage(1);
143
+ Repository.resumeEvents();
144
+ await Repository.reload();
145
+ }
146
+ } else if (currentSorter.name !== Repository.schema.model.idProperty || currentSorter.direction !== 'DESC') {
139
147
  Repository.pauseEvents();
140
148
  Repository.sort(Repository.schema.model.idProperty, 'DESC');
141
149
  Repository.setPage(1);