@onehat/ui 0.3.34 → 0.3.36
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 +1 -1
- package/src/Components/Form/Field/Combo/Combo.js +8 -3
- package/src/Components/Form/Form.js +6 -2
- package/src/Components/Grid/Grid.js +4 -2
- package/src/Components/Hoc/withData.js +25 -4
- package/src/Components/Hoc/withInlineEditor.js +1 -0
- package/src/Components/Hoc/withPdfButton.js +1 -0
- package/src/Components/Hoc/withSelection.js +1 -1
- package/src/Components/Hoc/withSideEditor.js +1 -0
- package/src/Components/Hoc/withWindowedEditor.js +1 -0
- package/src/Components/Icons/Certificate.js +14 -0
- package/src/Components/Icons/ClipboardCheck.js +21 -0
- package/src/Components/Icons/Gauge.js +21 -0
- package/src/Components/Icons/Video.js +20 -0
- package/src/Components/Panel/Panel.js +1 -1
- package/src/Components/Toolbar/Pagination.js +15 -0
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ export function ComboComponent(props) {
|
|
|
38
38
|
hideMenuOnSelection = true,
|
|
39
39
|
_input = {},
|
|
40
40
|
isEditor = false,
|
|
41
|
+
isDisabled = false,
|
|
41
42
|
|
|
42
43
|
// withValue
|
|
43
44
|
value,
|
|
@@ -258,6 +259,10 @@ export function ComboComponent(props) {
|
|
|
258
259
|
},
|
|
259
260
|
searchForMatches = async (value) => {
|
|
260
261
|
|
|
262
|
+
if (_.isEmpty(value)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
261
266
|
let found;
|
|
262
267
|
if (Repository) {
|
|
263
268
|
|
|
@@ -275,9 +280,7 @@ export function ComboComponent(props) {
|
|
|
275
280
|
searchField = displayFieldName + ' LIKE';
|
|
276
281
|
}
|
|
277
282
|
|
|
278
|
-
|
|
279
|
-
value += '%';
|
|
280
|
-
}
|
|
283
|
+
value += '%';
|
|
281
284
|
|
|
282
285
|
await Repository.filter(searchField, value);
|
|
283
286
|
if (!this.isAutoLoad) {
|
|
@@ -408,6 +411,7 @@ export function ComboComponent(props) {
|
|
|
408
411
|
ref={inputRef}
|
|
409
412
|
value={textValue}
|
|
410
413
|
autoSubmit={true}
|
|
414
|
+
isDisabled={isDisabled}
|
|
411
415
|
onChangeValue={onInputChangeText}
|
|
412
416
|
onKeyPress={onInputKeyPress}
|
|
413
417
|
onBlur={onInputBlur}
|
|
@@ -453,6 +457,7 @@ export function ComboComponent(props) {
|
|
|
453
457
|
color: 'primary.800',
|
|
454
458
|
size: 'sm',
|
|
455
459
|
}}
|
|
460
|
+
isDisabled={isDisabled}
|
|
456
461
|
onPress={onTriggerPress}
|
|
457
462
|
onBlur={onTriggerBlur}
|
|
458
463
|
h="100%"
|
|
@@ -307,8 +307,12 @@ function Form(props) {
|
|
|
307
307
|
type = 'Text';
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
if (
|
|
311
|
-
editorTypeProps.autoLoad =
|
|
310
|
+
if (item.hasOwnProperty('autoLoad')) {
|
|
311
|
+
editorTypeProps.autoLoad = item.autoLoad;
|
|
312
|
+
} else {
|
|
313
|
+
if (type?.match && type.match(/Combo$/) && Repository?.isRemote && !Repository?.isLoaded) {
|
|
314
|
+
editorTypeProps.autoLoad = true;
|
|
315
|
+
}
|
|
312
316
|
}
|
|
313
317
|
const Element = getComponentFromType(type);
|
|
314
318
|
let children;
|
|
@@ -145,6 +145,7 @@ function GridComponent(props) {
|
|
|
145
145
|
} = props,
|
|
146
146
|
styles = UiGlobals.styles,
|
|
147
147
|
forceUpdate = useForceUpdate(),
|
|
148
|
+
containerRef = useRef(),
|
|
148
149
|
gridRef = useRef(),
|
|
149
150
|
isAddingRef = useRef(),
|
|
150
151
|
[isReady, setIsReady] = useState(false),
|
|
@@ -775,7 +776,7 @@ function GridComponent(props) {
|
|
|
775
776
|
}, [selectorId, selectorSelected]);
|
|
776
777
|
|
|
777
778
|
if (self) {
|
|
778
|
-
self.ref =
|
|
779
|
+
self.ref = containerRef;
|
|
779
780
|
}
|
|
780
781
|
|
|
781
782
|
isAddingRef.current = isAdding;
|
|
@@ -801,7 +802,7 @@ function GridComponent(props) {
|
|
|
801
802
|
let listFooterComponent = null;
|
|
802
803
|
if (!disableBottomToolbar) {
|
|
803
804
|
if (Repository && bottomToolbar === 'pagination' && !disablePagination && Repository.isPaginated) {
|
|
804
|
-
listFooterComponent = <PaginationToolbar Repository={Repository} toolbarItems={footerToolbarItemComponents} disablePageSize={!disableAdjustingPageSizeToHeight} />;
|
|
805
|
+
listFooterComponent = <PaginationToolbar Repository={Repository} self={self} toolbarItems={footerToolbarItemComponents} disablePageSize={!disableAdjustingPageSizeToHeight} />;
|
|
805
806
|
} else if (footerToolbarItemComponents.length) {
|
|
806
807
|
listFooterComponent = <Toolbar>{footerToolbarItemComponents}</Toolbar>;
|
|
807
808
|
}
|
|
@@ -816,6 +817,7 @@ function GridComponent(props) {
|
|
|
816
817
|
|
|
817
818
|
return <Column
|
|
818
819
|
{...testProps('Grid')}
|
|
820
|
+
ref={containerRef}
|
|
819
821
|
w="100%"
|
|
820
822
|
bg={bg}
|
|
821
823
|
borderWidth={styles.GRID_BORDER_WIDTH}
|
|
@@ -18,8 +18,9 @@ export default function withData(WrappedComponent) {
|
|
|
18
18
|
setRepository,
|
|
19
19
|
uniqueRepository = false,
|
|
20
20
|
model,
|
|
21
|
-
autoLoad
|
|
21
|
+
autoLoad, // bool
|
|
22
22
|
pageSize,
|
|
23
|
+
baseParams,
|
|
23
24
|
|
|
24
25
|
// For plain JS data
|
|
25
26
|
data,
|
|
@@ -46,11 +47,14 @@ export default function withData(WrappedComponent) {
|
|
|
46
47
|
return () => {};
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
let repositoryId;
|
|
51
|
+
|
|
49
52
|
(async () => {
|
|
50
53
|
let Repository;
|
|
51
54
|
if (uniqueRepository) {
|
|
52
55
|
const schema = oneHatData.getSchema(model);
|
|
53
56
|
Repository = await oneHatData.createRepository({ schema });
|
|
57
|
+
repositoryId = Repository.id;
|
|
54
58
|
} else {
|
|
55
59
|
Repository = oneHatData.getRepository(model);
|
|
56
60
|
}
|
|
@@ -59,8 +63,19 @@ export default function withData(WrappedComponent) {
|
|
|
59
63
|
Repository.setPageSize(pageSize);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
if (
|
|
63
|
-
|
|
66
|
+
if (baseParams) {
|
|
67
|
+
Repository.setBaseParams(baseParams);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if (Repository && !Repository.isLoaded && Repository.isRemote && !Repository.isAutoLoad && !Repository.isLoading) {
|
|
72
|
+
let doAutoLoad = Repository.autoLoad;
|
|
73
|
+
if (!_.isNil(autoLoad)) { // prop can override schema setting for autoLoad
|
|
74
|
+
doAutoLoad = autoLoad;
|
|
75
|
+
}
|
|
76
|
+
if (doAutoLoad) {
|
|
77
|
+
await Repository.load();
|
|
78
|
+
}
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
setLocalRepository(Repository);
|
|
@@ -73,7 +88,13 @@ export default function withData(WrappedComponent) {
|
|
|
73
88
|
setIsReady(true);
|
|
74
89
|
})();
|
|
75
90
|
|
|
76
|
-
|
|
91
|
+
return () => {
|
|
92
|
+
if (repositoryId) {
|
|
93
|
+
oneHatData.deleteRepository(repositoryId);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}, []);
|
|
77
98
|
|
|
78
99
|
if (!isReady) {
|
|
79
100
|
return null;
|
|
@@ -281,7 +281,7 @@ export default function withSelection(WrappedComponent) {
|
|
|
281
281
|
(async () => {
|
|
282
282
|
|
|
283
283
|
if (usesWithValue && Repository?.isRemote
|
|
284
|
-
&& !Repository.isAutoLoad && !Repository.isLoaded && !Repository.isLoading) {
|
|
284
|
+
&& !Repository.isAutoLoad && !Repository.isLoaded && !Repository.isLoading && (!_.isNil(value) || !_.isEmpty(selection)) || autoSelectFirstItem) {
|
|
285
285
|
// on initialization, we can't conformSelectionToValue if the repository is not yet loaded,
|
|
286
286
|
// so first load repo, then conform to value
|
|
287
287
|
await Repository.load();
|
|
@@ -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="M211 7.3C205 1 196-1.4 187.6.8s-14.9 8.9-17.1 17.3l-15.8 62.5-62-17.5c-8.4-2.4-17.4 0-23.5 6.1s-8.5 15.1-6.1 23.5l17.5 62-62.5 15.9c-8.4 2.1-15 8.7-17.3 17.1S1 205 7.3 211l46.2 45-46.2 45c-6.3 6-8.7 15-6.5 23.4s8.9 14.9 17.3 17.1l62.5 15.8-17.5 62c-2.4 8.4 0 17.4 6.1 23.5s15.1 8.5 23.5 6.1l62-17.5 15.8 62.5c2.1 8.4 8.7 15 17.1 17.3s17.3-.2 23.4-6.4l45-46.2 45 46.2c6.1 6.2 15 8.7 23.4 6.4s14.9-8.9 17.1-17.3l15.8-62.5 62 17.5c8.4 2.4 17.4 0 23.5-6.1s8.5-15.1 6.1-23.5l-17.5-62 62.5-15.8c8.4-2.1 15-8.7 17.3-17.1s-.2-17.3-6.4-23.4l-46.2-45 46.2-45c6.2-6.1 8.7-15 6.4-23.4s-8.9-14.9-17.3-17.1l-62.5-15.8 17.5-62c2.4-8.4 0-17.4-6.1-23.5s-15.1-8.5-23.5-6.1l-62 17.5-15.9-62.5c-2.1-8.4-8.7-15-17.1-17.3S307 1 301 7.3l-45 46.2-45-46.2z" />
|
|
10
|
+
</Icon>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default SvgComponent
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
id="Layer_2"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
viewBox="0 0 9.51 12.68"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<Path
|
|
15
|
+
d="M4.76 0C3.72 0 2.84.66 2.52 1.59h-.93C.72 1.59 0 2.3 0 3.18v7.93c0 .87.71 1.59 1.59 1.59h6.34c.87 0 1.59-.71 1.59-1.59V3.17c0-.87-.71-1.59-1.59-1.59H7A2.384 2.384 0 004.76-.01zm0 1.59c.44 0 .79.35.79.79s-.35.79-.79.79-.79-.35-.79-.79.35-.79.79-.79zm2.8 5.18L4.39 9.94c-.23.23-.61.23-.84 0L1.96 8.35c-.23-.23-.23-.61 0-.84s.61-.23.84 0l1.16 1.16 2.75-2.75c.23-.23.61-.23.84 0s.23.61 0 .84z"
|
|
16
|
+
/>
|
|
17
|
+
</Icon>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default SvgComponent
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
id="Layer_2"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
viewBox="0 0 10.46 10.46"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
<Path
|
|
15
|
+
d="M0 5.23C0 2.34 2.34 0 5.23 0s5.23 2.34 5.23 5.23-2.34 5.23-5.23 5.23S0 8.12 0 5.23zm5.89-3.27c0-.36-.29-.65-.65-.65s-.65.29-.65.65.29.65.65.65.65-.29.65-.65zM5.24 8.5c.72 0 1.31-.59 1.31-1.31 0-.36-.14-.68-.37-.91L7.49 3.3c.11-.25 0-.54-.25-.65s-.54 0-.65.25L5.28 5.88h-.04c-.72 0-1.31.59-1.31 1.31S4.52 8.5 5.24 8.5zM3.6 2.94c0-.36-.29-.65-.65-.65s-.65.29-.65.65.29.65.65.65.65-.29.65-.65zM1.96 5.88c.36 0 .65-.29.65-.65s-.29-.65-.65-.65-.65.29-.65.65.29.65.65.65zm7.19-.65c0-.36-.29-.65-.65-.65s-.65.29-.65.65.29.65.65.65.65-.29.65-.65z"
|
|
16
|
+
/>
|
|
17
|
+
</Icon>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
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
|
+
viewBox="0 0 11.77 7.85"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<Path
|
|
14
|
+
d="M0 1.31C0 .59.59 0 1.31 0h5.23c.72 0 1.31.59 1.31 1.31v5.23c0 .72-.59 1.31-1.31 1.31H1.31C.59 7.85 0 7.26 0 6.54V1.31zM11.43.73c.21.11.35.34.35.58v5.23c0 .24-.13.46-.35.58s-.47.1-.67-.03L8.8 5.78l-.29-.19V2.27l.29-.19L10.76.77c.2-.13.46-.15.67-.03z"
|
|
15
|
+
/>
|
|
16
|
+
</Icon>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SvgComponent
|
|
@@ -35,7 +35,7 @@ function Panel(props) {
|
|
|
35
35
|
onLayout = null,
|
|
36
36
|
|
|
37
37
|
// Header
|
|
38
|
-
title = UiGlobals.customInflect(Inflector.camel2words(Inflector.underscore(props.model))),
|
|
38
|
+
title = props.model ? UiGlobals.customInflect(Inflector.camel2words(Inflector.underscore(props.model))) : '',
|
|
39
39
|
showHeader = true,
|
|
40
40
|
header = null,
|
|
41
41
|
isClosable = false,
|
|
@@ -18,6 +18,9 @@ export default function Pagination(props) {
|
|
|
18
18
|
const {
|
|
19
19
|
minimize = false,
|
|
20
20
|
disablePageSize = false,
|
|
21
|
+
|
|
22
|
+
// withComponent
|
|
23
|
+
self,
|
|
21
24
|
|
|
22
25
|
// withData
|
|
23
26
|
Repository,
|
|
@@ -56,6 +59,8 @@ export default function Pagination(props) {
|
|
|
56
59
|
isDisabled = page === 1;
|
|
57
60
|
items.push(<IconButton
|
|
58
61
|
key="first"
|
|
62
|
+
parent={self}
|
|
63
|
+
reference="firstPageBtn"
|
|
59
64
|
{...iconButtonProps}
|
|
60
65
|
isDisabled={isDisabled}
|
|
61
66
|
icon={<Icon as={AnglesLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -64,6 +69,8 @@ export default function Pagination(props) {
|
|
|
64
69
|
/>);
|
|
65
70
|
items.push(<IconButton
|
|
66
71
|
key="prev"
|
|
72
|
+
parent={self}
|
|
73
|
+
reference="prevPageBtn"
|
|
67
74
|
{...iconButtonProps}
|
|
68
75
|
isDisabled={isDisabled}
|
|
69
76
|
icon={<Icon as={AngleLeft} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -79,6 +86,8 @@ export default function Pagination(props) {
|
|
|
79
86
|
>
|
|
80
87
|
<Text mr={2}>Page</Text>
|
|
81
88
|
<Input
|
|
89
|
+
parent={self}
|
|
90
|
+
reference="pageInput"
|
|
82
91
|
keyboardType="numeric"
|
|
83
92
|
value={page?.toString()}
|
|
84
93
|
onChangeValue={(value) => Repository.setPage(value)}
|
|
@@ -94,6 +103,8 @@ export default function Pagination(props) {
|
|
|
94
103
|
isDisabled = page === totalPages || totalPages <= 1;
|
|
95
104
|
items.push(<IconButton
|
|
96
105
|
key="next"
|
|
106
|
+
parent={self}
|
|
107
|
+
reference="nextPageBtn"
|
|
97
108
|
{...iconButtonProps}
|
|
98
109
|
isDisabled={isDisabled}
|
|
99
110
|
icon={<Icon as={AngleRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -102,6 +113,8 @@ export default function Pagination(props) {
|
|
|
102
113
|
/>);
|
|
103
114
|
items.push(<IconButton
|
|
104
115
|
key="last"
|
|
116
|
+
parent={self}
|
|
117
|
+
reference="lastPageBtn"
|
|
105
118
|
{...iconButtonProps}
|
|
106
119
|
isDisabled={isDisabled}
|
|
107
120
|
icon={<Icon as={AnglesRight} {...iconProps} color={isDisabled ? 'disabled' : 'trueGray.600'} />}
|
|
@@ -111,6 +124,8 @@ export default function Pagination(props) {
|
|
|
111
124
|
if (!Repository.isLocal) {
|
|
112
125
|
items.push(<IconButton
|
|
113
126
|
key="reload"
|
|
127
|
+
parent={self}
|
|
128
|
+
reference="reloadPageBtn"
|
|
114
129
|
{...iconButtonProps}
|
|
115
130
|
icon={<Icon as={Rotate} {...iconProps} color="trueGray.600" />}
|
|
116
131
|
onPress={() => Repository.reload()}
|