This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from solocommand/idx-address-fields
Add city, street, extra fields, hidden support
- Loading branch information
Showing
11 changed files
with
426 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
packages/marko-web-identity-x/browser/form/address-block.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<template> | ||
<fieldset class="px-3 border mb-3"> | ||
<legend class="h6 w-auto"> | ||
Address | ||
</legend> | ||
|
||
<div v-if="street.visible" class="row"> | ||
<street | ||
v-model="user.street" | ||
:required="street.required" | ||
:class-name="addressExtra.visible ? 'col-md-8' : 'col-md-12'" | ||
/> | ||
<address-extra | ||
v-if="addressExtra.visible" | ||
v-model="user.addressExtra" | ||
:required="addressExtra.required" | ||
/> | ||
</div> | ||
|
||
<div v-if="city.visible || regionCode.visible" class="row"> | ||
<city | ||
v-if="city.visible" | ||
v-model="user.city" | ||
:required="city.required" | ||
:class-name="regionCode.visible ? 'col-md-4' : 'col-md-6'" | ||
/> | ||
<region | ||
v-if="regionCode.visible" | ||
v-model="user.regionCode" | ||
:country-code="user.countryCode" | ||
:required="regionCode.required" | ||
:class-name="city.visible ? 'col-md-4' : 'col-md-6'" | ||
/> | ||
<postal-code | ||
v-if="regionCode.visible" | ||
v-model="user.postalCode" | ||
:required="postalCode.required" | ||
:class-name="city.visible ? 'col-md-4' : 'col-md-6'" | ||
/> | ||
</div> | ||
</fieldset> | ||
</template> | ||
|
||
<script> | ||
import City from './fields/city.vue'; | ||
import Region from './fields/region.vue'; | ||
import PostalCode from './fields/postal-code.vue'; | ||
import Street from './fields/street.vue'; | ||
import AddressExtra from './fields/address-extra.vue'; | ||
export default { | ||
components: { | ||
City, | ||
Region, | ||
PostalCode, | ||
Street, | ||
AddressExtra, | ||
}, | ||
props: { | ||
user: { | ||
type: Object, | ||
required: true, | ||
}, | ||
street: { | ||
type: Object, | ||
required: true, | ||
}, | ||
addressExtra: { | ||
type: Object, | ||
required: true, | ||
}, | ||
city: { | ||
type: Object, | ||
required: true, | ||
}, | ||
regionCode: { | ||
type: Object, | ||
required: true, | ||
}, | ||
postalCode: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
classNames() { | ||
const classNames = ['form-group']; | ||
const { className } = this; | ||
if (className) classNames.push(className); | ||
return classNames; | ||
}, | ||
countryCode() { | ||
const { user } = this; | ||
if (!user) return null; | ||
return user.countryCode; | ||
}, | ||
}, | ||
}; | ||
</script> |
64 changes: 64 additions & 0 deletions
64
packages/marko-web-identity-x/browser/form/fields/address-extra.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<template> | ||
<form-group class-name="col-md-4"> | ||
<form-label :for="id" :required="required"> | ||
{{ label }} | ||
</form-label> | ||
<input | ||
:id="id" | ||
v-model="addressExtra" | ||
class="form-control" | ||
type="text" | ||
:required="required" | ||
:disabled="disabled" | ||
:placeholder="placeholder" | ||
autocomplete="address-extra" | ||
> | ||
</form-group> | ||
</template> | ||
|
||
<script> | ||
import FormGroup from '../common/form-group.vue'; | ||
import FormLabel from '../common/form-label.vue'; | ||
export default { | ||
components: { | ||
FormGroup, | ||
FormLabel, | ||
}, | ||
props: { | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
required: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
label: { | ||
type: String, | ||
default: 'Extra (Apt, Suite, etc.)', | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: '', | ||
}, | ||
value: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
data: () => ({ | ||
id: 'sign-on-address-extra', | ||
}), | ||
computed: { | ||
addressExtra: { | ||
get() { | ||
return this.value || ''; | ||
}, | ||
set(addressExtra) { | ||
this.$emit('input', addressExtra || null); | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> |
68 changes: 68 additions & 0 deletions
68
packages/marko-web-identity-x/browser/form/fields/city.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<form-group :class-name="className"> | ||
<form-label :for="id" :required="required"> | ||
{{ label }} | ||
</form-label> | ||
<input | ||
:id="id" | ||
v-model="city" | ||
class="form-control" | ||
type="text" | ||
:required="required" | ||
:disabled="disabled" | ||
:placeholder="placeholder" | ||
autocomplete="city" | ||
> | ||
</form-group> | ||
</template> | ||
|
||
<script> | ||
import FormGroup from '../common/form-group.vue'; | ||
import FormLabel from '../common/form-label.vue'; | ||
export default { | ||
components: { | ||
FormGroup, | ||
FormLabel, | ||
}, | ||
props: { | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
required: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
label: { | ||
type: String, | ||
default: 'City', | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: '', | ||
}, | ||
value: { | ||
type: String, | ||
default: '', | ||
}, | ||
className: { | ||
type: String, | ||
default: 'col-md-6', | ||
}, | ||
}, | ||
data: () => ({ | ||
id: 'sign-on-city', | ||
}), | ||
computed: { | ||
city: { | ||
get() { | ||
return this.value || ''; | ||
}, | ||
set(city) { | ||
this.$emit('input', city || null); | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
packages/marko-web-identity-x/browser/form/fields/street.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<form-group :class-name="className"> | ||
<form-label :for="id" :required="required"> | ||
{{ label }} | ||
</form-label> | ||
<input | ||
:id="id" | ||
v-model="street" | ||
class="form-control" | ||
type="text" | ||
:required="required" | ||
:disabled="disabled" | ||
:placeholder="placeholder" | ||
autocomplete="street" | ||
> | ||
</form-group> | ||
</template> | ||
|
||
<script> | ||
import FormGroup from '../common/form-group.vue'; | ||
import FormLabel from '../common/form-label.vue'; | ||
export default { | ||
components: { | ||
FormGroup, | ||
FormLabel, | ||
}, | ||
props: { | ||
disabled: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
required: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
label: { | ||
type: String, | ||
default: 'Street', | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: '', | ||
}, | ||
value: { | ||
type: String, | ||
default: '', | ||
}, | ||
className: { | ||
type: String, | ||
default: 'col-md-12', | ||
}, | ||
}, | ||
data: () => ({ | ||
id: 'sign-on-street', | ||
}), | ||
computed: { | ||
street: { | ||
get() { | ||
return this.value || ''; | ||
}, | ||
set(street) { | ||
this.$emit('input', street || null); | ||
}, | ||
}, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.