internal static bool HasSnapName(this BField dataBField) { return(dataBField.ComponentType == ComponentType.BAccountComponent || dataBField.ComponentType == ComponentType.BParameterComponent); }
static void RenderComponent(PaddedStringBuilder output, BField dataBField, bool userRawStringForMessaging) { var valueAccessPath = Exporter.GetResolvedPropertyName(dataBField.Name); var label = "Message." + dataBField.Name; if (userRawStringForMessaging) { label = '"' + dataBField.Name + '"'; } if (dataBField.ComponentType == ComponentType.BDateTimePicker) { output.AppendLine("<BDateTimePicker format = \"DDMMYYYY\""); output.AppendLine(" value = {data." + valueAccessPath + "}"); output.AppendLine(" dateOnChange = {(e: any, value: Date) => data." + valueAccessPath + " = value}"); output.AppendLine(" floatingLabelTextDate = {" + label + "}"); output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BInput) { output.AppendLine("<BInput value = {data." + valueAccessPath + "}"); output.AppendLine(" onChange = {(e: any, value: string) => data." + valueAccessPath + " = value}"); output.AppendLine(" floatingLabelText = {" + label + "}"); output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BInputNumeric) { output.AppendLine("<BInputNumeric value = {data." + valueAccessPath + "}"); output.AppendLine(" onChange = {(e: any, value: any) => data." + valueAccessPath + " = value}"); output.AppendLine(" floatingLabelText = {" + label + "}"); if (dataBField.DotNetType == DotNetType.Decimal) { output.AppendLine(" format = {\"D\"}"); output.AppendLine(" maxLength = {22}"); } else { output.AppendLine(" maxLength = {10}"); } output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BAccountComponent) { output.AppendLine("<BAccountComponent accountNumber = {data." + valueAccessPath + "}"); output.AppendLine(" onAccountSelect = {(selectedAccount: any) => data." + valueAccessPath + " = selectedAccount ? selectedAccount.accountNumber : null}"); output.AppendLine(" isVisibleBalance={false}"); output.AppendLine(" isVisibleAccountSuffix={false}"); output.AppendLine(" enableShowDialogMessagesInCallback={false}"); output.AppendLine(" isVisibleIBAN={false}"); output.AppendLine(" ref={(r: any) => this.snaps." + dataBField.GetSnapName() + " = r}"); output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BCheckBox) { output.AppendLine("<BCheckBox checked = {data." + valueAccessPath + "}"); output.AppendLine(" onCheck = {(e: Object, isChecked: boolean) => data." + valueAccessPath + " = isChecked}"); output.AppendLine(" label = {" + label + "}"); output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BParameterComponent) { if (dataBField.DotNetType == DotNetType.Int32) { output.AppendLine("<BParameterComponent selectedParamCode = {Helper.numberToString(data." + valueAccessPath + ")}"); output.AppendLine(" onParameterSelect = {(selectedParameter: BOA.Types.Kernel.General.ParameterContract) => data." + valueAccessPath + " = selectedParameter ? Helper.stringToNumber(selectedParameter.paramCode) : null}"); } else { output.AppendLine("<BParameterComponent selectedParamCode = {data." + valueAccessPath + "}"); output.AppendLine(" onParameterSelect = {(selectedParameter: BOA.Types.Kernel.General.ParameterContract) => data." + valueAccessPath + " = selectedParameter ? selectedParameter.paramCode : null}"); } if (dataBField.ParamType.IsNullOrWhiteSpace()) { output.AppendLine(" paramType=\"GENDER\""); } else { output.AppendLine(" paramType=\"" + dataBField.ParamType + "\""); } output.AppendLine(" hintText = {" + label + "}"); output.AppendLine(" labelText = {" + label + "}"); output.AppendLine(" isAllOptionIncluded={true}"); output.AppendLine(" paramColumns={["); output.AppendLine(" { name: \"paramCode\", header: Message.Code, visible: false },"); output.AppendLine(" { name: \"paramDescription\", header: Message.Description, width: 200 }"); output.AppendLine(" ]}"); output.AppendLine(" ref={(r: any) => this.snaps." + dataBField.GetSnapName() + " = r}"); output.AppendLine(" context = {context}/>"); return; } if (dataBField.ComponentType == ComponentType.BBranchComponent) { output.AppendLine("<BBranchComponent selectedBranchId = {data." + valueAccessPath + "}"); output.AppendLine(" onBranchSelect = {(selectedBranch: BOA.Common.Types.BranchContract) => data." + valueAccessPath + " = selectedBranch ? selectedBranch.branchId : null}"); output.AppendLine(" mode={\"horizontal\"}"); output.AppendLine(" labelText = {" + label + "}"); output.AppendLine(" sortOption={BBranchComponent.name}"); output.AppendLine(" context = {context}/>"); } }
internal static string GetSnapName(this BField dataBField) { return($"{dataBField.ComponentType.ToString().RemoveFromStart("B").MakeLowerCaseFirstChar()}{dataBField.Name}"); }