@onehat/ui 0.3.30 → 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 +60 -0
- 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 +34 -28
- package/src/Components/Hoc/withPresetButtons.js +26 -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 +58 -14
- package/src/Components/index.js +4 -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
|
@@ -9,6 +9,7 @@ import Inflector from 'inflector-js';
|
|
|
9
9
|
import qs from 'qs';
|
|
10
10
|
import FormPanel from '../Panel/FormPanel.js';
|
|
11
11
|
import inArray from '../../Functions/inArray.js';
|
|
12
|
+
import Pdf from '../Icons/Pdf.js';
|
|
12
13
|
import useAdjustedWindowSize from '../../Hooks/useAdjustedWindowSize.js';
|
|
13
14
|
import { EDITOR_TYPE__PLAIN } from '@onehat/ui/src/Constants/Editor.js';
|
|
14
15
|
import UiGlobals from '../../UiGlobals.js';
|
|
@@ -46,27 +47,34 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
46
47
|
const modalItems = _.map(_.cloneDeep(items), (item, ix) => buildNextLayer(item, ix, columnDefaults)); // clone, as we don't want to alter the item by reference
|
|
47
48
|
|
|
48
49
|
if (!_.isEmpty(ancillaryItems)) {
|
|
50
|
+
const
|
|
51
|
+
ancillaryItemsClone = _.cloneDeep(ancillaryItems),
|
|
52
|
+
items = [];
|
|
53
|
+
_.each(ancillaryItemsClone, (ancillaryItem) => { // clone, as we don't want to alter the item by reference
|
|
54
|
+
let name;
|
|
55
|
+
if (ancillaryItem.model) {
|
|
56
|
+
name = Inflector.underscore(ancillaryItem.model);
|
|
57
|
+
} else {
|
|
58
|
+
name = ancillaryItem.title;
|
|
59
|
+
}
|
|
60
|
+
if (!inArray(name, ['Photos', 'Videos', 'Files'])) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
name = 'ancillary___' + name;
|
|
64
|
+
items.push({
|
|
65
|
+
title: ancillaryItem.title,
|
|
66
|
+
label: ancillaryItem.title,
|
|
67
|
+
name,
|
|
68
|
+
type: 'Checkbox',
|
|
69
|
+
});
|
|
70
|
+
});
|
|
49
71
|
modalItems.push({
|
|
50
72
|
type: 'FieldSet',
|
|
51
73
|
title: 'Ancillary Items',
|
|
52
74
|
defaults: {
|
|
53
75
|
labelWidth: '90%',
|
|
54
76
|
},
|
|
55
|
-
items
|
|
56
|
-
let name;
|
|
57
|
-
if (ancillaryItem.model) {
|
|
58
|
-
name = Inflector.underscore(ancillaryItem.model);
|
|
59
|
-
} else {
|
|
60
|
-
name = ancillaryItem.title;
|
|
61
|
-
}
|
|
62
|
-
name = 'ancillary___' + name;
|
|
63
|
-
return {
|
|
64
|
-
title: ancillaryItem.title,
|
|
65
|
-
label: ancillaryItem.title,
|
|
66
|
-
name,
|
|
67
|
-
type: 'Checkbox',
|
|
68
|
-
};
|
|
69
|
-
}),
|
|
77
|
+
items,
|
|
70
78
|
showToggleAllCheckbox: true,
|
|
71
79
|
isCollapsible: false,
|
|
72
80
|
});
|
|
@@ -142,19 +150,17 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
142
150
|
window.open(url + queryString, '_blank');
|
|
143
151
|
};
|
|
144
152
|
|
|
145
|
-
const button =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
>View PDF</Button>;
|
|
155
|
-
additionalEditButtons.unshift(button);
|
|
153
|
+
const button = {
|
|
154
|
+
key: 'viewPdfBtn',
|
|
155
|
+
text: 'View PDF',
|
|
156
|
+
icon: Pdf,
|
|
157
|
+
handler: () => {
|
|
158
|
+
setIsModalShown(true);
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
additionalEditButtons.push(button);
|
|
156
162
|
if (additionalEditButtons !== additionalViewButtons) { // Ensure they're NOT the same object, otherwise this would be adding it twice!
|
|
157
|
-
additionalViewButtons.
|
|
163
|
+
additionalViewButtons.push(button);
|
|
158
164
|
}
|
|
159
165
|
|
|
160
166
|
let modal = null;
|
|
@@ -195,7 +201,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
195
201
|
{...props}
|
|
196
202
|
additionalEditButtons={additionalEditButtons}
|
|
197
203
|
additionalViewButtons={additionalViewButtons}
|
|
198
|
-
|
|
204
|
+
/>
|
|
199
205
|
{modal}
|
|
200
206
|
</>;
|
|
201
207
|
};
|
|
@@ -35,6 +35,9 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
35
35
|
contextMenuItems,
|
|
36
36
|
additionalToolbarButtons,
|
|
37
37
|
onChangeColumnsConfig,
|
|
38
|
+
verifyCanEdit,
|
|
39
|
+
verifyCanDelete,
|
|
40
|
+
verifyCanDuplicate,
|
|
38
41
|
...propsToPass
|
|
39
42
|
} = props,
|
|
40
43
|
{
|
|
@@ -51,6 +54,9 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
51
54
|
disableDuplicate = !isEditor,
|
|
52
55
|
disablePrint = !isGrid,
|
|
53
56
|
|
|
57
|
+
// withComponent
|
|
58
|
+
self,
|
|
59
|
+
|
|
54
60
|
// withEditor
|
|
55
61
|
userCanEdit = true,
|
|
56
62
|
userCanView = true,
|
|
@@ -120,12 +126,14 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
120
126
|
return isDisabled;
|
|
121
127
|
},
|
|
122
128
|
getPresetButtonProps = (type) => {
|
|
123
|
-
let
|
|
129
|
+
let key,
|
|
130
|
+
text,
|
|
124
131
|
handler,
|
|
125
132
|
icon = null,
|
|
126
133
|
isDisabled = false;
|
|
127
134
|
switch(type) {
|
|
128
135
|
case 'add':
|
|
136
|
+
key = 'addBtn';
|
|
129
137
|
text = 'Add';
|
|
130
138
|
handler = onAdd;
|
|
131
139
|
icon = <Plus />;
|
|
@@ -137,6 +145,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
137
145
|
}
|
|
138
146
|
break;
|
|
139
147
|
case 'edit':
|
|
148
|
+
key = 'editBtn';
|
|
140
149
|
text = 'Edit';
|
|
141
150
|
handler = onEdit;
|
|
142
151
|
icon = <Edit />;
|
|
@@ -146,8 +155,12 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
146
155
|
if (_.isEmpty(selection) || (_.isArray(selection) && selection.length > 1)) {
|
|
147
156
|
isDisabled = true;
|
|
148
157
|
}
|
|
158
|
+
if (verifyCanEdit && !verifyCanEdit(selection)) {
|
|
159
|
+
isDisabled = true;
|
|
160
|
+
}
|
|
149
161
|
break;
|
|
150
162
|
case 'delete':
|
|
163
|
+
key = 'deleteBtn';
|
|
151
164
|
text = 'Delete';
|
|
152
165
|
handler = onDelete;
|
|
153
166
|
icon = <Trash />;
|
|
@@ -157,8 +170,12 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
157
170
|
if (_.isEmpty(selection) || (_.isArray(selection) && selection.length > 1)) {
|
|
158
171
|
isDisabled = true;
|
|
159
172
|
}
|
|
173
|
+
if (verifyCanDelete && !verifyCanDelete(selection)) {
|
|
174
|
+
isDisabled = true;
|
|
175
|
+
}
|
|
160
176
|
break;
|
|
161
177
|
case 'view':
|
|
178
|
+
key = 'viewBtn';
|
|
162
179
|
text = 'View';
|
|
163
180
|
handler = onView;
|
|
164
181
|
icon = <Eye />;
|
|
@@ -171,6 +188,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
171
188
|
}
|
|
172
189
|
break;
|
|
173
190
|
case 'copy':
|
|
191
|
+
key = 'copyBtn';
|
|
174
192
|
text = 'Copy to Clipboard';
|
|
175
193
|
handler = onCopyToClipboard;
|
|
176
194
|
icon = <Clipboard />;
|
|
@@ -183,6 +201,7 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
183
201
|
}
|
|
184
202
|
break;
|
|
185
203
|
case 'duplicate':
|
|
204
|
+
key = 'duplicateBtn';
|
|
186
205
|
text = 'Duplicate';
|
|
187
206
|
handler = onDuplicate;
|
|
188
207
|
icon = <Duplicate />;
|
|
@@ -193,6 +212,9 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
193
212
|
if (_.isEmpty(selection) || selection.length > 1) {
|
|
194
213
|
isDisabled = true;
|
|
195
214
|
}
|
|
215
|
+
if (verifyCanDuplicate && !verifyCanDuplicate(selection)) {
|
|
216
|
+
isDisabled = true;
|
|
217
|
+
}
|
|
196
218
|
break;
|
|
197
219
|
// case 'print':
|
|
198
220
|
// text = 'Print';
|
|
@@ -202,10 +224,13 @@ export default function withPresetButtons(WrappedComponent, isGrid = false) {
|
|
|
202
224
|
default:
|
|
203
225
|
}
|
|
204
226
|
return {
|
|
227
|
+
key,
|
|
205
228
|
text,
|
|
206
229
|
handler,
|
|
207
230
|
icon,
|
|
208
231
|
isDisabled,
|
|
232
|
+
parent: self,
|
|
233
|
+
reference: key,
|
|
209
234
|
};
|
|
210
235
|
},
|
|
211
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,
|
|
@@ -109,7 +113,11 @@ function Viewer(props) {
|
|
|
109
113
|
|
|
110
114
|
let element = <Element
|
|
111
115
|
value={value}
|
|
116
|
+
isEditable={false}
|
|
117
|
+
parent={self}
|
|
118
|
+
reference={name}
|
|
112
119
|
{...propsToPass}
|
|
120
|
+
{...editorTypeProps}
|
|
113
121
|
/>;
|
|
114
122
|
if (label) {
|
|
115
123
|
const labelProps = {};
|
|
@@ -145,6 +153,7 @@ function Viewer(props) {
|
|
|
145
153
|
h={350}
|
|
146
154
|
canEditorViewOnly={true}
|
|
147
155
|
uniqueRepository={true}
|
|
156
|
+
parent={self}
|
|
148
157
|
{...propsToPass}
|
|
149
158
|
/>;
|
|
150
159
|
if (title) {
|
|
@@ -157,11 +166,49 @@ function Viewer(props) {
|
|
|
157
166
|
});
|
|
158
167
|
}
|
|
159
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;
|
|
160
206
|
};
|
|
161
207
|
|
|
162
208
|
const
|
|
163
209
|
showDeleteBtn = onDelete && viewerCanDelete,
|
|
164
|
-
showCloseBtn = !isSideEditor
|
|
210
|
+
showCloseBtn = !isSideEditor,
|
|
211
|
+
additionalButtons = buildAdditionalButtons();
|
|
165
212
|
|
|
166
213
|
return <Column flex={flex} {...props}>
|
|
167
214
|
<ScrollView width="100%" _web={{ height: 1 }}>
|
|
@@ -175,9 +222,9 @@ function Viewer(props) {
|
|
|
175
222
|
>To Edit</Button>
|
|
176
223
|
</Row>}
|
|
177
224
|
|
|
178
|
-
{!_.isEmpty(
|
|
225
|
+
{!_.isEmpty(additionalButtons) &&
|
|
179
226
|
<Row p={2} alignItems="center" justifyContent="flex-end">
|
|
180
|
-
{
|
|
227
|
+
{additionalButtons}
|
|
181
228
|
</Row>}
|
|
182
229
|
|
|
183
230
|
{buildFromItems()}
|
|
@@ -200,16 +247,13 @@ function Viewer(props) {
|
|
|
200
247
|
color="#fff"
|
|
201
248
|
>Delete</Button>
|
|
202
249
|
</Row>}
|
|
203
|
-
{showCloseBtn &&
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
color="#fff"
|
|
209
|
-
>Close</Button>
|
|
210
|
-
</Button.Group>}
|
|
250
|
+
{showCloseBtn && <Button
|
|
251
|
+
key="closeBtn"
|
|
252
|
+
onPress={onClose}
|
|
253
|
+
color="#fff"
|
|
254
|
+
>Close</Button>}
|
|
211
255
|
</Footer>}
|
|
212
256
|
</Column>;
|
|
213
257
|
}
|
|
214
258
|
|
|
215
|
-
export default withPdfButton(Viewer);
|
|
259
|
+
export default withComponent(withPdfButton(Viewer));
|