From 6edb3d5dd422c6ab3000f6e3e3655426f9c2d8e5 Mon Sep 17 00:00:00 2001 From: huyueb <1062887235@qq.com> Date: Wed, 8 Nov 2017 15:54:23 +0800 Subject: [PATCH] publish 1.0.5 and --- build/Table.css | 99 ++++++++++++++++++++++++++++++++++++ build/render/DateRender.js | 4 +- build/render/InputRender.js | 29 ++++------- build/render/SelectRender.js | 23 ++++++++- package.json | 2 +- 5 files changed, 134 insertions(+), 23 deletions(-) diff --git a/build/Table.css b/build/Table.css index db69d16..3b2d165 100644 --- a/build/Table.css +++ b/build/Table.css @@ -203,3 +203,102 @@ padding: 0; top: 3px; right: 0; } + +.editable-cell { + position: relative; } + +.editable-cell-input-wrapper, +.editable-cell-text-wrapper { + padding-right: 24px; } + +.editable-cell-text-wrapper { + padding: 5px 24px 5px 5px; + height: 30px; } + +.editable-cell-icon, +.editable-cell-icon-check { + position: absolute; + top: 0; + right: 0; + width: 20px; + cursor: pointer; } + +.editable-cell-icon { + line-height: 28px; + display: none; } + +.editable-cell-icon-check { + line-height: 28px; } + +.editable-cell:hover .editable-cell-icon { + display: inline-block; } + +.editable-cell-icon:hover, +.editable-cell-icon-check:hover { + color: #2db7f5; } + +.editable-add-btn { + margin-bottom: 8px; } + +.search-component { + margin-bottom: 20px; } + .search-component .empty-search { + position: absolute; + right: 45px; + z-index: 20; + top: 5px; + color: #524e4e; + cursor: pointer; } + .search-component.u-input-group.simple { + float: right; } + .search-component.u-input-group.simple .u-form-control { + width: 251px; + background: #f5f5f5; + border-color: #f5f5f5; + border-radius: 20px; } + .search-component.u-input-group.simple .u-input-group-btn { + top: 3px; + right: 20px; + position: absolute; } + +.bee-table-column-sorter { + position: relative; + margin-left: 4px; + display: inline-block; + width: 14px; + height: 1em; + vertical-align: middle; + text-align: center; } + .bee-table-column-sorter > .bee-table-column-sorter-down, + .bee-table-column-sorter > .bee-table-column-sorter-up { + line-height: 6px; + display: block; + width: 14px; + cursor: pointer; } + +.bee-table-column-sorter-down.on .uf-triangle-down, +.bee-table-column-sorter-down.on .uf-triangle-up, +.bee-table-column-sorter-up.on .uf-triangle-down, +.bee-table-column-sorter-up.on .uf-triangle-up { + color: #108ee9; } + +.bee-table-column-sorter .uf-triangle-down, .bee-table-column-sorter .uf-triangle-up { + -webkit-filter: none; + filter: none; + font-size: 12px; } + +.bee-table-column-sorter .uf-triangle-down, .bee-table-column-sorter .uf-triangle-up { + display: inline-block; + padding: 0; + font-size: 12px; + font-size: 8px\9; + -webkit-transform: scale(0.66667) rotate(0deg); + -ms-transform: scale(0.66667) rotate(0deg); + transform: scale(0.66667) rotate(0deg); + -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand', M11=1, M12=0, M21=0, M22=1)"; + zoom: 1; + line-height: 4px; + height: 4px; + color: #999; + -webkit-transition: all .3s; + transition: all .3s; } diff --git a/build/render/DateRender.js b/build/render/DateRender.js index f202d25..ee43491 100644 --- a/build/render/DateRender.js +++ b/build/render/DateRender.js @@ -51,7 +51,7 @@ var DateRender = function (_Component) { var _ref = _this.props || "YYYY-MM-DD", format = _ref.format; - var value = e.format(format); + var value = e ? e.format(format) : ""; _this.setState({ value: value, editable: false }); if (_this.props.onChange) { _this.props.onChange(value); @@ -77,7 +77,7 @@ var DateRender = function (_Component) { var isclickTrigger = this.props.isclickTrigger; var cellContent = ""; - var date_value = (0, _moment2["default"])(value); + var date_value = value ? (0, _moment2["default"])(value) : value; if (editable) { cellContent = isclickTrigger ? _react2["default"].createElement( "div", diff --git a/build/render/InputRender.js b/build/render/InputRender.js index 8a65163..e102c65 100644 --- a/build/render/InputRender.js +++ b/build/render/InputRender.js @@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", { 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 _react = require("react"); var _react2 = _interopRequireDefault(_react); @@ -32,6 +34,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; } +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } @@ -107,6 +111,7 @@ var InputRender = function (_Component) { var _state = this.state, value = _state.value, editable = _state.editable; + var _props = this.props, name = _props.name, placeholder = _props.placeholder, @@ -114,12 +119,8 @@ var InputRender = function (_Component) { format = _props.format, formItemClassName = _props.formItemClassName, mesClassName = _props.mesClassName, - isRequire = _props.isRequire, check = _props.check, - method = _props.method, - errorMessage = _props.errorMessage, - reg = _props.reg, - htmlType = _props.htmlType; + other = _objectWithoutProperties(_props, ["name", "placeholder", "isclickTrigger", "format", "formItemClassName", "mesClassName", "check"]); var cellContent = ""; if (editable) { @@ -128,18 +129,13 @@ var InputRender = function (_Component) { { className: "editable-cell-input-wrapper" }, _react2["default"].createElement( _beeForm2["default"].FormItem, - { + _extends({ className: "formItem-style " + formItemClassName, mesClassName: "errMessage-style " + mesClassName, - isRequire: isRequire, change: this.handleChange, blur: this.check, - htmlType: htmlType, - method: method, - errorMessage: errorMessage, - reg: reg, check: this.checkValidate - }, + }, other), _react2["default"].createElement(_beeFormControl2["default"], { name: name, placeholder: placeholder, @@ -153,18 +149,13 @@ var InputRender = function (_Component) { { className: "editable-cell-input-wrapper" }, _react2["default"].createElement( _beeForm2["default"].FormItem, - { + _extends({ className: "formItem-style " + formItemClassName, mesClassName: "errMessage-style " + mesClassName, - isRequire: isRequire, change: this.handleChange, blur: this.check, - htmlType: htmlType, - method: method, - errorMessage: errorMessage, - reg: reg, check: this.checkValidate - }, + }, other), _react2["default"].createElement(_beeFormControl2["default"], { name: name, placeholder: placeholder, diff --git a/build/render/SelectRender.js b/build/render/SelectRender.js index 507c49e..c243674 100644 --- a/build/render/SelectRender.js +++ b/build/render/SelectRender.js @@ -10,6 +10,10 @@ var _react = require("react"); var _react2 = _interopRequireDefault(_react); +var _propTypes = require("prop-types"); + +var _propTypes2 = _interopRequireDefault(_propTypes); + var _beeIcon = require("bee-icon"); var _beeIcon2 = _interopRequireDefault(_beeIcon); @@ -28,6 +32,10 @@ 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); } +var propTypes = { + dataSource: _propTypes2["default"].array +}; + var SelectRender = function (_Component) { _inherits(SelectRender, _Component); @@ -66,7 +74,9 @@ var SelectRender = function (_Component) { var _state = this.state, value = _state.value, editable = _state.editable; - var isclickTrigger = this.props.isclickTrigger; + var _props = this.props, + isclickTrigger = _props.isclickTrigger, + dataSource = _props.dataSource; var cellContent = ""; if (editable) { @@ -104,6 +114,15 @@ var SelectRender = function (_Component) { }) ); } else { + if (dataSource && dataSource.length > 0) { + for (var index = 0; index < dataSource.length; index++) { + var element = dataSource[index]; + if (element.value === value) { + value = element.key; + break; + } + } + } cellContent = isclickTrigger ? _react2["default"].createElement( "div", { className: "editable-cell-text-wrapper", onClick: this.edit }, @@ -130,4 +149,6 @@ var SelectRender = function (_Component) { }(_react.Component); exports["default"] = SelectRender; + +SelectRender.propTypes = propTypes; module.exports = exports["default"]; \ No newline at end of file diff --git a/package.json b/package.json index 53b0282..f9a37b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "1.0.4", + "version": "1.0.5", "description": "Table ui component for react", "keywords": [ "react",