0.0.34 • Published 5 years ago

@beisen/common-label v0.0.34

Weekly downloads
13
License
ISC
Repository
gitlab
Last release
5 years ago

AutoComplete

参数

State

isFocus: false,  // 输入框样式控制
inputValue: props && props.inputDefaultValue || '' //input表单值

Props

hidden: false, // 是否渲染
disabled: false, // 不可用
readOnly: true, // 只读
labelText: 'AutoComplete', //左侧 label 文字
placeholder: '请输入', // input placeholder
inputDefaultValue: null, // input 默认值
defaultItems: [], // autocomplete 数据 需传入一个DOM数组 nodeName为li
keyUpCallBack: (value, event) => console.log(value, event), // input keyup输入回调
itemCallBack: (event, data) => console.log(event), // autocomplete 点击回调 event事件回调,data为li上attribute的值
focusCallBack: (value) => console.log(value), // input keyup输入回调
blurCallBack: (event) => console.log(event), // autocomplete 点击回调
changeCallBack: (event, data) => console.log(value) // input keyup输入回调 event事件回调 data为li上attribute的值

PropTypes

hidden: PropTypes.bool,
disabled: PropTypes.bool,
readOnly: PropTypes.bool,
labelText: PropTypes.oneOfType([
  PropTypes.string,
  PropTypes.number,
]).isRequired,
placeholder: PropTypes.oneOfType([
  PropTypes.string,
  PropTypes.number,
]),
inputDefaultValue: PropTypes.oneOfType([
  PropTypes.string,
  PropTypes.number,
]),
defaultItems: PropTypes.arrayOf(PropTypes.element).isRequired,
keyUpCallBack: PropTypes.func.isRequired,
itemCallBack: PropTypes.func.isRequired,
focusCallBack: PropTypes.func,
blurCallBack: PropTypes.func,
changeCallBack: PropTypes.func

使用方法

class App extends Component {

	constructor(props) {
		super(props)
		this.state = {
			autoValue: this.setDefaultValue()
		}
	}
	
	// 返回defaultItems
	setDefaultValue(count = 5) {
		let items = [];

		for (let i = 0; i < count; i++) {
			items.push(<li key={i}>{i}</li>);
		}
		return items;
	}	
	
	// 根据keyup返回新的defaultItems
	setNewValue(count) {
		this.setState({autoValue: this.setDefaultValue(count)})
	}
	
	// 清空defaultItems
	restValue(event, data) {
		console.log(event, data)
		this.setState({autoValue: null});
	}

  	render () {
		const {autoValue} = this.state;
		const options = {
			labelText: 'AutoComplete',
			placeholder: '请输入',
			inputDefaultValue: null
		}
	    return (
	     	 <AutoComplete {...options} defaultItems={autoValue} keyUpCallBack={::this.setNewValue} itemCallBack={::this.restValue} />
	    )
  	}
}
render(<App />, document.getElementById('content'))
@infinitebrahmanuniverse/nolb-_beisen_@everything-registry/sub-chunk-119metadata-page-builderitalent-create-taskitalent-portalitalent-task-operate-areaperformance-formula-editerpc-italent-appstore-managetest-searchformsearch-fromrecruit-adlistpps-last-thas-resultpps-work-experiencepps-form-mutli-tablepps-formula-editux-attachment-typesux-attachment-new-typeux-italent-feed-componentux-last-test-resultsux-last-thas-resultux-person-last-evaluation-scoreux-plan-completion-rateux-pagebuilderux-person-cardux-person-evaluation-resultux-person-last-alldeg-scoreux-person-last-alldeg-scoresux-evaluation-reportsux-new-feed-layoutux-m-last-alldeg-scoreux-m-last-evaluation-scoreux-m-report-alldeg-scoreux-m-report-evaluation-scoreux-work-experienceux-task-drawerux-task-listux-total-defense-reportux-report-last-evaluation-resultux-search-form@beisen-cmps/italent-task-common-component@beisen-cmps/natureui-tooltips@beisen-cmps/natureui-upload@beisen-cmps/form-uploader@beisen-cmps/italent-create-summary@beisen-cmps/italent-create-task@beisen-cmps/natureui-datepicker@beisen-cmps/natureui-form@beisen-cmps/natureui-input@beisen-cmps/natureui-optional@beisen-cmps/natureui-radio@beisen-cmps/natureui-timepicker@beisen-cmps/natureui-area@beisen-cmps/natureui-cascader@beisen-cmps/natureui-check@beisen-cmps/natureui-checkbox@beisen-cmps/static-form-label@beisen-cmps/task-drawer@beisen/upaas-user-selector@beisen/ux-computationrule@beisen/tms-react@beisen/ux-upaas-ethos@beisen/tita-react-components@beisen/recruit-dropdown-list@beisen/platform-base
0.0.34

5 years ago

0.0.33

5 years ago

0.0.31

5 years ago

0.0.32

5 years ago

0.0.28-1

6 years ago

0.0.1

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.12

6 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago