react 16升级

This commit is contained in:
jonymrshi 2017-10-23 14:19:48 +08:00
parent 67dfe113bd
commit 056fbc03d1
3 changed files with 40 additions and 14 deletions

View File

@ -55,14 +55,32 @@ var InputRender = function (_Component) {
if (event.keyCode == 13) {
_this.check();
}
}, _this.formatCurrency = function (money) {
if (money && money != null && !!Number(money)) {
money = String(money);
var left = money.split(".")[0],
right = money.split(".")[1];
right = right ? right.length >= 2 ? "." + right.substr(0, 2) : "." + right + "0" : ".00";
var temp = left.split("").reverse().join("").match(/(\d{1,3})/g);
return (Number(money) < 0 ? "-" : "") + temp.join(",").split("").reverse().join("") + right;
} else if (money === 0) {
//注意===在这里的使用如果传入的money为0,if中会将其判定为boolean类型故而要另外做===判断
return "0.00";
} else {
return "";
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
//货币的格式化方法
InputRender.prototype.render = function render() {
var _state = this.state,
value = _state.value,
editable = _state.editable;
var isclickTrigger = this.props.isclickTrigger;
var _props = this.props,
isclickTrigger = _props.isclickTrigger,
format = _props.format;
var cellContent = "";
if (editable) {
@ -91,6 +109,9 @@ var InputRender = function (_Component) {
})
);
} else {
if (format && format === "Currency") {
value = this.formatCurrency(value);
}
cellContent = isclickTrigger ? _react2["default"].createElement(
"div",
{ className: "editable-cell-text-wrapper", onClick: this.edit },

View File

@ -15,8 +15,8 @@
<script src="./node_modules/console-polyfill/index.js"></script>
<script src="./node_modules/es5-shim/es5-shim.min.js"></script>
<script src="./node_modules/es5-shim/es5-sham.min.js"></script>
<script src="./node_modules/react/dist/react-with-addons.js"></script>
<script src="./node_modules/react-dom/dist/react-dom.js"></script>
<script src="//design.yonyoucloud.com/static/react/16.0.0/umd/react.development.js"></script>
<script src="//design.yonyoucloud.com/static/react/16.0.0/umd/react-dom.development.js"></script>
<script src="//design.yonyoucloud.com/static/prop-types/15.6.0/prop-types.min.js"></script>
<script src="./dist/demo.js"></script>
</body>

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "0.2.3",
"version": "1.0.1",
"description": "Table ui component for react",
"keywords": [
"react",
@ -37,23 +37,28 @@
"lodash.clonedeep": "^4.5.0",
"object-path": "^0.11.3",
"shallowequal": "^0.2.2",
"tinper-bee-core": "^0.1.6",
"tinper-bee-core": "latest",
"warning": "^3.0.0"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0",
"react-dom": "^15.3.0 || ^16.0",
"prop-types": "15.6.0"
},
"devDependencies": {
"bee-animate": "latest",
"bee-button": "latest",
"bee-checkbox": "^0.2.4",
"bee-datepicker": "^0.1.7",
"bee-form-control": "^0.1.8",
"bee-icon": "0.0.5",
"bee-input-group": "^0.1.12",
"bee-checkbox": "latest",
"bee-datepicker": "latest",
"bee-form-control": "latest",
"bee-icon": "latest",
"bee-input-group": "latest",
"bee-layout": "latest",
"bee-pagination": "^0.1.7",
"bee-pagination": "latest",
"bee-panel": "latest",
"bee-popconfirm": "^0.2.2",
"bee-select": "^0.1.6",
"bee-tools": "^0.3.2",
"bee-popconfirm": "latest",
"bee-select": "latest",
"bee-tools": "latest",
"chai": "^3.5.0",
"console-polyfill": "~0.2.1",
"enzyme": "^2.4.1",