-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 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
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,50 @@ | ||
import {Formio} from 'react-formio'; | ||
|
||
import {localiseSchema} from './i18n'; | ||
|
||
const FieldComponent = Formio.Components.components.field; | ||
|
||
/** | ||
* An address component. | ||
*/ | ||
class Address extends FieldComponent { | ||
constructor(component, options, data) { | ||
super(component, options, data); | ||
this.checks = []; | ||
} | ||
|
||
static schema(...extend) { | ||
const schema = FieldComponent.schema( | ||
{ | ||
label: 'Address', | ||
type: 'address', | ||
input: false, | ||
}, | ||
...extend | ||
); | ||
return localiseSchema(schema); | ||
} | ||
|
||
static get builderInfo() { | ||
return { | ||
title: 'Address', | ||
icon: 'home', | ||
group: 'basic', | ||
weight: 300, | ||
schema: Address.schema(), | ||
}; | ||
} | ||
|
||
render(content) { | ||
const btnContent = this.t('Address', { | ||
authPlugin: this.component.authPlugin, | ||
}); | ||
const context = { | ||
content: content, | ||
btnContent: btnContent, | ||
}; | ||
return super.render(this.renderTemplate('address', context)); | ||
} | ||
} | ||
|
||
export default Address; |
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