@onehat/ui 0.2.44 → 0.2.46

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.2.44",
3
+ "version": "0.2.46",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -808,6 +808,7 @@ export function Grid(props) {
808
808
  borderWidth: isReorderMode ? 4 : 0,
809
809
  borderColor: isReorderMode ? '#23d9ea' : null,
810
810
  borderStyle: 'dashed',
811
+ flex: 1,
811
812
  }}
812
813
  refreshing={isLoading}
813
814
  onRefresh={pullToRefresh ? onRefresh : null}
@@ -227,7 +227,7 @@ export default function withDraggable(WrappedComponent) {
227
227
  position={{ x: 0, y: 0, /* reset to dropped position */ }}
228
228
  // bounds={bounds}
229
229
  >
230
- <div className="nsResize" style={{ width: '100%', }}>
230
+ <div className="nsResize">
231
231
  <WrappedComponent {...propsToPass} />
232
232
  </div>
233
233
  </Draggable>;
@@ -57,6 +57,13 @@ export default function withEditor(WrappedComponent) {
57
57
  addValues[selectorId] = selectorSelected.id;
58
58
  }
59
59
 
60
+ // 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
61
+ Repository.pauseEvents();
62
+ Repository.sort(Repository.schema.model.idProperty, 'DESC');
63
+ Repository.setPage(1);
64
+ Repository.resumeEvents();
65
+ await Repository.reload();
66
+
60
67
  const entity = await Repository.add(addValues, false, true, true);
61
68
  setSelection([entity]);
62
69
  setIsEditorViewOnly(false);
@@ -121,6 +121,9 @@ export default function withPresetButtons(WrappedComponent) {
121
121
  text = 'Add';
122
122
  handler = onAdd;
123
123
  icon = <Plus />;
124
+ if (selectorId && !selectorSelected) {
125
+ isDisabled = true;
126
+ }
124
127
  break;
125
128
  case 'edit':
126
129
  text = 'Edit';