From 056fbc03d13fe7e835e0d62f5e849d528361e089 Mon Sep 17 00:00:00 2001 From: jonymrshi Date: Mon, 23 Oct 2017 14:19:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?react=2016=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/render/InputRender.js | 23 ++++++++++++++++++++++- index.html | 4 ++-- package.json | 27 ++++++++++++++++----------- 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/build/render/InputRender.js b/build/render/InputRender.js index 2599309..2bbe85d 100644 --- a/build/render/InputRender.js +++ b/build/render/InputRender.js @@ -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 }, diff --git a/index.html b/index.html index d99b748..599cd35 100644 --- a/index.html +++ b/index.html @@ -15,8 +15,8 @@ - - + + diff --git a/package.json b/package.json index 3e1f936..82e981d 100644 --- a/package.json +++ b/package.json @@ -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", From 440131773a5610e5505403f194ce929c50f6cda0 Mon Sep 17 00:00:00 2001 From: zhaoyuu Date: Mon, 23 Oct 2017 15:42:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fixed:=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 5532612..3c382d4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -55,4 +55,4 @@ {% include "mixin.md"%} -{% include "rendertype.md"%} \ No newline at end of file +{% include "rendertype.md"%} From 53ca08280e932db7786b0ecc0c120b467fb8aca8 Mon Sep 17 00:00:00 2001 From: zhaoyuu Date: Mon, 23 Oct 2017 15:50:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fixed:=E6=96=87=E6=A1=A3=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index 3c382d4..23c9031 100644 --- a/docs/api.md +++ b/docs/api.md @@ -33,7 +33,7 @@ |title|表格标题|function|-| |footer|表格尾部|function|-| |emptyText|无数据时显示的内容|function|() => 'No Data'| -|scroll|横向或纵向支持滚动,也可用于指定滚动区域的宽高度:{{ x: true, y: 300 }}|object|{}| +|scroll|横向或纵向支持滚动,也可用于指定滚动区域的宽高度:{ x: true, y: 300 }|object|{}| |rowRef|获取行的ref|Function(record, index, indent):string|() => null| |getBodyWrapper|添加对table body的包装|Function(body)|body => body|