+
{isSection && props.meta.displayType === "title" && (
{props.meta.displayName}
)}
@@ -103,7 +107,7 @@ function RenderColumn({
form={props.form[field.name]}
sync={sync}
/>
- ))}
+ ))}
);
diff --git a/src/form/form-controls/Footer/Footer.tsx b/src/form/form-controls/Footer/Footer.tsx
index d67d2a0..a2eb738 100644
--- a/src/form/form-controls/Footer/Footer.tsx
+++ b/src/form/form-controls/Footer/Footer.tsx
@@ -74,8 +74,13 @@ function Footer(props: IProps) {
props.onCustom(e, button, callback);
}
};
+
return (
-
+
{props.formButtons.map((button: IField, idx: number) => {
const className = FormUtils.getCssClassName(button.meta?.displayProps);
const subprops = {
@@ -156,7 +161,7 @@ const FooterStyled = styled(Row)<{ useDefault: boolean }>`
gap: 1.5rem;
margin-top: 1.5rem;
justify-content: flex-end;
- ${(props) =>
+ ${(props) =>
props.useDefault
? `
display: flex;
diff --git a/src/form/form-group/BaseFormGroup.tsx b/src/form/form-group/BaseFormGroup.tsx
index d21ecfb..4d81074 100644
--- a/src/form/form-group/BaseFormGroup.tsx
+++ b/src/form/form-group/BaseFormGroup.tsx
@@ -50,12 +50,24 @@ export default abstract class BaseFormGroup extends React.Component {
});
this.context.listener(EVENTS.SWITCH, (payload: { payload: string; callback?: TCallback }) => {
switch (payload.payload) {
- case "next":
- this.setActiveIndex(this.state.activeIndex + 1, payload.callback);
- break;
- case "previous":
- this.setActiveIndex(this.state.activeIndex - 1, payload.callback);
- break;
+ case "next": {
+ const nextIndex = this.getNextAvailableIndex(this.state.activeIndex + 1);
+ if (nextIndex >= 0) {
+ this.setActiveIndex(nextIndex, payload.callback);
+ }
+ const hasMorePages = this.getNextAvailableIndex(nextIndex + 1) === -1 ? false : true;
+ if (!hasMorePages) {
+ this.context.emit(EVENTS._END_OF_PAGE, { payload: nextIndex + 1});
+ }
+ }
+ break;
+ case "previous": {
+ const previousIndex = this.getPreviousAvailableIndex(this.state.activeIndex - 1);
+ if (previousIndex >= 0) {
+ this.setActiveIndex(previousIndex, payload.callback);
+ }
+ }
+ break;
}
});
this.context.listener(EVENTS.VALIDATION_ERROR, (payload: { payload: string; callback: TCallback }) => {
@@ -142,6 +154,28 @@ export default abstract class BaseFormGroup extends React.Component {
});
}
+ getNextAvailableIndex(index: number): number {
+ if (this.tabFields.length > index) {
+ if (this.tabFields[index]?.meta?.isDisabled === true) {
+ return this.getNextAvailableIndex(index + 1);
+ } else {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ getPreviousAvailableIndex(index: number): number {
+ if (this.tabFields.length > index) {
+ if (this.tabFields[index]?.meta?.isDisabled === true) {
+ return this.getPreviousAvailableIndex(index - 1);
+ } else {
+ return index;
+ }
+ }
+ return -1;
+ }
+
abstract tabs(): JSX.Element;
abstract panels(): JSX.Element;
}
diff --git a/src/form/form-group/common/Section.tsx b/src/form/form-group/common/Section.tsx
index 5e349a9..3e88df8 100644
--- a/src/form/form-group/common/Section.tsx
+++ b/src/form/form-group/common/Section.tsx
@@ -32,7 +32,10 @@ export function Section(props: ISectionProps) {
role="tabpanel"
aria-labelledby={props.section.name}
>
-
+
{props.section.fields &&
props.section.fields.map((field: IField) => (
+
{fields.map((field) => (