@onehat/ui 0.3.128 → 0.3.130

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.128",
3
+ "version": "0.3.130",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -30,6 +30,8 @@ function Editor(props) {
30
30
  return null; // hide the editor when no selection
31
31
  }
32
32
 
33
+ const propsToPass = _.omit(props, ['self', 'reference', 'parent']);
34
+
33
35
  // Repository?.isRemotePhantomMode && selection.length === 1 &&
34
36
  if (editorMode === EDITOR_MODE__VIEW || isEditorViewOnly) {
35
37
  const record = selection[0];
@@ -37,19 +39,20 @@ function Editor(props) {
37
39
  return null;
38
40
  }
39
41
  return <Viewer
40
- {...props}
42
+ {...propsToPass}
43
+ {..._viewer}
41
44
  record={record}
42
45
  onEditMode={isEditorViewOnly ? null : onEditMode}
43
46
  onClose={onClose}
44
47
  onDelete={onDelete}
45
48
  parent={self}
46
49
  reference="viewer"
47
- {..._viewer}
48
50
  />;
49
51
  }
50
52
 
51
53
  return <Form
52
- {...props}
54
+ {...propsToPass}
55
+ {..._form}
53
56
  record={selection}
54
57
  onCancel={onCancel}
55
58
  onSave={onSave}
@@ -57,7 +60,6 @@ function Editor(props) {
57
60
  onDelete={onDelete}
58
61
  parent={self}
59
62
  reference="form"
60
- {..._form}
61
63
  />;
62
64
  }
63
65
 
@@ -120,7 +120,7 @@ export function ComboComponent(props) {
120
120
  }
121
121
  }
122
122
  if (Repository && !Repository.isLoaded) {
123
- await Repository.load();
123
+ // await Repository.load(); // this breaks when the menu (Grid) has selectorSelected
124
124
  }
125
125
  setIsMenuShown(true);
126
126
  },
@@ -905,6 +905,22 @@ export function ComboComponent(props) {
905
905
  </Row>;
906
906
 
907
907
  if (isViewerShown && Editor) {
908
+ const propsForViewer = _.pick(props, [
909
+ 'disableCopy',
910
+ 'disableDuplicate',
911
+ 'disablePrint',
912
+ 'disableView',
913
+ 'value',
914
+ 'Repository',
915
+ 'data',
916
+ 'displayField',
917
+ 'displayIx',
918
+ 'fields',
919
+ 'idField',
920
+ 'idIx',
921
+ 'model',
922
+ 'name',
923
+ ]);
908
924
  assembledComponents =
909
925
  <>
910
926
  {assembledComponents}
@@ -913,7 +929,7 @@ export function ComboComponent(props) {
913
929
  onClose={onViewerClose}
914
930
  >
915
931
  <Editor
916
- {...props}
932
+ {...propsForViewer}
917
933
  editorType={EDITOR_TYPE__WINDOWED}
918
934
  px={0}
919
935
  py={0}
@@ -227,7 +227,7 @@ function Form(props) {
227
227
  let editorProps = {};
228
228
  if (!editor) {
229
229
  const propertyDef = fieldName && Repository?.getSchema().getPropertyDefinition(fieldName);
230
- editor = propertyDef[fieldName].editorType;
230
+ editor = propertyDef && propertyDef[fieldName].editorType;
231
231
  if (_.isPlainObject(editor)) {
232
232
  const {
233
233
  type,
@@ -323,15 +323,15 @@ function Form(props) {
323
323
  {
324
324
  type: t,
325
325
  ...p
326
- } = propertyDef.editorType;
326
+ } = propertyDef?.editorType;
327
327
  type = t;
328
328
  editorTypeProps = p;
329
- } else if (propertyDef.viewerType) {
329
+ } else if (propertyDef?.viewerType) {
330
330
  const
331
331
  {
332
332
  type: t,
333
333
  ...p
334
- } = propertyDef.viewerType;
334
+ } = propertyDef?.viewerType;
335
335
  type = t;
336
336
  } else {
337
337
  type = 'Text';
@@ -693,6 +693,8 @@ function Form(props) {
693
693
  if (self) {
694
694
  self.ref = formRef;
695
695
  self.formState = formState;
696
+ self.formSetValue = formSetValue;
697
+ self.formGetValues = formGetValues;
696
698
  }
697
699
 
698
700
  const sizeProps = {};
@@ -483,7 +483,7 @@ export default function withFilters(WrappedComponent) {
483
483
 
484
484
  // basic property filter
485
485
  const propertyDef = Repository.getSchema().getPropertyDefinition(filterField);
486
- data.push([ filterField, propertyDef.title ]);
486
+ data.push([ filterField, propertyDef?.title ]);
487
487
  });
488
488
 
489
489
  // sort by title
@@ -108,7 +108,7 @@ export default function withPdfButton(WrappedComponent) {
108
108
 
109
109
  if (!item.title) {
110
110
  const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
111
- if (propertyDef.title) {
111
+ if (propertyDef?.title) {
112
112
  item.title = propertyDef.title;
113
113
  }
114
114
  }
@@ -0,0 +1,14 @@
1
+ // Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.
2
+ import * as React from "react"
3
+ import Svg, { Path } from "react-native-svg"
4
+ import { Icon } from 'native-base';
5
+
6
+ function SvgComponent(props) {
7
+ return (
8
+ <Icon xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" {...props}>
9
+ <Path d="M32 96h320V32c0-12.9 7.8-24.6 19.8-29.6s25.7-2.2 34.9 6.9l96 96c6 6 9.4 14.1 9.4 22.6s-3.4 16.6-9.4 22.6l-96 96c-9.2 9.2-22.9 11.9-34.9 6.9S352 236.8 352 223.8V160H32c-17.7 0-32-14.3-32-32s14.3-32 32-32zm448 256c17.7 0 32 14.3 32 32s-14.3 32-32 32H160v64c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-96-96c-6-6-9.4-14.1-9.4-22.6s3.4-16.6 9.4-22.6l96-96c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6v64h320z" />
10
+ </Icon>
11
+ )
12
+ }
13
+
14
+ export default SvgComponent
@@ -73,12 +73,12 @@ function Viewer(props) {
73
73
 
74
74
  const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
75
75
  if (!type) {
76
- if (propertyDef.viewerType) {
76
+ if (propertyDef?.viewerType) {
77
77
  const
78
78
  {
79
79
  type: t,
80
80
  ...p
81
- } = propertyDef.viewerType;
81
+ } = propertyDef.viewerType;
82
82
  type = t
83
83
  } else {
84
84
  type = 'Text';
@@ -121,7 +121,7 @@ function Viewer(props) {
121
121
  return <Element key={ix} title={title} {...defaults} {...propsToPass} {...editorTypeProps}>{children}</Element>;
122
122
  }
123
123
 
124
- if (!label && Repository && propertyDef.title) {
124
+ if (!label && Repository && propertyDef?.title) {
125
125
  label = propertyDef.title;
126
126
  }
127
127
 
@@ -144,6 +144,7 @@ import RectangleXmark from '../Components/Icons/RectangleXmark.js';
144
144
  import RectangleXmarkRegular from '../Components/Icons/RectangleXmarkRegular.js';
145
145
  import ReorderRows from '../Components/Icons/ReorderRows.js';
146
146
  import RightFromBracket from '../Components/Icons/RightFromBracket.js';
147
+ import RightLeft from '../Components/Icons/RightLeft.js';
147
148
  import RightToBracket from '../Components/Icons/RightToBracket.js';
148
149
  import Rotate from '../Components/Icons/Rotate.js';
149
150
  import RotateLeft from '../Components/Icons/RotateLeft.js';
@@ -374,6 +375,7 @@ const components = {
374
375
  RectangleXmarkRegular,
375
376
  ReorderRows,
376
377
  RightFromBracket,
378
+ RightLeft,
377
379
  RightToBracket,
378
380
  Rotate,
379
381
  RotateLeft,