application/metaproperties/longtext-meta-property.js
- import React from 'react';
- import TextField from 'material-ui/TextField';
-
- class LongtextMetaProperty extends React.Component {
- constructor(props) {
- super(props);
- this.displayName = 'LongtextMetaProperty';
- }
-
- rando() {
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
- let str = [];
- for (let i=0; i<5; i++) {
- str.push(chars.charAt(Math.floor(Math.random() * chars.length)));
- }
-
- return str.join('');
- }
-
- shouldComponentUpdate(nextProps, nextState) {
- if (nextProps.value != this.props.value) {
- return true;
- }
- if (nextProps.disabled != this.props.disabled) {
- return true;
- }
- return false;
- }
-
- render() {
- const name = this.props.name ? this.props.name : 'textfield_' + this.rando();
- return (
- <TextField
- name={name}
- multiLine={true}
- rows={2}
- rowsMax={6}
- {...this.props}
- />
- );
- }
- }
-
- export default LongtextMetaProperty;