Skip to content

Commit

Permalink
ver. 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
光弘 committed May 26, 2016
1 parent 2041975 commit 830522d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion demo/InputFormFieldDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Demo extends React.Component {
autoTrim={false}
jsxlabel="普通输入框"
jsxtips="请输入数字"
validateOnBlur={false}
jsxplaceholder="输入"
onKeyDown={me.handleKeyDown.bind(me)}
jsxrules={{validator: Validators.isNotEmpty, errMsg: "不能为空"}}>
<LeftAddon>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uxcore-input-form-field",
"version": "0.1.1",
"version": "0.1.2",
"description": "uxcore-input-form-field component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-input-form-field.git",
"author": "eternalsky",
Expand Down
17 changes: 10 additions & 7 deletions src/InputFormField.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
* All rights reserved.
*/

let React = require('react');
let ReactDOM = require('react-dom');
let FormField = require('uxcore-form-field');
let Constants = require("uxcore-const");
let classnames = require('classnames');
let assign = require('object-assign');
const React = require('react');
const ReactDOM = require('react-dom');
const FormField = require('uxcore-form-field');
const Constants = require("uxcore-const");
const classnames = require('classnames');
const assign = require('object-assign');
const util = require('./util');

class FormCount extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -216,6 +217,8 @@ class InputFormField extends FormField {
if (!!leftAddon) {
arr.push(leftAddon);
}
const IEver = util.getIEVer();
const placeholder = (IEver >= 10) ? "" : me.props.jsxplaceholder;
arr.push(<input
className={classnames({
"kuma-input": true,
Expand All @@ -225,7 +228,7 @@ class InputFormField extends FormField {
ref="root"
key={me.props.inputType}
type={me.props.inputType}
placeholder={me.props.jsxplaceholder}
placeholder={placeholder}
disabled={(me.props.jsxdisabled == "disabled" || me.props.jsxdisabled == true) ? "disabled" : ""}
name={me.props.key}
value={me.state.formatValue}
Expand Down
18 changes: 18 additions & 0 deletions src/util.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
getIEVer: () => {
if (window) {
const ua = window.navigator.userAgent;
const idx = ua.indexOf('MSIE');
if (idx > 0) {
// "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727)"
return parseInt(ua.substring(idx + 5, ua.indexOf(".", idx)));
}
if (!!ua.match(/Trident\/7\./)) {
// "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; rv:11.0) like Gecko"
return 11;
}
return 0;
}
return 0;
}
}

0 comments on commit 830522d

Please sign in to comment.