@onehat/ui 0.3.42 → 0.3.44

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.42",
3
+ "version": "0.3.44",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -13,6 +13,7 @@ export default function SquareButton(props) {
13
13
  activeColor,
14
14
  invertColorWhenActive = false,
15
15
  disableInteractions = false,
16
+ fontSize = '20px',
16
17
  ...propsToPass
17
18
  } = props,
18
19
  styles = UiGlobals.styles,
@@ -54,7 +55,7 @@ export default function SquareButton(props) {
54
55
  // _pressed={pressedProps}
55
56
  >
56
57
  <Icon as={icon} color={color} size="xl" />
57
- <Text fontSize={20} color={color}>{text}</Text>
58
+ <Text fontSize={fontSize} color={color}>{text}</Text>
58
59
  </Pressable>;
59
60
  }
60
61
 
@@ -77,6 +77,7 @@ function Form(props) {
77
77
  submitBtnLabel,
78
78
  onSubmit,
79
79
  additionalEditButtons,
80
+ useAdditionalEditButtons = true,
80
81
  additionalFooterButtons,
81
82
 
82
83
  // sizing of outer container
@@ -290,6 +291,9 @@ function Form(props) {
290
291
  editorTypeProps = {};
291
292
 
292
293
  const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
294
+ if (!useAdditionalEditButtons) {
295
+ item = _.omit(item, 'additionalEditButtons');
296
+ }
293
297
  if (propertyDef?.isEditingDisabled && checkIsEditingDisabled) {
294
298
  isEditable = false;
295
299
  }
@@ -30,6 +30,7 @@ export default function withEditor(WrappedComponent, isTree = false) {
30
30
  return 'record' + (selection[0].displayValue ? ' "' + selection[0].displayValue + '"' : '') + '?';
31
31
  },
32
32
  record,
33
+ onChange,
33
34
 
34
35
  // withComponent
35
36
  self,
@@ -123,6 +124,9 @@ export default function withEditor(WrappedComponent, isTree = false) {
123
124
  if (getListeners().onAfterAdd) {
124
125
  await getListeners().onAfterAdd(entity);
125
126
  }
127
+ if (onChange) {
128
+ onChange();
129
+ }
126
130
  },
127
131
  onEdit = async () => {
128
132
  if (_.isEmpty(selection) || (_.isArray(selection) && (selection.length > 1 || selection[0]?.isDestroyed))) {
@@ -206,6 +210,9 @@ export default function withEditor(WrappedComponent, isTree = false) {
206
210
  if (cb) {
207
211
  cb();
208
212
  }
213
+ if (onChange) {
214
+ onChange();
215
+ }
209
216
  },
210
217
  onView = async () => {
211
218
  if (!userCanView) {
@@ -312,6 +319,9 @@ export default function withEditor(WrappedComponent, isTree = false) {
312
319
  if (getListeners().onAfterEdit) {
313
320
  await getListeners().onAfterEdit(what);
314
321
  }
322
+ if (onChange) {
323
+ onChange();
324
+ }
315
325
 
316
326
  return true;
317
327
  },
@@ -42,7 +42,7 @@ export default function withPdfButton(WrappedComponent) {
42
42
 
43
43
  } = props,
44
44
  [isModalShown, setIsModalShown] = useState(false),
45
- [width, height] = useAdjustedWindowSize(500, 800);
45
+ [width, height] = useAdjustedWindowSize(500, 800),
46
46
  buildModalItems = () => {
47
47
  const modalItems = _.map(_.cloneDeep(items), (item, ix) => buildNextLayer(item, ix, columnDefaults)); // clone, as we don't want to alter the item by reference
48
48
 
@@ -195,6 +195,7 @@ export default function withPdfButton(WrappedComponent) {
195
195
  setIsModalShown(false);
196
196
  }}
197
197
  submitBtnLabel="View PDF"
198
+ useAdditionalEditButtons={false}
198
199
  />
199
200
  </Column>
200
201
  </Modal>;
@@ -313,6 +313,7 @@ export default function withSelection(WrappedComponent) {
313
313
  }, []);
314
314
 
315
315
  if (self) {
316
+ self.selection = localSelection;
316
317
  self.setSelection = setSelection;
317
318
  self.selectNext = selectNext;
318
319
  self.selectPrev = selectPrev;