@onehat/ui 0.3.272 → 0.3.273
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/Editor/Editor.js +3 -3
- package/src/Components/Form/Form.js +2 -2
- package/src/Components/Grid/Grid.js +1 -0
- package/src/Components/Grid/GridRow.js +4 -2
- package/src/Components/Hoc/withAlert.js +9 -2
- package/src/Components/Viewer/Viewer.js +2 -2
- package/src/Functions/testProps.js +7 -3
package/package.json
CHANGED
|
@@ -18,7 +18,9 @@ function Editor(props) {
|
|
|
18
18
|
onEditMode,
|
|
19
19
|
verifyCanEdit,
|
|
20
20
|
_viewer = {},
|
|
21
|
-
_form = {
|
|
21
|
+
_form = {
|
|
22
|
+
containerProps: {}
|
|
23
|
+
},
|
|
22
24
|
|
|
23
25
|
// withComponent
|
|
24
26
|
self,
|
|
@@ -46,7 +48,6 @@ function Editor(props) {
|
|
|
46
48
|
return null;
|
|
47
49
|
}
|
|
48
50
|
return <Viewer
|
|
49
|
-
{...testProps(self)}
|
|
50
51
|
{...propsToPass}
|
|
51
52
|
{..._viewer}
|
|
52
53
|
record={record}
|
|
@@ -59,7 +60,6 @@ function Editor(props) {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
return <Form
|
|
62
|
-
{...testProps(self)}
|
|
63
63
|
{...propsToPass}
|
|
64
64
|
{..._form}
|
|
65
65
|
record={selection}
|
|
@@ -899,7 +899,7 @@ function Form(props) {
|
|
|
899
899
|
>Back</Button>}
|
|
900
900
|
{isSingle && editorMode === EDITOR_MODE__EDIT && onViewMode && !disableView &&
|
|
901
901
|
<Button
|
|
902
|
-
{...testProps('
|
|
902
|
+
{...testProps('toViewBtn')}
|
|
903
903
|
key="viewBtn"
|
|
904
904
|
onPress={onViewMode}
|
|
905
905
|
leftIcon={<Icon as={Eye} color="#fff" size="sm" />}
|
|
@@ -968,7 +968,7 @@ function Form(props) {
|
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
970
|
|
|
971
|
-
return <Column {...sizeProps} {...containerProps} onLayout={onLayoutDecorated} ref={formRef}
|
|
971
|
+
return <Column {...testProps(self)} {...sizeProps} {...containerProps} onLayout={onLayoutDecorated} ref={formRef}>
|
|
972
972
|
{!!containerWidth && <>
|
|
973
973
|
{editorType === EDITOR_TYPE__INLINE &&
|
|
974
974
|
<Row
|
|
@@ -24,6 +24,7 @@ function GridRow(props) {
|
|
|
24
24
|
fields,
|
|
25
25
|
rowProps,
|
|
26
26
|
hideNavColumn,
|
|
27
|
+
isSelected,
|
|
27
28
|
bg,
|
|
28
29
|
item,
|
|
29
30
|
isInlineEditorShown,
|
|
@@ -126,7 +127,7 @@ function GridRow(props) {
|
|
|
126
127
|
elementProps.isViewOnly = true; // TODO: this won't work for InlineGridEditor, bc that Grid can't use isViewOnly when actually editing
|
|
127
128
|
}
|
|
128
129
|
return <Element
|
|
129
|
-
{...testProps('
|
|
130
|
+
{...testProps('cell-' + config.fieldName)}
|
|
130
131
|
value={value}
|
|
131
132
|
key={key}
|
|
132
133
|
overflow="hidden"
|
|
@@ -167,7 +168,7 @@ function GridRow(props) {
|
|
|
167
168
|
elementProps.textOverflow = 'ellipsis';
|
|
168
169
|
}
|
|
169
170
|
return <Text
|
|
170
|
-
{...testProps('
|
|
171
|
+
{...testProps('cell-' + config.fieldName)}
|
|
171
172
|
key={key}
|
|
172
173
|
overflow="hidden"
|
|
173
174
|
alignSelf="center"
|
|
@@ -219,6 +220,7 @@ function GridRow(props) {
|
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
return <Row
|
|
223
|
+
{...testProps('row' + (isSelected ? '-selected' : ''))}
|
|
222
224
|
alignItems="center"
|
|
223
225
|
flexGrow={1}
|
|
224
226
|
{...rowProps}
|
|
@@ -124,6 +124,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
124
124
|
let buttons = [];
|
|
125
125
|
if (includeCancel) {
|
|
126
126
|
buttons.push(<Button
|
|
127
|
+
{...testProps('cancelBtn')}
|
|
127
128
|
key="cancelBtn"
|
|
128
129
|
onPress={onCancel}
|
|
129
130
|
color="#fff"
|
|
@@ -136,6 +137,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
136
137
|
case ALERT_MODE_OK:
|
|
137
138
|
case ALERT_MODE_INFO:
|
|
138
139
|
buttons.push(<Button
|
|
140
|
+
{...testProps('okBtn')}
|
|
139
141
|
key="okBtn"
|
|
140
142
|
ref={autoFocusRef}
|
|
141
143
|
onPress={onOk}
|
|
@@ -144,6 +146,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
144
146
|
break;
|
|
145
147
|
case ALERT_MODE_YES:
|
|
146
148
|
buttons.push(<Button
|
|
149
|
+
{...testProps('yesBtn')}
|
|
147
150
|
key="yesBtn"
|
|
148
151
|
ref={autoFocusRef}
|
|
149
152
|
onPress={onYes}
|
|
@@ -154,6 +157,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
154
157
|
case ALERT_MODE_YES_NO:
|
|
155
158
|
// TODO: need to create a new colorScheme so this can be black with blank background
|
|
156
159
|
buttons.push(<Button
|
|
160
|
+
{...testProps('noBtn')}
|
|
157
161
|
key="noBtn"
|
|
158
162
|
onPress={onNo}
|
|
159
163
|
color="trueGray.800"
|
|
@@ -162,6 +166,7 @@ export default function withAlert(WrappedComponent) {
|
|
|
162
166
|
mr={2}
|
|
163
167
|
>No</Button>);
|
|
164
168
|
buttons.push(<Button
|
|
169
|
+
{...testProps('yesBtn')}
|
|
165
170
|
key="yesBtn"
|
|
166
171
|
ref={autoFocusRef}
|
|
167
172
|
onPress={onYes}
|
|
@@ -191,11 +196,13 @@ export default function withAlert(WrappedComponent) {
|
|
|
191
196
|
isOpen={isAlertShown}
|
|
192
197
|
onClose={() => setIsAlertShown(false)}
|
|
193
198
|
>
|
|
194
|
-
<AlertDialog.Content
|
|
199
|
+
<AlertDialog.Content
|
|
200
|
+
{...testProps('AlertDialog')}
|
|
201
|
+
>
|
|
195
202
|
{canClose && <AlertDialog.CloseButton />}
|
|
196
203
|
<AlertDialog.Header>{title}</AlertDialog.Header>
|
|
197
204
|
<AlertDialog.Body>
|
|
198
|
-
<Row alignItems="center"
|
|
205
|
+
<Row alignItems="center">
|
|
199
206
|
<Column w="40px" p={0} mr={5}>
|
|
200
207
|
<Icon as={mode === ALERT_MODE_INFO ? CircleInfo : TriangleExclamation} size={10} color={mode === ALERT_MODE_INFO ? '#000' : '#f00'} />
|
|
201
208
|
</Column>
|
|
@@ -249,14 +249,14 @@ function Viewer(props) {
|
|
|
249
249
|
canEdit = false;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
return <Column flex={flex} {...props} onLayout={onLayout}>
|
|
252
|
+
return <Column flex={flex} {...testProps(self)} {...props} onLayout={onLayout}>
|
|
253
253
|
{containerWidth && <>
|
|
254
254
|
|
|
255
255
|
<ScrollView _web={{ height: 1 }} width="100%" pb={1} ref={scrollViewRef}>
|
|
256
256
|
{canEdit && onEditMode &&
|
|
257
257
|
<Row px={4} pt={4} alignItems="center" justifyContent="flex-end">
|
|
258
258
|
<Button
|
|
259
|
-
{...testProps('
|
|
259
|
+
{...testProps('toEditBtn')}
|
|
260
260
|
key="editBtn"
|
|
261
261
|
onPress={onEditMode}
|
|
262
262
|
leftIcon={<Icon as={Pencil} color="#fff" size="sm" />}
|
|
@@ -7,11 +7,15 @@ export default function testProps(id) {
|
|
|
7
7
|
if (typeof __DEV__ === 'undefined' || !__DEV__) {
|
|
8
8
|
return {}; // don't add test props in production
|
|
9
9
|
}
|
|
10
|
-
if (id?.
|
|
11
|
-
|
|
10
|
+
if (id?.path) { // id is actually 'self' object
|
|
11
|
+
id = id.path;
|
|
12
|
+
} else if (id?.reference) { // id is actually 'self' object
|
|
12
13
|
id = id.reference;
|
|
13
14
|
}
|
|
14
|
-
if (id
|
|
15
|
+
if (!id) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
if (id.match(/\s/g)) {
|
|
15
19
|
id = id.replace(/\s/g, '_'); // convert any spaces to underscores
|
|
16
20
|
}
|
|
17
21
|
if (!window && Platform.OS === 'android') {
|