@onehat/ui 0.3.44 → 0.3.45
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/Form.js +45 -49
- package/src/Components/Viewer/Viewer.js +12 -12
package/package.json
CHANGED
|
@@ -601,6 +601,7 @@ function Form(props) {
|
|
|
601
601
|
sizeProps.maxHeight = maxHeight;
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
+
const formButtons = [];
|
|
604
605
|
let formComponents,
|
|
605
606
|
editor,
|
|
606
607
|
additionalButtons,
|
|
@@ -616,17 +617,7 @@ function Form(props) {
|
|
|
616
617
|
}
|
|
617
618
|
|
|
618
619
|
if (editorType === EDITOR_TYPE__INLINE) {
|
|
619
|
-
|
|
620
|
-
editor = <ScrollView
|
|
621
|
-
horizontal={true}
|
|
622
|
-
flex={1}
|
|
623
|
-
bg="#fff"
|
|
624
|
-
py={1}
|
|
625
|
-
borderTopWidth={3}
|
|
626
|
-
borderBottomWidth={5}
|
|
627
|
-
borderTopColor="primary.100"
|
|
628
|
-
borderBottomColor="primary.100"
|
|
629
|
-
>{formComponents}</ScrollView>;
|
|
620
|
+
editor = buildFromColumnsConfig();
|
|
630
621
|
// } else if (editorType === EDITOR_TYPE__PLAIN) {
|
|
631
622
|
// formComponents = buildFromItems();
|
|
632
623
|
// const formAncillaryComponents = buildAncillary();
|
|
@@ -637,24 +628,35 @@ function Form(props) {
|
|
|
637
628
|
} else {
|
|
638
629
|
formComponents = buildFromItems();
|
|
639
630
|
const formAncillaryComponents = buildAncillary();
|
|
640
|
-
editor =
|
|
631
|
+
editor = <>
|
|
641
632
|
{containerWidth >= CONTAINER_THRESHOLD ? <Row p={4} pl={0}>{formComponents}</Row> : null}
|
|
642
633
|
{containerWidth < CONTAINER_THRESHOLD ? <Column p={4}>{formComponents}</Column> : null}
|
|
643
634
|
<Column m={2} pt={4}>{formAncillaryComponents}</Column>
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
635
|
+
</>;
|
|
636
|
+
|
|
637
|
+
additionalButtons = buildAdditionalButtons(additionalEditButtons);
|
|
638
|
+
|
|
639
|
+
formButtons.push(<Row key="buttonsRow" px={4} pt={4} alignItems="center" justifyContent="flex-end">
|
|
640
|
+
{isSingle && editorMode === EDITOR_MODE__EDIT && onBack &&
|
|
641
|
+
<Button
|
|
642
|
+
key="backBtn"
|
|
643
|
+
onPress={onBack}
|
|
644
|
+
leftIcon={<Icon as={AngleLeft} color="#fff" size="sm" />}
|
|
645
|
+
color="#fff"
|
|
646
|
+
>Back</Button>}
|
|
647
|
+
{isSingle && editorMode === EDITOR_MODE__EDIT && onViewMode &&
|
|
648
|
+
<Button
|
|
649
|
+
key="viewBtn"
|
|
650
|
+
onPress={onViewMode}
|
|
651
|
+
leftIcon={<Icon as={Eye} color="#fff" size="sm" />}
|
|
652
|
+
color="#fff"
|
|
653
|
+
>To View</Button>}
|
|
654
|
+
</Row>);
|
|
655
|
+
if (editorMode === EDITOR_MODE__EDIT && !_.isEmpty(additionalButtons)) {
|
|
656
|
+
formButtons.push(<Row key="additionalButtonsRow" p={4} alignItems="center" justifyContent="flex-end" flexWrap="wrap">
|
|
657
|
+
{additionalButtons}
|
|
658
|
+
</Row>)
|
|
659
|
+
}
|
|
658
660
|
}
|
|
659
661
|
|
|
660
662
|
if (!_.isEmpty(formState.errors)) {
|
|
@@ -671,33 +673,27 @@ function Form(props) {
|
|
|
671
673
|
footerProps.alignItems = 'flex-start';
|
|
672
674
|
}
|
|
673
675
|
|
|
674
|
-
additionalButtons = buildAdditionalButtons(additionalEditButtons);
|
|
675
676
|
}
|
|
676
677
|
|
|
677
678
|
return <Column {...sizeProps} onLayout={onLayoutDecorated} ref={formRef}>
|
|
678
679
|
{containerWidth && <>
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
<Row p={4} alignItems="center" justifyContent="flex-end" flexWrap="wrap">
|
|
697
|
-
{additionalButtons}
|
|
698
|
-
</Row>}
|
|
699
|
-
|
|
700
|
-
{editor}
|
|
680
|
+
|
|
681
|
+
{editorType === EDITOR_TYPE__INLINE &&
|
|
682
|
+
<ScrollView
|
|
683
|
+
horizontal={true}
|
|
684
|
+
flex={1}
|
|
685
|
+
bg="#fff"
|
|
686
|
+
py={1}
|
|
687
|
+
borderTopWidth={3}
|
|
688
|
+
borderBottomWidth={5}
|
|
689
|
+
borderTopColor="primary.100"
|
|
690
|
+
borderBottomColor="primary.100"
|
|
691
|
+
>{editor}</ScrollView>}
|
|
692
|
+
{editorType !== EDITOR_TYPE__INLINE &&
|
|
693
|
+
<ScrollView _web={{ minHeight, }} width="100%" pb={1}>
|
|
694
|
+
{formButtons}
|
|
695
|
+
{editor}
|
|
696
|
+
</ScrollView>}
|
|
701
697
|
|
|
702
698
|
<Footer justifyContent="flex-end" {...footerProps} {...savingProps}>
|
|
703
699
|
{onDelete && editorMode === EDITOR_MODE__EDIT && isSingle &&
|
|
@@ -222,20 +222,20 @@ function Viewer(props) {
|
|
|
222
222
|
|
|
223
223
|
return <Column flex={flex} {...props} onLayout={onLayout}>
|
|
224
224
|
{containerWidth && <>
|
|
225
|
-
{onEditMode && <Row px={4} pt={4} alignItems="center" justifyContent="flex-end">
|
|
226
|
-
<Button
|
|
227
|
-
key="editBtn"
|
|
228
|
-
onPress={onEditMode}
|
|
229
|
-
leftIcon={<Icon as={Pencil} color="#fff" size="sm" />}
|
|
230
|
-
color="#fff"
|
|
231
|
-
>To Edit</Button>
|
|
232
|
-
</Row>}
|
|
233
|
-
{!_.isEmpty(additionalButtons) &&
|
|
234
|
-
<Row p={4} alignItems="center" justifyContent="flex-end" flexWrap="wrap">
|
|
235
|
-
{additionalButtons}
|
|
236
|
-
</Row>}
|
|
237
225
|
|
|
238
226
|
<ScrollView _web={{ height: 1 }} width="100%" pb={1} ref={scrollViewRef}>
|
|
227
|
+
{onEditMode && <Row px={4} pt={4} alignItems="center" justifyContent="flex-end">
|
|
228
|
+
<Button
|
|
229
|
+
key="editBtn"
|
|
230
|
+
onPress={onEditMode}
|
|
231
|
+
leftIcon={<Icon as={Pencil} color="#fff" size="sm" />}
|
|
232
|
+
color="#fff"
|
|
233
|
+
>To Edit</Button>
|
|
234
|
+
</Row>}
|
|
235
|
+
{!_.isEmpty(additionalButtons) &&
|
|
236
|
+
<Row p={4} alignItems="center" justifyContent="flex-end" flexWrap="wrap">
|
|
237
|
+
{additionalButtons}
|
|
238
|
+
</Row>}
|
|
239
239
|
<Column>
|
|
240
240
|
{containerWidth >= CONTAINER_THRESHOLD ? <Row p={4} pl={0}>{viewerComponents}</Row> : null}
|
|
241
241
|
{containerWidth < CONTAINER_THRESHOLD ? <Column p={4}>{viewerComponents}</Column> : null}
|