This commit is contained in:
huayj 2019-08-26 16:56:59 +08:00
parent fccea4eb05
commit 3a0460c70d
9 changed files with 1382 additions and 1170 deletions

View File

@ -845,6 +845,12 @@
vertical-align: middle;
overflow: hidden; }
.body-dispaly-in-row .u-table-fieldtype {
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
overflow: hidden; }
.u-table-drag-hidden-cont {
position: absolute;
top: -1000px; }

View File

@ -843,17 +843,17 @@ var Table = function (_Component) {
switch (props.showRowNum.type) {
case 'number':
{
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + 1;
break;
}
case 'ascii':
{
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || 0).charCodeAt());
data[i][props.showRowNum.key || '_index'] = String.fromCharCode(i + (props.showRowNum.base || '0').charCodeAt());
break;
}
default:
{
data[i][props.showRowNum.key || '_index'] = i + (props.showRowNum.base || 0);
data[i][props.showRowNum.key || '_index'] = (props.showRowNum.base || 0) + 1;
break;
}
}

View File

@ -75,7 +75,7 @@ var TableCell = function (_Component) {
var link = function link() {
window.open(linkUrl, linkType || '_blank');
};
var cls = 'u-table-link ';
var cls = 'u-table-link u-table-fieldtype ';
if (className) {
cls += className + ' ';
}
@ -122,10 +122,14 @@ var TableCell = function (_Component) {
_this.renderNumber = function (data) {
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
var precision = config.precision,
thousand = config.thousand,
makeUp = config.makeUp,
preSymbol = config.preSymbol,
nextSymbol = config.nextSymbol;
console.log(config);
var number = (0, _utils.formatMoney)(data, config.precision, config.thousand);
if (config.makeUp === false && number !== '0') {
var number = (0, _utils.formatMoney)(data, precision, thousand);
if (makeUp === false && number !== '0') {
number = number.replace(/0*$/, '').replace(/\.$/, '');
}
var numberWidth = parseInt(width) - 16; // 减去默认的左右padding共计16px
@ -134,25 +138,38 @@ var TableCell = function (_Component) {
{ className: 'u-table-currency-number' },
number
);
var pre = config.preSymbol ? _react2["default"].createElement(
var pre = preSymbol ? _react2["default"].createElement(
'span',
{ className: 'u-table-currency-pre' },
config.preSymbol
preSymbol
) : null;
var next = config.nextSymbol ? _react2["default"].createElement(
var next = nextSymbol ? _react2["default"].createElement(
'span',
{ className: 'u-table-currency-next' },
config.nextSymbol
nextSymbol
) : null;
var title = '';
title += typeof preSymbol === 'string' ? preSymbol : '';
title += number;
title += typeof nextSymbol === 'string' ? nextSymbol : '';
return _react2["default"].createElement(
'span',
{ className: 'u-table-currency', style: { width: numberWidth } },
{ className: 'u-table-currency u-table-fieldtype', style: { width: numberWidth }, title: title },
pre,
res,
next
);
};
_this.renderDate = function (data) {
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var moment = config.moment,
format = config.format;
if (!moment) return data;
return moment(data).format(format || 'YYYY-MM-DD');
};
_this.isInvalidRenderCellText = _this.isInvalidRenderCellText.bind(_this);
_this.handleClick = _this.handleClick.bind(_this);
return _this;
@ -181,6 +198,9 @@ var TableCell = function (_Component) {
// 渲染整数/货币类型
// 渲染时间类型
TableCell.prototype.render = function render() {
var _props2 = this.props,
record = _props2.record,
@ -249,7 +269,7 @@ var TableCell = function (_Component) {
case 'number':
{
var _config = {
precision: 2, // 精度值,需要大于0
precision: 0, // 精度值,需要大于0
thousand: true, // 是否显示千分符号
makeUp: false, // 末位是否补零
preSymbol: '', // 前置符号
@ -258,6 +278,11 @@ var TableCell = function (_Component) {
text = this.renderNumber(text, _extends({}, _config, column.numberConfig), column.width);
break;
}
case 'date':
{
text = this.renderDate(text, column.dateConfig);
break;
}
default:
{
break;
@ -290,7 +315,7 @@ var TableCell = function (_Component) {
} else if (column.textAlign) {
className = className + (' text-' + column.textAlign);
}
if (typeof text == 'string' && bodyDisplayInRow) {
if ((typeof text == 'string' || typeof text === 'number') && bodyDisplayInRow) {
title = text;
}
if (expandIcon && expandIcon.props.expandable) {

File diff suppressed because one or more lines are too long

16
dist/demo.css vendored
View File

@ -435,6 +435,8 @@
*/
-ms-user-select: none;
user-select: none; }
.u-table-thead th .required {
color: #F22C1D; }
.u-table-thead th .bee-table-column-sorter {
position: relative;
margin-left: 4px;
@ -588,6 +590,14 @@
.u-table .u-table-drag-hidden-cont {
width: 100px;
height: 40px; }
.u-table .u-table-link {
cursor: pointer;
color: #0073E1; }
.u-table .u-table-link-underline:hover {
text-decoration: underline; }
.u-table .u-table-currency {
display: inline-block;
text-align: right; }
.u-table:focus {
outline: none;
@ -826,6 +836,12 @@
vertical-align: middle;
overflow: hidden; }
.body-dispaly-in-row .u-table-fieldtype {
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
overflow: hidden; }
.u-table-drag-hidden-cont {
position: absolute;
top: -1000px; }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

2467
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "2.2.1-beta.3",
"version": "2.2.1-beta.5",
"description": "Table ui component for react",
"keywords": [
"react",
@ -92,4 +92,4 @@
"reqwest": "^2.0.5",
"tinper-bee": "latest"
}
}
}