增加主题定制

This commit is contained in:
yangchch6 2019-02-20 15:16:58 +08:00
parent 7b8f68df48
commit 0f0707f552
10 changed files with 28436 additions and 22778 deletions

View File

@ -178,13 +178,25 @@
.u-table th ::last-child {
overflow: hidden; }
.u-table td {
border-bottom: 1px solid #e9e9e9; }
border-bottom: 1px solid rgb(233,233,233); }
.u-table td a {
color: rgb(30,136,229); }
.u-table td a:hover {
color: rgb(66,165,245); }
.u-table td a:active {
color: rgb(21,101,192); }
.u-table tr:hover {
background: #E7F2FC; }
background: rgb(227,242,253); }
.u-table tr:hover td .uf-eye {
visibility: visible !important; }
.u-table tr tr a {
color: rgb(30,136,229); }
.u-table tr tr a:hover {
color: rgb(66,165,245); }
.u-table tr tr a:active {
color: rgb(21,101,192); }
.u-table tr.tr-row-hover {
background: #E7F2FC; }
background: rgb(227,242,253); }
.u-table th,
.u-table td {
padding: 12px 8px;
@ -197,23 +209,24 @@
.u-table tr.filterable th .filterContext {
height: 35px; }
.u-table-row-hover {
background: #e3f2fd; }
background: rgb(227,242,253); }
.u-table-scroll {
overflow: auto; }
.u-table-bordered table {
border: 1px solid #e9e9e9;
border: 1px solid rgb(233,233,233);
box-sizing: border-box;
table-layout: fixed; }
.u-table-bordered th {
border-bottom: 1px solid #e9e9e9;
border-bottom: 1px solid rgb(233,233,233);
box-sizing: border-box; }
.u-table-bordered th,
.u-table-bordered td {
border-right: 1px solid #e9e9e9;
border-right: 1px solid rgb(233,233,233);
box-sizing: border-box; }
.u-table-header {
overflow: hidden;
background: #f7f7f7; }
background: rgb(247,247,247);
color: rgb(102, 102, 102); }
.u-table.fixed-height td {
padding: 0px 8px; }
.u-table-fixed-header .u-table-body {
@ -235,12 +248,12 @@
box-sizing: border-box; }
.u-table-title {
padding: 12px 8px;
border-top: 1px solid #e9e9e9; }
border-top: 1px solid rgb(233,233,233); }
.u-table-content {
position: relative; }
.u-table-footer {
padding: 12px 8px;
border-bottom: 1px solid #e9e9e9; }
border-bottom: 1px solid rgb(233,233,233); }
.u-table-footer .u-table-scroll {
overflow-x: hidden; }
.u-table-footer .u-table {
@ -248,7 +261,7 @@
.u-table-placeholder {
padding: 12px 8px;
background: #fff;
border-bottom: 1px solid #e9e9e9;
border-bottom: 1px solid rgb(233,233,233);
text-align: center;
position: relative; }
.u-table-expand-icon-col {
@ -261,7 +274,7 @@
height: 16px;
text-align: center;
line-height: 16px;
border: 1px solid #e9e9e9;
border: 1px solid rgb(233,233,233);
user-select: none;
background: #fff;
margin-right: 10px; }
@ -273,6 +286,8 @@
content: "-"; }
.u-table-row-collapsed:after, .u-table-expanded-row-collapsed:after {
content: "+"; }
.u-table-row.selected {
background: rgb(227,242,253); }
.u-table tr.u-table-expanded-row {
background: #f7f7f7; }
.u-table tr.u-table-expanded-row:hover {
@ -335,7 +350,8 @@
.u-table-thead .filter-wrap .filter-btns {
min-width: 58px; }
.u-table-thead th {
background: #f7f7f7;
background: rgb(247,247,247);
color: rgb(102, 102, 102);
background-clip: padding-box;
-moz-user-select: -moz-none;
-khtml-user-select: none;
@ -387,7 +403,7 @@
.u-table-thead .th-drag {
cursor: move; }
.u-table-thead .th-drag:hover {
background: #e3f2fd; }
background: rgb(227,242,253); }
.u-table-thead .th-drag-hover {
background: #ccc; }
.u-table-thead-th {
@ -466,7 +482,7 @@
.u-table.bordered th,
.u-table.bordered td {
border: 1px solid #e9e9e9; }
border: 1px solid rgb(233,233,233); }
.move-enter,
.move-appear {

View File

@ -1,7 +1,7 @@
'use strict';
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; };
@ -36,137 +36,137 @@ var cloneDeep = require('lodash.clonedeep');
function dragColumn(Table) {
return function (_Component) {
_inherits(DragColumn, _Component);
return function (_Component) {
_inherits(DragColumn, _Component);
function DragColumn(props) {
_classCallCheck(this, DragColumn);
function DragColumn(props) {
_classCallCheck(this, DragColumn);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da, i) {
da.dragIndex = i;
da.drgHover = false;
});
return _column;
};
_this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da, i) {
da.dragIndex = i;
da.drgHover = false;
});
return _column;
};
_this.onDrop = function (event, data) {
var dragSource = data.dragSource,
dragTarg = data.dragTarg;
var columns = _this.state.columns;
_this.onDrop = function (event, data) {
var dragSource = data.dragSource,
dragTarg = data.dragTarg;
var columns = _this.state.columns;
var sourceIndex = -1,
targetIndex = -1;
var sourceIndex = -1,
targetIndex = -1;
sourceIndex = columns.findIndex(function (da, i) {
return da.key == dragSource.key;
});
targetIndex = columns.findIndex(function (da, i) {
return da.key == dragTarg.key;
});
// for (let index = 0; index < columns.length; index++) {
// const da = columns[index];
// if(da.key === dragSource.key){
// columns[index] = dragTargColum;
// }
// if(da.key === dragTarg.key){
// columns[index] = dragSourceColum;
// }
// }
// 向前移动
if (targetIndex < sourceIndex) {
targetIndex = targetIndex + 1;
sourceIndex = columns.findIndex(function (da, i) {
return da.key == dragSource.key;
});
targetIndex = columns.findIndex(function (da, i) {
return da.key == dragTarg.key;
});
// for (let index = 0; index < columns.length; index++) {
// const da = columns[index];
// if(da.key === dragSource.key){
// columns[index] = dragTargColum;
// }
// if(da.key === dragTarg.key){
// columns[index] = dragSourceColum;
// }
// }
// 向前移动
if (targetIndex < sourceIndex) {
targetIndex = targetIndex + 1;
}
columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]);
_this.setState({
columns: cloneDeep(columns)
});
if (_this.props.onDrop) {
_this.props.onDrop(event, data, columns);
}
};
_this.getTarget = function (evt) {
return evt.target || evt.srcElement;
};
_this.state = {
columns: _this.setColumOrderByIndex(props.columns)
};
return _this;
}
columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]);
_this.setState({
columns: cloneDeep(columns)
DragColumn.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.columns != this.props.columns) {
this.setState({
columns: this.setColumOrderByIndex(nextProps.columns)
});
}
};
DragColumn.prototype.cloneDeep = function cloneDeep(obj) {
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || Object.keys(obj).length === 0) {
return obj;
}
var resultData = {};
return this.recursion(obj, resultData);
};
DragColumn.prototype.recursion = function (_recursion) {
function recursion(_x) {
return _recursion.apply(this, arguments);
}
recursion.toString = function () {
return _recursion.toString();
};
return recursion;
}(function (obj) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
for (key in obj) {
if (_typeof(obj[key]) == 'object' && Object.keys(obj[key].length > 0)) {
data[key] = recursion(obj[key]);
} else {
data[key] = obj[key];
}
}
return data;
});
if (_this.props.onDrop) {
_this.props.onDrop(event, data, columns);
}
};
_this.getTarget = function (evt) {
return evt.target || evt.srcElement;
};
DragColumn.prototype.render = function render() {
var _props = this.props,
data = _props.data,
dragborder = _props.dragborder,
draggable = _props.draggable,
className = _props.className,
columns = _props.columns,
onDragStart = _props.onDragStart,
onDragEnter = _props.onDragEnter,
onDragOver = _props.onDragOver,
onDrop = _props.onDrop,
others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className', 'columns', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDrop']);
_this.state = {
columns: _this.setColumOrderByIndex(props.columns)
};
return _this;
}
var key = new Date().getTime();
return _react2["default"].createElement(Table, _extends({}, others, {
columns: this.state.columns,
data: data,
className: className + ' u-table-drag-border',
onDragStart: this.onDragStart,
onDragOver: this.onDragOver,
onDrop: this.onDrop,
onDragEnter: this.onDragEnter,
draggable: draggable,
dragborder: dragborder
// dragborder={false}
, dragborderKey: key
}));
};
DragColumn.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.columns != this.props.columns) {
this.setState({
columns: this.setColumOrderByIndex(nextProps.columns)
});
}
};
DragColumn.prototype.cloneDeep = function cloneDeep(obj) {
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || Object.keys(obj).length === 0) {
return obj;
}
var resultData = {};
return this.recursion(obj, resultData);
};
DragColumn.prototype.recursion = function (_recursion) {
function recursion(_x) {
return _recursion.apply(this, arguments);
}
recursion.toString = function () {
return _recursion.toString();
};
return recursion;
}(function (obj) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
for (key in obj) {
if (_typeof(obj[key]) == 'object' && Object.keys(obj[key].length > 0)) {
data[key] = recursion(obj[key]);
} else {
data[key] = obj[key];
}
}
return data;
});
DragColumn.prototype.render = function render() {
var _props = this.props,
data = _props.data,
dragborder = _props.dragborder,
draggable = _props.draggable,
className = _props.className,
columns = _props.columns,
onDragStart = _props.onDragStart,
onDragEnter = _props.onDragEnter,
onDragOver = _props.onDragOver,
onDrop = _props.onDrop,
others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className', 'columns', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDrop']);
var key = new Date().getTime();
return _react2["default"].createElement(Table, _extends({}, others, {
columns: this.state.columns,
data: data,
className: className + ' u-table-drag-border',
onDragStart: this.onDragStart,
onDragOver: this.onDragOver,
onDrop: this.onDrop,
onDragEnter: this.onDragEnter,
draggable: draggable,
dragborder: dragborder
// dragborder={false}
, dragborderKey: key
}));
};
return DragColumn;
}(_react.Component);
return DragColumn;
}(_react.Component);
}
module.exports = exports['default'];

View File

@ -1,7 +1,7 @@
'use strict';
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; };
@ -20,29 +20,29 @@ exports.ObjectAssign = ObjectAssign;
*/
function sortBy(arr, prop, desc) {
var props = [],
ret = [],
i = 0,
len = arr.length;
if (typeof prop == 'string') {
for (; i < len; i++) {
var oI = arr[i];
(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 '参数类型错误';
var props = [],
ret = [],
i = 0,
len = arr.length;
if (typeof prop == 'string') {
for (; i < len; i++) {
var oI = arr[i];
(props[i] = new String(oI && oI[prop] || ''))._obj = oI;
}
props.sort();
for (i = 0; i < len; i++) {
ret[i] = props[i]._obj;
} else if (typeof prop == 'function') {
for (; i < len; i++) {
var _oI = arr[i];
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
}
if (desc) ret.reverse();
return ret;
} else {
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
*/
function compare(property) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
};
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
};
}
/**
@ -63,17 +63,17 @@ function compare(property) {
* @param {*} obj 要拷贝的对象
*/
function ObjectAssign(obj) {
var b = obj instanceof Array;
var tagObj = b ? [] : {};
if (b) {
//数组
obj.forEach(function (da) {
var _da = {};
_extends(_da, da);
tagObj.push(_da);
});
} else {
_extends(tagObj, obj);
}
return tagObj;
var b = obj instanceof Array;
var tagObj = b ? [] : {};
if (b) {
//数组
obj.forEach(function (da) {
var _da = {};
_extends(_da, da);
tagObj.push(_da);
});
} else {
_extends(tagObj, obj);
}
return tagObj;
}

File diff suppressed because one or more lines are too long

514
dist/demo.css vendored

File diff suppressed because it is too large Load Diff

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

50273
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

@ -46,7 +46,7 @@
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"dependencies": {
"bee-button": "^1.0.6",
"bee-button": "^2.0.2",
"bee-datepicker": "latest",
"bee-dnd": "^1.0.2",
"bee-dropdown": "^1.0.1",
@ -76,7 +76,7 @@
"devDependencies": {
"babel-jest": "^22.0.4",
"bee-animate": "latest",
"bee-checkbox": "^1.1.1",
"bee-checkbox": "^2.0.1",
"bee-form": "1.1.10",
"bee-input-group": "latest",
"bee-layout": "latest",

View File

@ -5,11 +5,13 @@
$text-color: #666;
$font-size-base: 12px;
$line-height: 1.5;
$table-border-color: $border-color-base;
$table-head-background-color: #f7f7f7;
// 主题定制border
$table-border-color: unquote("rgb(#{$table-border-color-base})");
// $table-head-background-color: #f7f7f7;
// $table-head-text-color: #666;
$vertical-padding: 12px;
$horizontal-padding: 8px;
$table-border-color: #e9e9e9;
// $table-border-color: #e9e9e9;
$table-hover-color: #E7F2FC;
$table-move-in-color: $bg-color-base;
@ -54,21 +56,39 @@ $checkbox-height:16px;
td {
border-bottom: 1px solid $table-border-color;
a{
color: $brand-primary;
&:hover{
color: $brand-primary-hover;
}
&:active{
color: $brand-primary-active;
}
}
}
tr {
// transition: all 0.3s ease;
&:hover {
background: $table-hover-color;
background: $hover-bg-color-base;
td {
.uf-eye{
visibility: visible !important;
}
}
}
tr a{
color: $brand-primary;
&:hover{
color: $brand-primary-hover;
}
&:active{
color: $brand-primary-active;
}
}
}
tr.tr-row-hover {
background: $table-hover-color;
background: $hover-bg-color-base;
}
th,
@ -91,7 +111,7 @@ $checkbox-height:16px;
}
}
&-row-hover {
background: rgb(227, 242, 253);
background: $hover-bg-color-base;
}
&-scroll {
@ -99,24 +119,25 @@ $checkbox-height:16px;
}
&-bordered {
table {
border: 1px solid #e9e9e9;
border: 1px solid $table-border-color;
box-sizing: border-box;
table-layout: fixed;
// width:auto;
}
th {
border-bottom: 1px solid #e9e9e9;
border-bottom: 1px solid $table-border-color;
box-sizing: border-box;
}
th,
td {
border-right: 1px solid #e9e9e9;
border-right: 1px solid $table-border-color;
box-sizing: border-box;
}
}
&-header {
overflow: hidden;
background: $table-head-background-color;
color: $table-head-text-color;
}
&.fixed-height td {
@ -211,6 +232,11 @@ $checkbox-height:16px;
content: "+";
}
}
&-row{
&.selected{
background: $hover-bg-color-base;
}
}
tr.u-table-expanded-row {
background: #f7f7f7;
&:hover {
@ -312,6 +338,7 @@ $checkbox-height:16px;
}
th{
background: $table-head-background-color;
color: $table-head-text-color;
background-clip:padding-box;
//禁止选中文字
-moz-user-select: -moz-none;
@ -383,7 +410,7 @@ $checkbox-height:16px;
cursor: move;
}
.th-drag:hover{
background: rgb(227,242,253);
background: $hover-bg-color-base;
}
//为了区分是拖拽宽度还是交换列先注释上面了
// .th-drag:hover{