[Feature]左侧展开收起图标的行高由16px改为14px

This commit is contained in:
yangchch6 2019-04-25 16:57:19 +08:00
parent 0d4bdeb4ec
commit f04b26e573
17 changed files with 568 additions and 345 deletions

View File

@ -146,7 +146,7 @@
width: 16px; width: 16px;
height: 16px; height: 16px;
text-align: center; text-align: center;
line-height: 16px; line-height: 14px;
border: 1px solid rgb(193, 199, 208); border: 1px solid rgb(193, 199, 208);
user-select: none; user-select: none;
background: #fff; background: #fff;
@ -162,9 +162,9 @@
.u-table-row.selected { .u-table-row.selected {
background: #FFF7E7; } background: #FFF7E7; }
.u-table tr.u-table-expanded-row { .u-table tr.u-table-expanded-row {
background: #f7f7f7; } background: #DFE1E6; }
.u-table tr.u-table-expanded-row:hover { .u-table tr.u-table-expanded-row:hover {
background: #f7f7f7; } background: #DFE1E6; }
.u-table tr.u-table-expanded-row .u-table { .u-table tr.u-table-expanded-row .u-table {
z-index: 1; } z-index: 1; }
.u-table-column-hidden { .u-table-column-hidden {

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@ -20,29 +20,29 @@ exports.ObjectAssign = ObjectAssign;
*/ */
function sortBy(arr, prop, desc) { function sortBy(arr, prop, desc) {
var props = [], var props = [],
ret = [], ret = [],
i = 0, i = 0,
len = arr.length; len = arr.length;
if (typeof prop == 'string') { if (typeof prop == 'string') {
for (; i < len; i++) { for (; i < len; i++) {
var oI = arr[i]; var oI = arr[i];
(props[i] = new String(oI && oI[prop] || ''))._obj = oI; (props[i] = new String(oI && oI[prop] || ''))._obj = oI;
}
} else if (typeof prop == 'function') {
for (; i < len; i++) {
var _oI = arr[i];
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
}
} else {
throw '参数类型错误';
} }
props.sort(); } else if (typeof prop == 'function') {
for (i = 0; i < len; i++) { for (; i < len; i++) {
ret[i] = props[i]._obj; var _oI = arr[i];
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
} }
if (desc) ret.reverse(); } else {
return ret; throw '参数类型错误';
}
props.sort();
for (i = 0; i < len; i++) {
ret[i] = props[i]._obj;
}
if (desc) ret.reverse();
return ret;
}; };
/** /**
@ -51,11 +51,11 @@ function sortBy(arr, prop, desc) {
* @param {} property * @param {} property
*/ */
function compare(property) { function compare(property) {
return function (a, b) { return function (a, b) {
var value1 = a[property]; var value1 = a[property];
var value2 = b[property]; var value2 = b[property];
return value1 - value2; return value1 - value2;
}; };
} }
/** /**
@ -63,17 +63,17 @@ function compare(property) {
* @param {*} obj 要拷贝的对象 * @param {*} obj 要拷贝的对象
*/ */
function ObjectAssign(obj) { function ObjectAssign(obj) {
var b = obj instanceof Array; var b = obj instanceof Array;
var tagObj = b ? [] : {}; var tagObj = b ? [] : {};
if (b) { if (b) {
//数组 //数组
obj.forEach(function (da) { obj.forEach(function (da) {
var _da = {}; var _da = {};
_extends(_da, da); _extends(_da, da);
tagObj.push(_da); tagObj.push(_da);
}); });
} else { } else {
_extends(tagObj, obj); _extends(tagObj, obj);
} }
return tagObj; return tagObj;
} }

View File

@ -11,49 +11,20 @@ import {Button,Tooltip} from "tinper-bee";
import Table from "../../src"; import Table from "../../src";
const columns = [ const columns = [
{ { title: "员工编号", dataIndex: "a", key: "a", width: 150 },
title: "员工编号", dataIndex: "a", key: "a", width: 120, className: "rowClassName", { title: "员工姓名", dataIndex: "b", key: "b", width:100},
fixed:'left', { title: "性别", dataIndex: "c", key: "c", width: 100},
render: (text, record, index) => {
return (
<Tooltip inverse overlay={text}>
<span tootip={text} style={{
display: "block",
width: "80px",
textOverflow: "ellipsis",
overflow: "hidden",
whiteSpace: "nowrap",
verticalAlign: "bottom",
}}>{text}</span>
</Tooltip>
);
}
},
{ title: "员工姓名", dataIndex: "b", key: "b", width:100 },
{ title: "性别", dataIndex: "c", key: "c", width: 100 },
{ title: "部门", dataIndex: "d", key: "d", width: 100 }, { title: "部门", dataIndex: "d", key: "d", width: 100 },
{ title: "职级", dataIndex: "e", key: "e", width: 100 } { title: "职级", dataIndex: "e", key: "e", width: 100 }
]; ];
const data = [ const data = [
{ a: "ASVAL_201903280005", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" }, { a: "ASVAL_20190328", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" },
{ a: "ASVAL_201903200004", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" }, { a: "ASVAL_20190320", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" },
{ a: "ASVAL_201903120002", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" } { a: "ASVAL_20190312", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" }
]; ];
class Demo01 extends Component { class Demo0101 extends Component {
constructor(props) {
super(props);
this.state = {
data: data
}
}
handleClick = () => {
console.log('这是第' , this.currentIndex , '行');
console.log('内容:' , this.currentRecord);
}
render() { render() {
return ( return (
<Table <Table
@ -64,4 +35,4 @@ class Demo01 extends Component {
} }
} }
export default Demo01; export default Demo0101;

View File

@ -9,9 +9,8 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import Table from '../../src'; import Table from '../../src';
import Icon from 'bee-icon';
const columns02 = [ const columns = [
{ {
title: "员工编号", title: "员工编号",
dataIndex: "num", dataIndex: "num",
@ -31,7 +30,7 @@ const columns02 = [
} }
]; ];
const data02 = []; const data = [];
// 在此自定义无数据时的展示内容 // 在此自定义无数据时的展示内容
const emptyFunc = () => 'No Data'; const emptyFunc = () => 'No Data';
@ -40,8 +39,8 @@ class Demo02 extends Component {
render() { render() {
return ( return (
<Table <Table
columns={columns02} columns={columns}
data={data02} data={data}
// emptyText={emptyFunc} // emptyText={emptyFunc}
/> />
) )

View File

@ -2,7 +2,7 @@
* *
* @title 固定表头 * @title 固定表头
* @parent 基础 Basic * @parent 基础 Basic
* @description 设置`scroll.y`指定滚动区域的高度达到固定表头效果 * @description 设置`scroll.y`指定滚动区域的高度达到固定表头效果
* demo0103 * demo0103
*/ */

39
demo/demolist/Demo0107.js Normal file
View File

@ -0,0 +1,39 @@
/**
*
* @title 带边框
* @parent 基础 Basic
* @description 设置 `bordered` 属性可添加表格边框线
* demo0107
*/
import React, { Component } from "react";
import {Button,Tooltip} from "tinper-bee";
import Table from "../../src";
const columns = [
{ title: "员工编号", dataIndex: "a", key: "a", width: 150 },
{ title: "员工姓名", dataIndex: "b", key: "b", width:100},
{ title: "性别", dataIndex: "c", key: "c", width: 100},
{ title: "部门", dataIndex: "d", key: "d", width: 100 },
{ title: "职级", dataIndex: "e", key: "e", width: 100 }
];
const data = [
{ a: "ASVAL_20190328", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" },
{ a: "ASVAL_20190320", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" },
{ a: "ASVAL_20190312", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" }
];
class Demo06 extends Component {
render() {
return (
<Table
columns={columns}
data={data}
bordered
/>
);
}
}
export default Demo06;

File diff suppressed because one or more lines are too long

6
dist/demo.css vendored
View File

@ -146,7 +146,7 @@
width: 16px; width: 16px;
height: 16px; height: 16px;
text-align: center; text-align: center;
line-height: 16px; line-height: 14px;
border: 1px solid rgb(193, 199, 208); border: 1px solid rgb(193, 199, 208);
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
@ -165,9 +165,9 @@
.u-table-row.selected { .u-table-row.selected {
background: #FFF7E7; } background: #FFF7E7; }
.u-table tr.u-table-expanded-row { .u-table tr.u-table-expanded-row {
background: #f7f7f7; } background: #DFE1E6; }
.u-table tr.u-table-expanded-row:hover { .u-table tr.u-table-expanded-row:hover {
background: #f7f7f7; } background: #DFE1E6; }
.u-table tr.u-table-expanded-row .u-table { .u-table tr.u-table-expanded-row .u-table {
z-index: 1; } z-index: 1; }
.u-table-column-hidden { .u-table-column-hidden {

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

574
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

@ -48,16 +48,16 @@
"dependencies": { "dependencies": {
"bee-button": "latest", "bee-button": "latest",
"bee-checkbox": "latest", "bee-checkbox": "latest",
"bee-datepicker": "^2.0.9", "bee-datepicker": "^2.0.28",
"bee-dropdown": "^2.0.3", "bee-dropdown": "^2.0.4",
"bee-form-control": "latest", "bee-form-control": "latest",
"bee-icon": "latest", "bee-icon": "latest",
"bee-input-number": "^2.0.5", "bee-input-number": "^2.0.7",
"bee-loading": "^1.0.6", "bee-loading": "^1.0.9",
"bee-locale": "0.0.11", "bee-locale": "0.0.13",
"bee-menus": "^2.0.2", "bee-menus": "^2.0.6",
"bee-radio": "^2.0.8", "bee-radio": "^2.0.8",
"bee-select": "^2.0.9", "bee-select": "^2.0.11",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"component-classes": "^1.2.6", "component-classes": "^1.2.6",
"lodash.clonedeep": "^4.5.0", "lodash.clonedeep": "^4.5.0",

View File

@ -270,7 +270,7 @@ $icon-color:#505F79;
width: 16px; width: 16px;
height: 16px; height: 16px;
text-align: center; text-align: center;
line-height: 16px; line-height: 14px;
border: 1px solid $table-border-color; border: 1px solid $table-border-color;
user-select: none; user-select: none;
background: #fff; background: #fff;
@ -297,9 +297,9 @@ $icon-color:#505F79;
} }
} }
tr.u-table-expanded-row { tr.u-table-expanded-row {
background: #f7f7f7; background: #DFE1E6;
&:hover { &:hover {
background: #f7f7f7; background: #DFE1E6;
} }
.u-table { .u-table {
// padding: 0 40px 0 20px; // padding: 0 40px 0 20px;