SAPUI5 Utilize full width of WizardStep - sapui5

I am using a Wizard object in my app with multiple steps. I want the content of this step to utilize the full width available. I am currently using the below XML, though this is just resulting in the content being bunched together on the left (see attached image).
How can I modify this so the SimpleForms will use the full width of the page ?
Any help would be greatly appreciated,
thanks,
Joe
<WizardStep id="wizStep2" validated="true" title="Customer Confirm"
icon="sap-icon://customer" >
<HBox width="100%" fitContainer="true">
<form:SimpleForm editable="true">
<Label text="Title"/>
<Input value="MR"/>
<Label text="Name"/>
<Input value="John"/>
<Input value="Smith"/>
<Label text="House"/>
<Input value="81"/>
<Label text="Street"/>
<Input value="Main Road"/>
<Label text="City"/>
<Input value=""/>
<Label text="PostCode"/>
<Input value=""/>
</form:SimpleForm>
<form:SimpleForm editable="true">
<Label text="Home Tel"/>
<Input value=""/>
<Label text="Mobile No"/>
<Input value=""/>
<Label text="Email"/>
<Input value=""/>
</form:SimpleForm>
</HBox>
</WizardStep>
Current output

A SimpleForm will start a new column if you use a Title element: Simple Form API Doc. You also can control the Layout of the Simple Form by using SimpleFormLayout.
So basically, you need to place content that will actually use the 100% width.

By default it uses 100% with ... your limitation comes from somewhere else in your view.
This wizard takes 100% of your screen:
<mvc:View controllerName="tc_v1.test.controller.Main" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
displayBlock="true" xmlns="sap.m" xmlns:form="sap.ui.layout.form">
<App id="idAppControl">
<pages>
<Page title="{i18n>title}">
<content>
<Wizard id="wizard" complete="onPressReview" finishButtonText="Review" showNextButton="true">
<WizardStep id="wizStep1" validated="true" title="Customer Confirm" icon="sap-icon://customer">
<HBox fitContainer="true">
<form:SimpleForm editable="true">
<Label text="Title"/>
<Input value="MR"/>
<Label text="Name"/>
<Input value="John"/>
<Input value="Smith"/>
<Label text="House"/>
<Input value="81"/>
<Label text="Street"/>
<Input value="Main Road"/>
<Label text="City"/>
<Input value=""/>
<Label text="PostCode"/>
<Input value=""/>
</form:SimpleForm>
<form:SimpleForm editable="true">
<Label text="Home Tel"/>
<Input value=""/>
<Label text="Mobile No"/>
<Input value=""/>
<Label text="Email"/>
<Input value=""/>
</form:SimpleForm>
</HBox>
</WizardStep>
<WizardStep id="id_wizStp2" validated="true" title="Step 2"/>
<WizardStep id="id_wizStp3" validated="true" title="Step 3"/>
</Wizard>
</content>
</Page>
</pages>
</App>
</mvc:View>

Related

How to place icon next to or within input field

How I can put my icon next to or within the input field?
The problem is, the icon changes the form. Usually, it's like this:
But when I'm adding the icon (code below), it displaces the Dauer input Field.
Is there a way to make it look clean and that's next to it? Or better in the input field inside?
I can make the button smaller with CSS but there is still a gap between them.. And it does not move automatically.
The best solution is like the Datum above with a small icon inside where I can click or like the icon is next to the Dauer without no gap between input field from Dauer and the ? icon.
PS: I just want it like this (I will decide then later which option is better. But it is possible?)
<form:SimpleForm id="neuezeiterfassung"
editable="true"
title="Neue Zeiterfassung anlegen"
>
<Label
text="Auftrag"
class="font1"
tooltip="Auftrag eingeben"
/>
<l:VerticalLayout>
<ComboBox id="Auftrag"
items="{/ZAUFKSet}"
showSecondaryValues="true"
width="50%"
>
<core:ListItem text="{Aufnr}" />
</ComboBox>
</l:VerticalLayout>
<Label
text="Datum"
class="font1"
/>
<DatePicker id="DP3"
valueFormat="dd.MM.yyyy"
displayFormat="medium"
width="50%"
placeholder="dd.mm.yyyy"
/>
<Label class="font1" text="Dauer" />
<Input id="dauer"
class="dauer"
placeholder="Dauer eingeben ... "
width="50%"
/>
<HBox class="sapUiSmallMargin">
<core:Icon
src="sap-icon://sys-help"
class="size1" color="#031E48" press="aseads"
>
<core:layoutData>
<FlexItemData growFactor="1" />
</core:layoutData>
</core:Icon>
</HBox>
<!-- <Button icon="sap-icon://sys-help" class="myButton"/> -->
<Label class="font1" text="Arbeitsbeschreibung" />
<TextArea id="beschreibung" width="50%" />
</form:SimpleForm>
Update: with the change in commit:8f1757d, which is available since UI5 1.84, the value help icon can be changed via valueHelpIconSrc:
<Input showValueHelp="true"
valueHelpIconSrc="sap-icon://sys-help"
valueHelpRequest="alert('Help requested')"
/><!-- valueHelpIconSrc available since 1.84.0 -->
No need to extend sap.m.InputBase in this case. Other input controls like sap.m.MaskInput still need to be extended as shown in the linked Plunk below.
Original answer:
The best solution is like the Datum above with a small icon inside where I can click. (...) Is it possible?
Yes, it's possible. Here is a minimal example: https://embed.plnkr.co/EzlF2tkvalJWvSEn
For this, UI5 provides the API addEndIconapi which is protected, meaning it should be used only when extending sap.m.InputBase!
As an argument for the addEndIcon, you can pass a map of settings that are required to create sap.ui.core.Iconapi, which is highly customizable.
const icon = this.addEndIcon({
id: this.getId() + "-questionMarkBtn",
src: IconPool.getIconURI("sys-help"),
noTabStop: true,
tooltip: "Information",
press: [this.onEndButtonPress, this],
}); // See sap.ui.core.Icon/properties for more settings
// icon.addStyleClass(...); if even more customization required..
You can achieve it using the below code, just updated the CSS as per your requirement. It is a responsive design, it will work for all the devices.
CODE
<VBox class="sapUiSmallMargin">
<f:SimpleForm
editable="true"
layout="ResponsiveGridLayout"
title="Neue Zeiterfassung anlegen"
labelSpanXL="3"
labelSpanL="3"
labelSpanM="3"
labelSpanS="12"
adjustLabelSpan="false"
emptySpanXL="1"
emptySpanL="1"
emptySpanM="1"
emptySpanS="0"
columnsXL="1"
columnsL="1"
columnsM="1"
singleContainerFullSize="false" >
<f:content>
<Label text="Auftrag" tooltip="Auftrag eingeben" />
<ComboBox items="{/ZAUFKSet}" id="Auftrag" showSecondaryValues="true">
<core:ListItem text="{Aufnr}"/>
</ComboBox>
<Label text="Datum" labelFor="DP3"/>
<DatePicker id="DP3" valueFormat="dd.MM.yyyy" displayFormat="medium" placeholder="dd.mm.yyyy"/>
<Label class="font1" text="Dauer"/>
<Input value="Street">
<layoutData>
<l:GridData span="XL7 L7 M7 S10" />
</layoutData>
</Input>
<Button icon="sap-icon://sys-help" press="onPress" >
<layoutData>
<l:GridData span="XL1 L1 M1 S2" />
</layoutData>
</Button>
<Label text="Arbeitsbeschreibung"/>
<TextArea id="beschreibung"/>
</f:content>
</f:SimpleForm>
</VBox>
Output:
If you are looking for below output
<f:SimpleForm
editable="true"
layout="ResponsiveGridLayout"
title="Neue Zeiterfassung anlegen"
labelSpanXL="3"
labelSpanL="3"
labelSpanM="3"
labelSpanS="12"
adjustLabelSpan="false"
emptySpanXL="1"
emptySpanL="1"
emptySpanM="1"
emptySpanS="0"
columnsXL="1"
columnsL="1"
columnsM="1"
singleContainerFullSize="false" >
<f:content>
<Label text="Auftrag" tooltip="Auftrag eingeben" />
<ComboBox items="{/ZAUFKSet}" id="Auftrag" showSecondaryValues="true">
<core:ListItem text="{Aufnr}"/>
<layoutData>
<l:GridData span="XL8 L8 M7 S9" />
</layoutData>
</ComboBox>
<Label text="Datum" labelFor="DP3"/>
<DatePicker id="DP3" valueFormat="dd.MM.yyyy" displayFormat="medium"
placeholder="dd.mm.yyyy">
<layoutData>
<l:GridData span="XL8 L8 M7 S9" />
</layoutData>
</DatePicker>
<Label class="font1" text="Dauer"/>
<Input value="Street">
<layoutData>
<l:GridData span="XL8 L8 M7 S9" />
</layoutData>
</Input>
<Button icon="sap-icon://sys-help" press="onPress" width="40px" >
<layoutData>
<l:GridData span="XL1 L1 M1 S3" />
</layoutData>
</Button>
<Label text="Arbeitsbeschreibung"/>
<TextArea id="beschreibung">
<layoutData>
<l:GridData span="XL8 L8 M7 S9" />
</layoutData>
</TextArea>
</f:content>
</f:SimpleForm>
With icon
<VBox class="sapUiSmallMargin">
<f:SimpleForm
editable="true"
layout="ResponsiveGridLayout"
title="Neue Zeiterfassung anlegen"
labelSpanXL="3"
labelSpanL="3"
labelSpanM="3"
labelSpanS="12"
adjustLabelSpan="false"
emptySpanXL="1"
emptySpanL="1"
emptySpanM="1"
emptySpanS="0"
columnsXL="1"
columnsL="1"
columnsM="1"
singleContainerFullSize="false" >
<f:content>
<Label text="Auftrag" tooltip="Auftrag eingeben" />
<ComboBox items="{/ZAUFKSet}" id="Auftrag" showSecondaryValues="true">
<core:ListItem text="{Aufnr}"/>
<layoutData>
<l:GridData span="XL10 L10 M10 S10" />
</layoutData>
</ComboBox>
<Label text="Datum" labelFor="DP3"/>
<DatePicker id="DP3" valueFormat="dd.MM.yyyy" displayFormat="medium" placeholder="dd.mm.yyyy">
<layoutData>
<l:GridData span="XL10 L10 M10 S10" />
</layoutData>
</DatePicker>
<Label class="font1" text="Dauer"/>
<Input value="Street">
<layoutData>
<l:GridData span="XL10 L10 M10 S10" />
</layoutData>
</Input>
<HBox>
<core:Icon src="sap-icon://sys-help" color="#031E48" press="onPress" class="infoIcon"/>
<layoutData>
<l:GridData span="XL1 L1 M1 S1" />
</layoutData>
</HBox>
<Label text="Arbeitsbeschreibung"/>
<TextArea id="beschreibung">
<layoutData>
<l:GridData span="XL10 L10 M10 S10" />
</layoutData>
</TextArea>
</f:content>
</f:SimpleForm>
</VBox>
If you are using the ICON you need to add the style as well for alignment
.infoIcon {
line-height: 3rem;
}
Sometimes extending the InputBase class can be a bit overkill/increase the complexity of the code.
You can also use Flexbox containers to achieve the alignment of the input and the icon.
For example, if you want the input and the icon to be centered vertically and horizontally:
<HBox
alignItems="Center"
justifyContent="Center">
<Input>
<layoutData>
<FlexItemData growFactor="3" />
</layoutData>
</Input>
<core:Icon
src="sap-icon://sys-help">
<!-- Be careful here with the namespaces (use layoutData from core, not m) -->
<core:layoutData>
<FlexItemData growFactor="1" />
</core:layoutData>
</core:Icon>
</HBox>
This will give something like this:
See Flexbox for more examples (API Reference is available at the top of the page).

cannot set modal background to transparent in android

cannot set the background of the native script modal window to transparent
i have done a example in the below link. https://play.nativescript.org/?template=play-js&id=6xzzC2
<!-- >> modal-view-xml -->
<Page backgroundColor="transparent" xmlns="http://www.nativescript.org/tns.xsd"
shownModally="onShownModally" height="300" width="250">
<StackLayout borderRadius="30" backgroundColor="green">
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
<Label text="android" textWrap="true" />
</StackLayout>
</Page>
<!-- << modal-view-xml -->
i need a border rounded modal window
Try this,
if (page._dialogFragment) {
page._dialogFragment.getDialog().getWindow().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(android.graphics.Color.TRANSPARENT));
}
Playground Sample

Layout with Label, Inputfield, and Checkbox

Mockup
Current Code
<mvc:View
xmlns="sap.m"
xmlns:core="sap.ui.core"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
displayBlock="true" height="100%">
<Page showHeader="false" id="page">
<content>
<l:Grid defaultSpan="L12 M12 S12" width="auto">
<l:content>
<f:Form editable="true">
<f:title>
<core:Title text="Test" />
</f:title>
<f:layout>
<f:ResponsiveGridLayout
labelSpanL="3"
labelSpanM="3"
emptySpanL="4"
emptySpanM="4"
columnsL="1"
columnsM="1"
/>
</f:layout>
<f:formContainers>
<f:FormContainer>
<f:formElements>
<f:FormElement label="Name">
<f:fields>
<Input id="name1" value="" />
</f:fields>
</f:FormElement>
<f:FormElement label="Name">
<f:fields>
<Input id="name2" value="" />
</f:fields>
</f:FormElement>
<f:FormElement>
<f:fields>
<CheckBox id="cb1" />
<Text wrapping="true" text="lorem ipsum" />
</f:fields>
</f:FormElement>
</f:formElements>
</f:FormContainer>
</f:formContainers>
</f:Form>
</l:content>
</l:Grid>
</content>
</Page>
</mvc:View>
Problem
The checkbox is not centered. The current code is responsive and the solution should also be responsive.
If you want the checkbox to be centered you need to use a label on your formElement just as you do with the others. If you don't want a label you will probably need some css to put a left-margin on that specific FormElement.
There is maybe another way more "polite" to do that, but if it exists I do not know it, will keep looking at that post to see if someone actually offers a better solution.
But for now, I hope this works for you for the moment.

Inserting HTML into XML view with captcha

I'm currently working on a page that is made with openui5, what I need to do is to insert a captcha, but as far as I know there is no captcha in openui5, what I was trying is to insert HTML content into this.
The problem is, my views are in XML and I did try to insert directly using tags and changing the content, but wasn't possible, it says incorrect xml parsing.
Part of my code of where I want to input my html div:
<Page id="page1" class="marginBoxContent" showHeader="false" showFooter="false" enableScrolling="true">
<content>
<Image src="../../image/logo.svg" />
<l:Grid
defaultSpan="L12 M12 S12"
width="100%">
<l:content>
<f:Form id="FormChange354"
minWidth="1024"
maxContainerCols="2"
editable="true">
<f:layout>
<f:ResponsiveGridLayout
labelSpanL="3"
labelSpanM="3"
emptySpanL="4"
emptySpanM="4"
columnsL="1"
columnsM="1" />
</f:layout>
<f:formContainers>
<f:FormContainer>
<f:formElements>
<f:FormElement label="{i18n>Language}">
<f:fields>
<Select id="animationSelect" selectedKey="en" change="languageChange">
<core:Item text="English" key="en" />
<core:Item text="Português" key="pt" />
<core:Item text="Español" key="es" />
<layoutData>
<FlexItemData growFactor="1" />
</layoutData>
</Select>
</f:fields>
</f:FormElement>
</f:formElements>
<f:formElements>
<f:FormElement label="{i18n>User}">
<f:fields>
<Input id="username" value="" type="Email" />
</f:fields>
</f:FormElement>
</f:formElements>
<f:formElements>
<f:FormElement label="{i18n>Password}">
<f:fields>
<Input id="password" type="Password" placeholder="" value="" />
</f:fields>
</f:FormElement>
</f:formElements>
<f:formElements>
<f:FormElement label="">
<f:fields>
<Button id="btnLogin" text="{i18n>Sigin}" type="Emphasized" press="login" />
</f:fields>
</f:FormElement>
</f:formElements>
</f:FormContainer>
</f:formContainers>
</f:Form>
<l:VerticalLayout>
<Link text="{i18n>CreateUser}" press="navCreateUser" />
<Link text="{i18n>RecoverPass}" press="navRecoverPass" />
<Link text="{i18n>ChangePass}" press="navChangePass" />
</l:VerticalLayout>
</l:content>
</l:Grid>
</content>
I want to insert exaclty here:
<f:formElements>
<f:FormElement label="">
<f:fields>
<Button id="btnLogin" text="{i18n>Sigin}" type="Emphasized" press="login" />
</f:fields>
</f:FormElement>
</f:formElements>
Inside the fields xml or before, because the captcha will appear above the login button.
The content of the div I want to insert is from google captcha:
<div id='recaptcha' class="g-recaptcha"
data-sitekey="your_site_key"
data-callback="onSubmit"
data-size="invisible"></div>
Couldn't have success yet, anybody can help me with that?
Maybe is something about the namespace, I don't know, here is my namespace config:
<mvc:View
height="100%"
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:core="sap.ui.core"
controllerName="hiddenName.app.login.view.Login">
Thanks a lot for your time!
thank you for every help. I got some help from all comments, what I did was declare the namespace to html:
<mvc:View
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:l="sap.ui.layout"
xmlns:f="sap.ui.layout.form"
xmlns:core="sap.ui.core"
xmlns:html="http://www.w3.org/1999/xhtml"
height="100%"
controllerName="hiddenName.app.login.view.Login"
>
And simply added the tag as I show down here:
<html:div id="recaptchaGoogle" class="g-recaptcha" data-sitekey="yourKey"></html:div>
Also remember to declare the import of the google js(added it on my index):
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
I'm still trying to figure out how to get this captcha answer and pass or not to the login.
With that, the captcha appears and is generated.
Thank you!
To insert HTML in a XML view you could use the HTML control from the sap.ui.core library. You will have to escape the HTML text before using it in XML.
<core:HTML content='<div id="recaptcha" class="g-recaptcha" data-sitekey="your_site_key" data-callback="onSubmit" data-size="invisible"></div>' />

How to iterativly print label in zk using templates with mvvm style

<window apply="org.zkoss.bind.BindComposer"
viewModel="#id('vm') #init('com.test.labelTest')">
<template <!--model = "#bind(vm.allLabelSets)" some thing like this --> >
<label value="#load(each.label1)" />
<label value="#load(each.label2)" />
<label value="#load(each.label3)" />
</template>
</window>
how can we use template to iterate over a list without using any of gridModel,treeModel ?
Try this below code
<vlayout id="vlayout" children="#bind(vm.allLabelSets) #template('record')">
<template name="record" var="record">
<vlayout style="padding-left:10px; border:2px solid green;" >
<label value="#load(each.label1)" />
<label value="#load(each.label2)" />
<label value="#load(each.label3)" />
</vlayout>
</template>
</vlayout>
You have to use children attribute