@onehat/ui 0.3.101 → 0.3.104

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.101",
3
+ "version": "0.3.104",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -87,15 +87,15 @@ export default function withEditor(WrappedComponent, isTree = false) {
87
87
  getNewEntityDisplayValue = () => {
88
88
  return newEntityDisplayValueRef.current;
89
89
  },
90
- onAdd = async () => {
90
+ onAdd = async (values) => {
91
91
  const defaultValues = Repository.getSchema().getDefaultValues();
92
- let addValues = _.clone(defaultValues);
92
+ let addValues = values || _.clone(defaultValues);
93
93
 
94
94
  if (selectorId && !_.isEmpty(selectorSelected)) {
95
95
  addValues[selectorId] = selectorSelected.id;
96
96
  }
97
97
 
98
- if (getNewEntityDisplayValue()) {
98
+ if (!values && getNewEntityDisplayValue()) {
99
99
  const displayPropertyName = Repository.getSchema().model.displayProperty;
100
100
  addValues[displayPropertyName] = getNewEntityDisplayValue();
101
101
  }
@@ -265,11 +265,10 @@ export default function withFilters(WrappedComponent) {
265
265
  field,
266
266
  type: filterType,
267
267
  title,
268
- } = filter,
269
-
270
- propertyDef = Repository.getSchema().getPropertyDefinition(field);
268
+ } = filter;
271
269
 
272
270
  if (!title) {
271
+ const propertyDef = Repository.getSchema().getPropertyDefinition(field);
273
272
  title = propertyDef?.title;
274
273
  }
275
274
 
@@ -328,7 +327,7 @@ export default function withFilters(WrappedComponent) {
328
327
 
329
328
  if (!isReady) {
330
329
  const savedFilters = await getSaved(id + '-filters');
331
- if (!_.isEmpty(savedFilters)) {
330
+ if (!_.isEmpty(savedFilters) && !isUsingCustomFilters) {
332
331
  // load saved filters
333
332
  filtersToUse = savedFilters;
334
333
  setFilters(savedFilters, true, false); // false to skip save
@@ -337,7 +336,7 @@ export default function withFilters(WrappedComponent) {
337
336
 
338
337
  if (isUsingCustomFilters) {
339
338
  _.each(filtersToUse, (filter) => {
340
- const repoFiltersFromFilter = filter.getRepoFilters(value);
339
+ const repoFiltersFromFilter = filter.getRepoFilters(filter.value);
341
340
  _.each(repoFiltersFromFilter, (repoFilter) => { // one custom filter might generate multiple filters for the repository
342
341
  newRepoFilters.push(repoFilter);
343
342
  });
@@ -410,10 +409,12 @@ export default function withFilters(WrappedComponent) {
410
409
  const
411
410
  renderedFilters = renderFilters(),
412
411
  hasFilters = !!renderedFilters.length;
413
- topToolbar = <Toolbar justifyContent="space-between" alignItems="center">
414
- <Text pr={2} userSelect="none">Filters:{hasFilters ? '' : ' None'}</Text>
415
- {renderedFilters}
416
- <Row flex={hasFilters ? null : 1} justifyContent="flex-end">
412
+ topToolbar = <Toolbar>
413
+ <Row flex={1} alignItems="center">
414
+ <Text pr={2} userSelect="none">Filters:{hasFilters ? '' : ' None'}</Text>
415
+ {renderedFilters}
416
+ </Row>
417
+ <Row flex={hasFilters ? null : 1} alignItems="center" alignSelf="flex-end">
417
418
  <IconButton
418
419
  key="clear"
419
420
  _icon={{
@@ -0,0 +1,23 @@
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
16
+ fill="#1E3050"
17
+ d="M224 0c-17.7 0-32 14.3-32 32v19.2C119 66 64 130.6 64 208v18.8c0 47-17.3 92.4-48.5 127.6l-7.4 8.3c-8.4 9.4-10.4 22.9-5.3 34.4S19.4 416 32 416h384c12.6 0 24-7.4 29.2-18.9s3.1-25-5.3-34.4l-7.4-8.3c-31.2-35.2-48.5-80.5-48.5-127.6V208c0-77.4-55-142-128-156.8V32c0-17.7-14.3-32-32-32zm45.3 493.3c12-12 18.7-28.3 18.7-45.3H160c0 17 6.7 33.3 18.7 45.3S207 512 224 512s33.3-6.7 45.3-18.7z"
18
+ />
19
+ </Icon>
20
+ )
21
+ }
22
+
23
+ export default SvgComponent
@@ -22,7 +22,7 @@ function ManagerScreen(props) {
22
22
  title,
23
23
  sideModeComponent,
24
24
  fullModeComponent,
25
- id,
25
+ reference,
26
26
  } = props,
27
27
  styles = UiGlobals.styles,
28
28
  [isReady, setIsReady] = useState(false),
@@ -32,18 +32,22 @@ function ManagerScreen(props) {
32
32
  return; // no change
33
33
  }
34
34
  setModeRaw(newMode);
35
- setSaved(id + '-mode', newMode);
35
+ if (reference) {
36
+ setSaved(reference + '-mode', newMode);
37
+ }
36
38
  };
37
39
 
38
40
  useEffect(() => {
39
41
  // Restore saved settings
40
42
  (async () => {
41
43
 
42
- let key, val;
43
- key = id + '-mode';
44
- val = await getSaved(key);
45
- if (!_.isNil(val)) {
46
- setMode(val);
44
+ if (reference) {
45
+ const
46
+ key = reference + '-mode',
47
+ val = await getSaved(key);
48
+ if (!_.isNil(val)) {
49
+ setMode(val);
50
+ }
47
51
  }
48
52
 
49
53
  if (!isReady) {
@@ -432,7 +432,7 @@ function TabBar(props) {
432
432
  p={2}
433
433
  pb={0}
434
434
  bg={styles.TAB_BAR_BG}
435
- h={isCollapsed ? '30px' : tabHeight}
435
+ h={isCollapsed ? '38px' : tabHeight}
436
436
  >
437
437
  <ScrollView
438
438
  horizontal={true}