@synerise/ds-table 0.42.0 → 0.42.4

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/Cell/Action/ActionCell.js +1 -1
  3. package/dist/Cell/Action/ActionCell.styles.js +1 -1
  4. package/dist/Cell/AvatarLabel/AvatarLabel.js +1 -1
  5. package/dist/Cell/AvatarLabel/AvatarLabel.styles.js +2 -2
  6. package/dist/Cell/Copyable/CopyableCell.js +2 -15
  7. package/dist/Cell/Editable/EditableCell.js +5 -19
  8. package/dist/Cell/LabelsWithShowMore/LabelsWithShowMore.js +3 -16
  9. package/dist/Cell/LabelsWithShowMore/Modal/Modal.js +3 -16
  10. package/dist/Cell/Star/StarCell.styles.js +1 -1
  11. package/dist/ColumnSortMenu/SortRenderer.js +5 -19
  12. package/dist/ColumnSortMenu/TitleWithSort.js +1 -3
  13. package/dist/ColumnSortMenu/columnWithSortButtons.js +6 -4
  14. package/dist/ColumnSortMenu/groupedColumnsSort.js +7 -19
  15. package/dist/ColumnSortMenu/replaceSortButtons.js +2 -2
  16. package/dist/ColumnSortMenu/useSortState.js +39 -44
  17. package/dist/DefaultTable/DefaultTable.js +28 -53
  18. package/dist/FilterTrigger/FilterTrigger.js +6 -19
  19. package/dist/GroupTable/GroupTable.js +16 -40
  20. package/dist/GroupTable/GroupTable.styles.js +2 -2
  21. package/dist/GroupTable/GroupTableBody/GroupTableBody.js +10 -23
  22. package/dist/GroupTable/GroupTableHeader/GroupTableHeader.js +1 -1
  23. package/dist/Table.js +10 -22
  24. package/dist/Table.styles.js +1 -1
  25. package/dist/TableHeader/TableHeader.js +4 -17
  26. package/dist/TableHeader/TableLimit/TableLimit.js +3 -3
  27. package/dist/TableHeader/TableSelection.js +16 -28
  28. package/dist/TreeTable/TreeTable.js +5 -19
  29. package/dist/TreeTable/TreeTable.styles.js +2 -2
  30. package/dist/VirtualTable/VirtualTable.js +44 -66
  31. package/dist/VirtualTable/VirtualTable.styles.js +1 -1
  32. package/dist/VirtualTable/VirtualTableRow.js +54 -79
  33. package/dist/hooks/useRowStar.js +5 -5
  34. package/dist/utils/calculatePixels.js +1 -1
  35. package/dist/utils/locale.js +4 -4
  36. package/package.json +20 -20
@@ -1,30 +1,10 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
4
2
 
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
4
 
7
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
6
 
9
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
-
11
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
12
-
13
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
14
-
15
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
16
-
17
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
-
19
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20
-
21
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
22
-
23
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
24
-
25
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
26
-
27
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
7
+ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
28
8
 
29
9
  import * as React from 'react';
30
10
  import classNames from 'classnames';
@@ -44,67 +24,62 @@ var calculateToPixelsIfDefined = function calculateToPixelsIfDefined(value) {
44
24
  };
45
25
 
46
26
  var VirtualTableRow = /*#__PURE__*/function (_React$PureComponent) {
47
- _inherits(VirtualTableRow, _React$PureComponent);
48
-
49
- var _super = _createSuper(VirtualTableRow);
27
+ _inheritsLoose(VirtualTableRow, _React$PureComponent);
50
28
 
51
29
  function VirtualTableRow() {
52
- _classCallCheck(this, VirtualTableRow);
53
-
54
- return _super.apply(this, arguments);
30
+ return _React$PureComponent.apply(this, arguments) || this;
55
31
  }
56
32
 
57
- _createClass(VirtualTableRow, [{
58
- key: "render",
59
- value: function render() {
60
- var _this$props = this.props,
61
- index = _this$props.index,
62
- style = _this$props.style,
63
- data = _this$props.data;
64
- var mergedColumns = data.mergedColumns,
65
- onRowClick = data.onRowClick,
66
- selection = data.selection,
67
- dataSource = data.dataSource,
68
- cellHeight = data.cellHeight,
69
- infiniteScroll = data.infiniteScroll,
70
- defaultTableProps = data.defaultTableProps;
71
- var rowData = dataSource[index];
72
- return (
73
- /*#__PURE__*/
74
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
75
- React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.RowWrapper, {
76
- className: classNames('virtual-table-row', {
77
- 'ds-expanded-row': rowData[EXPANDED_ROW_PROPERTY]
78
- }),
79
- style: style,
80
- onClick: function onClick() {
81
- return onRowClick && onRowClick(rowData);
82
- }
83
- }, mergedColumns.map(function (column, columnIndex) {
84
- return /*#__PURE__*/React.createElement(S.ColWrapper, {
85
- className: classNames('virtual-table-cell', {
86
- 'virtual-table-cell-last': columnIndex === mergedColumns.length - 1,
87
- 'ant-table-selection-column': columnIndex === 0 && selection,
88
- 'ds-expanded-row-first': rowData[EXPANDED_ROW_PROPERTY] && columnIndex === 0,
89
- 'ds-expanded-row-data': rowData[EXPANDED_ROW_PROPERTY] && (columnIndex === 1 && selection || columnIndex === 0 && !selection)
90
- }, isColumnSortingActive((defaultTableProps === null || defaultTableProps === void 0 ? void 0 : defaultTableProps.columns) || [], column) && 'ant-table-column-sort', column.className),
91
- key: "row-".concat(index, "-column-").concat(column.dataIndex || column.key),
92
- minWidth: calculateToPixelsIfDefined(column === null || column === void 0 ? void 0 : column.minWidth),
93
- width: column.width,
94
- maxWidth: calculateToPixelsIfDefined(column === null || column === void 0 ? void 0 : column.maxWidth)
95
- }, column.render ? column.render(rowData[column.dataIndex], rowData) : rowData[column.dataIndex]);
96
- })), infiniteScroll && index === dataSource.length - 1 && /*#__PURE__*/React.createElement(S.RowWrapper, {
97
- style: _objectSpread(_objectSpread({}, style), {}, {
98
- top: "".concat(Number(style.top) + cellHeight, "px"),
99
- height: '64px',
100
- padding: '16px 24px'
101
- })
102
- }, /*#__PURE__*/React.createElement(InfiniteLoaderItem, {
103
- infiniteScroll: infiniteScroll
104
- })))
105
- );
106
- }
107
- }]);
33
+ var _proto = VirtualTableRow.prototype;
34
+
35
+ _proto.render = function render() {
36
+ var _this$props = this.props,
37
+ index = _this$props.index,
38
+ style = _this$props.style,
39
+ data = _this$props.data;
40
+ var mergedColumns = data.mergedColumns,
41
+ onRowClick = data.onRowClick,
42
+ selection = data.selection,
43
+ dataSource = data.dataSource,
44
+ cellHeight = data.cellHeight,
45
+ infiniteScroll = data.infiniteScroll,
46
+ defaultTableProps = data.defaultTableProps;
47
+ var rowData = dataSource[index];
48
+ return (
49
+ /*#__PURE__*/
50
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
51
+ React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(S.RowWrapper, {
52
+ className: classNames('virtual-table-row', {
53
+ 'ds-expanded-row': rowData[EXPANDED_ROW_PROPERTY]
54
+ }),
55
+ style: style,
56
+ onClick: function onClick() {
57
+ return onRowClick && onRowClick(rowData);
58
+ }
59
+ }, mergedColumns.map(function (column, columnIndex) {
60
+ return /*#__PURE__*/React.createElement(S.ColWrapper, {
61
+ className: classNames('virtual-table-cell', {
62
+ 'virtual-table-cell-last': columnIndex === mergedColumns.length - 1,
63
+ 'ant-table-selection-column': columnIndex === 0 && selection,
64
+ 'ds-expanded-row-first': rowData[EXPANDED_ROW_PROPERTY] && columnIndex === 0,
65
+ 'ds-expanded-row-data': rowData[EXPANDED_ROW_PROPERTY] && (columnIndex === 1 && selection || columnIndex === 0 && !selection)
66
+ }, isColumnSortingActive((defaultTableProps == null ? void 0 : defaultTableProps.columns) || [], column) && 'ant-table-column-sort', column.className),
67
+ key: "row-" + index + "-column-" + (column.dataIndex || column.key),
68
+ minWidth: calculateToPixelsIfDefined(column == null ? void 0 : column.minWidth),
69
+ width: column.width,
70
+ maxWidth: calculateToPixelsIfDefined(column == null ? void 0 : column.maxWidth)
71
+ }, column.render ? column.render(rowData[column.dataIndex], rowData) : rowData[column.dataIndex]);
72
+ })), infiniteScroll && index === dataSource.length - 1 && /*#__PURE__*/React.createElement(S.RowWrapper, {
73
+ style: _objectSpread({}, style, {
74
+ top: Number(style.top) + cellHeight + "px",
75
+ height: '64px',
76
+ padding: '16px 24px'
77
+ })
78
+ }, /*#__PURE__*/React.createElement(InfiniteLoaderItem, {
79
+ infiniteScroll: infiniteScroll
80
+ })))
81
+ );
82
+ };
108
83
 
109
84
  return VirtualTableRow;
110
85
  }(React.PureComponent);
@@ -13,24 +13,24 @@ var createRowStarColumn = function createRowStarColumn(_ref) {
13
13
  selection = _ref2.selection;
14
14
  return {
15
15
  key: '_row-star',
16
- className: "".concat((rowStar === null || rowStar === void 0 ? void 0 : rowStar.className) || '', " ds-table-star-column"),
16
+ className: ((rowStar == null ? void 0 : rowStar.className) || '') + " ds-table-star-column",
17
17
  width: !!selection && !!rowStar ? STAR_COL_WIDTH_SELECTON : STAR_COL_WIDTH_SINGLE,
18
- render: (rowStar === null || rowStar === void 0 ? void 0 : rowStar.renderCell) || function (value, _ref3) {
18
+ render: (rowStar == null ? void 0 : rowStar.renderCell) || function (value, _ref3) {
19
19
  var key = _ref3.key;
20
20
  var keyString = String(key);
21
21
  return /*#__PURE__*/React.createElement(Tooltip, {
22
- title: locale === null || locale === void 0 ? void 0 : locale.starRowTooltip
22
+ title: locale == null ? void 0 : locale.starRowTooltip
23
23
  }, /*#__PURE__*/React.createElement(Button.Star, {
24
24
  "data-testid": "ds-table-star-button",
25
25
  active: isStarred(keyString),
26
26
  onClick: function onClick(e) {
27
27
  var newStarredRowKeys = toggleStarred(keyString);
28
28
 
29
- if (typeof (rowStar === null || rowStar === void 0 ? void 0 : rowStar.onChange) === 'function') {
29
+ if (typeof (rowStar == null ? void 0 : rowStar.onChange) === 'function') {
30
30
  rowStar.onChange(newStarredRowKeys);
31
31
  }
32
32
 
33
- if (typeof (rowStar === null || rowStar === void 0 ? void 0 : rowStar.onClick) === 'function') {
33
+ if (typeof (rowStar == null ? void 0 : rowStar.onClick) === 'function') {
34
34
  rowStar.onClick(e);
35
35
  }
36
36
  }
@@ -3,7 +3,7 @@
3
3
  import toPx from 'unit-to-px';
4
4
 
5
5
  var hasSameLength = function hasSameLength(parsedValue, originalValue) {
6
- return "".concat(parsedValue).length === "".concat(originalValue).length;
6
+ return ("" + parsedValue).length === ("" + originalValue).length;
7
7
  }; // eslint-disable-next-line import/prefer-default-export
8
8
 
9
9
 
@@ -1,4 +1,4 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
4
 
@@ -89,9 +89,9 @@ export var getDefaultLocale = function getDefaultLocale(intl) {
89
89
  };
90
90
  export var useTableLocale = function useTableLocale(intl, locale) {
91
91
  return React.useMemo(function () {
92
- return _objectSpread(_objectSpread(_objectSpread({}, getDefaultLocale(intl)), locale), {}, {
93
- pagination: _objectSpread(_objectSpread({}, getDefaultLocale(intl).pagination), locale === null || locale === void 0 ? void 0 : locale.pagination)
92
+ return _objectSpread({}, getDefaultLocale(intl), {}, locale, {
93
+ pagination: _objectSpread({}, getDefaultLocale(intl).pagination, {}, locale == null ? void 0 : locale.pagination)
94
94
  });
95
95
  }, [intl, locale]);
96
96
  };
97
- export var TableLocaleContext = /*#__PURE__*/React.createContext({});
97
+ export var TableLocaleContext = React.createContext({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-table",
3
- "version": "0.42.0",
3
+ "version": "0.42.4",
4
4
  "description": "Table UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,24 +32,24 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-alert": "^0.4.0",
36
- "@synerise/ds-button": "^0.16.0",
37
- "@synerise/ds-button-group": "^0.6.0",
38
- "@synerise/ds-checkbox": "^0.11.0",
39
- "@synerise/ds-column-manager": "^0.9.0",
40
- "@synerise/ds-dropdown": "^0.17.0",
41
- "@synerise/ds-flag": "^0.3.0",
42
- "@synerise/ds-icon": "^0.46.0",
43
- "@synerise/ds-input": "^0.18.0",
44
- "@synerise/ds-menu": "^0.11.0",
45
- "@synerise/ds-pagination": "^0.7.0",
46
- "@synerise/ds-search": "^0.6.0",
47
- "@synerise/ds-search-bar": "^0.5.0",
48
- "@synerise/ds-select": "^0.14.0",
49
- "@synerise/ds-status": "^0.5.0",
50
- "@synerise/ds-tags": "^0.6.0",
51
- "@synerise/ds-tooltip": "^0.11.0",
52
- "@synerise/ds-typography": "^0.12.0",
35
+ "@synerise/ds-alert": "^0.4.2",
36
+ "@synerise/ds-button": "^0.16.2",
37
+ "@synerise/ds-button-group": "^0.6.2",
38
+ "@synerise/ds-checkbox": "^0.11.4",
39
+ "@synerise/ds-column-manager": "^0.9.4",
40
+ "@synerise/ds-dropdown": "^0.17.4",
41
+ "@synerise/ds-flag": "^0.3.2",
42
+ "@synerise/ds-icon": "^0.46.2",
43
+ "@synerise/ds-input": "^0.18.2",
44
+ "@synerise/ds-menu": "^0.11.2",
45
+ "@synerise/ds-pagination": "^0.7.2",
46
+ "@synerise/ds-search": "^0.6.4",
47
+ "@synerise/ds-search-bar": "^0.5.2",
48
+ "@synerise/ds-select": "^0.14.2",
49
+ "@synerise/ds-status": "^0.5.4",
50
+ "@synerise/ds-tags": "^0.6.4",
51
+ "@synerise/ds-tooltip": "^0.11.2",
52
+ "@synerise/ds-typography": "^0.12.2",
53
53
  "@synerise/ds-utils": "^0.19.0",
54
54
  "@types/react-window": "^1.8.2",
55
55
  "classnames": "^2.2.6",
@@ -63,5 +63,5 @@
63
63
  "antd": "^4",
64
64
  "react": ">=16.9.0 < 17.0.0"
65
65
  },
66
- "gitHead": "a797e1d5e1233f121f8f7dfbeaf97b48a8195d25"
66
+ "gitHead": "3e5f807c3c9ce7bbcb707b1e229ad5d7ef50d830"
67
67
  }