@onehat/ui 0.3.372 → 0.3.374

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.372",
3
+ "version": "0.3.374",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "@gluestack-ui/themed": "^1.1.26",
32
32
  "@hookform/resolvers": "^3.3.1",
33
33
  "@k-renwick/colour-mixer": "^1.2.1",
34
- "@onehat/data": "^1.21.0",
34
+ "@onehat/data": "^1.21.18",
35
35
  "@react-native-community/slider": "^4.5.2",
36
36
  "@reduxjs/toolkit": "^1.9.5",
37
37
  "inflector-js": "^1.0.1",
@@ -20,6 +20,9 @@ const
20
20
  const {
21
21
  value,
22
22
  setValue,
23
+ onText = 'Yes',
24
+ offText = 'No',
25
+
23
26
  flex, // flex doesn't work right on mobile
24
27
  ...propsToPass
25
28
  } = props,
@@ -79,9 +82,10 @@ const
79
82
  >
80
83
  <Text
81
84
  {...testProps('readout')}
82
- mx={2}
85
+ ml={1}
86
+ mr={2}
83
87
  fontSize={styles.FORM_TOGGLE_FONTSIZE}
84
- >{_.isNil(value) ? 'N/A' : (!!value ? 'Yes' : 'No')}</Text>
88
+ >{_.isNil(value) ? 'N/A' : (!!value ? onText : offText)}</Text>
85
89
  </Pressable>
86
90
  </Row>;
87
91
  },
@@ -238,10 +238,17 @@ export default function withFilters(WrappedComponent) {
238
238
  return filter?.type;
239
239
  },
240
240
  getIsFilterRange = (filter) => {
241
- let field = _.isString(filter) ? filter : filter.field;
242
- const filterType = getFilterType(field);
241
+ let filterType;
242
+ if (filter.type) {
243
+ // filter type is already determined
244
+ filterType = filter.type;
245
+ } else {
246
+ // try to find filter type from field name
247
+ const field = _.isString(filter) ? filter : filter.field;
248
+ filterType = getFilterType(field);
249
+ }
243
250
  if (filterType?.type) {
244
- return inArray(filterType.type, ['NumberRange', 'DateRange'])
251
+ filterType = filterType.type;
245
252
  }
246
253
  return inArray(filterType, ['NumberRange', 'DateRange']);
247
254
  },
@@ -129,17 +129,17 @@ function Panel(props) {
129
129
  },
130
130
  nonFrameProps = {
131
131
  ...borderProps,
132
- borderTopWidth: 1,
133
- borderBottomWidth: 1,
134
- borderLeftWidth: 1,
135
- borderRightWidth: 1,
132
+ borderTopWidth: 0,
133
+ borderBottomWidth: 0,
134
+ borderLeftWidth: 0,
135
+ borderRightWidth: 0,
136
136
  },
137
137
  frameProps = {
138
138
  ...borderProps,
139
- borderTopWidth: 3,
140
- borderBottomWidth: 3,
141
- borderLeftWidth: 3,
142
- borderRightWidth: 3,
139
+ borderTopWidth: 2,
140
+ borderBottomWidth: 2,
141
+ borderLeftWidth: 2,
142
+ borderRightWidth: 2,
143
143
  };
144
144
  let framePropsToUse = nonFrameProps;
145
145
  if (frame) {
@@ -1154,7 +1154,9 @@ function TreeComponent(props) {
1154
1154
  }
1155
1155
 
1156
1156
  (async () => {
1157
- await reloadTree();
1157
+ if (autoLoadRootNodes) {
1158
+ await reloadTree();
1159
+ }
1158
1160
  setIsReady(true);
1159
1161
  })();
1160
1162
 
@@ -23,6 +23,10 @@ function UploadsDownloadsWindow(props) {
23
23
  {
24
24
  Repository,
25
25
  columnsConfig = [],
26
+ uploadHeaders,
27
+ downloadHeaders,
28
+ uploadParams = {},
29
+ downloadParams = {},
26
30
 
27
31
  // withComponent
28
32
  self,
@@ -64,8 +68,9 @@ function UploadsDownloadsWindow(props) {
64
68
  order,
65
69
  model,
66
70
  isTemplate,
71
+ ...downloadParams,
67
72
  }),
68
- headers: _.merge({ 'Content-Type': 'application/json' }, Repository.headers),
73
+ headers: _.merge({ 'Content-Type': 'application/json' }, Repository.headers, downloadHeaders),
69
74
  },
70
75
  fetchWindow = downloadWithFetch(url, options, win),
71
76
  interval = setInterval(function() {
@@ -83,7 +88,7 @@ function UploadsDownloadsWindow(props) {
83
88
  onUpload = async () => {
84
89
  const
85
90
  url = Repository.api.baseURL + Repository.name + '/uploadBatch',
86
- result = await Repository._send('POST', url, { importFile })
91
+ result = await Repository._send('POST', url, { importFile, ...uploadParams, }, uploadHeaders)
87
92
  .catch(error => {
88
93
  if (Repository.debugMode) {
89
94
  console.log(url + ' error', error);