+ {this._customFormatter.renderCustomFormatContent(customFormatting.header, this.getFormValuesForValidation(), true)}
+
+ }
+
+ // Custom Formatting - Body
+ const bodySections: ICustomFormattingBodySection[] = [];
+ if (!customFormattingDisabled && customFormatting?.body) {
+ bodySections.push(...customFormatting.body.slice());
+ if (bodySections.length > 0) {
+ const specifiedFields: string[] = bodySections.reduce((prev, cur) => {
+ prev.push(...cur.fields);
+ return prev;
+ }, []);
+ const omittedFields = fieldCollection.filter(f => !specifiedFields.includes(f.label)).map(f => f.label);
+ bodySections[bodySections.length - 1].fields.push(...omittedFields);
+ }
+ }
+
+ // Custom Formatting - Footer
+ let footerContent: JSX.Element;
+ if (!customFormattingDisabled && customFormatting?.footer) {
+ footerContent =
+ {this._customFormatter.renderCustomFormatContent(customFormatting.footer, this.getFormValuesForValidation(), true)}
+
+ }
+
+ // Content Type
+ let contentTypeId = this.props.contentTypeId;
+ if (this.state.contentTypeId !== undefined) contentTypeId = this.state.contentTypeId;
return (
- {fieldCollection.length === 0 ?
:
+ {infoErrorMessages.map((ie, i) => (
+
{ie.message}
+ ))}
+ {fieldCollection.length === 0 ? (
- {fieldCollection.map((v, i) => {
- if(fieldOverrides && Object.prototype.hasOwnProperty.call(fieldOverrides, v.columnInternalName)) {
- v.disabled = v.disabled || isSaving;
- return fieldOverrides[v.columnInternalName](v);
- }
- return
;
- })}
- {
- !this.props.disabled &&
+
+
+ ) : (
+
+ {headerContent}
+ {this.props.enableFileSelection === true &&
+ this.props.listItemId === undefined &&
+ contentTypeId !== undefined &&
+ contentTypeId.startsWith("0x0101") &&
+ this.renderFileSelectionControl()}
+ {(bodySections.length > 0 && !customFormattingDisabled) && bodySections
+ .filter(bs => bs.fields.filter(bsf => hiddenByFormula.indexOf(bsf) < 0).length > 0)
+ .map((section, i) => (
+ <>
+
{section.displayname}
+
+ {section.fields
+ .filter(f => fieldCollection.find(fc => fc.label === f))
+ .map((f, i) => (
+
+ {this.renderField(fieldCollection.find(fc => fc.label === f) as IDynamicFieldProps)}
+
+ ))}
+
+ {i < bodySections.length - 1 &&
}
+ >
+ ))}
+ {(bodySections.length === 0 || customFormattingDisabled) && fieldCollection.map((f, i) => this.renderField(f))}
+ {footerContent}
+ {!this.props.disabled && (
- this.onSubmitClick()} />
-
+ this.onSubmitClick()}
+ />
+
- }
-
-
+ )}
- }
+ )}
+
);
}
- //trigger when the user submits the form.
+ private sortFields = (fields: IDynamicFieldProps[], customSort: string[]): IDynamicFieldProps[] => {
+ const fMap = new Map