Merge branch 'master' of github.com:tinper-bee/bee-table

This commit is contained in:
izbz wh 2019-06-04 16:54:53 +08:00
commit 49aee39c59
18 changed files with 87239 additions and 30629 deletions

View File

@ -1,3 +1,13 @@
<a name="2.1.0"></a>
# [2.1.0](https://github.com/tinper-bee/bee-table/compare/v2.0.25...v2.1.0) (2019-06-01)
### Bug Fixes
* 纵向滚动条动态显示 ([c0167c3](https://github.com/tinper-bee/bee-table/commit/c0167c3))
<a name="2.0.25"></a> <a name="2.0.25"></a>
## [2.0.25](https://github.com/tinper-bee/bee-table/compare/v2.0.24...v2.0.25) (2019-05-24) ## [2.0.25](https://github.com/tinper-bee/bee-table/compare/v2.0.24...v2.0.25) (2019-05-24)

View File

@ -153,6 +153,13 @@
.u-loading.u-loading-line.u-loading-line-warning > div { .u-loading.u-loading-line.u-loading-line-warning > div {
background-color: #ff9800; } background-color: #ff9800; }
.u-loading.u-loading-custom > div {
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%); }
@keyframes line-scale { @keyframes line-scale {
0% { 0% {
-webkit-transform: scaley(1); -webkit-transform: scaley(1);

View File

@ -1089,7 +1089,7 @@ var Table = function (_Component) {
var _drag_class = _this4.props.dragborder ? "table-drag-bordered" : ""; var _drag_class = _this4.props.dragborder ? "table-drag-bordered" : "";
return _react2["default"].createElement( return _react2["default"].createElement(
'table', 'table',
{ id: 'bee-table-uid', className: ' ' + tableClassName + ' table-bordered ' + _drag_class + ' ', style: tableStyle }, { className: ' ' + tableClassName + ' table-bordered ' + _drag_class + ' ', style: tableStyle },
_this4.getColGroup(columns, fixed), _this4.getColGroup(columns, fixed),
hasHead ? _this4.getHeader(columns, fixed) : null, hasHead ? _this4.getHeader(columns, fixed) : null,
tableBody tableBody

View File

@ -106,9 +106,9 @@ function sum(Table) {
return _this; return _this;
} }
/** /**
* 获取当前的表格类型 * 获取当前的表格类型
* *
*/ */

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; };
@ -9,71 +9,71 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
exports.sortBy = sortBy; exports.sortBy = sortBy;
exports.compare = compare; exports.compare = compare;
exports.ObjectAssign = ObjectAssign; exports.ObjectAssign = ObjectAssign;
/* /*
* 快速排序按某个属性或按获取排序依据的函数来排序. * 快速排序按某个属性或按获取排序依据的函数来排序.
* @method soryBy * @method soryBy
* @static * @static
* @param {array} arr 待处理数组 * @param {array} arr 待处理数组
* @param {string|function} prop 排序依据属性获取 * @param {string|function} prop 排序依据属性获取
* @param {boolean} desc 降序 * @param {boolean} desc 降序
* @return {array} 返回排序后的新数组 * @return {array} 返回排序后的新数组
*/ */
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;
}; };
/** /**
* 数组对象排序 * 数组对象排序
* console.log(arr.sort(compare('age'))) * console.log(arr.sort(compare('age')))
* @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;
}; };
} }
/** /**
* 简单数组数据对象拷贝 * 简单数组数据对象拷贝
* @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

@ -19,11 +19,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
/** /**
* 渲染checkbox * 渲染checkbox
* @param Checkbox * @param Checkbox
* @param Icon * @param Icon
* @returns {CheckboxRender} * @returns {CheckboxRender}
*/ */
function renderCheckbox(Checkbox, Icon) { function renderCheckbox(Checkbox, Icon) {
return function (_Component) { return function (_Component) {

View File

@ -28,12 +28,12 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
/** /**
* 渲染输入框 * 渲染输入框
* @param Form * @param Form
* @param Input * @param Input
* @param Icon * @param Icon
* @returns {InputRender} * @returns {InputRender}
*/ */
function renderInput(Form, Input, Icon) { function renderInput(Form, Input, Icon) {
var _class, _temp2; var _class, _temp2;

View File

@ -26,11 +26,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
/** /**
* 渲染下拉框 * 渲染下拉框
* @param Select * @param Select
* @param Icon * @param Icon
* @returns {SelectRender} * @returns {SelectRender}
*/ */
function renderSelect(Select, Icon) { function renderSelect(Select, Icon) {
var _class, _temp2; var _class, _temp2;

View File

@ -7,6 +7,7 @@
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import Button from 'bee-button';
import Table from "../../src"; import Table from "../../src";
const renderContent = (value, row, index) => { const renderContent = (value, row, index) => {
@ -167,8 +168,8 @@ class Demo15 extends Component {
let cols = this.state.colFlag?columns:columns1; let cols = this.state.colFlag?columns:columns1;
return ( return (
<div> <div>
<button onClick={this.onChange}>change列</button> <Button onClick={this.onChange} colors="secondary" style={{marginBottom:'8px'}}>change列</Button>
<Table columns={cols} data={data} bordered/> <Table columns={cols} data={data} bordered/>
</div> </div>
); );

View File

@ -7,7 +7,7 @@
*/ */
import React, { Component } from "react"; import React, { Component } from "react";
import { Radio } from "tinper-bee"; import Radio from "bee-radio";
import Table from "../../src"; import Table from "../../src";
import singleSelect from "../../src/lib/singleSelect.js"; import singleSelect from "../../src/lib/singleSelect.js";

File diff suppressed because one or more lines are too long

6
dist/demo.css vendored
View File

@ -142,6 +142,12 @@
.u-loading.u-loading-line.u-loading-line-warning > div { .u-loading.u-loading-line.u-loading-line-warning > div {
background-color: #ff9800; } background-color: #ff9800; }
.u-loading.u-loading-custom > div {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%); }
@keyframes line-scale { @keyframes line-scale {
0% { 0% {
transform: scaley(1); } transform: scaley(1); }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

117661
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

@ -161,6 +161,9 @@ Table 组件参数:
| getSelectedDataFunc | 返回当前选中的数据数组 | Function | 无 | | getSelectedDataFunc | 返回当前选中的数据数组 | Function | 无 |
| selectedRowIndex | 指定当前选中数据的 index | number | 无 | | selectedRowIndex | 指定当前选中数据的 index | number | 无 |
#### singleSelect 使用示例
- [单选功能](http://design.yonyoucloud.com/tinper-bee/bee-table#%E5%8D%95%E9%80%89%E5%8A%9F%E8%83%BD)
### multiSelect 多选功能 ### multiSelect 多选功能
@ -447,11 +450,11 @@ const CheckboxRender = renderCheckbox(Checkbox, Icon);
| 快捷键 | 快捷键说明 | 类型 | 默认值 | | 快捷键 | 快捷键说明 | 类型 | 默认值 |
| --- | :--- | --- |--- | | --- | :--- | --- |--- |
| focusable | 是否开启快捷键功能 | bool | - | focusable | 是否开启快捷键功能 | bool | false
| onKeyTab | tab快捷键可以处理默认选中第一条数据 | function| - | onKeyTab | tab快捷键可以处理默认选中第一条数据 | function| () => {}
| onKeyUp | ↑(上箭) 快捷键可以处理table的上一条数据 | function| - | onKeyUp | ↑(上箭) 快捷键可以处理table的上一条数据 | function| () => {}
| onKeyDown | ↓(下箭)快捷键可以处理table的下一条数据 | function| - | onKeyDown | ↓(下箭)快捷键可以处理table的下一条数据 | function| () => {}
| onTableKeyDown | 触发table的所有快捷键 | function| - | onTableKeyDown | 触发table的所有快捷键 | function| () => {}
| tabIndex | 设置焦点顺序 | number | 0 | tabIndex | 设置焦点顺序 | number | 0
## 注意事项 ## 注意事项

View File

@ -1,6 +1,6 @@
{ {
"name": "bee-table", "name": "bee-table",
"version": "2.0.26-beta.0", "version": "2.1.0",
"description": "Table ui component for react", "description": "Table ui component for react",
"keywords": [ "keywords": [
"react", "react",
@ -53,10 +53,10 @@
"bee-form-control": "latest", "bee-form-control": "latest",
"bee-icon": "latest", "bee-icon": "latest",
"bee-input-number": "^2.0.7", "bee-input-number": "^2.0.7",
"bee-loading": "^1.0.9", "bee-loading": "1.1.2",
"bee-locale": "0.0.14", "bee-locale": "0.0.14",
"bee-menus": "^2.0.6", "bee-menus": "^2.0.6",
"bee-radio": "^2.0.8", "bee-radio": "2.0.10",
"bee-select": "^2.0.11", "bee-select": "^2.0.11",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"component-classes": "^1.2.6", "component-classes": "^1.2.6",

View File

@ -940,7 +940,7 @@ class Table extends Component {
) : null; ) : null;
let _drag_class = this.props.dragborder ? "table-drag-bordered" : "" let _drag_class = this.props.dragborder ? "table-drag-bordered" : ""
return ( return (
<table id="bee-table-uid" className={` ${tableClassName} table-bordered ${_drag_class} `} style={tableStyle} > <table className={` ${tableClassName} table-bordered ${_drag_class} `} style={tableStyle} >
{/* {this.props.dragborder?null:this.getColGroup(columns, fixed)} */} {/* {this.props.dragborder?null:this.getColGroup(columns, fixed)} */}
{this.getColGroup(columns, fixed)} {this.getColGroup(columns, fixed)}
{hasHead ? this.getHeader(columns, fixed) : null} {hasHead ? this.getHeader(columns, fixed) : null}