1.0.1 • Published 4 years ago

@feizheng/react-ant-filter-dropdown-checkbox v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

react-ant-filter-dropdown-checkbox

Filter dropdown for checkbox.

installation

npm install -S @feizheng/react-ant-filter-dropdown-checkbox

update

npm update @feizheng/react-ant-filter-dropdown-checkbox

properties

NameTypeRequiredDefaultDescription
classNamestringfalse-The extended className for component.
valuearrayfalse-Default value.
itemsarrayfalse[]The dropdown menu items.
selectAllTextanyfalse'全选'Select all text.
onChangefuncfalsenoopThe change handler.

usage

  1. import css

    @import "~@feizheng/react-ant-filter-dropdown-checkbox/dist/style.scss";
    
    // customize your styles:
    $react-ant-filter-dropdown-checkbox-options: ()
  2. import js

    import ReactAntFilterDropdownCheckbox from '@feizheng/react-ant-filter-dropdown-checkbox';
    import ReactDOM from 'react-dom';
    import React from 'react';
    import './assets/style.scss';
    
    class App extends React.Component {
      state = { value: [] };
      render() {
        const items = [
          { value: 'blank', label: '空白单元格' },
          { value: 'not-filled', label: '未填单元格' },
          { value: 'fixed', label: '已修正' }
        ];
        const { value } = this.state;
    
        return (
          <div className="app-container">
            <ReactAntFilterDropdownCheckbox
              items={items}
              onChange={(e) => {
                this.setState({ value: e.target.value });
              }}
            />
    
            <div className="code-container">
              <div className="is-code">
                <pre>
                  <code>{JSON.stringify(items, null, 2)}</code>
                </pre>
              </div>
              <div className="is-code">
                <pre>
                  <code>{JSON.stringify(value, null, 2)}</code>
                </pre>
              </div>
            </div>
          </div>
        );
      }
    }
    
    ReactDOM.render(<App />, document.getElementById('app'));

documentation