0.0.1 • Published 5 years ago

nova-transfer v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Nova Transfer

Transfer elements between two columns in an intuitive and efficient way.

How do I do? (HTML Markup)

  <nova-transfer 
    show-select-all
    show-search> 
    <p slot="source-footer" style="padding: 8px 0; text-align: center;">Footer 1</p>
    <p slot="target-footer" style="padding: 8px 0; text-align: center;">Footer 2</p>
  </nova-transfer>
   var transfer = document.querySelector('nova-transfer');
   transfer.data = data;
   transfer.configuration = configuration;

Customize styles

    // customized styles for the columns
    transfer.columnStyle = {
      boxShadow: "0px 0px 53px -11px rgba(0,0,0,1)",
      width: "45%"
    } 
    // customized styles for the operation buttons (<,>)
    transfer.operationStyle = {
      width: "10%",
    }
    // customized styles for the wrapper of the component
    transfer.wrapperStyle = {
      width: "46%",
      height: "340px",
      minWidth: "500px",
      margin: "0 auto"
    }

JSON Data Model

{
    "data": {
        "items": [
        {
        "key": "key1",
        "title": "Title1",
        "description": "Description1",
        "disabled": false
        },
        {
        "key": "key2",
        "title": "Title2",
        "description": "Description2",
        "disabled": true
        },
        {
        "key": "key3",
        "title": "Title3",
        "description": "Description3",
        "disabled": false
        }
    ],
    "targetKeys": [
        "key6", "key11"
        ]
    },
    "configuration": {
        "labels": {
          titleSource: "source",
          titleTarget: "target",
          operationLeft: "left",
          operationRight: "right",
          unit: "item",
          units: "items",
          notFoundContent: "the list is empty",
          searchPlaceholder: "search here"
        } 
    },
    "styling": {
    }
}

Properties

PropertyDescriptionTypeDefault
itemsThe elements that are part of this array will be present the left column. Except the elements whose keys are included in targetKeys prop.any[]
targetKeysA set of keys of elements that are listed on the right column.string[][]
show-select-allShow select all checkbox on the headerbooleanfalse
show-searchIf included, a search box is shown on each column.booleanfalse
disabledWhether disabled transferbooleanfalse
source-footerSlot that can be added to the component to show a footer in the source column
target-footerSlot that can be added to the component to show a footer in the target column
columnStyleA custom CSS style used for rendering the transfer columns.object{}
operationStyleA custom CSS style used for rendering the operations column.object{}
wrapperStyleA custom CSS style used for rendering wrapper element.object{}
searchEvent function that is emitted when search field is changedeventListener
filterEvent function that is emitted when items are filtered in a columneventListener
transferColumnEvent that is emitted each time the user requests to change items from one column to anothereventListener
selectEvent that is emitted each time the user selects an item of a columneventListener
filterOptionA function to determine whether an item should show in search result list(inputValue, option): boolean
renderItemThe function to generate the item shown on a column.Function(item):string
handleSelectMethod that allows the customization of the component.Method(key:string)

Built with StencilJS