Y! Auction Category Picker
<yauction-category-picker /> is a category picker for TW Yahoo! Auction. Users could go through the whole category tree to pick a suitable category for their merchandise.
<yauction-category-picker /> will show up with categoryId which developers set. That means user can start from category 「root」 or 「leaf」.
Try to select category in the following field and press 「SUMMON」to see what can <yauction-category-picker /> do ?
Vision
Here comes <yauction-category-picker /> rised vision. With this clear view, users could find suitable category through it.
Basic Usage
<yauction-category-picker /> is a web component. All we need to do is put the required script into your HTML document. Then follow <yauction-category-picker />'s html structure and everything will be all set.
Required Script
Structure
Put <yauction-category-picker /> into HTML document. It will have different functions and looks with attribute mutation.
Otherwise, developers could also choose remoteconfig to fetch config for <yauction-category-picker />.
JavaScript Instantiation
<yauction-category-picker /> could also use JavaScript to create DOM element. Here comes some examples.
Style Customization
Developers could apply styles to decorate <yauction-category-picker />'s looking.
Attributes
<yauction-category-picker /> supports some attributes to let it become more convenience & useful.
params
Set parameters for <yauction-category-picker />. It should be JSON string. Each fetching will attached these parameters to api. Default is {} (not set).
l10n
Set localization for <yauction-category-picker />. It will replace some message & button text to anything you like. It should be JSON string. Developers could set title、confirm、emptyLabel and placeholder.
- title:category title text. Default is Category Picker.
- confirm:button「confirm」text. Default is CONFIRM.
- emptyLabel:empty label text. Default is Select.
- placeholder:search field placeholder content. Default is Search category.
webservice
Set web service information for <yauction-category-picker />. It should be JSON string. Developers could set path、nodes、children and tree api address here.
PS. Developers could apply {{categoryId}} as replace key for category id in api address. Such as "https://your-domain/getCategoryChildren/{{categoryId}}".
- path:api address for category path information fetching (leaf to root).
- children:api address for category children fetching.
- nodes:api address for category nodes information fetching.
- tree:api address for category tree information fetching.
Property
| Property Name | Type | Description |
|---|---|---|
params
|
Object | Getter / Setter for params. Each fetching will attached these parameters to api. Default is {}. |
l10n
|
Object | Getter / Setter for l10n. It will replace some UI text to anything you like. Developers could set title、confirm、emptyLabel and placeholder. |
webservice
|
Object | Getter / Setter for webservice. Developers could set path、children、nodes and tree api address here. |
open
|
Boolean | Getter for <yauction-category-picker />'s open status. |
pickedInfo
|
Object | Getter for current <yauction-category-picker />'s category information. Developers could get { picked, path }. |
Method
| Method Signature | Description |
|---|---|
show(categoryId)
|
Fetch & popup <yauction-category-picker />. Developers could call this method with argument > category id to popup <yauction-category-picker />.Such as: element.show('23288'). Default is 0 (not set). |
dismiss
|
Dismiss <yauction-category-picker />. |
Event
| Event Signature | Description |
|---|---|
yauction-category-picker-pick
|
Fired when user finish picked category. Developers could gather picked data > { picked,path } through event.detail. |
yauction-category-picker-cancel
|
Fired when <yauction-category-picker /> canceled.(user closed <yauction-category-picker />) |
yauction-category-picker-error
|
Fired when <yauction-category-picker /> fetching error. Develpoers could gather information through event.detail.(<yauction-category-picker /> will put server response to event.detail.cause) |