@commercetools-uikit/data-table 12.2.7 → 12.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,7 +62,7 @@ export default Example;
62
62
  | Props | Type | Required | Default | Description |
63
63
  | ------------------------- | -------------------------------------------------------------- | :------: | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
64
64
  | `rows` | `Array: Row[]`<br/>[See signature.](#signature-rows) | ✅ | | The list of data that needs to be rendered in the table. Each object in the list can&#xA;have any shape as long as it has a unique identifier.&#xA;The data is rendered by using the callback render function `itemRenderer`. |
65
- | `columns` | `Array: TColumn[]`<br/>[See signature.](#signature-columns) || | Each object requires a unique `key` which should correspond to property key of&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered.&#xA;Each column can be customized (see properties below). |
65
+ | `columns` | `Array: TColumn[]`<br/>[See signature.](#signature-columns) | | `[]` | Each object requires a unique `key` which should correspond to property key of&#xA;the items of `rows` that you want to render under this column, and a `label`&#xA;which defines the name shown on the header.&#xA;The list of columns to be rendered.&#xA;Each column can be customized (see properties below). |
66
66
  | `footer` | `ReactNode` | | | Element to render within the `tfoot` (footer) element of the table. |
67
67
  | `maxWidth` | `union`<br/>Possible values:<br/>`number , string` | | | The max width (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow horizontally to fill its parent. |
68
68
  | `maxHeight` | `union`<br/>Possible values:<br/>`number , string` | | | The max height (a number of pixels or a css value string with units) for which the table&#xA;is allowed to grow. If unset, the table will grow vertically to fill its parent. |
@@ -7,7 +7,6 @@ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArr
7
7
  var _pt = require('prop-types');
8
8
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
9
9
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
10
- var _Array$isArray = require('@babel/runtime-corejs3/core-js-stable/array/is-array');
11
10
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
12
11
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
13
12
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -37,7 +36,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
37
36
  var _pt__default = /*#__PURE__*/_interopDefault(_pt);
38
37
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
39
38
  var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
40
- var _Array$isArray__default = /*#__PURE__*/_interopDefault(_Array$isArray);
41
39
  var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
42
40
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
43
41
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
@@ -974,6 +972,7 @@ var shouldRenderRowBottomBorder = function shouldRenderRowBottomBorder(rowIndex,
974
972
  };
975
973
 
976
974
  var defaultProps = {
975
+ columns: [],
977
976
  isCondensed: false,
978
977
  wrapHeaderLabels: true,
979
978
  verticalCellAlignment: 'top',
@@ -988,7 +987,7 @@ var defaultProps = {
988
987
  var DataTable = function DataTable(props) {
989
988
  var _context2, _context3;
990
989
 
991
- process.env.NODE_ENV !== "production" ? utils.warning(_Array$isArray__default["default"](props.columns), "ui-kit/DataTable: the prop \"columns\" is required.") : void 0;
990
+ process.env.NODE_ENV !== "production" ? utils.warning(props.columns.length > 0, "ui-kit/DataTable: empty table \"columns\", expected at least one column. If you are using DataTableManager you need to pass the \"columns\" there and they will be injected into DataTable.") : void 0;
992
991
  var tableRef = react$1.useRef();
993
992
  var columnResizingReducer = useManualColumnResizing$1(tableRef); // if the table columns have been measured
994
993
  // and if the list of columns, their width field, or the isCondensed prop has changed
@@ -1027,7 +1026,7 @@ var DataTable = function DataTable(props) {
1027
1026
  value: columnResizingReducer,
1028
1027
  children: [jsxRuntime.jsx(Header, {
1029
1028
  children: jsxRuntime.jsx(Row, {
1030
- children: props.columns && _mapInstanceProperty__default["default"](_context2 = props.columns).call(_context2, function (column) {
1029
+ children: _mapInstanceProperty__default["default"](_context2 = props.columns).call(_context2, function (column) {
1031
1030
  return jsxRuntime.jsx(HeaderCell$1, {
1032
1031
  shouldWrap: props.wrapHeaderLabels,
1033
1032
  isCondensed: props.isCondensed,
@@ -1106,7 +1105,7 @@ DataTable.displayName = 'DataTable';
1106
1105
  var DataTable$1 = DataTable;
1107
1106
 
1108
1107
  // NOTE: This string will be replaced on build time with the package version.
1109
- var version = "12.2.7";
1108
+ var version = "12.2.8";
1110
1109
 
1111
1110
  Object.defineProperty(exports, 'useRowSelection', {
1112
1111
  enumerable: true,
@@ -7,7 +7,6 @@ var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArr
7
7
  require('prop-types');
8
8
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
9
9
  var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
10
- require('@babel/runtime-corejs3/core-js-stable/array/is-array');
11
10
  var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
12
11
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
13
12
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
@@ -809,6 +808,7 @@ var shouldRenderRowBottomBorder = function shouldRenderRowBottomBorder(rowIndex,
809
808
  };
810
809
 
811
810
  var defaultProps = {
811
+ columns: [],
812
812
  isCondensed: false,
813
813
  wrapHeaderLabels: true,
814
814
  verticalCellAlignment: 'top',
@@ -860,7 +860,7 @@ var DataTable = function DataTable(props) {
860
860
  value: columnResizingReducer,
861
861
  children: [jsxRuntime.jsx(Header, {
862
862
  children: jsxRuntime.jsx(Row, {
863
- children: props.columns && _mapInstanceProperty__default["default"](_context2 = props.columns).call(_context2, function (column) {
863
+ children: _mapInstanceProperty__default["default"](_context2 = props.columns).call(_context2, function (column) {
864
864
  return jsxRuntime.jsx(HeaderCell$1, {
865
865
  shouldWrap: props.wrapHeaderLabels,
866
866
  isCondensed: props.isCondensed,
@@ -909,7 +909,7 @@ DataTable.displayName = 'DataTable';
909
909
  var DataTable$1 = DataTable;
910
910
 
911
911
  // NOTE: This string will be replaced on build time with the package version.
912
- var version = "12.2.7";
912
+ var version = "12.2.8";
913
913
 
914
914
  Object.defineProperty(exports, 'useRowSelection', {
915
915
  enumerable: true,
@@ -3,7 +3,6 @@ import _toConsumableArray from '@babel/runtime-corejs3/helpers/esm/toConsumableA
3
3
  import _pt from 'prop-types';
4
4
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
5
5
  import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
6
- import _Array$isArray from '@babel/runtime-corejs3/core-js-stable/array/is-array';
7
6
  import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
8
7
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
9
8
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
@@ -949,6 +948,7 @@ var shouldRenderRowBottomBorder = function shouldRenderRowBottomBorder(rowIndex,
949
948
  };
950
949
 
951
950
  var defaultProps = {
951
+ columns: [],
952
952
  isCondensed: false,
953
953
  wrapHeaderLabels: true,
954
954
  verticalCellAlignment: 'top',
@@ -963,7 +963,7 @@ var defaultProps = {
963
963
  var DataTable = function DataTable(props) {
964
964
  var _context2, _context3;
965
965
 
966
- process.env.NODE_ENV !== "production" ? warning(_Array$isArray(props.columns), "ui-kit/DataTable: the prop \"columns\" is required.") : void 0;
966
+ process.env.NODE_ENV !== "production" ? warning(props.columns.length > 0, "ui-kit/DataTable: empty table \"columns\", expected at least one column. If you are using DataTableManager you need to pass the \"columns\" there and they will be injected into DataTable.") : void 0;
967
967
  var tableRef = useRef();
968
968
  var columnResizingReducer = useManualColumnResizing$1(tableRef); // if the table columns have been measured
969
969
  // and if the list of columns, their width field, or the isCondensed prop has changed
@@ -1002,7 +1002,7 @@ var DataTable = function DataTable(props) {
1002
1002
  value: columnResizingReducer,
1003
1003
  children: [jsx(Header, {
1004
1004
  children: jsx(Row, {
1005
- children: props.columns && _mapInstanceProperty(_context2 = props.columns).call(_context2, function (column) {
1005
+ children: _mapInstanceProperty(_context2 = props.columns).call(_context2, function (column) {
1006
1006
  return jsx(HeaderCell$1, {
1007
1007
  shouldWrap: props.wrapHeaderLabels,
1008
1008
  isCondensed: props.isCondensed,
@@ -1081,6 +1081,6 @@ DataTable.displayName = 'DataTable';
1081
1081
  var DataTable$1 = DataTable;
1082
1082
 
1083
1083
  // NOTE: This string will be replaced on build time with the package version.
1084
- var version = "12.2.7";
1084
+ var version = "12.2.8";
1085
1085
 
1086
1086
  export { DataTable$1 as default, version };
@@ -13,13 +13,9 @@ export declare type TDataCell = {
13
13
  handleRowCollapseClick?: () => void;
14
14
  isRowCollapsed?: boolean;
15
15
  };
16
- declare type TDefaultProps = {
17
- isTruncated: boolean;
18
- shouldRenderBottomBorder: boolean;
19
- };
20
16
  declare const DataCell: {
21
17
  (props: TDataCell): import("@emotion/react/jsx-runtime").JSX.Element;
22
18
  displayName: string;
23
- defaultProps: TDefaultProps;
19
+ defaultProps: Pick<TDataCell, "isTruncated" | "shouldRenderBottomBorder">;
24
20
  };
25
21
  export default DataCell;
@@ -36,7 +36,7 @@ export declare type TDataTableProps<Row extends TRow = TRow> = {
36
36
  };
37
37
  declare const DataTable: {
38
38
  <Row extends TRow = TRow>(props: TDataTableProps<Row>): import("@emotion/react/jsx-runtime").JSX.Element;
39
- defaultProps: Pick<TDataTableProps<TRow>, "isCondensed" | "wrapHeaderLabels" | "horizontalCellAlignment" | "verticalCellAlignment" | "disableSelfContainment" | "itemRenderer">;
39
+ defaultProps: Pick<TDataTableProps<TRow>, "columns" | "isCondensed" | "wrapHeaderLabels" | "horizontalCellAlignment" | "verticalCellAlignment" | "disableSelfContainment" | "itemRenderer">;
40
40
  displayName: string;
41
41
  };
42
42
  export default DataTable;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/data-table",
3
3
  "description": "A component for rendering tabular data.",
4
- "version": "12.2.7",
4
+ "version": "12.2.8",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",