@onehat/ui 0.3.31 → 0.3.32
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/Buttons/Button.js +20 -0
- package/src/Components/Buttons/IconButton.js +68 -51
- package/src/Components/Buttons/SquareButton.js +6 -4
- package/src/Components/Container/Container.js +4 -1
- package/src/Components/Container/ScreenContainer.js +4 -1
- package/src/Components/Editor/Editor.js +15 -1
- package/src/Components/Form/Field/CKEditor/CKEditor.js +2 -1
- package/src/Components/Form/Field/Checkbox/Checkbox.js +2 -1
- package/src/Components/Form/Field/Color.js +2 -1
- package/src/Components/Form/Field/Combo/Combo.js +7 -4
- package/src/Components/Form/Field/Date.js +2 -1
- package/src/Components/Form/Field/DisplayField.js +2 -1
- package/src/Components/Form/Field/File.js +2 -1
- package/src/Components/Form/Field/Input.js +2 -1
- package/src/Components/Form/Field/Number.js +2 -1
- package/src/Components/Form/Field/RadioGroup/RadioGroup.js +2 -1
- package/src/Components/Form/Field/Text.js +2 -1
- package/src/Components/Form/Field/TextArea.js +3 -2
- package/src/Components/Form/Field/Toggle.js +2 -1
- package/src/Components/Form/Form.js +91 -44
- package/src/Components/Grid/Grid.js +67 -53
- package/src/Components/Grid/GridHeaderRow.js +5 -2
- package/src/Components/Grid/GridRow.js +8 -2
- package/src/Components/Hoc/withAlert.js +1 -3
- package/src/Components/Hoc/withComponent.js +59 -0
- package/src/Components/Hoc/withEditor.js +16 -4
- package/src/Components/Hoc/withInlineEditor.js +4 -0
- package/src/Components/Hoc/withPdfButton.js +12 -13
- package/src/Components/Hoc/withPresetButtons.js +14 -1
- package/src/Components/Hoc/withSideEditor.js +7 -1
- package/src/Components/Hoc/withWindowedEditor.js +7 -1
- package/src/Components/Icons/HighPriority.js +20 -0
- package/src/Components/Icons/LowPriority.js +20 -0
- package/src/Components/Icons/MedPriority.js +20 -0
- package/src/Components/Icons/Pdf.js +14 -0
- package/src/Components/Screens/Manager.js +5 -2
- package/src/Components/Tab/TabBar.js +5 -2
- package/src/Components/Toolbar/Pagination.js +2 -1
- package/src/Components/Tree/Tree.js +47 -40
- package/src/Components/Viewer/TagViewer.js +3 -1
- package/src/Components/Viewer/Viewer.js +57 -14
- package/src/Components/index.js +2 -0
- package/src/Functions/getIconButtonFromConfig.js +3 -1
- package/src/Components/Form/Field/Field.js +0 -14
- package/src/Components/Grid/ReactGrid.js +0 -468
- package/src/Components/Grid/SenchaGrid.js +0 -421
- package/src/Components/Grid/reactgrid.css +0 -6
|
@@ -54,6 +54,9 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
54
54
|
disableDuplicate = !isEditor,
|
|
55
55
|
disablePrint = !isGrid,
|
|
56
56
|
|
|
57
|
+
// withComponent
|
|
58
|
+
self,
|
|
59
|
+
|
|
57
60
|
// withEditor
|
|
58
61
|
userCanEdit = true,
|
|
59
62
|
userCanView = true,
|
|
@@ -123,12 +126,14 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
123
126
|
return isDisabled;
|
|
124
127
|
},
|
|
125
128
|
getPresetButtonProps = (type) => {
|
|
126
|
-
let
|
|
129
|
+
let key,
|
|
130
|
+
text,
|
|
127
131
|
handler,
|
|
128
132
|
icon = null,
|
|
129
133
|
isDisabled = false;
|
|
130
134
|
switch(type) {
|
|
131
135
|
case 'add':
|
|
136
|
+
key = 'addBtn';
|
|
132
137
|
text = 'Add';
|
|
133
138
|
handler = onAdd;
|
|
134
139
|
icon = <Plus />;
|
|
@@ -140,6 +145,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
140
145
|
}
|
|
141
146
|
break;
|
|
142
147
|
case 'edit':
|
|
148
|
+
key = 'editBtn';
|
|
143
149
|
text = 'Edit';
|
|
144
150
|
handler = onEdit;
|
|
145
151
|
icon = <Edit />;
|
|
@@ -154,6 +160,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
154
160
|
}
|
|
155
161
|
break;
|
|
156
162
|
case 'delete':
|
|
163
|
+
key = 'deleteBtn';
|
|
157
164
|
text = 'Delete';
|
|
158
165
|
handler = onDelete;
|
|
159
166
|
icon = <Trash />;
|
|
@@ -168,6 +175,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
168
175
|
}
|
|
169
176
|
break;
|
|
170
177
|
case 'view':
|
|
178
|
+
key = 'viewBtn';
|
|
171
179
|
text = 'View';
|
|
172
180
|
handler = onView;
|
|
173
181
|
icon = <Eye />;
|
|
@@ -180,6 +188,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
180
188
|
}
|
|
181
189
|
break;
|
|
182
190
|
case 'copy':
|
|
191
|
+
key = 'copyBtn';
|
|
183
192
|
text = 'Copy to Clipboard';
|
|
184
193
|
handler = onCopyToClipboard;
|
|
185
194
|
icon = <Clipboard />;
|
|
@@ -192,6 +201,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
192
201
|
}
|
|
193
202
|
break;
|
|
194
203
|
case 'duplicate':
|
|
204
|
+
key = 'duplicateBtn';
|
|
195
205
|
text = 'Duplicate';
|
|
196
206
|
handler = onDuplicate;
|
|
197
207
|
icon = <Duplicate />;
|
|
@@ -214,10 +224,13 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
214
224
|
default:
|
|
215
225
|
}
|
|
216
226
|
return {
|
|
227
|
+
key,
|
|
217
228
|
text,
|
|
218
229
|
handler,
|
|
219
230
|
icon,
|
|
220
231
|
isDisabled,
|
|
232
|
+
parent: self,
|
|
233
|
+
reference: key,
|
|
221
234
|
};
|
|
222
235
|
},
|
|
223
236
|
generatePresetButtons = () => {
|
|
@@ -12,6 +12,11 @@ export default function withSideEditor(WrappedComponent, isTree = false) {
|
|
|
12
12
|
Editor,
|
|
13
13
|
editorProps = {},
|
|
14
14
|
sideFlex = 100,
|
|
15
|
+
|
|
16
|
+
// withComponent
|
|
17
|
+
self,
|
|
18
|
+
|
|
19
|
+
...propsToPass
|
|
15
20
|
} = props;
|
|
16
21
|
|
|
17
22
|
if (!Editor) {
|
|
@@ -25,12 +30,13 @@ export default function withSideEditor(WrappedComponent, isTree = false) {
|
|
|
25
30
|
{...props}
|
|
26
31
|
/>}
|
|
27
32
|
east={<Editor
|
|
28
|
-
{...
|
|
33
|
+
{...propsToPass}
|
|
29
34
|
editorType={EDITOR_TYPE__SIDE}
|
|
30
35
|
flex={sideFlex}
|
|
31
36
|
borderLeftWidth={1}
|
|
32
37
|
borderLeftColor="#ccc"
|
|
33
38
|
{...editorProps}
|
|
39
|
+
parent={self}
|
|
34
40
|
/>}
|
|
35
41
|
/>;
|
|
36
42
|
});
|
|
@@ -32,6 +32,11 @@ export default function withWindowedEditor(WrappedComponent, isTree = false) {
|
|
|
32
32
|
setIsEditorShown,
|
|
33
33
|
Editor,
|
|
34
34
|
editorProps = {},
|
|
35
|
+
|
|
36
|
+
// withComponent
|
|
37
|
+
self,
|
|
38
|
+
|
|
39
|
+
...propsToPass
|
|
35
40
|
} = props;
|
|
36
41
|
|
|
37
42
|
if (!Editor) {
|
|
@@ -47,8 +52,9 @@ export default function withWindowedEditor(WrappedComponent, isTree = false) {
|
|
|
47
52
|
>
|
|
48
53
|
<Editor
|
|
49
54
|
editorType={EDITOR_TYPE__WINDOWED}
|
|
50
|
-
{...
|
|
55
|
+
{...propsToPass}
|
|
51
56
|
{...editorProps}
|
|
57
|
+
parent={self}
|
|
52
58
|
/>
|
|
53
59
|
</Modal>}
|
|
54
60
|
</>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import Svg, { Path } from "react-native-svg"
|
|
3
|
+
import { Icon } from 'native-base';
|
|
4
|
+
|
|
5
|
+
function SvgComponent(props) {
|
|
6
|
+
return (
|
|
7
|
+
<Icon
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
viewBox="0 0 101.44 83.8"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<Path
|
|
13
|
+
d="M58.92 4.5L99.9 68.86c4.12 6.47-.53 14.94-8.2 14.94H9.74c-7.67 0-12.32-8.47-8.2-14.94L42.52 4.5c3.82-6 12.58-6 16.4 0zM34.64 72.71c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18h-9.54l1.38 27.18h6.84zm12.66 13.92c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18h-9.54l1.38 27.18h6.84zM66.8 72.71c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18H62l1.38 27.18h6.84z"
|
|
14
|
+
strokeWidth={0}
|
|
15
|
+
/>
|
|
16
|
+
</Icon>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SvgComponent
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import Svg, { Path } from "react-native-svg"
|
|
3
|
+
import { Icon } from 'native-base';
|
|
4
|
+
|
|
5
|
+
function SvgComponent(props) {
|
|
6
|
+
return (
|
|
7
|
+
<Icon
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
viewBox="0 0 101.44 83.8"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<Path
|
|
13
|
+
d="M58.92 4.5L99.9 68.86c4.12 6.47-.53 14.94-8.2 14.94H9.74c-7.67 0-12.32-8.47-8.2-14.94L42.52 4.5c3.82-6 12.58-6 16.4 0zm-8.2 68.21c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18h-9.54l1.38 27.18h6.84z"
|
|
14
|
+
strokeWidth={0}
|
|
15
|
+
/>
|
|
16
|
+
</Icon>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default SvgComponent
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import Svg, { Path } from "react-native-svg"
|
|
3
|
+
import { Icon } from 'native-base';
|
|
4
|
+
|
|
5
|
+
function SvgComponent(props) {
|
|
6
|
+
return (
|
|
7
|
+
<Icon
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
viewBox="0 0 101.44 83.8"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<Path
|
|
13
|
+
d="M58.92 4.5L99.9 68.86c4.12 6.47-.53 14.94-8.2 14.94H9.74c-7.67 0-12.32-8.47-8.2-14.94L42.52 4.5c3.82-6 12.58-6 16.4 0zM42.68 72.71c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18h-9.54l1.38 27.18h6.84zm12.66 13.92c3.24 0 5.34-2.34 5.34-5.46-.06-3.18-2.16-5.46-5.34-5.46s-5.4 2.28-5.4 5.46 2.16 5.46 5.4 5.46zm3.42-13.92l1.32-27.18h-9.54l1.38 27.18h6.84z"
|
|
14
|
+
strokeWidth={0}
|
|
15
|
+
/>
|
|
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="M0 64C0 28.7 28.7 0 64 0h160v128c0 17.7 14.3 32 32 32h128v144H176c-35.3 0-64 28.7-64 64v144H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0l128 128zM176 352h32c30.9 0 56 25.1 56 56s-25.1 56-56 56h-16v32c0 8.8-7.2 16-16 16s-16-7.2-16-16V368c0-8.8 7.2-16 16-16zm32 80c13.3 0 24-10.7 24-24s-10.7-24-24-24h-16v48h16zm96-80h32c26.5 0 48 21.5 48 48v64c0 26.5-21.5 48-48 48h-32c-8.8 0-16-7.2-16-16V368c0-8.8 7.2-16 16-16zm32 128c8.8 0 16-7.2 16-16v-64c0-8.8-7.2-16-16-16h-16v96h16zm80-112c0-8.8 7.2-16 16-16h48c8.8 0 16 7.2 16 16s-7.2 16-16 16h-32v32h32c8.8 0 16 7.2 16 16s-7.2 16-16 16h-32v48c0 8.8-7.2 16-16 16s-16-7.2-16-16V368z" />
|
|
10
|
+
</Icon>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default SvgComponent
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Row,
|
|
5
5
|
Text,
|
|
6
6
|
} from 'native-base';
|
|
7
|
+
import withComponent from '../Hoc/withComponent.js';
|
|
7
8
|
import IconButton from '../Buttons/IconButton';
|
|
8
9
|
import FullWidth from '../Icons/FullWidth';
|
|
9
10
|
import SideBySide from '../Icons/SideBySide';
|
|
@@ -15,7 +16,7 @@ const
|
|
|
15
16
|
MODE_FULL = 'MODE_FULL',
|
|
16
17
|
MODE_SIDE = 'MODE_SIDE';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
function ManagerScreen(props) {
|
|
19
20
|
const {
|
|
20
21
|
title,
|
|
21
22
|
sideModeComponent,
|
|
@@ -93,4 +94,6 @@ export default function ManagerScreen(props) {
|
|
|
93
94
|
{whichComponent}
|
|
94
95
|
|
|
95
96
|
</Column>;
|
|
96
|
-
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default withComponent(ManagerScreen);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
VERTICAL,
|
|
12
12
|
} from '../../Constants/Directions.js';
|
|
13
13
|
import UiGlobals from '../../UiGlobals.js';
|
|
14
|
+
import withComponent from '../Hoc/withComponent.js';
|
|
14
15
|
import IconButton from '../Buttons/IconButton.js';
|
|
15
16
|
import Minimize from '../Icons/Minimize.js';
|
|
16
17
|
import Maximize from '../Icons/Maximize.js';
|
|
@@ -19,7 +20,7 @@ import setSaved from '../../Functions/setSaved.js';
|
|
|
19
20
|
import _ from 'lodash';
|
|
20
21
|
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
function TabBar(props) {
|
|
23
24
|
const {
|
|
24
25
|
tabs = [], // { _icon, title, content, path, items, }
|
|
25
26
|
content, // e.g. Expo Router slot
|
|
@@ -386,4 +387,6 @@ export default function TabBar(props) {
|
|
|
386
387
|
{renderedCurrentTabContent}
|
|
387
388
|
</Column>}
|
|
388
389
|
</Column>;
|
|
389
|
-
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export default withComponent(TabBar);
|
|
@@ -79,7 +79,8 @@ export default function Pagination(props) {
|
|
|
79
79
|
>
|
|
80
80
|
<Text mr={2}>Page</Text>
|
|
81
81
|
<Input
|
|
82
|
-
|
|
82
|
+
keyboardType="numeric"
|
|
83
|
+
value={page?.toString()}
|
|
83
84
|
onChangeValue={(value) => Repository.setPage(value)}
|
|
84
85
|
maxValue={totalPages}
|
|
85
86
|
isDisabled={totalPages === 1}
|
|
@@ -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 =
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
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 =
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
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
|
-
|
|
1216
|
+
),
|
|
1217
|
+
true // isTree
|
|
1218
|
+
)
|
|
1214
1219
|
)
|
|
1215
|
-
)
|
|
1216
|
-
|
|
1220
|
+
// )
|
|
1221
|
+
)
|
|
1217
1222
|
)
|
|
1218
1223
|
)
|
|
1219
1224
|
);
|
|
1220
1225
|
|
|
1221
|
-
export const WindowedTreeEditor =
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
225
|
+
{!_.isEmpty(additionalButtons) &&
|
|
180
226
|
<Row p={2} alignItems="center" justifyContent="flex-end">
|
|
181
|
-
{
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
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));
|
package/src/Components/index.js
CHANGED
|
@@ -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}
|