Affiliate Search
Description
Affiliate Search is a react component that can be used to filter results from a REST API sources.
Â
System Dependencies
Installation
The package can be installed via npm:
npm install empower-affiliate-search --save
Standard Affiliate
Configuration
const AFFILIATE_OPTIONS = [
{
"label": "Fruit Name",
"value": "fruit_name",
"type": "string",
},
{
"label": "Status",
"value": "fruit_status",
"type": "multiple",
"categoryOptions": [
{
"label": "Fresh",
"value": "fresh"
},
{
"label": "Rotten",
"value": "rotten"
}
]
},
]
const extractValueFromAffiliate = (val) => {
...Statement
}
<AffiliateSearch
options={AFFILIATE_OPTIONS}
getValue={(val) => extractValueFromAffiliate(val)}
/>
Affiliate Search with Default Value
Configuration
const DEF_VALUE = [
{
type: 'string',
category: 'fruit_name',
value: 'Orange',
categoryLabel: 'Fruit Name',
valueLabel: 'Orange',
},
{
type: 'multiple',
category: 'fruit_status',
value: 'fresh',
categoryLabel: 'Status',
valueLabel: 'Fresh',
},
]
<AffiliateSearch
options={AFFILIATE_OPTIONS}
getValue={(val) => extractValueFromAffiliate(val)}
defaultValue={DEF_VALUE}
/>
Affiliate Search with Custom Options Not Found
Configuration
 Properties
Parameter | Data Type | Constraint | Description |
---|---|---|---|
disabled | Boolean | Optional | Define if the component is disabled or not |
| ArrayObject | null | Required | Define the options in the affiliate Object Properties: |
placeholder | String | Optional | Sets the display placeholder of the affiliate |
defaultValue | ArrayObject | Optional | Sets the default value of the affiliate Object Properties: |
type | String | Optional | Sets the type of the affiliate. Setting this to "single" will result to affiliate will only accept one (1) option value |
disableTextInput | Boolean | Optional | Use this to disable the option value upon enter |
customNotFoundOptionDisplay | JSX Element | String | Optional | Provide a custom display if the searched option for the affiliate filter cannot be found |
isAffiliateDropdown | Boolean | Optional | Sets the component as a dropdown |
iconPlacement | String | Optional | Icon placement of the buttons |
getValue | Function | Required | A function to trigger upon changing the affiliate value. The option value can be extracted in the function arguments |
References
Repository Link: https://bitbucket.org/empowerteams/empower-affiliate-search
NPM Package: npm: empower-affiliate-search
Demo Repo: git@bitbucket.org:empowerteams/mfe-sub-application-template.git