stenciljs webcomponents : ion-router for a simple step-by-step wizard? - web-component

my stencil app is a step-by-step wizard. In app-root.tsx I have
render() {
return (
<ion-app>
<ion-router useHash={false}>
<ion-route component="app-home" >
<ion-route url="/" component="step-one" />
<ion-route url="/two/:data" component="step-two" />
<ion-route url="/three/:data" component="step-three" />
</ion-route>
</ion-router>
<ion-nav />
</ion-app>
);
}
in app-home.tsx I have
<ion-navbar>
<ion-tabs>
<ion-tab tab="tab1" component="step-one" />
<ion-tab tab="tab2" component="step-two" />
<ion-tab tab="tab3" component="step-three" />
<ion-tab-bar slot="top" selectedTab={this.selectedTab)}>
<ion-tab-button tab="tab1">Step One</ion-tab-button>
<ion-tab-button tab="tab2">Step Two</ion-tab-button>
<ion-tab-button tab="tab3">Step Three</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
</ion-navbar>
at some point I would like to diable the ion-tab-buttons and use them only to display the active tab, but now they are active since I have several problems :
the app doesn't start with the content of "step-one" (a form). I see the tabs at the top and I can click on any tab to select it, but how to make it start at step-one ? ( this.selectedTab = 'tab1' in componentWillLoad)
in step-one I put a <ion-button disabled={!this.valid} routerDirection = 'forward'>Next</ion-button> that shows up, is enabled when the form is filled, but when I click on it, nothing happens (I tried href="/two" without success...)
how to pass the form data to the next steps, by the way ?
Any help appreciated... Thanks !

In the route definitions the component should be the name of the tab (the tab property) and not the component inside of the tab (see Router integration in the ion-tabs docs).
<ion-route component="app-home">
<ion-route url="/" component="tab1" />
<ion-route url="/two/:data" component="tab2" />
<ion-route url="/three/:data" component="tab3" />
</ion-route>
The reason that the button doesn't work with the href attribute is probably the missing :data parameter.
I suggest not passing the data through the URL but to use a central data store, for example Stencil Store. That way you don't have to worry about URL encoding etc.

Related

Styling TextBoxes in FluentUI

I am creating a dashboard in react with FLuentUI. I have a row of textBoxes and they are just not lining up - as you can see. Can someone give me a starter please on how to line these up :
As you can see the 'Enter text here is not straight with the others. here is my react code.
return (
<div style={{ fontSize: FontSizes.size42 }} className="ms-Grid" dir="ltr">
<ProducingBroker currency={currency} setCurrency={setCurrency} />
<BrokerContact currency={currency} setCurrency={setCurrency} />
<OriginalInsured currency={currency} setCurrency={setCurrency} />
<ReinsuredName currency={currency} setCurrency={setCurrency} />
<label>{mailboxitem.itemId}</label>
</div>
I know I need to put some styling around it, just need a starter please.

Blazorise LayoutSider not visible to anonymous users

I'm building a new .NET 6.0 application using Blazor Web Server and Blazorise 0.9.5.2.
As presently configured, the sider layout is only visible to logged-in users. Anonymous users see the entire layout except the sider. Comparing the HTTP content in both conditions shows that the only differences between anonymous and logged-in users are the presence or absence of the two nav bar links that depend on authorization, as well as the out-of-the-box display of "Welcome, user" vs. "Login" in the upper right corner. Chrome shows no failures to download CSS or JS in either case.
The MainLayout.razor looks like this:
<Layout Sider="true">
<LayoutSider>
<LayoutSiderContent>
<Bar Breakpoint="Breakpoint.Desktop" NavigationBreakpoint="Breakpoint.Tablet" ThemeContrast="ThemeContrast.Dark"
Mode="BarMode.VerticalInline" CollapseMode="BarCollapseMode.Small">
<BarToggler />
<BarBrand>
<BarItem>
<BarLink To="">
<BarIcon IconName="_customIcon" />
My SIte
</BarLink>
</BarItem>
</BarBrand>
<NavMenu />
</Bar>
</LayoutSiderContent>
</LayoutSider>
<Layout>
<LayoutHeader Fixed="true">
<Bar #bind-Visible="#_topbarVisible" Breakpoint="Breakpoint.Desktop" Background="Background.Primary" ThemeContrast="ThemeContrast.Light">
<BarBrand>
<BarItem>
<BarLink To="">
<BarIcon IconName="FontAwesomeIcons.CloudSun" />
My Site
</BarLink>
</BarItem>
</BarBrand>
#* ReSharper disable once UnknownCssClass *#
<BarMenu Class="justify-content-end">
<BarEnd>
<AuthorizeView>
<Authorized>
<BarItem>
<Blazorise.Icon Name="FontAwesomeIcons.User" Visibility="Visibility.Visible" />
Hi, #context?.User?.Identity?.Name
</BarItem>
</Authorized>
</AuthorizeView>
<BarItem>
<LoginDisplay />
</BarItem>
</BarEnd>
</BarMenu>
</Bar>
</LayoutHeader>
<LayoutContent Padding="Padding.Is4.OnX">
#Body
</LayoutContent>
<LayoutFooter Fixed="true" Padding="Padding.Is4.OnX">
Copyright ©#DateTimeOffset.UtcNow.Year Inner Drive Technology.
</LayoutFooter>
</Layout>
</Layout>
The NavMenu.razor component looks like this:
#using Blazorise.Icons.FontAwesome
<BarMenu>
<BarStart>
<BarItem>
<BarLink To="">
<BarIcon IconName="FontAwesomeIcons.Home" />
Home
</BarLink>
</BarItem>
<BarItem>
<BarLink To="/Current">
<BarIcon IconName="FontAwesomeIcons.CloudSun" />
Current
</BarLink>
</BarItem>
<AuthorizeView>
<Authorized>
<BarItem>
<BarLink To="/ApiStatus">
<BarIcon IconName="FontAwesomeIcons.Server" />
API Status
</BarLink>
</BarItem>
<BarItem>
<BarLink To="/BuildStatus">
<BarIcon IconName="FontAwesomeIcons.Rocket" />
Build Status
</BarLink>
</BarItem>
</Authorized>
</AuthorizeView>
<BarItem>
<BarLink To="/About">
<BarIcon IconName="FontAwesomeIcons.InfoCircle" />
About
</BarLink>
</BarItem>
</BarStart>
</BarMenu>
Program.cs contains this section:
builder.Services.AddRazorPages(options =>
{
options.Conventions.AllowAnonymousToFolder("/");
options.Conventions.AllowAnonymousToPage("/Index");
options.Conventions.AllowAnonymousToFolder("/_content");
options.Conventions.AllowAnonymousToFolder("/Pages");
options.Conventions.AllowAnonymousToFolder("/Shared");
});
The problem seems to be the presence of the Mode="BarMode.VerticalInline" attribute. (I'll spare you the A/B testing that led to this conclusion.) When the Mode attribute is present, the entire sider is hidden for anonymous users. When it's absent, the entire sider is visible.
Anyone know what's up with this?
Well, this was fun. And all that CORS stuff was a red herring.
The issue: the default AddAuthorization service provider options blocked a request somewhere, so removing it allowed all the page components to load, even while keeping the authentication-required bits hidden.
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy
//options.FallbackPolicy = options.DefaultPolicy; // Removed this line
});
Removing the fallback policy fixed this issue.

remove underline in inputText in React Native

I cannot remove underline in input text
I guess it should be
underlineColorAndroid="transparent"
See the related issue https://github.com/facebook/react-native/issues/10108
Use underlineColorAndroid property of TextInput component
<TextInput underlineColorAndroid='transparent'
placeholder="type here ..">
TXT
</TextInput>
Following prop in TextField works for me
underlineColorAndroid='rgba(0,0,0,0)'
I found another way to surcharge InputContainer styles directly on the TextInput :
inputContainerStyle={{borderBottomWidth:0}}
I found a simple solution
underlineColorAndroid='#FFF'
I agree with above answers but it produces following problem randomly
https://github.com/facebook/react-native/issues/18214
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)
So i get up with other solution. I added editbox style in style.xml
<item name="android:background">#android:color/transparent</item>
---------------------------Full code------------------------------------
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:windowBackground">#color/backgroundcolor</item>
<item name="android:editTextStyle">#style/AppEditTextStyle</item>
</style>
<style name="AppEditTextStyle" parent="#style/Widget.AppCompat.EditText">
<item name="android:background">#android:color/transparent</item>
<item name="android:minHeight">40dp</item>
</style>
underlineColorAndroid="transparent" is perfectly working for me
<TextInput
underlineColorAndroid="transparent"
placeholder="Your Placeholder"
/>
See Discussion here
Following prop in TextField works for android 6 to up
underlineColorAndroid='transparent'
Following prop in TextField works for android 6 to down
borderWidth={0}
so you should both props to work in every devices
underlineColorAndroid='transparent'
borderWidth={0}
If you're still looking for a solution and underlineColorAndroid='transparent' doesn't do the trick then try autoCorrect={false}.
Example :
<TextInput autoCorrect={false} underlineColorAndroid='transparent' placeholderTextColor={Colors.gray} style={styles.input} autoCapitalize='characters' placeholder="Type your word" />
I found only one way to remove underline exactly from input container:
<TextField
placeholder="user#gmail.co"
InputProps={{ disableUnderline: true }}
/>

Alfresco share worflow form validation

I have been trying to validate my alfresco share workflow form for several days without success. This is what i have done.
Configured my workflow in the share-config-custom.xml located in %TOMCAT_HOME%tomcat\shared\classes\alfresco\web-extension
set my contraint handler as follows.
<constraint-handlers>
<constraint type="MANDATORY"
validation-handler="Alfresco.forms.validation.examplestaffnumber"
event="keyup" />
</constraint-handlers>
</field>
This field i have set to mandatory
< label-id="Staff Number" id="leave:staffnumber" mandatory="true">
I have created the contraint hanlder javascript and placed it at %ALFRESCO_HOME%\tomcat\webapps\share\js folder. This is both js and min.js
Finaly added the js in form.get.head.ftl located at %ALFRESCO_HOME%tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form
folder like this
<#script type="text/javascript" src="${page.url.context}/res/js/examplevalidation.js">
When I select my worflow form and key values in the staff number form nothing happens. I have checked in the firebug but there is no any call to the js.
Where could i have gone wrong?
I think you have not added dependencies for your java script. To do that add below code in your share-config-custom.xml located in %ALFRESCO_HOME%tomcat\shared\classes\alfresco\web-extension
<config>
<forms>
<dependencies>
<js src="/js/examplevalidation.js" />
</dependencies>
</forms>
</config>
And your constrains handler should be like
<field id="leave:staffnumber" label-id="Staff Number" mandatory="true">
<control template="/org/alfresco/components/form/controls/textfield.ftl" />
<constraint-handlers>
<constraint type="MANDATORY" validation-handler="Alfresco.forms.validation.examplestaffnumber" event="blur"/>
</constraint-handlers>
</field>
And function in your js should be like this:
Alfresco.forms.validation.examplestaffnumber = function examplestaffnumber(
field, args, event, form, silent, message) {
// your code with return statement
}
Hope this helps!!!

How to print attributes of related objects in zope templates?

I wrote an dexterity type with a field relating to another object:
institution = RelationChoice(
title=_(u"Institution"),
source=ObjPathSourceBinder(
object_provides=IInstitution.__identifier__
),
)
And also in the template I wrote:
<span id="institution" tal:content="context/institution" />
But it prints:
<z3c.relationfield.relation.RelationValue object at 0xe3a032c>
I have tried to get attributes to build a link to the item, but the next doesn't works:
<span id="institution" tal:content="context/institution/absolute_url" />
How can I get the attributes of the objecto to make a link to it?
Reference objects are documented in the Dexterity developer manual. You are looking for the to_object attribute:
<span id="institution" tal:content="context/institution/to_object/absolute_url" />
which would insert the URL of the linked object, or you could show the Title instead:
<span id="institution" tal:content="context/institution/to_object/Title" />

Resources