@onehat/ui 0.3.43 → 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
CHANGED
|
@@ -13,6 +13,7 @@ export default function SquareButton(props) {
|
|
|
13
13
|
activeColor,
|
|
14
14
|
invertColorWhenActive = false,
|
|
15
15
|
disableInteractions = false,
|
|
16
|
+
fontSize = '20px',
|
|
16
17
|
...propsToPass
|
|
17
18
|
} = props,
|
|
18
19
|
styles = UiGlobals.styles,
|
|
@@ -54,7 +55,7 @@ export default function SquareButton(props) {
|
|
|
54
55
|
// _pressed={pressedProps}
|
|
55
56
|
>
|
|
56
57
|
<Icon as={icon} color={color} size="xl" />
|
|
57
|
-
<Text fontSize={
|
|
58
|
+
<Text fontSize={fontSize} color={color}>{text}</Text>
|
|
58
59
|
</Pressable>;
|
|
59
60
|
}
|
|
60
61
|
|
|
@@ -77,6 +77,7 @@ function Form(props) {
|
|
|
77
77
|
submitBtnLabel,
|
|
78
78
|
onSubmit,
|
|
79
79
|
additionalEditButtons,
|
|
80
|
+
useAdditionalEditButtons = true,
|
|
80
81
|
additionalFooterButtons,
|
|
81
82
|
|
|
82
83
|
// sizing of outer container
|
|
@@ -290,6 +291,9 @@ function Form(props) {
|
|
|
290
291
|
editorTypeProps = {};
|
|
291
292
|
|
|
292
293
|
const propertyDef = name && Repository?.getSchema().getPropertyDefinition(name);
|
|
294
|
+
if (!useAdditionalEditButtons) {
|
|
295
|
+
item = _.omit(item, 'additionalEditButtons');
|
|
296
|
+
}
|
|
293
297
|
if (propertyDef?.isEditingDisabled && checkIsEditingDisabled) {
|
|
294
298
|
isEditable = false;
|
|
295
299
|
}
|
|
@@ -597,6 +601,7 @@ function Form(props) {
|
|
|
597
601
|
sizeProps.maxHeight = maxHeight;
|
|
598
602
|
}
|
|
599
603
|
|
|
604
|
+
const formButtons = [];
|
|
600
605
|
let formComponents,
|
|
601
606
|
editor,
|
|
602
607
|
additionalButtons,
|
|
@@ -612,17 +617,7 @@ function Form(props) {
|
|
|
612
617
|
}
|
|
613
618
|
|
|
614
619
|
if (editorType === EDITOR_TYPE__INLINE) {
|
|
615
|
-
|
|
616
|
-
editor = <ScrollView
|
|
617
|
-
horizontal={true}
|
|
618
|
-
flex={1}
|
|
619
|
-
bg="#fff"
|
|
620
|
-
py={1}
|
|
621
|
-
borderTopWidth={3}
|
|
622
|
-
borderBottomWidth={5}
|
|
623
|
-
borderTopColor="primary.100"
|
|
624
|
-
borderBottomColor="primary.100"
|
|
625
|
-
>{formComponents}</ScrollView>;
|
|
620
|
+
editor = buildFromColumnsConfig();
|
|
626
621
|
// } else if (editorType === EDITOR_TYPE__PLAIN) {
|
|
627
622
|
// formComponents = buildFromItems();
|
|
628
623
|
// const formAncillaryComponents = buildAncillary();
|
|
@@ -633,24 +628,35 @@ function Form(props) {
|
|
|
633
628
|
} else {
|
|
634
629
|
formComponents = buildFromItems();
|
|
635
630
|
const formAncillaryComponents = buildAncillary();
|
|
636
|
-
editor =
|
|
631
|
+
editor = <>
|
|
637
632
|
{containerWidth >= CONTAINER_THRESHOLD ? <Row p={4} pl={0}>{formComponents}</Row> : null}
|
|
638
633
|
{containerWidth < CONTAINER_THRESHOLD ? <Column p={4}>{formComponents}</Column> : null}
|
|
639
634
|
<Column m={2} pt={4}>{formAncillaryComponents}</Column>
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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
|
+
}
|
|
654
660
|
}
|
|
655
661
|
|
|
656
662
|
if (!_.isEmpty(formState.errors)) {
|
|
@@ -667,33 +673,27 @@ function Form(props) {
|
|
|
667
673
|
footerProps.alignItems = 'flex-start';
|
|
668
674
|
}
|
|
669
675
|
|
|
670
|
-
additionalButtons = buildAdditionalButtons(additionalEditButtons);
|
|
671
676
|
}
|
|
672
677
|
|
|
673
678
|
return <Column {...sizeProps} onLayout={onLayoutDecorated} ref={formRef}>
|
|
674
679
|
{containerWidth && <>
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
<Row p={4} alignItems="center" justifyContent="flex-end" flexWrap="wrap">
|
|
693
|
-
{additionalButtons}
|
|
694
|
-
</Row>}
|
|
695
|
-
|
|
696
|
-
{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>}
|
|
697
697
|
|
|
698
698
|
<Footer justifyContent="flex-end" {...footerProps} {...savingProps}>
|
|
699
699
|
{onDelete && editorMode === EDITOR_MODE__EDIT && isSingle &&
|
|
@@ -42,7 +42,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
42
42
|
|
|
43
43
|
} = props,
|
|
44
44
|
[isModalShown, setIsModalShown] = useState(false),
|
|
45
|
-
[width, height] = useAdjustedWindowSize(500, 800)
|
|
45
|
+
[width, height] = useAdjustedWindowSize(500, 800),
|
|
46
46
|
buildModalItems = () => {
|
|
47
47
|
const modalItems = _.map(_.cloneDeep(items), (item, ix) => buildNextLayer(item, ix, columnDefaults)); // clone, as we don't want to alter the item by reference
|
|
48
48
|
|
|
@@ -195,6 +195,7 @@ export default function withPdfButton(WrappedComponent) {
|
|
|
195
195
|
setIsModalShown(false);
|
|
196
196
|
}}
|
|
197
197
|
submitBtnLabel="View PDF"
|
|
198
|
+
useAdditionalEditButtons={false}
|
|
198
199
|
/>
|
|
199
200
|
</Column>
|
|
200
201
|
</Modal>;
|
|
@@ -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}
|