3.2.4 • Published 5 years ago

@opuscapita/react-select-order-list v3.2.4

Weekly downloads
1,757
License
MIT
Repository
github
Last release
5 years ago

react-select-order-list

Description

SelectOrderList component renders two lists. First contains data and we can check and uncheck them. After that selected row appears on second list where we can sort data by drag and drop function. We also have delete option avaiable from second list by remove icon.

Installation

npm install @opuscapita/react-select-order-list
  • Install and load font-awesome font to your project

Demo

View the DEMO

Builds

UMD

The default build with compiled styles in the .js file. Also minified version available in the lib/umd directory.

CommonJS/ES Module

You need to configure your module loader to use cjs or es fields of the package.json to use these module types. Also you need to configure sass loader, since all the styles are in sass format.

API

SelectOrderList

Prop nameTypeDefaultDescription
availableDataImmutable List of itemsList()List of the selectable items
onChangefunctionrequiredCallback function, which is called when data selection or order is changed. It returns an object of allSelected (boolean) sign and selectedData (List)
allSelectedbooleanfalseSign of all available items selected
idstring''Id for a component div wrapper
searchPlaceholderstring''Placeholder for search
selectedDataImmutable List of itemsListList of selected and sorted items
translationsobject{ allLabel: '', availableListLabel: '', searchTooltip: '', selectedListLabel: '' }Localized labels
singleColumnbooleanfalseUses single column layout and shows only selected data cloumn

SelectOrderList - items

Prop nameTypeDefaultDescription
labelstring or elementrequiredItem label
valuestring/bool/numberrequiredItem value
isLockedboolfalseItem locked sign

Code example

import React from 'react';
import { List } from 'immutable';
import SelectOrderList from '../../../src/index';

export default class ListItemsView extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      availableData: List([
        {
          label: 'one',
          value: 1',
        },
        {
          label: 'two',
          value: 2,
        },
        {
          label: 'three',
          value: 3,
        },
      ]),
      selectedData: List([
        {
          label: 'two',
          value: 2,
        },
        {
          label: 'three',
          value: 3,
        },
      ]),
      allSelected: false,
    };
  }

  onChange =(data) => {
    this.setState({ ...data });
  }

  render() {
    return (
      <SelectOrderList
        allLabel="All"
        allSelected={this.state.allSelected}
        availableData={this.state.availableData}
        availableListLabel="Available data"
        id="example"
        onChange={this.onChange}
        selectedData={this.state.selectedData}
        selectedListLabel="Selected data"
      />
    );
  }
}
3.2.4

5 years ago

3.2.3

5 years ago

3.2.2

5 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.6

6 years ago

3.1.5

6 years ago

3.1.4

6 years ago

3.1.3

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago