@onehat/ui 0.3.126 → 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.126",
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';
@@ -474,7 +474,9 @@ function Form(props) {
474
474
  editorTypeProps.selectorId = selectorId;
475
475
  }
476
476
  if (propsToPass.selectorId || editorTypeProps.selectorId) { // editorTypeProps.selectorId causes just this one field to use selectorId
477
- editorTypeProps.selectorSelected = record;
477
+ if (_.isNil(propsToPass.selectorSelected)) {
478
+ editorTypeProps.selectorSelected = record;
479
+ }
478
480
  }
479
481
  let dynamicProps = {};
480
482
  if (getDynamicProps) {
@@ -691,6 +693,8 @@ function Form(props) {
691
693
  if (self) {
692
694
  self.ref = formRef;
693
695
  self.formState = formState;
696
+ self.formSetValue = formSetValue;
697
+ self.formGetValues = formGetValues;
694
698
  }
695
699
 
696
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,20 @@
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
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ height={16}
11
+ width={14}
12
+ viewBox="0 0 448 512"
13
+ {...props}
14
+ >
15
+ <Path d="M8 256a56 56 0 11112 0 56 56 0 11-112 0zm160 0a56 56 0 11112 0 56 56 0 11-112 0zm216-56a56 56 0 110 112 56 56 0 110-112z" />
16
+ </Icon>
17
+ )
18
+ }
19
+
20
+ export default SvgComponent
@@ -0,0 +1,20 @@
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
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ height={16}
11
+ width={14}
12
+ viewBox="0 0 448 512"
13
+ {...props}
14
+ >
15
+ <Path d="M0 32v448h448V32H0zm243.8 349.4c0 43.6-25.6 63.5-62.9 63.5-33.7 0-53.2-17.4-63.2-38.5l34.3-20.7c6.6 11.7 12.6 21.6 27.1 21.6 13.8 0 22.6-5.4 22.6-26.5V237.7h42.1v143.7zm99.6 63.5c-39.1 0-64.4-18.6-76.7-43l34.3-19.8c9 14.7 20.8 25.6 41.5 25.6 17.4 0 28.6-8.7 28.6-20.8 0-14.4-11.4-19.5-30.7-28l-10.5-4.5c-30.4-12.9-50.5-29.2-50.5-63.5 0-31.6 24.1-55.6 61.6-55.6 26.8 0 46 9.3 59.8 33.7L368 290c-7.2-12.9-15-18-27.1-18-12.3 0-20.1 7.8-20.1 18 0 12.6 7.8 17.7 25.9 25.6l10.5 4.5c35.8 15.3 55.9 31 55.9 66.2 0 37.8-29.8 58.6-69.7 58.6z" />
16
+ </Icon>
17
+ )
18
+ }
19
+
20
+ export default SvgComponent
@@ -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
@@ -0,0 +1,20 @@
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
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ height={16}
11
+ width={16}
12
+ viewBox="0 0 512 512"
13
+ {...props}
14
+ >
15
+ <Path d="M64 256v-96h160v96H64zm0 64h160v96H64v-96zm224 96v-96h160v96H288zm160-160H288v-96h160v96zM64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z" />
16
+ </Icon>
17
+ )
18
+ }
19
+
20
+ 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
 
@@ -60,6 +60,7 @@ import Copyright from '../Components/Icons/Copyright.js';
60
60
  import Dot from '../Components/Icons/Dot.js';
61
61
  import Duplicate from '../Components/Icons/Duplicate.js';
62
62
  import Edit from '../Components/Icons/Edit.js';
63
+ import EllipsisHorizontal from '../Components/Icons/EllipsisHorizontal.js';
63
64
  import EllipsisVertical from '../Components/Icons/EllipsisVertical.js';
64
65
  import Envelope from '../Components/Icons/Envelope.js';
65
66
  import EnvelopeRegular from '../Components/Icons/EnvelopeRegular.js';
@@ -90,6 +91,7 @@ import House from '../Components/Icons/House.js';
90
91
  import Images from '../Components/Icons/Images.js';
91
92
  import Info from '../Components/Icons/Info.js';
92
93
  import ItunesNote from '../Components/Icons/ItunesNote.js';
94
+ import Js from '../Components/Icons/Js.js';
93
95
  import Leaf from '../Components/Icons/Leaf.js';
94
96
  import List from '../Components/Icons/List.js';
95
97
  import ListCheck from '../Components/Icons/ListCheck.js';
@@ -142,6 +144,7 @@ import RectangleXmark from '../Components/Icons/RectangleXmark.js';
142
144
  import RectangleXmarkRegular from '../Components/Icons/RectangleXmarkRegular.js';
143
145
  import ReorderRows from '../Components/Icons/ReorderRows.js';
144
146
  import RightFromBracket from '../Components/Icons/RightFromBracket.js';
147
+ import RightLeft from '../Components/Icons/RightLeft.js';
145
148
  import RightToBracket from '../Components/Icons/RightToBracket.js';
146
149
  import Rotate from '../Components/Icons/Rotate.js';
147
150
  import RotateLeft from '../Components/Icons/RotateLeft.js';
@@ -161,6 +164,7 @@ import SquareCheckRegular from '../Components/Icons/SquareCheckRegular.js';
161
164
  import SquareMinus from '../Components/Icons/SquareMinus.js';
162
165
  import SquareRegular from '../Components/Icons/SquareRegular.js';
163
166
  import Store from '../Components/Icons/Store.js';
167
+ import Table from '../Components/Icons/Table.js';
164
168
  import ThumbsDown from '../Components/Icons/ThumbsDown.js';
165
169
  import ThumbsDownRegular from '../Components/Icons/ThumbsDownRegular.js';
166
170
  import ThumbsUp from '../Components/Icons/ThumbsUp.js';
@@ -287,6 +291,7 @@ const components = {
287
291
  Dot,
288
292
  Duplicate,
289
293
  Edit,
294
+ EllipsisHorizontal,
290
295
  EllipsisVertical,
291
296
  Envelope,
292
297
  EnvelopeRegular,
@@ -317,6 +322,7 @@ const components = {
317
322
  Images,
318
323
  Info,
319
324
  ItunesNote,
325
+ Js,
320
326
  Leaf,
321
327
  List,
322
328
  ListCheck,
@@ -369,6 +375,7 @@ const components = {
369
375
  RectangleXmarkRegular,
370
376
  ReorderRows,
371
377
  RightFromBracket,
378
+ RightLeft,
372
379
  RightToBracket,
373
380
  Rotate,
374
381
  RotateLeft,
@@ -388,6 +395,7 @@ const components = {
388
395
  SquareMinus,
389
396
  SquareRegular,
390
397
  Store,
398
+ Table,
391
399
  ThumbsDown,
392
400
  ThumbsDownRegular,
393
401
  ThumbsUp,