@onehat/ui 0.3.31 → 0.3.33

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/Components/Buttons/Button.js +20 -0
  3. package/src/Components/Buttons/IconButton.js +68 -51
  4. package/src/Components/Buttons/SquareButton.js +6 -4
  5. package/src/Components/Container/Container.js +4 -1
  6. package/src/Components/Container/ScreenContainer.js +4 -1
  7. package/src/Components/Editor/Editor.js +15 -1
  8. package/src/Components/Form/Field/CKEditor/CKEditor.js +2 -1
  9. package/src/Components/Form/Field/Checkbox/Checkbox.js +2 -1
  10. package/src/Components/Form/Field/Color.js +2 -1
  11. package/src/Components/Form/Field/Combo/Combo.js +7 -4
  12. package/src/Components/Form/Field/Date.js +2 -1
  13. package/src/Components/Form/Field/DisplayField.js +2 -1
  14. package/src/Components/Form/Field/File.js +2 -1
  15. package/src/Components/Form/Field/Input.js +2 -1
  16. package/src/Components/Form/Field/Number.js +2 -1
  17. package/src/Components/Form/Field/RadioGroup/RadioGroup.js +2 -1
  18. package/src/Components/Form/Field/Text.js +2 -1
  19. package/src/Components/Form/Field/TextArea.js +3 -2
  20. package/src/Components/Form/Field/Toggle.js +2 -1
  21. package/src/Components/Form/Form.js +93 -45
  22. package/src/Components/Grid/Grid.js +67 -53
  23. package/src/Components/Grid/GridHeaderRow.js +5 -2
  24. package/src/Components/Grid/GridRow.js +8 -2
  25. package/src/Components/Hoc/withAlert.js +1 -3
  26. package/src/Components/Hoc/withComponent.js +65 -0
  27. package/src/Components/Hoc/withData.js +6 -0
  28. package/src/Components/Hoc/withEditor.js +54 -4
  29. package/src/Components/Hoc/withFilters.js +35 -5
  30. package/src/Components/Hoc/withInlineEditor.js +4 -0
  31. package/src/Components/Hoc/withPdfButton.js +12 -13
  32. package/src/Components/Hoc/withPresetButtons.js +14 -1
  33. package/src/Components/Hoc/withSelection.js +16 -0
  34. package/src/Components/Hoc/withSideEditor.js +7 -1
  35. package/src/Components/Hoc/withWindowedEditor.js +7 -1
  36. package/src/Components/Icons/HighPriority.js +20 -0
  37. package/src/Components/Icons/LowPriority.js +20 -0
  38. package/src/Components/Icons/MedPriority.js +20 -0
  39. package/src/Components/Icons/Pdf.js +14 -0
  40. package/src/Components/Screens/Manager.js +5 -2
  41. package/src/Components/Tab/TabBar.js +5 -2
  42. package/src/Components/Toolbar/Pagination.js +2 -1
  43. package/src/Components/Tree/Tree.js +47 -40
  44. package/src/Components/Viewer/TagViewer.js +3 -1
  45. package/src/Components/Viewer/Viewer.js +57 -14
  46. package/src/Components/index.js +2 -0
  47. package/src/Functions/getIconButtonFromConfig.js +3 -1
  48. package/src/Components/Form/Field/Field.js +0 -14
  49. package/src/Components/Grid/ReactGrid.js +0 -468
  50. package/src/Components/Grid/SenchaGrid.js +0 -421
  51. package/src/Components/Grid/reactgrid.css +0 -6
@@ -25,6 +25,7 @@ import UiGlobals from '../../UiGlobals.js';
25
25
  import useForceUpdate from '../../Hooks/useForceUpdate.js';
26
26
  import withContextMenu from '../Hoc/withContextMenu.js';
27
27
  import withAlert from '../Hoc/withAlert.js';
28
+ import withComponent from '../Hoc/withComponent.js';
28
29
  import withData from '../Hoc/withData.js';
29
30
  import withEvents from '../Hoc/withEvents.js';
30
31
  import withSideEditor from '../Hoc/withSideEditor.js';
@@ -1181,60 +1182,66 @@ function TreeComponent(props) {
1181
1182
 
1182
1183
  }
1183
1184
 
1184
- export const Tree = withAlert(
1185
- withEvents(
1186
- withData(
1187
- // withMultiSelection(
1188
- withSelection(
1189
- withFilters(
1190
- withContextMenu(
1191
- TreeComponent
1185
+ export const Tree = withComponent(
1186
+ withAlert(
1187
+ withEvents(
1188
+ withData(
1189
+ // withMultiSelection(
1190
+ withSelection(
1191
+ withFilters(
1192
+ withContextMenu(
1193
+ TreeComponent
1194
+ )
1192
1195
  )
1193
1196
  )
1194
- )
1195
- // )
1197
+ // )
1198
+ )
1196
1199
  )
1197
1200
  )
1198
1201
  );
1199
1202
 
1200
- export const SideTreeEditor = withAlert(
1201
- withEvents(
1202
- withData(
1203
- // withMultiSelection(
1204
- withSelection(
1205
- withSideEditor(
1206
- withFilters(
1207
- withPresetButtons(
1208
- withContextMenu(
1209
- TreeComponent
1203
+ export const SideTreeEditor = withComponent(
1204
+ withAlert(
1205
+ withEvents(
1206
+ withData(
1207
+ // withMultiSelection(
1208
+ withSelection(
1209
+ withSideEditor(
1210
+ withFilters(
1211
+ withPresetButtons(
1212
+ withContextMenu(
1213
+ TreeComponent
1214
+ )
1210
1215
  )
1211
- )
1212
- ),
1213
- true // isTree
1216
+ ),
1217
+ true // isTree
1218
+ )
1214
1219
  )
1215
- )
1216
- // )
1220
+ // )
1221
+ )
1217
1222
  )
1218
1223
  )
1219
1224
  );
1220
1225
 
1221
- export const WindowedTreeEditor = withAlert(
1222
- withEvents(
1223
- withData(
1224
- // withMultiSelection(
1225
- withSelection(
1226
- withWindowedEditor(
1227
- withFilters(
1228
- withPresetButtons(
1229
- withContextMenu(
1230
- TreeComponent
1226
+ export const WindowedTreeEditor = withComponent(
1227
+ withAlert(
1228
+ withEvents(
1229
+ withData(
1230
+ // withMultiSelection(
1231
+ withSelection(
1232
+ withWindowedEditor(
1233
+ withFilters(
1234
+ withPresetButtons(
1235
+ withContextMenu(
1236
+ TreeComponent
1237
+ )
1231
1238
  )
1232
- )
1233
- ),
1234
- true // isTree
1239
+ ),
1240
+ true // isTree
1241
+ )
1235
1242
  )
1236
- )
1237
- // )
1243
+ // )
1244
+ )
1238
1245
  )
1239
1246
  )
1240
1247
  );
@@ -2,6 +2,7 @@ import {
2
2
  Text,
3
3
  } from 'native-base';
4
4
  import UiGlobals from '../../UiGlobals.js';
5
+ import withComponent from '../Hoc/withComponent.js';
5
6
  import _ from 'lodash';
6
7
 
7
8
  function TagViewer(props) {
@@ -25,4 +26,5 @@ function TagViewer(props) {
25
26
  {...props}
26
27
  >{values}</Text>;
27
28
  }
28
- export default TagViewer;
29
+
30
+ export default withComponent(TagViewer);
@@ -1,5 +1,4 @@
1
1
  import {
2
- Button,
3
2
  Column,
4
3
  Icon,
5
4
  ScrollView,
@@ -10,9 +9,11 @@ import {
10
9
  EDITOR_TYPE__SIDE,
11
10
  } from '../../Constants/Editor.js';
12
11
  import UiGlobals from '../../UiGlobals.js';
12
+ import withComponent from '../Hoc/withComponent.js';
13
13
  import withPdfButton from '../Hoc/withPdfButton.js';
14
14
  import inArray from '../../Functions/inArray.js';
15
15
  import getComponentFromType from '../../Functions/getComponentFromType.js';
16
+ import Button from '../Buttons/Button.js';
16
17
  import Label from '../Form/Label.js';
17
18
  import Pencil from '../Icons/Pencil.js';
18
19
  import Footer from '../Layout/Footer.js';
@@ -25,7 +26,10 @@ function Viewer(props) {
25
26
  ancillaryItems = [], // additional items which are not controllable form elements, but should appear in the form
26
27
  columnDefaults = {}, // defaults for each Column defined in items (above)
27
28
  record,
28
- additionalViewButtons = [],
29
+ additionalViewButtons,
30
+
31
+ // withComponent
32
+ self,
29
33
 
30
34
  // withData
31
35
  Repository,
@@ -110,7 +114,10 @@ function Viewer(props) {
110
114
  let element = <Element
111
115
  value={value}
112
116
  isEditable={false}
117
+ parent={self}
118
+ reference={name}
113
119
  {...propsToPass}
120
+ {...editorTypeProps}
114
121
  />;
115
122
  if (label) {
116
123
  const labelProps = {};
@@ -146,6 +153,7 @@ function Viewer(props) {
146
153
  h={350}
147
154
  canEditorViewOnly={true}
148
155
  uniqueRepository={true}
156
+ parent={self}
149
157
  {...propsToPass}
150
158
  />;
151
159
  if (title) {
@@ -158,11 +166,49 @@ function Viewer(props) {
158
166
  });
159
167
  }
160
168
  return components;
169
+ },
170
+ buildAdditionalButtons = (configs) => {
171
+ const additionalButtons = [];
172
+ _.each(additionalViewButtons, (config) => {
173
+ const {
174
+ key,
175
+ text,
176
+ handler,
177
+ icon,
178
+ isDisabled,
179
+ color = '#fff',
180
+ } = config,
181
+ buttonProps = {};
182
+ if (key) {
183
+ buttonProps.key = key;
184
+ buttonProps.reference = key;
185
+ }
186
+ if (handler) {
187
+ buttonProps.onPress = handler;
188
+ }
189
+ if (icon) {
190
+ buttonProps.leftIcon = <Icon as={icon} color="#fff" size="sm" />;
191
+ }
192
+ if (isDisabled) {
193
+ buttonProps.isDisabled = isDisabled;
194
+ }
195
+
196
+ const button = <Button
197
+ color={color}
198
+ ml={2}
199
+ parent={self}
200
+ reference={key}
201
+ {...buttonProps}
202
+ >{text}</Button>;
203
+ additionalButtons.push(button);
204
+ });
205
+ return additionalButtons;
161
206
  };
162
207
 
163
208
  const
164
209
  showDeleteBtn = onDelete && viewerCanDelete,
165
- showCloseBtn = !isSideEditor;
210
+ showCloseBtn = !isSideEditor,
211
+ additionalButtons = buildAdditionalButtons();
166
212
 
167
213
  return <Column flex={flex} {...props}>
168
214
  <ScrollView width="100%" _web={{ height: 1 }}>
@@ -176,9 +222,9 @@ function Viewer(props) {
176
222
  >To Edit</Button>
177
223
  </Row>}
178
224
 
179
- {!_.isEmpty(additionalViewButtons) &&
225
+ {!_.isEmpty(additionalButtons) &&
180
226
  <Row p={2} alignItems="center" justifyContent="flex-end">
181
- {additionalViewButtons}
227
+ {additionalButtons}
182
228
  </Row>}
183
229
 
184
230
  {buildFromItems()}
@@ -201,16 +247,13 @@ function Viewer(props) {
201
247
  color="#fff"
202
248
  >Delete</Button>
203
249
  </Row>}
204
- {showCloseBtn &&
205
- <Button.Group space={2}>
206
- <Button
207
- key="closeBtn"
208
- onPress={onClose}
209
- color="#fff"
210
- >Close</Button>
211
- </Button.Group>}
250
+ {showCloseBtn && <Button
251
+ key="closeBtn"
252
+ onPress={onClose}
253
+ color="#fff"
254
+ >Close</Button>}
212
255
  </Footer>}
213
256
  </Column>;
214
257
  }
215
258
 
216
- export default withPdfButton(Viewer);
259
+ export default withComponent(withPdfButton(Viewer));
@@ -8,6 +8,7 @@ import ArrayRadioGroup from './Form/Field/RadioGroup/ArrayRadioGroup.js';
8
8
  // import BackButton from '../Components/Buttons/BackButton.js';
9
9
  import Blank from './Blank.js';
10
10
  import BooleanCombo from './Form/Field/Combo/BooleanCombo.js';
11
+ import Button from '../Components/Buttons/Button.js';
11
12
  // import CartButtonWithBadge from '../Components/Buttons/CartButtonWithBadge.js';
12
13
  // import CKEditor from './Form/Field/CKEditor/CKEditor.js'; // web only
13
14
  import Checkbox from './Form/Field/Checkbox/Checkbox.js';
@@ -59,6 +60,7 @@ const components = {
59
60
  // BackButton,
60
61
  Blank,
61
62
  BooleanCombo,
63
+ Button,
62
64
  // CartButtonWithBadge,
63
65
  Checkbox,
64
66
  CheckboxGroup,
@@ -1,7 +1,7 @@
1
1
  import IconButton from '../Components/Buttons/IconButton.js';
2
2
  import UiGlobals from '../UiGlobals.js';
3
3
 
4
- export default function getIconButtonFromConfig(config, ix) {
4
+ export default function getIconButtonFromConfig(config, ix, parent) {
5
5
  const
6
6
  {
7
7
  key,
@@ -27,6 +27,8 @@ export default function getIconButtonFromConfig(config, ix) {
27
27
  };
28
28
  return <IconButton
29
29
  key={key || ix}
30
+ parent={parent}
31
+ reference={key || ix}
30
32
  onPress={handler}
31
33
  icon={icon}
32
34
  _icon={_icon}
@@ -1,14 +0,0 @@
1
- import {
2
- Box,
3
- } from 'native-base';
4
- import _ from 'lodash';
5
-
6
- export default function Blank(props) {
7
- const {
8
- children,
9
- ...propsToPass
10
- } = props;
11
- return <Box {...propsToPass}>
12
- {children}
13
- </Box>;
14
- }