@atlaskit/dynamic-table
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -1,6 +0,16 @@ | ||
<a name="2.0.1"></a> | ||
## 2.0.1 (2017-03-08) | ||
<a name="2.1.0"></a> | ||
# 2.1.0 (2017-03-08) | ||
<a name="2.1.0"></a> | ||
# 2.1.0 (2017-03-08) | ||
### Features | ||
* **refactor:** use createError helper function from util-common package ([3466262](https://bitbucket.org/atlassian/atlaskit/commits/3466262)) | ||
<a name="2.0.1"></a> | ||
@@ -7,0 +17,0 @@ ## 2.0.1 (2017-03-08) |
@@ -88,3 +88,3 @@ module.exports = /******/ | ||
}); | ||
var _stateful = __webpack_require__(19), _stateful2 = _interopRequireDefault(_stateful); | ||
var _stateful = __webpack_require__(20), _stateful2 = _interopRequireDefault(_stateful); | ||
exports.default = _stateful2.default; | ||
@@ -115,3 +115,3 @@ }, /* 2 */ | ||
}); | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(4), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(5), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(6), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(7), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(8), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(9), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(10), _react2 = _interopRequireDefault(_react), _pagination = __webpack_require__(11), _constants = __webpack_require__(12), _props6 = __webpack_require__(13), _styled = __webpack_require__(15), DynamicTable = function(_Component) { | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(4), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(5), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(6), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(7), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(8), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(9), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(10), _react2 = _interopRequireDefault(_react), _pagination = __webpack_require__(11), _constants = __webpack_require__(12), _props6 = __webpack_require__(13), _styled = __webpack_require__(16), DynamicTable = function(_Component) { | ||
function DynamicTable() { | ||
@@ -274,5 +274,2 @@ var _ref, _temp, _this, _ret; | ||
} | ||
function createError(propName, componentName, message) { | ||
return new Error("Invalid prop `" + propName + "` supplied to" + (" `" + componentName + "`. " + message)); | ||
} | ||
function isInteger(props, propName, componentName) { | ||
@@ -282,3 +279,3 @@ if (void 0 === props[propName]) return null; | ||
var message = "'" + propName + "' should be an integer or an infinity, got " + props[propName] + " instead"; | ||
return createError(propName, componentName, message); | ||
return (0, _utilCommon.createError)(propName, componentName, message); | ||
} | ||
@@ -295,3 +292,3 @@ return null; | ||
}, !0); | ||
return isAllRowsSameLength ? null : createError(propName, componentName, "One of the rows has different cell-count compared to head."); | ||
return isAllRowsSameLength ? null : (0, _utilCommon.createError)(propName, componentName, "One of the rows has different cell-count compared to head."); | ||
} | ||
@@ -301,3 +298,4 @@ function isSortable(props, propName, componentName) { | ||
var initialCheck = _react.PropTypes.bool.apply(_react.PropTypes, [ props, propName, componentName ].concat(rest)); | ||
return initialCheck instanceof Error ? initialCheck : props[propName] && !props.key ? createError(propName, componentName, "'" + propName + "' can't be set to true, if the 'key' prop is missing.") : null; | ||
return initialCheck instanceof Error ? initialCheck : props[propName] && !props.key ? (0, | ||
_utilCommon.createError)(propName, componentName, "'" + propName + "' can't be set to true, if the 'key' prop is missing.") : null; | ||
} | ||
@@ -309,3 +307,3 @@ function sortKey(props, propName, componentName) { | ||
}).includes(props[propName]); | ||
return headHasKey ? null : createError(propName, componentName, "Cell with " + props[propName] + " key not found in head."); | ||
return headHasKey ? null : (0, _utilCommon.createError)(propName, componentName, "Cell with " + props[propName] + " key not found in head."); | ||
} | ||
@@ -315,3 +313,3 @@ Object.defineProperty(exports, "__esModule", { | ||
}), exports.statefulDefaultProps = exports.statelessDefaultProps = exports.statefulPropTypes = exports.statelessPropTypes = void 0; | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _isInteger = __webpack_require__(14), _isInteger2 = _interopRequireDefault(_isInteger), _react = __webpack_require__(10), _constants = __webpack_require__(12); | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _isInteger = __webpack_require__(14), _isInteger2 = _interopRequireDefault(_isInteger), _react = __webpack_require__(10), _utilCommon = __webpack_require__(15), _constants = __webpack_require__(12); | ||
isInteger.isRequired = !1; | ||
@@ -375,2 +373,6 @@ var rowCellObject = { | ||
/***/ | ||
function(module, exports) { | ||
module.exports = require("@atlaskit/util-common"); | ||
}, /* 16 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
@@ -386,3 +388,3 @@ "use strict"; | ||
}), exports.TableBodyCell = exports.TableBodyRow = exports.TableHeadCell = exports.TableHead = exports.Caption = exports.Table = void 0; | ||
var _taggedTemplateLiteral2 = __webpack_require__(16), _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2), _templateObject = (0, | ||
var _taggedTemplateLiteral2 = __webpack_require__(17), _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2), _templateObject = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", ";\n ", "\n" ], [ "\n ", "\n ", ";\n ", "\n" ]), _templateObject2 = (0, | ||
@@ -402,3 +404,3 @@ _taggedTemplateLiteral3.default)([ "width: ", "%;" ], [ "width: ", "%;" ]), _templateObject3 = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n &:hover {\n background: ", ";\n }\n" ], [ "\n ", "\n &:hover {\n background: ", ";\n }\n" ]), _templateObject15 = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", "\n ", " \n" ], [ "\n ", "\n ", "\n ", " \n" ]), _styledComponents = __webpack_require__(17), _styledComponents2 = _interopRequireDefault(_styledComponents), _utilSharedStyles = __webpack_require__(18), _constants = __webpack_require__(12), gridUnit = parseInt(_utilSharedStyles.akGridSize, 10), baselineUnit = gridUnit / 2, truncateStyle = function(_ref) { | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", "\n ", " \n" ], [ "\n ", "\n ", "\n ", " \n" ]), _styledComponents = __webpack_require__(18), _styledComponents2 = _interopRequireDefault(_styledComponents), _utilSharedStyles = __webpack_require__(19), _constants = __webpack_require__(12), gridUnit = parseInt(_utilSharedStyles.akGridSize, 10), baselineUnit = gridUnit / 2, truncateStyle = function(_ref) { | ||
var width = _ref.width, isFixedSize = _ref.isFixedSize, shouldTruncate = _ref.shouldTruncate; | ||
@@ -438,15 +440,15 @@ return (0, _styledComponents.css)(_templateObject, width ? (0, _styledComponents.css)(_templateObject2, width) : "", isFixedSize ? (0, | ||
}); | ||
}, /* 16 */ | ||
}, /* 17 */ | ||
/***/ | ||
function(module, exports) { | ||
module.exports = require("babel-runtime/helpers/taggedTemplateLiteral"); | ||
}, /* 17 */ | ||
}, /* 18 */ | ||
/***/ | ||
function(module, exports) { | ||
module.exports = require("styled-components"); | ||
}, /* 18 */ | ||
}, /* 19 */ | ||
/***/ | ||
function(module, exports) { | ||
module.exports = require("@atlaskit/util-shared-styles"); | ||
}, /* 19 */ | ||
}, /* 20 */ | ||
/***/ | ||
@@ -453,0 +455,0 @@ function(module, exports, __webpack_require__) { |
@@ -1,1 +0,1 @@ | ||
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DynamicTable=t.default=void 0;var o=n(2);Object.defineProperty(t,"DynamicTable",{enumerable:!0,get:function(){return r(o).default}});var a=n(19),l=r(a);t.default=l.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){switch(e){case S.DESC:return S.ASC;case S.ASC:return S.DESC;default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),l=r(a),i=n(4),s=r(i),u=n(5),d=r(u),p=n(6),f=r(p),c=n(7),h=r(c),y=n(8),b=r(y),g=n(9),v=r(g),P=n(10),x=r(P),m=n(11),S=n(12),T=n(13),w=n(15),C=function(e){function t(){var e,n,r,a;(0,f.default)(this,t);for(var l=arguments.length,i=Array(l),s=0;s<l;s++)i[s]=arguments[s];return n=r=(0,b.default)(this,(e=t.__proto__||(0,d.default)(t)).call.apply(e,[this].concat(i))),r.onSort=function(e){return function(){var t=e.key;if(t){var n=t!==r.props.sortKey?S.ASC:o(r.props.sortOrder);r.onSetPage(1),r.props.onSort({key:t,item:e,sortOrder:n})}}},r.onSetPage=function(e){return r.props.onSetPage(e)},a=n,(0,b.default)(r,a)}return(0,v.default)(t,e),(0,h.default)(t,[{key:"getSortedRows",value:function(){var e=this.props,t=e.head,n=e.rows,r=e.sortKey,o=e.sortOrder;if(!r||!t)return n;var a=function(e){return e.reduce(function(e,n,o){return e||t.cells[o].key===r&&(void 0!==n.key?n.key:n.content)},null)};return n.sort(function(e,t){var n=a(e.cells),r=a(t.cells),l=o===S.ASC?1:-1;return!n||n<r?-l:!r||n>r?l:0})}},{key:"renderCaption",value:function(){var e=this.props.caption;return e?x.default.createElement(w.Caption,null,e):null}},{key:"renderHead",value:function(){var e=this,t=this.props,n=t.head,r=t.sortKey,o=t.sortOrder;if(!n)return null;var a=n.cells,i=(0,s.default)(n,["cells"]);return x.default.createElement(w.TableHead,i,x.default.createElement("tr",null,a.map(function(t,n){var a=t.isSortable,i=t.key,u=t.content,d=(0,s.default)(t,["isSortable","key","content"]),p=e.props.isFixedSize;return x.default.createElement(w.TableHeadCell,(0,l.default)({key:i||n,onClick:a&&e.onSort(t),isFixedSize:p,isSortable:a,sortOrder:i===r&&o},d),x.default.createElement("span",null,u))})))}},{key:"renderBody",value:function(){var e=this,t=this.props,n=t.rowsPerPage,r=t.page,o=this.getSortedRows();return x.default.createElement("tbody",null,(o||[]).slice((r-1)*n,r*n).map(function(t,n){return e.renderBodyRow(t,n)}))}},{key:"renderBodyRow",value:function(e,t){var n=this.props,r=n.head,o=n.isFixedSize,a=e.cells,i=(0,s.default)(e,["cells"]);return x.default.createElement(w.TableBodyRow,(0,l.default)({key:t},i),a.map(function(e,t){var n=e.content,a=(0,s.default)(e,["content"]),i=(r||{cells:[]}).cells[t]||{},u=i.shouldTruncate,d=i.width;return x.default.createElement(w.TableBodyCell,(0,l.default)({},a,{key:t,width:d,shouldTruncate:u,isFixedSize:o}),n)}))}},{key:"render",value:function(){var e=this.props,t=e.rows,n=e.isFixedSize,r=e.rowsPerPage,o=e.emptyView,a=e.page,l=t?Math.ceil(t.length/r):0;return t&&t.length?x.default.createElement("div",null,x.default.createElement(w.Table,{isFixedSize:n},this.renderCaption(),this.renderHead(),this.renderBody()),l?x.default.createElement(m.Pagination,{current:a,total:l,onSetPage:this.onSetPage}):null):o}}]),t}(P.Component);C.propTypes=T.statelessPropTypes,C.defaultProps=T.statelessDefaultProps,t.default=C},function(e,t){e.exports=require("babel-runtime/helpers/extends")},function(e,t){e.exports=require("babel-runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("babel-runtime/core-js/object/get-prototype-of")},function(e,t){e.exports=require("babel-runtime/helpers/classCallCheck")},function(e,t){e.exports=require("babel-runtime/helpers/createClass")},function(e,t){e.exports=require("babel-runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("babel-runtime/helpers/inherits")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@atlaskit/pagination")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASC="ASC",t.DESC="DESC"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return new Error("Invalid prop `"+e+"` supplied to"+(" `"+t+"`. "+n))}function a(e,t,n){if(void 0===e[t])return null;if(!(0,f.default)(e[t])&&e[t]!==1/0){var r="'"+t+"' should be an integer or an infinity, got "+e[t]+" instead";return o(t,n,r)}return null}function l(e,t,n){for(var r=arguments.length,a=Array(r>3?r-3:0),l=3;l<r;l++)a[l-3]=arguments[l];var i=c.PropTypes.arrayOf(b).apply(void 0,[e,t,n].concat(a));if(i instanceof Error)return i;if(!e.head||!e.head.cells)return null;var s=e[t].reduce(function(t,n){return t&&n.length===e.head.cells.length},!0);return s?null:o(t,n,"One of the rows has different cell-count compared to head.")}function i(e,t,n){for(var r=arguments.length,a=Array(r>3?r-3:0),l=3;l<r;l++)a[l-3]=arguments[l];var i=c.PropTypes.bool.apply(c.PropTypes,[e,t,n].concat(a));return i instanceof Error?i:e[t]&&!e.key?o(t,n,"'"+t+"' can't be set to true, if the 'key' prop is missing."):null}function s(e,t,n){if(!e[t])return null;var r=e.head.cells.map(function(e){return e.key}).includes(e[t]);return r?null:o(t,n,"Cell with "+e[t]+" key not found in head.")}Object.defineProperty(t,"__esModule",{value:!0}),t.statefulDefaultProps=t.statelessDefaultProps=t.statefulPropTypes=t.statelessPropTypes=void 0;var u=n(3),d=r(u),p=n(14),f=r(p),c=n(10),h=n(12);a.isRequired=!1;var y={key:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string,c.PropTypes.bool]),content:c.PropTypes.node},b=c.PropTypes.shape(y);i.isRequired=!1;var g=(0,d.default)({},y,{isSortable:i,width:c.PropTypes.number,shouldTruncate:c.PropTypes.bool}),v=c.PropTypes.shape(g),P=c.PropTypes.shape({cells:c.PropTypes.arrayOf(v)}),x=c.PropTypes.arrayOf(c.PropTypes.shape({cells:l}));s.isRequired=!1;var m=c.PropTypes.node,S=c.PropTypes.oneOf([h.ASC,h.DESC]),T=c.PropTypes.bool,w=a,C=a,k=c.PropTypes.func,O=c.PropTypes.func,_=c.PropTypes.node,E={caption:m,head:P,rows:x,emptyView:_,isFixedSize:T,rowsPerPage:w,onSetPage:k,onSort:O},z={caption:null,head:null,rows:null,emptyView:null,isFixedSize:!1,rowsPerPage:1/0,onSetPage:function(){},onSort:function(){}};t.statelessPropTypes=(0,d.default)({},E,{page:C,sortKey:s,sortOrder:S}),t.statefulPropTypes=(0,d.default)({},E,{defaultPage:C,defaultSortKey:s,defaultSortOrder:S}),t.statelessDefaultProps=(0,d.default)({},z,{page:1,sortKey:null,sortOrder:null}),t.statefulDefaultProps=(0,d.default)({},z,{defaultPage:1,defaultSortKey:null,defaultSortOrder:null})},function(e,t){e.exports=require("babel-runtime/core-js/number/is-integer")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TableBodyCell=t.TableBodyRow=t.TableHeadCell=t.TableHead=t.Caption=t.Table=void 0;var o=n(16),a=r(o),l=(0,a.default)(["\n ","\n ",";\n ","\n"],["\n ","\n ",";\n ","\n"]),i=(0,a.default)(["width: ","%;"],["width: ","%;"]),s=(0,a.default)(["overflow: hidden;"],["overflow: hidden;"]),u=(0,a.default)(["\n white-space: nowrap;\n text-overflow: ellipsis;\n "],["\n white-space: nowrap;\n text-overflow: ellipsis;\n "]),d=(0,a.default)(["\n &:hover {\n cursor: pointer;\n }\n"],["\n &:hover {\n cursor: pointer;\n }\n"]),p=(0,a.default)(["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "],["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "]),f=(0,a.default)(["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "],["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "]),c=(0,a.default)(["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"],["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"]),h=(0,a.default)(["\n ",";\n width: 100%;\n border-collapse: collapse;\n"],["\n ",";\n width: 100%;\n border-collapse: collapse;\n"]),y=(0,a.default)(["table-layout: fixed;"],["table-layout: fixed;"]),b=(0,a.default)(["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"],["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"]),g=(0,a.default)(["\n border-bottom: 2px solid #DFE1E6;\n"],["\n border-bottom: 2px solid #DFE1E6;\n"]),v=(0,a.default)(["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"],["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"]),P=(0,a.default)(["\n ","\n &:hover {\n background: ",";\n }\n"],["\n ","\n &:hover {\n background: ",";\n }\n"]),x=(0,a.default)(["\n ","\n ","\n "," \n"],["\n ","\n ","\n "," \n"]),m=n(17),S=r(m),T=n(18),w=n(12),C=parseInt(T.akGridSize,10),k=C/2,O=function(e){var t=e.width,n=e.isFixedSize,r=e.shouldTruncate;return(0,m.css)(l,t?(0,m.css)(i,t):"",n?(0,m.css)(s):"",n&&r?(0,m.css)(u):"")},_=function(e){var t=e.onClick;return t&&(0,m.css)(d)},E=function(e){var t=e.isSortable,n=e.sortOrder;if(!t)return"";var r=(0,m.css)(p,C);return(0,m.css)(f,r,n===w.ASC?T.akColorN300:T.akColorN40,r,n===w.DESC?T.akColorN300:T.akColorN40,n===w.ASC?T.akColorN300:T.akColorN60,n===w.DESC?T.akColorN300:T.akColorN60)},z=(0,m.css)(c,k,C);t.Table=S.default.table(h,function(e){var t=e.isFixedSize;return t&&(0,m.css)(y)}),t.Caption=S.default.caption(b,7*k,C),t.TableHead=S.default.thead(g),t.TableHeadCell=S.default.th(v,function(e){return _(e)},function(e){return O(e)},function(e){return E(e)},function(){return z},T.akColorN300),t.TableBodyRow=S.default.tr(P,function(e){return _(e)},T.akColorN10),t.TableBodyCell=S.default.td(x,function(e){return _(e)},function(e){return O(e)},function(){return z})},function(e,t){e.exports=require("babel-runtime/helpers/taggedTemplateLiteral")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@atlaskit/util-shared-styles")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),a=r(o),l=n(6),i=r(l),s=n(7),u=r(s),d=n(8),p=r(d),f=n(9),c=r(f),h=n(10),y=r(h),b=n(2),g=r(b),v=n(13),P=function(e){function t(){var e,n,r,o;(0,i.default)(this,t);for(var l=arguments.length,s=Array(l),u=0;u<l;u++)s[u]=arguments[u];return n=r=(0,p.default)(this,(e=t.__proto__||(0,a.default)(t)).call.apply(e,[this].concat(s))),r.state={page:r.props.defaultPage,sortKey:r.props.defaultSortKey,sortOrder:r.props.defaultSortOrder},r.onSetPage=function(e){r.props.onSetPage(e),r.setState({page:e})},r.onSort=function(e){var t=e.key,n=e.item,o=e.sortOrder;r.props.onSort({key:t,item:n,sortOrder:o}),r.setState({sortKey:t,sortOrder:o,page:1})},o=n,(0,p.default)(r,o)}return(0,c.default)(t,e),(0,u.default)(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({page:e.page,sortKey:e.defaultSortKey,sortOrder:e.defaultSortOrder})}},{key:"render",value:function(){return y.default.createElement(g.default,{caption:this.props.caption,head:this.props.head,rows:this.props.rows,emptyView:this.props.emptyView,isFixedSize:this.props.isFixedSize,rowsPerPage:this.props.rowsPerPage,onSetPage:this.onSetPage,onSort:this.onSort,page:this.state.page,sortKey:this.state.sortKey,sortOrder:this.state.sortOrder})}}]),t}(h.PureComponent);P.propTypes=v.statefulPropTypes,P.defaultProps=v.statefulDefaultProps,t.default=P}]); | ||
module.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DynamicTable=t.default=void 0;var o=n(2);Object.defineProperty(t,"DynamicTable",{enumerable:!0,get:function(){return r(o).default}});var a=n(20),l=r(a);t.default=l.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){switch(e){case S.DESC:return S.ASC;case S.ASC:return S.DESC;default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(3),l=r(a),i=n(4),s=r(i),u=n(5),d=r(u),p=n(6),f=r(p),c=n(7),h=r(c),y=n(8),b=r(y),g=n(9),v=r(g),P=n(10),m=r(P),x=n(11),S=n(12),T=n(13),w=n(16),k=function(e){function t(){var e,n,r,a;(0,f.default)(this,t);for(var l=arguments.length,i=Array(l),s=0;s<l;s++)i[s]=arguments[s];return n=r=(0,b.default)(this,(e=t.__proto__||(0,d.default)(t)).call.apply(e,[this].concat(i))),r.onSort=function(e){return function(){var t=e.key;if(t){var n=t!==r.props.sortKey?S.ASC:o(r.props.sortOrder);r.onSetPage(1),r.props.onSort({key:t,item:e,sortOrder:n})}}},r.onSetPage=function(e){return r.props.onSetPage(e)},a=n,(0,b.default)(r,a)}return(0,v.default)(t,e),(0,h.default)(t,[{key:"getSortedRows",value:function(){var e=this.props,t=e.head,n=e.rows,r=e.sortKey,o=e.sortOrder;if(!r||!t)return n;var a=function(e){return e.reduce(function(e,n,o){return e||t.cells[o].key===r&&(void 0!==n.key?n.key:n.content)},null)};return n.sort(function(e,t){var n=a(e.cells),r=a(t.cells),l=o===S.ASC?1:-1;return!n||n<r?-l:!r||n>r?l:0})}},{key:"renderCaption",value:function(){var e=this.props.caption;return e?m.default.createElement(w.Caption,null,e):null}},{key:"renderHead",value:function(){var e=this,t=this.props,n=t.head,r=t.sortKey,o=t.sortOrder;if(!n)return null;var a=n.cells,i=(0,s.default)(n,["cells"]);return m.default.createElement(w.TableHead,i,m.default.createElement("tr",null,a.map(function(t,n){var a=t.isSortable,i=t.key,u=t.content,d=(0,s.default)(t,["isSortable","key","content"]),p=e.props.isFixedSize;return m.default.createElement(w.TableHeadCell,(0,l.default)({key:i||n,onClick:a&&e.onSort(t),isFixedSize:p,isSortable:a,sortOrder:i===r&&o},d),m.default.createElement("span",null,u))})))}},{key:"renderBody",value:function(){var e=this,t=this.props,n=t.rowsPerPage,r=t.page,o=this.getSortedRows();return m.default.createElement("tbody",null,(o||[]).slice((r-1)*n,r*n).map(function(t,n){return e.renderBodyRow(t,n)}))}},{key:"renderBodyRow",value:function(e,t){var n=this.props,r=n.head,o=n.isFixedSize,a=e.cells,i=(0,s.default)(e,["cells"]);return m.default.createElement(w.TableBodyRow,(0,l.default)({key:t},i),a.map(function(e,t){var n=e.content,a=(0,s.default)(e,["content"]),i=(r||{cells:[]}).cells[t]||{},u=i.shouldTruncate,d=i.width;return m.default.createElement(w.TableBodyCell,(0,l.default)({},a,{key:t,width:d,shouldTruncate:u,isFixedSize:o}),n)}))}},{key:"render",value:function(){var e=this.props,t=e.rows,n=e.isFixedSize,r=e.rowsPerPage,o=e.emptyView,a=e.page,l=t?Math.ceil(t.length/r):0;return t&&t.length?m.default.createElement("div",null,m.default.createElement(w.Table,{isFixedSize:n},this.renderCaption(),this.renderHead(),this.renderBody()),l?m.default.createElement(x.Pagination,{current:a,total:l,onSetPage:this.onSetPage}):null):o}}]),t}(P.Component);k.propTypes=T.statelessPropTypes,k.defaultProps=T.statelessDefaultProps,t.default=k},function(e,t){e.exports=require("babel-runtime/helpers/extends")},function(e,t){e.exports=require("babel-runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("babel-runtime/core-js/object/get-prototype-of")},function(e,t){e.exports=require("babel-runtime/helpers/classCallCheck")},function(e,t){e.exports=require("babel-runtime/helpers/createClass")},function(e,t){e.exports=require("babel-runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("babel-runtime/helpers/inherits")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@atlaskit/pagination")},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASC="ASC",t.DESC="DESC"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){if(void 0===e[t])return null;if(!(0,p.default)(e[t])&&e[t]!==1/0){var r="'"+t+"' should be an integer or an infinity, got "+e[t]+" instead";return(0,c.createError)(t,n,r)}return null}function a(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var l=f.PropTypes.arrayOf(b).apply(void 0,[e,t,n].concat(o));if(l instanceof Error)return l;if(!e.head||!e.head.cells)return null;var i=e[t].reduce(function(t,n){return t&&n.length===e.head.cells.length},!0);return i?null:(0,c.createError)(t,n,"One of the rows has different cell-count compared to head.")}function l(e,t,n){for(var r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var l=f.PropTypes.bool.apply(f.PropTypes,[e,t,n].concat(o));return l instanceof Error?l:e[t]&&!e.key?(0,c.createError)(t,n,"'"+t+"' can't be set to true, if the 'key' prop is missing."):null}function i(e,t,n){if(!e[t])return null;var r=e.head.cells.map(function(e){return e.key}).includes(e[t]);return r?null:(0,c.createError)(t,n,"Cell with "+e[t]+" key not found in head.")}Object.defineProperty(t,"__esModule",{value:!0}),t.statefulDefaultProps=t.statelessDefaultProps=t.statefulPropTypes=t.statelessPropTypes=void 0;var s=n(3),u=r(s),d=n(14),p=r(d),f=n(10),c=n(15),h=n(12);o.isRequired=!1;var y={key:f.PropTypes.oneOfType([f.PropTypes.number,f.PropTypes.string,f.PropTypes.bool]),content:f.PropTypes.node},b=f.PropTypes.shape(y);l.isRequired=!1;var g=(0,u.default)({},y,{isSortable:l,width:f.PropTypes.number,shouldTruncate:f.PropTypes.bool}),v=f.PropTypes.shape(g),P=f.PropTypes.shape({cells:f.PropTypes.arrayOf(v)}),m=f.PropTypes.arrayOf(f.PropTypes.shape({cells:a}));i.isRequired=!1;var x=f.PropTypes.node,S=f.PropTypes.oneOf([h.ASC,h.DESC]),T=f.PropTypes.bool,w=o,k=o,C=f.PropTypes.func,O=f.PropTypes.func,_=f.PropTypes.node,E={caption:x,head:P,rows:m,emptyView:_,isFixedSize:T,rowsPerPage:w,onSetPage:C,onSort:O},q={caption:null,head:null,rows:null,emptyView:null,isFixedSize:!1,rowsPerPage:1/0,onSetPage:function(){},onSort:function(){}};t.statelessPropTypes=(0,u.default)({},E,{page:k,sortKey:i,sortOrder:S}),t.statefulPropTypes=(0,u.default)({},E,{defaultPage:k,defaultSortKey:i,defaultSortOrder:S}),t.statelessDefaultProps=(0,u.default)({},q,{page:1,sortKey:null,sortOrder:null}),t.statefulDefaultProps=(0,u.default)({},q,{defaultPage:1,defaultSortKey:null,defaultSortOrder:null})},function(e,t){e.exports=require("babel-runtime/core-js/number/is-integer")},function(e,t){e.exports=require("@atlaskit/util-common")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TableBodyCell=t.TableBodyRow=t.TableHeadCell=t.TableHead=t.Caption=t.Table=void 0;var o=n(17),a=r(o),l=(0,a.default)(["\n ","\n ",";\n ","\n"],["\n ","\n ",";\n ","\n"]),i=(0,a.default)(["width: ","%;"],["width: ","%;"]),s=(0,a.default)(["overflow: hidden;"],["overflow: hidden;"]),u=(0,a.default)(["\n white-space: nowrap;\n text-overflow: ellipsis;\n "],["\n white-space: nowrap;\n text-overflow: ellipsis;\n "]),d=(0,a.default)(["\n &:hover {\n cursor: pointer;\n }\n"],["\n &:hover {\n cursor: pointer;\n }\n"]),p=(0,a.default)(["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "],["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "]),f=(0,a.default)(["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "],["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "]),c=(0,a.default)(["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"],["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"]),h=(0,a.default)(["\n ",";\n width: 100%;\n border-collapse: collapse;\n"],["\n ",";\n width: 100%;\n border-collapse: collapse;\n"]),y=(0,a.default)(["table-layout: fixed;"],["table-layout: fixed;"]),b=(0,a.default)(["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"],["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"]),g=(0,a.default)(["\n border-bottom: 2px solid #DFE1E6;\n"],["\n border-bottom: 2px solid #DFE1E6;\n"]),v=(0,a.default)(["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"],["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"]),P=(0,a.default)(["\n ","\n &:hover {\n background: ",";\n }\n"],["\n ","\n &:hover {\n background: ",";\n }\n"]),m=(0,a.default)(["\n ","\n ","\n "," \n"],["\n ","\n ","\n "," \n"]),x=n(18),S=r(x),T=n(19),w=n(12),k=parseInt(T.akGridSize,10),C=k/2,O=function(e){var t=e.width,n=e.isFixedSize,r=e.shouldTruncate;return(0,x.css)(l,t?(0,x.css)(i,t):"",n?(0,x.css)(s):"",n&&r?(0,x.css)(u):"")},_=function(e){var t=e.onClick;return t&&(0,x.css)(d)},E=function(e){var t=e.isSortable,n=e.sortOrder;if(!t)return"";var r=(0,x.css)(p,k);return(0,x.css)(f,r,n===w.ASC?T.akColorN300:T.akColorN40,r,n===w.DESC?T.akColorN300:T.akColorN40,n===w.ASC?T.akColorN300:T.akColorN60,n===w.DESC?T.akColorN300:T.akColorN60)},q=(0,x.css)(c,C,k);t.Table=S.default.table(h,function(e){var t=e.isFixedSize;return t&&(0,x.css)(y)}),t.Caption=S.default.caption(b,7*C,k),t.TableHead=S.default.thead(g),t.TableHeadCell=S.default.th(v,function(e){return _(e)},function(e){return O(e)},function(e){return E(e)},function(){return q},T.akColorN300),t.TableBodyRow=S.default.tr(P,function(e){return _(e)},T.akColorN10),t.TableBodyCell=S.default.td(m,function(e){return _(e)},function(e){return O(e)},function(){return q})},function(e,t){e.exports=require("babel-runtime/helpers/taggedTemplateLiteral")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@atlaskit/util-shared-styles")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),a=r(o),l=n(6),i=r(l),s=n(7),u=r(s),d=n(8),p=r(d),f=n(9),c=r(f),h=n(10),y=r(h),b=n(2),g=r(b),v=n(13),P=function(e){function t(){var e,n,r,o;(0,i.default)(this,t);for(var l=arguments.length,s=Array(l),u=0;u<l;u++)s[u]=arguments[u];return n=r=(0,p.default)(this,(e=t.__proto__||(0,a.default)(t)).call.apply(e,[this].concat(s))),r.state={page:r.props.defaultPage,sortKey:r.props.defaultSortKey,sortOrder:r.props.defaultSortOrder},r.onSetPage=function(e){r.props.onSetPage(e),r.setState({page:e})},r.onSort=function(e){var t=e.key,n=e.item,o=e.sortOrder;r.props.onSort({key:t,item:n,sortOrder:o}),r.setState({sortKey:t,sortOrder:o,page:1})},o=n,(0,p.default)(r,o)}return(0,c.default)(t,e),(0,u.default)(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({page:e.page,sortKey:e.defaultSortKey,sortOrder:e.defaultSortOrder})}},{key:"render",value:function(){return y.default.createElement(g.default,{caption:this.props.caption,head:this.props.head,rows:this.props.rows,emptyView:this.props.emptyView,isFixedSize:this.props.isFixedSize,rowsPerPage:this.props.rowsPerPage,onSetPage:this.onSetPage,onSort:this.onSort,page:this.state.page,sortKey:this.state.sortKey,sortOrder:this.state.sortOrder})}}]),t}(h.PureComponent);P.propTypes=v.statefulPropTypes,P.defaultProps=v.statefulDefaultProps,t.default=P}]); |
!function(root, factory) { | ||
"object" == typeof exports && "object" == typeof module ? module.exports = factory(require("babel-runtime/helpers/extends"), require("babel-runtime/helpers/objectWithoutProperties"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("react"), require("@atlaskit/pagination"), require("babel-runtime/core-js/number/is-integer"), require("babel-runtime/helpers/taggedTemplateLiteral"), require("styled-components"), require("@atlaskit/util-shared-styles")) : "function" == typeof define && define.amd ? define([ "babel-runtime/helpers/extends", "babel-runtime/helpers/objectWithoutProperties", "babel-runtime/core-js/object/get-prototype-of", "babel-runtime/helpers/classCallCheck", "babel-runtime/helpers/createClass", "babel-runtime/helpers/possibleConstructorReturn", "babel-runtime/helpers/inherits", "react", "@atlaskit/pagination", "babel-runtime/core-js/number/is-integer", "babel-runtime/helpers/taggedTemplateLiteral", "styled-components", "@atlaskit/util-shared-styles" ], factory) : "object" == typeof exports ? exports["@atlaskit/dynamicTable"] = factory(require("babel-runtime/helpers/extends"), require("babel-runtime/helpers/objectWithoutProperties"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("react"), require("@atlaskit/pagination"), require("babel-runtime/core-js/number/is-integer"), require("babel-runtime/helpers/taggedTemplateLiteral"), require("styled-components"), require("@atlaskit/util-shared-styles")) : root["@atlaskit/dynamicTable"] = factory(root["babel-runtime/helpers/extends"], root["babel-runtime/helpers/objectWithoutProperties"], root["babel-runtime/core-js/object/get-prototype-of"], root["babel-runtime/helpers/classCallCheck"], root["babel-runtime/helpers/createClass"], root["babel-runtime/helpers/possibleConstructorReturn"], root["babel-runtime/helpers/inherits"], root.react, root["@atlaskit/pagination"], root["babel-runtime/core-js/number/is-integer"], root["babel-runtime/helpers/taggedTemplateLiteral"], root["styled-components"], root["@atlaskit/util-shared-styles"]); | ||
}(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_7__, __WEBPACK_EXTERNAL_MODULE_8__, __WEBPACK_EXTERNAL_MODULE_9__, __WEBPACK_EXTERNAL_MODULE_10__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_14__, __WEBPACK_EXTERNAL_MODULE_16__, __WEBPACK_EXTERNAL_MODULE_17__, __WEBPACK_EXTERNAL_MODULE_18__) { | ||
"object" == typeof exports && "object" == typeof module ? module.exports = factory(require("babel-runtime/helpers/extends"), require("babel-runtime/helpers/objectWithoutProperties"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("react"), require("@atlaskit/pagination"), require("babel-runtime/core-js/number/is-integer"), require("@atlaskit/util-common"), require("babel-runtime/helpers/taggedTemplateLiteral"), require("styled-components"), require("@atlaskit/util-shared-styles")) : "function" == typeof define && define.amd ? define([ "babel-runtime/helpers/extends", "babel-runtime/helpers/objectWithoutProperties", "babel-runtime/core-js/object/get-prototype-of", "babel-runtime/helpers/classCallCheck", "babel-runtime/helpers/createClass", "babel-runtime/helpers/possibleConstructorReturn", "babel-runtime/helpers/inherits", "react", "@atlaskit/pagination", "babel-runtime/core-js/number/is-integer", "@atlaskit/util-common", "babel-runtime/helpers/taggedTemplateLiteral", "styled-components", "@atlaskit/util-shared-styles" ], factory) : "object" == typeof exports ? exports["@atlaskit/dynamicTable"] = factory(require("babel-runtime/helpers/extends"), require("babel-runtime/helpers/objectWithoutProperties"), require("babel-runtime/core-js/object/get-prototype-of"), require("babel-runtime/helpers/classCallCheck"), require("babel-runtime/helpers/createClass"), require("babel-runtime/helpers/possibleConstructorReturn"), require("babel-runtime/helpers/inherits"), require("react"), require("@atlaskit/pagination"), require("babel-runtime/core-js/number/is-integer"), require("@atlaskit/util-common"), require("babel-runtime/helpers/taggedTemplateLiteral"), require("styled-components"), require("@atlaskit/util-shared-styles")) : root["@atlaskit/dynamicTable"] = factory(root["babel-runtime/helpers/extends"], root["babel-runtime/helpers/objectWithoutProperties"], root["babel-runtime/core-js/object/get-prototype-of"], root["babel-runtime/helpers/classCallCheck"], root["babel-runtime/helpers/createClass"], root["babel-runtime/helpers/possibleConstructorReturn"], root["babel-runtime/helpers/inherits"], root.react, root["@atlaskit/pagination"], root["babel-runtime/core-js/number/is-integer"], root["@atlaskit/util-common"], root["babel-runtime/helpers/taggedTemplateLiteral"], root["styled-components"], root["@atlaskit/util-shared-styles"]); | ||
}(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_5__, __WEBPACK_EXTERNAL_MODULE_6__, __WEBPACK_EXTERNAL_MODULE_7__, __WEBPACK_EXTERNAL_MODULE_8__, __WEBPACK_EXTERNAL_MODULE_9__, __WEBPACK_EXTERNAL_MODULE_10__, __WEBPACK_EXTERNAL_MODULE_11__, __WEBPACK_EXTERNAL_MODULE_14__, __WEBPACK_EXTERNAL_MODULE_15__, __WEBPACK_EXTERNAL_MODULE_17__, __WEBPACK_EXTERNAL_MODULE_18__, __WEBPACK_EXTERNAL_MODULE_19__) { | ||
/******/ | ||
@@ -91,3 +91,3 @@ return function(modules) { | ||
}); | ||
var _stateful = __webpack_require__(19), _stateful2 = _interopRequireDefault(_stateful); | ||
var _stateful = __webpack_require__(20), _stateful2 = _interopRequireDefault(_stateful); | ||
exports.default = _stateful2.default; | ||
@@ -118,3 +118,3 @@ }, /* 2 */ | ||
}); | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(4), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(5), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(6), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(7), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(8), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(9), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(10), _react2 = _interopRequireDefault(_react), _pagination = __webpack_require__(11), _constants = __webpack_require__(12), _props6 = __webpack_require__(13), _styled = __webpack_require__(15), DynamicTable = function(_Component) { | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _objectWithoutProperties2 = __webpack_require__(4), _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2), _getPrototypeOf = __webpack_require__(5), _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf), _classCallCheck2 = __webpack_require__(6), _classCallCheck3 = _interopRequireDefault(_classCallCheck2), _createClass2 = __webpack_require__(7), _createClass3 = _interopRequireDefault(_createClass2), _possibleConstructorReturn2 = __webpack_require__(8), _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2), _inherits2 = __webpack_require__(9), _inherits3 = _interopRequireDefault(_inherits2), _react = __webpack_require__(10), _react2 = _interopRequireDefault(_react), _pagination = __webpack_require__(11), _constants = __webpack_require__(12), _props6 = __webpack_require__(13), _styled = __webpack_require__(16), DynamicTable = function(_Component) { | ||
function DynamicTable() { | ||
@@ -277,5 +277,2 @@ var _ref, _temp, _this, _ret; | ||
} | ||
function createError(propName, componentName, message) { | ||
return new Error("Invalid prop `" + propName + "` supplied to" + (" `" + componentName + "`. " + message)); | ||
} | ||
function isInteger(props, propName, componentName) { | ||
@@ -285,3 +282,3 @@ if (void 0 === props[propName]) return null; | ||
var message = "'" + propName + "' should be an integer or an infinity, got " + props[propName] + " instead"; | ||
return createError(propName, componentName, message); | ||
return (0, _utilCommon.createError)(propName, componentName, message); | ||
} | ||
@@ -298,3 +295,3 @@ return null; | ||
}, !0); | ||
return isAllRowsSameLength ? null : createError(propName, componentName, "One of the rows has different cell-count compared to head."); | ||
return isAllRowsSameLength ? null : (0, _utilCommon.createError)(propName, componentName, "One of the rows has different cell-count compared to head."); | ||
} | ||
@@ -304,3 +301,4 @@ function isSortable(props, propName, componentName) { | ||
var initialCheck = _react.PropTypes.bool.apply(_react.PropTypes, [ props, propName, componentName ].concat(rest)); | ||
return initialCheck instanceof Error ? initialCheck : props[propName] && !props.key ? createError(propName, componentName, "'" + propName + "' can't be set to true, if the 'key' prop is missing.") : null; | ||
return initialCheck instanceof Error ? initialCheck : props[propName] && !props.key ? (0, | ||
_utilCommon.createError)(propName, componentName, "'" + propName + "' can't be set to true, if the 'key' prop is missing.") : null; | ||
} | ||
@@ -312,3 +310,3 @@ function sortKey(props, propName, componentName) { | ||
}).includes(props[propName]); | ||
return headHasKey ? null : createError(propName, componentName, "Cell with " + props[propName] + " key not found in head."); | ||
return headHasKey ? null : (0, _utilCommon.createError)(propName, componentName, "Cell with " + props[propName] + " key not found in head."); | ||
} | ||
@@ -318,3 +316,3 @@ Object.defineProperty(exports, "__esModule", { | ||
}), exports.statefulDefaultProps = exports.statelessDefaultProps = exports.statefulPropTypes = exports.statelessPropTypes = void 0; | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _isInteger = __webpack_require__(14), _isInteger2 = _interopRequireDefault(_isInteger), _react = __webpack_require__(10), _constants = __webpack_require__(12); | ||
var _extends2 = __webpack_require__(3), _extends3 = _interopRequireDefault(_extends2), _isInteger = __webpack_require__(14), _isInteger2 = _interopRequireDefault(_isInteger), _react = __webpack_require__(10), _utilCommon = __webpack_require__(15), _constants = __webpack_require__(12); | ||
isInteger.isRequired = !1; | ||
@@ -378,2 +376,6 @@ var rowCellObject = { | ||
/***/ | ||
function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_15__; | ||
}, /* 16 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
@@ -389,3 +391,3 @@ "use strict"; | ||
}), exports.TableBodyCell = exports.TableBodyRow = exports.TableHeadCell = exports.TableHead = exports.Caption = exports.Table = void 0; | ||
var _taggedTemplateLiteral2 = __webpack_require__(16), _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2), _templateObject = (0, | ||
var _taggedTemplateLiteral2 = __webpack_require__(17), _taggedTemplateLiteral3 = _interopRequireDefault(_taggedTemplateLiteral2), _templateObject = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", ";\n ", "\n" ], [ "\n ", "\n ", ";\n ", "\n" ]), _templateObject2 = (0, | ||
@@ -405,3 +407,3 @@ _taggedTemplateLiteral3.default)([ "width: ", "%;" ], [ "width: ", "%;" ]), _templateObject3 = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n &:hover {\n background: ", ";\n }\n" ], [ "\n ", "\n &:hover {\n background: ", ";\n }\n" ]), _templateObject15 = (0, | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", "\n ", " \n" ], [ "\n ", "\n ", "\n ", " \n" ]), _styledComponents = __webpack_require__(17), _styledComponents2 = _interopRequireDefault(_styledComponents), _utilSharedStyles = __webpack_require__(18), _constants = __webpack_require__(12), gridUnit = parseInt(_utilSharedStyles.akGridSize, 10), baselineUnit = gridUnit / 2, truncateStyle = function(_ref) { | ||
_taggedTemplateLiteral3.default)([ "\n ", "\n ", "\n ", " \n" ], [ "\n ", "\n ", "\n ", " \n" ]), _styledComponents = __webpack_require__(18), _styledComponents2 = _interopRequireDefault(_styledComponents), _utilSharedStyles = __webpack_require__(19), _constants = __webpack_require__(12), gridUnit = parseInt(_utilSharedStyles.akGridSize, 10), baselineUnit = gridUnit / 2, truncateStyle = function(_ref) { | ||
var width = _ref.width, isFixedSize = _ref.isFixedSize, shouldTruncate = _ref.shouldTruncate; | ||
@@ -441,6 +443,2 @@ return (0, _styledComponents.css)(_templateObject, width ? (0, _styledComponents.css)(_templateObject2, width) : "", isFixedSize ? (0, | ||
}); | ||
}, /* 16 */ | ||
/***/ | ||
function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_16__; | ||
}, /* 17 */ | ||
@@ -456,2 +454,6 @@ /***/ | ||
/***/ | ||
function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_19__; | ||
}, /* 20 */ | ||
/***/ | ||
function(module, exports, __webpack_require__) { | ||
@@ -458,0 +460,0 @@ "use strict"; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babel-runtime/helpers/extends"),require("babel-runtime/helpers/objectWithoutProperties"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("@atlaskit/pagination"),require("babel-runtime/core-js/number/is-integer"),require("babel-runtime/helpers/taggedTemplateLiteral"),require("styled-components"),require("@atlaskit/util-shared-styles")):"function"==typeof define&&define.amd?define(["babel-runtime/helpers/extends","babel-runtime/helpers/objectWithoutProperties","babel-runtime/core-js/object/get-prototype-of","babel-runtime/helpers/classCallCheck","babel-runtime/helpers/createClass","babel-runtime/helpers/possibleConstructorReturn","babel-runtime/helpers/inherits","react","@atlaskit/pagination","babel-runtime/core-js/number/is-integer","babel-runtime/helpers/taggedTemplateLiteral","styled-components","@atlaskit/util-shared-styles"],t):"object"==typeof exports?exports["@atlaskit/dynamicTable"]=t(require("babel-runtime/helpers/extends"),require("babel-runtime/helpers/objectWithoutProperties"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("@atlaskit/pagination"),require("babel-runtime/core-js/number/is-integer"),require("babel-runtime/helpers/taggedTemplateLiteral"),require("styled-components"),require("@atlaskit/util-shared-styles")):e["@atlaskit/dynamicTable"]=t(e["babel-runtime/helpers/extends"],e["babel-runtime/helpers/objectWithoutProperties"],e["babel-runtime/core-js/object/get-prototype-of"],e["babel-runtime/helpers/classCallCheck"],e["babel-runtime/helpers/createClass"],e["babel-runtime/helpers/possibleConstructorReturn"],e["babel-runtime/helpers/inherits"],e.react,e["@atlaskit/pagination"],e["babel-runtime/core-js/number/is-integer"],e["babel-runtime/helpers/taggedTemplateLiteral"],e["styled-components"],e["@atlaskit/util-shared-styles"])}(this,function(e,t,r,n,o,l,a,i,s,u,p,d,f){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DynamicTable=t.default=void 0;var o=r(2);Object.defineProperty(t,"DynamicTable",{enumerable:!0,get:function(){return n(o).default}});var l=r(19),a=n(l);t.default=a.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){switch(e){case S.DESC:return S.ASC;case S.ASC:return S.DESC;default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var l=r(3),a=n(l),i=r(4),s=n(i),u=r(5),p=n(u),d=r(6),f=n(d),c=r(7),b=n(c),h=r(8),y=n(h),m=r(9),g=n(m),v=r(10),P=n(v),x=r(11),S=r(12),C=r(13),T=r(15),k=function(e){function t(){var e,r,n,l;(0,f.default)(this,t);for(var a=arguments.length,i=Array(a),s=0;s<a;s++)i[s]=arguments[s];return r=n=(0,y.default)(this,(e=t.__proto__||(0,p.default)(t)).call.apply(e,[this].concat(i))),n.onSort=function(e){return function(){var t=e.key;if(t){var r=t!==n.props.sortKey?S.ASC:o(n.props.sortOrder);n.onSetPage(1),n.props.onSort({key:t,item:e,sortOrder:r})}}},n.onSetPage=function(e){return n.props.onSetPage(e)},l=r,(0,y.default)(n,l)}return(0,g.default)(t,e),(0,b.default)(t,[{key:"getSortedRows",value:function(){var e=this.props,t=e.head,r=e.rows,n=e.sortKey,o=e.sortOrder;if(!n||!t)return r;var l=function(e){return e.reduce(function(e,r,o){return e||t.cells[o].key===n&&(void 0!==r.key?r.key:r.content)},null)};return r.sort(function(e,t){var r=l(e.cells),n=l(t.cells),a=o===S.ASC?1:-1;return!r||r<n?-a:!n||r>n?a:0})}},{key:"renderCaption",value:function(){var e=this.props.caption;return e?P.default.createElement(T.Caption,null,e):null}},{key:"renderHead",value:function(){var e=this,t=this.props,r=t.head,n=t.sortKey,o=t.sortOrder;if(!r)return null;var l=r.cells,i=(0,s.default)(r,["cells"]);return P.default.createElement(T.TableHead,i,P.default.createElement("tr",null,l.map(function(t,r){var l=t.isSortable,i=t.key,u=t.content,p=(0,s.default)(t,["isSortable","key","content"]),d=e.props.isFixedSize;return P.default.createElement(T.TableHeadCell,(0,a.default)({key:i||r,onClick:l&&e.onSort(t),isFixedSize:d,isSortable:l,sortOrder:i===n&&o},p),P.default.createElement("span",null,u))})))}},{key:"renderBody",value:function(){var e=this,t=this.props,r=t.rowsPerPage,n=t.page,o=this.getSortedRows();return P.default.createElement("tbody",null,(o||[]).slice((n-1)*r,n*r).map(function(t,r){return e.renderBodyRow(t,r)}))}},{key:"renderBodyRow",value:function(e,t){var r=this.props,n=r.head,o=r.isFixedSize,l=e.cells,i=(0,s.default)(e,["cells"]);return P.default.createElement(T.TableBodyRow,(0,a.default)({key:t},i),l.map(function(e,t){var r=e.content,l=(0,s.default)(e,["content"]),i=(n||{cells:[]}).cells[t]||{},u=i.shouldTruncate,p=i.width;return P.default.createElement(T.TableBodyCell,(0,a.default)({},l,{key:t,width:p,shouldTruncate:u,isFixedSize:o}),r)}))}},{key:"render",value:function(){var e=this.props,t=e.rows,r=e.isFixedSize,n=e.rowsPerPage,o=e.emptyView,l=e.page,a=t?Math.ceil(t.length/n):0;return t&&t.length?P.default.createElement("div",null,P.default.createElement(T.Table,{isFixedSize:r},this.renderCaption(),this.renderHead(),this.renderBody()),a?P.default.createElement(x.Pagination,{current:l,total:a,onSetPage:this.onSetPage}):null):o}}]),t}(v.Component);k.propTypes=C.statelessPropTypes,k.defaultProps=C.statelessDefaultProps,t.default=k},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=l},function(e,t){e.exports=a},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASC="ASC",t.DESC="DESC"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return new Error("Invalid prop `"+e+"` supplied to"+(" `"+t+"`. "+r))}function l(e,t,r){if(void 0===e[t])return null;if(!(0,f.default)(e[t])&&e[t]!==1/0){var n="'"+t+"' should be an integer or an infinity, got "+e[t]+" instead";return o(t,r,n)}return null}function a(e,t,r){for(var n=arguments.length,l=Array(n>3?n-3:0),a=3;a<n;a++)l[a-3]=arguments[a];var i=c.PropTypes.arrayOf(y).apply(void 0,[e,t,r].concat(l));if(i instanceof Error)return i;if(!e.head||!e.head.cells)return null;var s=e[t].reduce(function(t,r){return t&&r.length===e.head.cells.length},!0);return s?null:o(t,r,"One of the rows has different cell-count compared to head.")}function i(e,t,r){for(var n=arguments.length,l=Array(n>3?n-3:0),a=3;a<n;a++)l[a-3]=arguments[a];var i=c.PropTypes.bool.apply(c.PropTypes,[e,t,r].concat(l));return i instanceof Error?i:e[t]&&!e.key?o(t,r,"'"+t+"' can't be set to true, if the 'key' prop is missing."):null}function s(e,t,r){if(!e[t])return null;var n=e.head.cells.map(function(e){return e.key}).includes(e[t]);return n?null:o(t,r,"Cell with "+e[t]+" key not found in head.")}Object.defineProperty(t,"__esModule",{value:!0}),t.statefulDefaultProps=t.statelessDefaultProps=t.statefulPropTypes=t.statelessPropTypes=void 0;var u=r(3),p=n(u),d=r(14),f=n(d),c=r(10),b=r(12);l.isRequired=!1;var h={key:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string,c.PropTypes.bool]),content:c.PropTypes.node},y=c.PropTypes.shape(h);i.isRequired=!1;var m=(0,p.default)({},h,{isSortable:i,width:c.PropTypes.number,shouldTruncate:c.PropTypes.bool}),g=c.PropTypes.shape(m),v=c.PropTypes.shape({cells:c.PropTypes.arrayOf(g)}),P=c.PropTypes.arrayOf(c.PropTypes.shape({cells:a}));s.isRequired=!1;var x=c.PropTypes.node,S=c.PropTypes.oneOf([b.ASC,b.DESC]),C=c.PropTypes.bool,T=l,k=l,w=c.PropTypes.func,O=c.PropTypes.func,_=c.PropTypes.node,q={caption:x,head:v,rows:P,emptyView:_,isFixedSize:C,rowsPerPage:T,onSetPage:w,onSort:O},j={caption:null,head:null,rows:null,emptyView:null,isFixedSize:!1,rowsPerPage:1/0,onSetPage:function(){},onSort:function(){}};t.statelessPropTypes=(0,p.default)({},q,{page:k,sortKey:s,sortOrder:S}),t.statefulPropTypes=(0,p.default)({},q,{defaultPage:k,defaultSortKey:s,defaultSortOrder:S}),t.statelessDefaultProps=(0,p.default)({},j,{page:1,sortKey:null,sortOrder:null}),t.statefulDefaultProps=(0,p.default)({},j,{defaultPage:1,defaultSortKey:null,defaultSortOrder:null})},function(e,t){e.exports=u},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TableBodyCell=t.TableBodyRow=t.TableHeadCell=t.TableHead=t.Caption=t.Table=void 0;var o=r(16),l=n(o),a=(0,l.default)(["\n ","\n ",";\n ","\n"],["\n ","\n ",";\n ","\n"]),i=(0,l.default)(["width: ","%;"],["width: ","%;"]),s=(0,l.default)(["overflow: hidden;"],["overflow: hidden;"]),u=(0,l.default)(["\n white-space: nowrap;\n text-overflow: ellipsis;\n "],["\n white-space: nowrap;\n text-overflow: ellipsis;\n "]),p=(0,l.default)(["\n &:hover {\n cursor: pointer;\n }\n"],["\n &:hover {\n cursor: pointer;\n }\n"]),d=(0,l.default)(["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "],["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "]),f=(0,l.default)(["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "],["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "]),c=(0,l.default)(["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"],["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"]),b=(0,l.default)(["\n ",";\n width: 100%;\n border-collapse: collapse;\n"],["\n ",";\n width: 100%;\n border-collapse: collapse;\n"]),h=(0,l.default)(["table-layout: fixed;"],["table-layout: fixed;"]),y=(0,l.default)(["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"],["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"]),m=(0,l.default)(["\n border-bottom: 2px solid #DFE1E6;\n"],["\n border-bottom: 2px solid #DFE1E6;\n"]),g=(0,l.default)(["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"],["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"]),v=(0,l.default)(["\n ","\n &:hover {\n background: ",";\n }\n"],["\n ","\n &:hover {\n background: ",";\n }\n"]),P=(0,l.default)(["\n ","\n ","\n "," \n"],["\n ","\n ","\n "," \n"]),x=r(17),S=n(x),C=r(18),T=r(12),k=parseInt(C.akGridSize,10),w=k/2,O=function(e){var t=e.width,r=e.isFixedSize,n=e.shouldTruncate;return(0,x.css)(a,t?(0,x.css)(i,t):"",r?(0,x.css)(s):"",r&&n?(0,x.css)(u):"")},_=function(e){var t=e.onClick;return t&&(0,x.css)(p)},q=function(e){var t=e.isSortable,r=e.sortOrder;if(!t)return"";var n=(0,x.css)(d,k);return(0,x.css)(f,n,r===T.ASC?C.akColorN300:C.akColorN40,n,r===T.DESC?C.akColorN300:C.akColorN40,r===T.ASC?C.akColorN300:C.akColorN60,r===T.DESC?C.akColorN300:C.akColorN60)},j=(0,x.css)(c,w,k);t.Table=S.default.table(b,function(e){var t=e.isFixedSize;return t&&(0,x.css)(h)}),t.Caption=S.default.caption(y,7*w,k),t.TableHead=S.default.thead(m),t.TableHeadCell=S.default.th(g,function(e){return _(e)},function(e){return O(e)},function(e){return q(e)},function(){return j},C.akColorN300),t.TableBodyRow=S.default.tr(v,function(e){return _(e)},C.akColorN10),t.TableBodyCell=S.default.td(P,function(e){return _(e)},function(e){return O(e)},function(){return j})},function(e,t){e.exports=p},function(e,t){e.exports=d},function(e,t){e.exports=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),l=n(o),a=r(6),i=n(a),s=r(7),u=n(s),p=r(8),d=n(p),f=r(9),c=n(f),b=r(10),h=n(b),y=r(2),m=n(y),g=r(13),v=function(e){function t(){var e,r,n,o;(0,i.default)(this,t);for(var a=arguments.length,s=Array(a),u=0;u<a;u++)s[u]=arguments[u];return r=n=(0,d.default)(this,(e=t.__proto__||(0,l.default)(t)).call.apply(e,[this].concat(s))),n.state={page:n.props.defaultPage,sortKey:n.props.defaultSortKey,sortOrder:n.props.defaultSortOrder},n.onSetPage=function(e){n.props.onSetPage(e),n.setState({page:e})},n.onSort=function(e){var t=e.key,r=e.item,o=e.sortOrder;n.props.onSort({key:t,item:r,sortOrder:o}),n.setState({sortKey:t,sortOrder:o,page:1})},o=r,(0,d.default)(n,o)}return(0,c.default)(t,e),(0,u.default)(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({page:e.page,sortKey:e.defaultSortKey,sortOrder:e.defaultSortOrder})}},{key:"render",value:function(){return h.default.createElement(m.default,{caption:this.props.caption,head:this.props.head,rows:this.props.rows,emptyView:this.props.emptyView,isFixedSize:this.props.isFixedSize,rowsPerPage:this.props.rowsPerPage,onSetPage:this.onSetPage,onSort:this.onSort,page:this.state.page,sortKey:this.state.sortKey,sortOrder:this.state.sortOrder})}}]),t}(b.PureComponent);v.propTypes=g.statefulPropTypes,v.defaultProps=g.statefulDefaultProps,t.default=v}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("babel-runtime/helpers/extends"),require("babel-runtime/helpers/objectWithoutProperties"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("@atlaskit/pagination"),require("babel-runtime/core-js/number/is-integer"),require("@atlaskit/util-common"),require("babel-runtime/helpers/taggedTemplateLiteral"),require("styled-components"),require("@atlaskit/util-shared-styles")):"function"==typeof define&&define.amd?define(["babel-runtime/helpers/extends","babel-runtime/helpers/objectWithoutProperties","babel-runtime/core-js/object/get-prototype-of","babel-runtime/helpers/classCallCheck","babel-runtime/helpers/createClass","babel-runtime/helpers/possibleConstructorReturn","babel-runtime/helpers/inherits","react","@atlaskit/pagination","babel-runtime/core-js/number/is-integer","@atlaskit/util-common","babel-runtime/helpers/taggedTemplateLiteral","styled-components","@atlaskit/util-shared-styles"],t):"object"==typeof exports?exports["@atlaskit/dynamicTable"]=t(require("babel-runtime/helpers/extends"),require("babel-runtime/helpers/objectWithoutProperties"),require("babel-runtime/core-js/object/get-prototype-of"),require("babel-runtime/helpers/classCallCheck"),require("babel-runtime/helpers/createClass"),require("babel-runtime/helpers/possibleConstructorReturn"),require("babel-runtime/helpers/inherits"),require("react"),require("@atlaskit/pagination"),require("babel-runtime/core-js/number/is-integer"),require("@atlaskit/util-common"),require("babel-runtime/helpers/taggedTemplateLiteral"),require("styled-components"),require("@atlaskit/util-shared-styles")):e["@atlaskit/dynamicTable"]=t(e["babel-runtime/helpers/extends"],e["babel-runtime/helpers/objectWithoutProperties"],e["babel-runtime/core-js/object/get-prototype-of"],e["babel-runtime/helpers/classCallCheck"],e["babel-runtime/helpers/createClass"],e["babel-runtime/helpers/possibleConstructorReturn"],e["babel-runtime/helpers/inherits"],e.react,e["@atlaskit/pagination"],e["babel-runtime/core-js/number/is-integer"],e["@atlaskit/util-common"],e["babel-runtime/helpers/taggedTemplateLiteral"],e["styled-components"],e["@atlaskit/util-shared-styles"])}(this,function(e,t,r,n,o,a,l,i,s,u,p,d,c,f){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.DynamicTable=t.default=void 0;var o=r(2);Object.defineProperty(t,"DynamicTable",{enumerable:!0,get:function(){return n(o).default}});var a=r(20),l=n(a);t.default=l.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){switch(e){case S.DESC:return S.ASC;case S.ASC:return S.DESC;default:return e}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(3),l=n(a),i=r(4),s=n(i),u=r(5),p=n(u),d=r(6),c=n(d),f=r(7),b=n(f),h=r(8),y=n(h),m=r(9),g=n(m),v=r(10),x=n(v),P=r(11),S=r(12),k=r(13),C=r(16),T=function(e){function t(){var e,r,n,a;(0,c.default)(this,t);for(var l=arguments.length,i=Array(l),s=0;s<l;s++)i[s]=arguments[s];return r=n=(0,y.default)(this,(e=t.__proto__||(0,p.default)(t)).call.apply(e,[this].concat(i))),n.onSort=function(e){return function(){var t=e.key;if(t){var r=t!==n.props.sortKey?S.ASC:o(n.props.sortOrder);n.onSetPage(1),n.props.onSort({key:t,item:e,sortOrder:r})}}},n.onSetPage=function(e){return n.props.onSetPage(e)},a=r,(0,y.default)(n,a)}return(0,g.default)(t,e),(0,b.default)(t,[{key:"getSortedRows",value:function(){var e=this.props,t=e.head,r=e.rows,n=e.sortKey,o=e.sortOrder;if(!n||!t)return r;var a=function(e){return e.reduce(function(e,r,o){return e||t.cells[o].key===n&&(void 0!==r.key?r.key:r.content)},null)};return r.sort(function(e,t){var r=a(e.cells),n=a(t.cells),l=o===S.ASC?1:-1;return!r||r<n?-l:!n||r>n?l:0})}},{key:"renderCaption",value:function(){var e=this.props.caption;return e?x.default.createElement(C.Caption,null,e):null}},{key:"renderHead",value:function(){var e=this,t=this.props,r=t.head,n=t.sortKey,o=t.sortOrder;if(!r)return null;var a=r.cells,i=(0,s.default)(r,["cells"]);return x.default.createElement(C.TableHead,i,x.default.createElement("tr",null,a.map(function(t,r){var a=t.isSortable,i=t.key,u=t.content,p=(0,s.default)(t,["isSortable","key","content"]),d=e.props.isFixedSize;return x.default.createElement(C.TableHeadCell,(0,l.default)({key:i||r,onClick:a&&e.onSort(t),isFixedSize:d,isSortable:a,sortOrder:i===n&&o},p),x.default.createElement("span",null,u))})))}},{key:"renderBody",value:function(){var e=this,t=this.props,r=t.rowsPerPage,n=t.page,o=this.getSortedRows();return x.default.createElement("tbody",null,(o||[]).slice((n-1)*r,n*r).map(function(t,r){return e.renderBodyRow(t,r)}))}},{key:"renderBodyRow",value:function(e,t){var r=this.props,n=r.head,o=r.isFixedSize,a=e.cells,i=(0,s.default)(e,["cells"]);return x.default.createElement(C.TableBodyRow,(0,l.default)({key:t},i),a.map(function(e,t){var r=e.content,a=(0,s.default)(e,["content"]),i=(n||{cells:[]}).cells[t]||{},u=i.shouldTruncate,p=i.width;return x.default.createElement(C.TableBodyCell,(0,l.default)({},a,{key:t,width:p,shouldTruncate:u,isFixedSize:o}),r)}))}},{key:"render",value:function(){var e=this.props,t=e.rows,r=e.isFixedSize,n=e.rowsPerPage,o=e.emptyView,a=e.page,l=t?Math.ceil(t.length/n):0;return t&&t.length?x.default.createElement("div",null,x.default.createElement(C.Table,{isFixedSize:r},this.renderCaption(),this.renderHead(),this.renderBody()),l?x.default.createElement(P.Pagination,{current:a,total:l,onSetPage:this.onSetPage}):null):o}}]),t}(v.Component);T.propTypes=k.statelessPropTypes,T.defaultProps=k.statelessDefaultProps,t.default=T},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=a},function(e,t){e.exports=l},function(e,t){e.exports=i},function(e,t){e.exports=s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASC="ASC",t.DESC="DESC"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){if(void 0===e[t])return null;if(!(0,d.default)(e[t])&&e[t]!==1/0){var n="'"+t+"' should be an integer or an infinity, got "+e[t]+" instead";return(0,f.createError)(t,r,n)}return null}function a(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),a=3;a<n;a++)o[a-3]=arguments[a];var l=c.PropTypes.arrayOf(y).apply(void 0,[e,t,r].concat(o));if(l instanceof Error)return l;if(!e.head||!e.head.cells)return null;var i=e[t].reduce(function(t,r){return t&&r.length===e.head.cells.length},!0);return i?null:(0,f.createError)(t,r,"One of the rows has different cell-count compared to head.")}function l(e,t,r){for(var n=arguments.length,o=Array(n>3?n-3:0),a=3;a<n;a++)o[a-3]=arguments[a];var l=c.PropTypes.bool.apply(c.PropTypes,[e,t,r].concat(o));return l instanceof Error?l:e[t]&&!e.key?(0,f.createError)(t,r,"'"+t+"' can't be set to true, if the 'key' prop is missing."):null}function i(e,t,r){if(!e[t])return null;var n=e.head.cells.map(function(e){return e.key}).includes(e[t]);return n?null:(0,f.createError)(t,r,"Cell with "+e[t]+" key not found in head.")}Object.defineProperty(t,"__esModule",{value:!0}),t.statefulDefaultProps=t.statelessDefaultProps=t.statefulPropTypes=t.statelessPropTypes=void 0;var s=r(3),u=n(s),p=r(14),d=n(p),c=r(10),f=r(15),b=r(12);o.isRequired=!1;var h={key:c.PropTypes.oneOfType([c.PropTypes.number,c.PropTypes.string,c.PropTypes.bool]),content:c.PropTypes.node},y=c.PropTypes.shape(h);l.isRequired=!1;var m=(0,u.default)({},h,{isSortable:l,width:c.PropTypes.number,shouldTruncate:c.PropTypes.bool}),g=c.PropTypes.shape(m),v=c.PropTypes.shape({cells:c.PropTypes.arrayOf(g)}),x=c.PropTypes.arrayOf(c.PropTypes.shape({cells:a}));i.isRequired=!1;var P=c.PropTypes.node,S=c.PropTypes.oneOf([b.ASC,b.DESC]),k=c.PropTypes.bool,C=o,T=o,w=c.PropTypes.func,O=c.PropTypes.func,q=c.PropTypes.node,_={caption:P,head:v,rows:x,emptyView:q,isFixedSize:k,rowsPerPage:C,onSetPage:w,onSort:O},E={caption:null,head:null,rows:null,emptyView:null,isFixedSize:!1,rowsPerPage:1/0,onSetPage:function(){},onSort:function(){}};t.statelessPropTypes=(0,u.default)({},_,{page:T,sortKey:i,sortOrder:S}),t.statefulPropTypes=(0,u.default)({},_,{defaultPage:T,defaultSortKey:i,defaultSortOrder:S}),t.statelessDefaultProps=(0,u.default)({},E,{page:1,sortKey:null,sortOrder:null}),t.statefulDefaultProps=(0,u.default)({},E,{defaultPage:1,defaultSortKey:null,defaultSortOrder:null})},function(e,t){e.exports=u},function(e,t){e.exports=p},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TableBodyCell=t.TableBodyRow=t.TableHeadCell=t.TableHead=t.Caption=t.Table=void 0;var o=r(17),a=n(o),l=(0,a.default)(["\n ","\n ",";\n ","\n"],["\n ","\n ",";\n ","\n"]),i=(0,a.default)(["width: ","%;"],["width: ","%;"]),s=(0,a.default)(["overflow: hidden;"],["overflow: hidden;"]),u=(0,a.default)(["\n white-space: nowrap;\n text-overflow: ellipsis;\n "],["\n white-space: nowrap;\n text-overflow: ellipsis;\n "]),p=(0,a.default)(["\n &:hover {\n cursor: pointer;\n }\n"],["\n &:hover {\n cursor: pointer;\n }\n"]),d=(0,a.default)(["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "],["\n position: absolute;\n display: block;\n width: 0;\n height: 0;\n right: -","px;\n border: 3px solid transparent;\n "]),c=(0,a.default)(["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "],["\n & > span {\n position: relative;\n &:before {\n ",";\n content: ' ';\n bottom: 8px;\n border-bottom: 3px solid ","; \n };\n &:after {\n ",";\n content: ' ';\n bottom: 0; \n border-top: 3px solid ","; \n };\n }\n \n &:hover > span {\n &:before {\n border-bottom: 3px solid ","; \n }\n &:after {\n border-top: 3px solid ","; \n }\n }\n "]),f=(0,a.default)(["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"],["\n padding: ","px ","px;\n border: none;\n text-align: left; \n &:first-child {\n padding-left: 0;\n }\n &:last-child {\n padding-right: 0;\n }\n"]),b=(0,a.default)(["\n ",";\n width: 100%;\n border-collapse: collapse;\n"],["\n ",";\n width: 100%;\n border-collapse: collapse;\n"]),h=(0,a.default)(["table-layout: fixed;"],["table-layout: fixed;"]),y=(0,a.default)(["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"],["\n font-size: 1.42857143em;\n font-style: inherit;\n font-weight: 500;\n letter-spacing: -0.008em;\n line-height: 1.2;\n margin-top: ","px;\n margin-bottom: ","px;\n text-align: left;\n"]),m=(0,a.default)(["\n border-bottom: 2px solid #DFE1E6;\n"],["\n border-bottom: 2px solid #DFE1E6;\n"]),g=(0,a.default)(["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"],["\n ","\n ","\n ","\n ","\n position: relative;\n vertical-align: top;\n text-align: left;\n border: none;\n font-size: 12px;\n color: ",";\n fontWeight: 600;\n"]),v=(0,a.default)(["\n ","\n &:hover {\n background: ",";\n }\n"],["\n ","\n &:hover {\n background: ",";\n }\n"]),x=(0,a.default)(["\n ","\n ","\n "," \n"],["\n ","\n ","\n "," \n"]),P=r(18),S=n(P),k=r(19),C=r(12),T=parseInt(k.akGridSize,10),w=T/2,O=function(e){var t=e.width,r=e.isFixedSize,n=e.shouldTruncate;return(0,P.css)(l,t?(0,P.css)(i,t):"",r?(0,P.css)(s):"",r&&n?(0,P.css)(u):"")},q=function(e){var t=e.onClick;return t&&(0,P.css)(p)},_=function(e){var t=e.isSortable,r=e.sortOrder;if(!t)return"";var n=(0,P.css)(d,T);return(0,P.css)(c,n,r===C.ASC?k.akColorN300:k.akColorN40,n,r===C.DESC?k.akColorN300:k.akColorN40,r===C.ASC?k.akColorN300:k.akColorN60,r===C.DESC?k.akColorN300:k.akColorN60)},E=(0,P.css)(f,w,T);t.Table=S.default.table(b,function(e){var t=e.isFixedSize;return t&&(0,P.css)(h)}),t.Caption=S.default.caption(y,7*w,T),t.TableHead=S.default.thead(m),t.TableHeadCell=S.default.th(g,function(e){return q(e)},function(e){return O(e)},function(e){return _(e)},function(){return E},k.akColorN300),t.TableBodyRow=S.default.tr(v,function(e){return q(e)},k.akColorN10),t.TableBodyCell=S.default.td(x,function(e){return q(e)},function(e){return O(e)},function(){return E})},function(e,t){e.exports=d},function(e,t){e.exports=c},function(e,t){e.exports=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),a=n(o),l=r(6),i=n(l),s=r(7),u=n(s),p=r(8),d=n(p),c=r(9),f=n(c),b=r(10),h=n(b),y=r(2),m=n(y),g=r(13),v=function(e){function t(){var e,r,n,o;(0,i.default)(this,t);for(var l=arguments.length,s=Array(l),u=0;u<l;u++)s[u]=arguments[u];return r=n=(0,d.default)(this,(e=t.__proto__||(0,a.default)(t)).call.apply(e,[this].concat(s))),n.state={page:n.props.defaultPage,sortKey:n.props.defaultSortKey,sortOrder:n.props.defaultSortOrder},n.onSetPage=function(e){n.props.onSetPage(e),n.setState({page:e})},n.onSort=function(e){var t=e.key,r=e.item,o=e.sortOrder;n.props.onSort({key:t,item:r,sortOrder:o}),n.setState({sortKey:t,sortOrder:o,page:1})},o=r,(0,d.default)(n,o)}return(0,f.default)(t,e),(0,u.default)(t,[{key:"componentWillReceiveProps",value:function(e){this.setState({page:e.page,sortKey:e.defaultSortKey,sortOrder:e.defaultSortOrder})}},{key:"render",value:function(){return h.default.createElement(m.default,{caption:this.props.caption,head:this.props.head,rows:this.props.rows,emptyView:this.props.emptyView,isFixedSize:this.props.isFixedSize,rowsPerPage:this.props.rowsPerPage,onSetPage:this.onSetPage,onSort:this.onSort,page:this.state.page,sortKey:this.state.sortKey,sortOrder:this.state.sortOrder})}}]),t}(b.PureComponent);v.propTypes=g.statefulPropTypes,v.defaultProps=g.statefulDefaultProps,t.default=v}])}); |
{ | ||
"name": "@atlaskit/dynamic-table", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"config": { | ||
@@ -19,2 +19,3 @@ "access": "public" | ||
"@atlaskit/pagination": "^1.0.4", | ||
"@atlaskit/util-common": "^1.1.0", | ||
"@atlaskit/util-shared-styles": "^1.0.1", | ||
@@ -24,4 +25,4 @@ "babel-runtime": "^6.11.6" | ||
"devDependencies": { | ||
"@atlaskit/util-readme": "^1.0.0", | ||
"@atlaskit/dynamic-table": "*" | ||
"@atlaskit/dynamic-table": "*", | ||
"@atlaskit/util-readme": "^1.0.0" | ||
}, | ||
@@ -28,0 +29,0 @@ "peerDependencies": { |
@@ -5,3 +5,3 @@ [![AtlasKit component registry](https://img.shields.io/badge/AtlasKit-components-FF5230.svg)](http://aui-cdn.atlassian.com/atlaskit/registry/) | ||
[![Report an issue](https://img.shields.io/badge/Report-an_issue-6554C0.svg)](https://ecosystem.atlassian.net/browse/AK) | ||
[![Ask in our forum](https://img.shields.io/badge/Ask-in_our_forum-6554C0.svg)](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,@atlaskit/dynamic-table,@atlaskit/dynamic-table@2.0.1) | ||
[![Ask in our forum](https://img.shields.io/badge/Ask-in_our_forum-6554C0.svg)](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,@atlaskit/dynamic-table,@atlaskit/dynamic-table@2.1.0) | ||
@@ -16,3 +16,3 @@ # DynamicTable | ||
Interact with a [live demo of the @atlaskit/dynamic-table component](https://aui-cdn.atlassian.com/atlaskit/stories/@atlaskit/dynamic-table/2.0.1/). | ||
Interact with a [live demo of the @atlaskit/dynamic-table component](https://aui-cdn.atlassian.com/atlaskit/stories/@atlaskit/dynamic-table/2.1.0/). | ||
@@ -25,3 +25,3 @@ ## Installation | ||
Detailed docs and example usage can be found [here](https://aui-cdn.atlassian.com/atlaskit/stories/@atlaskit/@atlaskit/dynamic-table/2.0.1/). | ||
Detailed docs and example usage can be found [here](https://aui-cdn.atlassian.com/atlaskit/stories/@atlaskit/@atlaskit/dynamic-table/2.1.0/). | ||
@@ -36,3 +36,3 @@ ## Support and feedback | ||
Ask a question in our [forum](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,@atlaskit/dynamic-table,@atlaskit/dynamic-table@2.0.1). | ||
Ask a question in our [forum](https://answers.atlassian.com/questions/ask?title=AtlasKit%3A%20&topics=atlaskit,@atlaskit/dynamic-table,@atlaskit/dynamic-table@2.1.0). | ||
@@ -39,0 +39,0 @@ Check [if someone has already asked the same question before](https://answers.atlassian.com/questions/topics/42926171/atlaskit). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95267
1060
3
8
6
+ Added@atlaskit/util-common@^1.1.0