@onehat/ui 0.3.85 → 0.3.88
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.
|
|
3
|
+
"version": "0.3.88",
|
|
4
4
|
"description": "Base UI for OneHat apps",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
"@reduxjs/toolkit": "^1.9.5",
|
|
34
34
|
"inflector-js": "^1.0.1",
|
|
35
35
|
"js-cookie": "^3.0.5",
|
|
36
|
-
"locutus": "^2.0.16",
|
|
37
36
|
"native-base": "^3.4.28",
|
|
38
|
-
"react-hook-form": "^7.
|
|
37
|
+
"react-hook-form": "^7.49.2",
|
|
39
38
|
"react-redux": "^8.1.2",
|
|
40
39
|
"yup": "^1.2.0"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"@files-ui/react": "^1.0.8",
|
|
44
43
|
"ckeditor5-custom-build": "file:ckeditor5",
|
|
44
|
+
"locutus": "^2.0.16",
|
|
45
45
|
"react": "*",
|
|
46
46
|
"react-color": "^2.19.3",
|
|
47
47
|
"react-datetime": "^3.2.0",
|
|
@@ -24,6 +24,7 @@ function TagComponent(props) {
|
|
|
24
24
|
isValueAlwaysArray,
|
|
25
25
|
isValueAsStringifiedJson,
|
|
26
26
|
Editor,
|
|
27
|
+
_combo = {},
|
|
27
28
|
|
|
28
29
|
// parent Form
|
|
29
30
|
onChangeValue,
|
|
@@ -144,8 +145,12 @@ function TagComponent(props) {
|
|
|
144
145
|
onView={() => onView(val)}
|
|
145
146
|
onDelete={isEditor ? () => onDelete(val) : null}
|
|
146
147
|
/>;
|
|
147
|
-
})
|
|
148
|
-
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
let WhichCombo = ComboEditor;
|
|
151
|
+
if (!_.isNil(_combo.isEditor) && !_combo.isEditor) {
|
|
152
|
+
WhichCombo = Combo;
|
|
153
|
+
}
|
|
149
154
|
|
|
150
155
|
const sizeProps = {};
|
|
151
156
|
if (!props.flex && !props.w) {
|
|
@@ -184,6 +189,7 @@ function TagComponent(props) {
|
|
|
184
189
|
onChangeValue={onChangeComboValue}
|
|
185
190
|
parent={self}
|
|
186
191
|
reference="combo"
|
|
192
|
+
{..._combo}
|
|
187
193
|
/>}
|
|
188
194
|
</Column>
|
|
189
195
|
{isViewerShown &&
|
|
@@ -121,6 +121,7 @@ function Form(props) {
|
|
|
121
121
|
record = props.record?.length === 1 ? props.record[0] : props.record,
|
|
122
122
|
isMultiple = _.isArray(record),
|
|
123
123
|
isSingle = !isMultiple, // for convenience
|
|
124
|
+
isPhantom = !!record?.isPhantom,
|
|
124
125
|
forceUpdate = useForceUpdate(),
|
|
125
126
|
[previousRecord, setPreviousRecord] = useState(record),
|
|
126
127
|
[containerWidth, setContainerWidth] = useState(),
|
|
@@ -157,6 +158,7 @@ function Form(props) {
|
|
|
157
158
|
// shouldUnregister: false,
|
|
158
159
|
// shouldUseNativeValidation: false,
|
|
159
160
|
resolver: yupResolver(validator || (isMultiple ? disableRequiredYupFields(Repository?.schema?.model?.validator) : Repository?.schema?.model?.validator) || yup.object()),
|
|
161
|
+
context: { isPhantom },
|
|
160
162
|
}),
|
|
161
163
|
buildFromColumnsConfig = () => {
|
|
162
164
|
// For InlineEditor
|
|
@@ -738,7 +740,7 @@ function Form(props) {
|
|
|
738
740
|
isSaveDisabled = true;
|
|
739
741
|
isSubmitDisabled = true;
|
|
740
742
|
}
|
|
741
|
-
if (_.isEmpty(formState.dirtyFields) && !
|
|
743
|
+
if (_.isEmpty(formState.dirtyFields) && !isPhantom) {
|
|
742
744
|
isSaveDisabled = true;
|
|
743
745
|
}
|
|
744
746
|
|
|
@@ -759,12 +761,10 @@ function Form(props) {
|
|
|
759
761
|
if (isEditorViewOnly) {
|
|
760
762
|
showCloseBtn = true;
|
|
761
763
|
} else {
|
|
762
|
-
const
|
|
763
|
-
formIsDirty = formState.isDirty,
|
|
764
|
-
recordIsPhantom = record?.isPhantom;
|
|
764
|
+
const formIsDirty = formState.isDirty;
|
|
765
765
|
// console.log('formIsDirty', formIsDirty);
|
|
766
|
-
// console.log('
|
|
767
|
-
if (formIsDirty ||
|
|
766
|
+
// console.log('isPhantom', isPhantom);
|
|
767
|
+
if (formIsDirty || isPhantom) {
|
|
768
768
|
if (isSingle && onCancel) {
|
|
769
769
|
showCancelBtn = true;
|
|
770
770
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Box,
|
|
2
3
|
Button,
|
|
3
4
|
Icon,
|
|
4
5
|
Modal,
|
|
@@ -6,13 +7,13 @@ import {
|
|
|
6
7
|
} from 'native-base';
|
|
7
8
|
import TriangleExclamation from '../Icons/TriangleExclamation.js';
|
|
8
9
|
|
|
9
|
-
export default function
|
|
10
|
+
export default function ErrorMessage(props) {
|
|
10
11
|
const {
|
|
11
12
|
text = 'Error',
|
|
12
13
|
color = 'red.500',
|
|
13
14
|
onOk,
|
|
14
15
|
} = props;
|
|
15
|
-
|
|
16
|
+
|
|
16
17
|
return <Modal isOpen={true} {...props} _backdrop={{ bg: "#000" }}>
|
|
17
18
|
<Modal.Content>
|
|
18
19
|
<Modal.Header>Alert</Modal.Header>
|
|
@@ -25,7 +26,9 @@ console.log('render ErrorMessage text', text);
|
|
|
25
26
|
borderRadius={5}
|
|
26
27
|
flexDirection="row"
|
|
27
28
|
>
|
|
28
|
-
<
|
|
29
|
+
<Box w="50px" mx={2}>
|
|
30
|
+
<Icon as={TriangleExclamation} color="red.500" size="10" />
|
|
31
|
+
</Box>
|
|
29
32
|
<Text color={color} fontSize="18px">{text}</Text>
|
|
30
33
|
</Modal.Body>
|
|
31
34
|
<Modal.Footer py={2} pr={4}>
|
|
@@ -396,10 +396,9 @@ function TabBar(props) {
|
|
|
396
396
|
renderedCurrentTabContent = renderCurrentTabContent(),
|
|
397
397
|
renderedToggleButton = !disableCollapse ? renderToggleButton() : null;
|
|
398
398
|
|
|
399
|
-
|
|
399
|
+
let tabBar = null;
|
|
400
400
|
if (direction === VERTICAL) {
|
|
401
|
-
|
|
402
|
-
<Column
|
|
401
|
+
tabBar = <Column
|
|
403
402
|
alignItems="center"
|
|
404
403
|
justifyContent="flex-start"
|
|
405
404
|
py={2}
|
|
@@ -411,21 +410,22 @@ function TabBar(props) {
|
|
|
411
410
|
<Column flex={1} w="100%" justifyContent="flex-end">
|
|
412
411
|
{renderedToggleButton}
|
|
413
412
|
</Column>
|
|
414
|
-
</Column
|
|
415
|
-
|
|
413
|
+
</Column>;
|
|
414
|
+
if (renderedCurrentTabContent) {
|
|
415
|
+
tabBar = <Row flex={1} w="100%" {...propsToPass}>
|
|
416
|
+
{tabBar}
|
|
416
417
|
<Column
|
|
417
418
|
alignItems="center"
|
|
418
419
|
justifyContent="flex-start"
|
|
419
420
|
flex={1}
|
|
420
421
|
>
|
|
421
422
|
{renderedCurrentTabContent}
|
|
422
|
-
</Column>
|
|
423
|
-
|
|
423
|
+
</Column>
|
|
424
|
+
</Row>;
|
|
425
|
+
}
|
|
424
426
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
return <Column flex={1} w="100%" {...propsToPass}>
|
|
428
|
-
<Row
|
|
427
|
+
if (direction === HORIZONTAL) {
|
|
428
|
+
tabBar = <Row
|
|
429
429
|
alignItems="center"
|
|
430
430
|
justifyContent="flex-start"
|
|
431
431
|
p={2}
|
|
@@ -439,16 +439,21 @@ function TabBar(props) {
|
|
|
439
439
|
{renderedToggleButton}
|
|
440
440
|
</Row>
|
|
441
441
|
</Row>
|
|
442
|
-
</Row
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
442
|
+
</Row>;
|
|
443
|
+
if (renderedCurrentTabContent) {
|
|
444
|
+
tabBar = <Column flex={1} w="100%" {...propsToPass}>
|
|
445
|
+
{tabBar}
|
|
446
|
+
<Column
|
|
447
|
+
alignItems="center"
|
|
448
|
+
justifyContent="flex-start"
|
|
449
|
+
flex={1}
|
|
450
|
+
>
|
|
451
|
+
{renderedCurrentTabContent}
|
|
452
|
+
</Column>
|
|
453
|
+
</Column>;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return tabBar;
|
|
452
457
|
}
|
|
453
458
|
|
|
454
459
|
export default withComponent(TabBar);
|