@onehat/ui 0.3.351 → 0.3.353

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.351",
3
+ "version": "0.3.353",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -105,6 +105,7 @@ function GridComponent(props) {
105
105
  flatListProps = {},
106
106
  onRowPress,
107
107
  onRender,
108
+ disableLoadOnRender = false,
108
109
  forceLoadOnRender = false,
109
110
  pullToRefresh = true,
110
111
  hideNavColumn = true,
@@ -801,6 +802,10 @@ function GridComponent(props) {
801
802
  }
802
803
  };
803
804
 
805
+ if (forceLoadOnRender && disableLoadOnRender) {
806
+ throw new Error('incompatible config! forceLoadOnRender and disableLoadOnRender cannot both be true');
807
+ }
808
+
804
809
  useEffect(() => {
805
810
  if (!isInited) {
806
811
  // first call -- meant to render placeholder so we get container dimensions
@@ -934,7 +939,7 @@ function GridComponent(props) {
934
939
  applySelectorSelected();
935
940
  Repository.resumeEvents();
936
941
 
937
- if ((Repository.isRemote && !Repository.isLoaded) || forceLoadOnRender) {
942
+ if (((Repository.isRemote && !Repository.isLoaded) || forceLoadOnRender) && !disableLoadOnRender) { // default remote repositories to load on render, optionally force or disable load on render
938
943
  Repository.load();
939
944
  }
940
945
 
@@ -58,6 +58,27 @@ export default function withPdfButtons(WrappedComponent) {
58
58
  buildModalItems = () => {
59
59
  const modalItems = _.map(_.cloneDeep(items), (item, ix) => buildNextLayer(item, ix, columnDefaults)); // clone, as we don't want to alter the item by reference
60
60
 
61
+ // remove additionalEditButtons from the modal
62
+ function walkTreeToDeleteAdditionalEditButtons(item) {
63
+ if (!item) {
64
+ return;
65
+ }
66
+
67
+ let {
68
+ additionalEditButtons,
69
+ items,
70
+ } = item;
71
+ if (!_.isEmpty(items)) {
72
+ _.each(items, (item) => {
73
+ walkTreeToDeleteAdditionalEditButtons(item);
74
+ });
75
+ }
76
+ if (additionalEditButtons) {
77
+ delete item.additionalEditButtons;
78
+ }
79
+ }
80
+ _.each(modalItems, walkTreeToDeleteAdditionalEditButtons);
81
+
61
82
  if (!_.isEmpty(ancillaryItems)) {
62
83
  const
63
84
  ancillaryItemsClone = _.cloneDeep(ancillaryItems),
@@ -144,7 +165,7 @@ export default function withPdfButtons(WrappedComponent) {
144
165
  },
145
166
  getStartingValues = (modalItems) => {
146
167
  const startingValues = {};
147
- function walkTree(item) {
168
+ function walkTreeToSetStartingValues(item) {
148
169
  if (!item) {
149
170
  return;
150
171
  }
@@ -155,14 +176,14 @@ export default function withPdfButtons(WrappedComponent) {
155
176
  } = item;
156
177
  if (!_.isEmpty(items)) {
157
178
  _.each(items, (item) => {
158
- walkTree(item);
179
+ walkTreeToSetStartingValues(item);
159
180
  });
160
181
  }
161
182
  if (name) {
162
183
  startingValues[name] = true;
163
184
  }
164
185
  }
165
- _.each(modalItems, walkTree);
186
+ _.each(modalItems, walkTreeToSetStartingValues);
166
187
  return startingValues;
167
188
  },
168
189
  onChooseFields = (userWantsToEmail = false) => {