@orfium/ictinus 4.6.0 → 4.6.1

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.
@@ -51,4 +51,5 @@ declare type Props<T> = {
51
51
  dataTestIdPrefix?: string;
52
52
  };
53
53
  declare function Table<T>({ data, columns, type, fixedHeader, fixedCTA, onCheck, padded, onSort, initialSort, sortDir, topLeftText, topRightArea, actionWidth, dataTestIdPrefix, }: Props<T>): import("@emotion/react/jsx-runtime").JSX.Element;
54
- export default Table;
54
+ declare const _default: React.MemoExoticComponent<typeof Table>;
55
+ export default _default;
@@ -11,6 +11,8 @@ var _pluralize = _interopRequireDefault(require("pluralize"));
11
11
 
12
12
  var _react = _interopRequireWildcard(require("react"));
13
13
 
14
+ var _reactFastCompare = _interopRequireDefault(require("react-fast-compare"));
15
+
14
16
  var _CheckBox = _interopRequireDefault(require("../CheckBox"));
15
17
 
16
18
  var _ExtendedColumnItem = _interopRequireDefault(require("./components/ExtendedColumnItem"));
@@ -251,7 +253,6 @@ function Table(_ref) {
251
253
  fixedHeader: fixedHeader,
252
254
  type: type,
253
255
  columnCount: columnCount,
254
- columnsHasNumberArr: columnsHasNumberArr,
255
256
  columnsWithWidth: columnsWithWidth,
256
257
  onSelectionChangeExist: Boolean(onCheck),
257
258
  expanded: Boolean(row.expanded),
@@ -263,5 +264,6 @@ function Table(_ref) {
263
264
  }))));
264
265
  }
265
266
 
266
- var _default = Table;
267
+ var _default = /*#__PURE__*/_react["default"].memo(Table, _reactFastCompare["default"]);
268
+
267
269
  exports["default"] = _default;
@@ -4,7 +4,6 @@ export declare type TableRowContextProps<T extends {
4
4
  [key: string]: unknown;
5
5
  }> = {
6
6
  row: Row<T>;
7
- columnsHasNumberArr: boolean[];
8
7
  columnsWithWidth: number[];
9
8
  padded: boolean;
10
9
  onSelectionChangeExist: boolean;
@@ -14,7 +14,6 @@ var TableRowContext = /*#__PURE__*/React.createContext({
14
14
  id: 0,
15
15
  cells: []
16
16
  },
17
- columnsHasNumberArr: [],
18
17
  columnsWithWidth: [],
19
18
  padded: false,
20
19
  onSelectionChangeExist: false,
@@ -44,7 +44,6 @@ var RenderRowWithCells = /*#__PURE__*/React.memo(function (_ref) {
44
44
  rowIndex = _ref.rowIndex;
45
45
 
46
46
  var _React$useContext = React.useContext(_TableRowContext.TableRowContext),
47
- columnsHasNumberArr = _React$useContext.columnsHasNumberArr,
48
47
  columnsWithWidth = _React$useContext.columnsWithWidth,
49
48
  onSelectionChangeExist = _React$useContext.onSelectionChangeExist,
50
49
  padded = _React$useContext.padded,
@@ -93,11 +92,10 @@ var RenderRowWithCells = /*#__PURE__*/React.memo(function (_ref) {
93
92
  return (0, _react2.jsx)(_ContentCell["default"], {
94
93
  key: row.id + "-" + index,
95
94
  cellCounter: index,
96
- columnsHasNumberArr: columnsHasNumberArr,
97
95
  columns: columns,
98
96
  padded: padded,
99
97
  colSpan: colSpan,
100
- columnsWithWidth: columnsWithWidth,
98
+ columnWidth: columnsWithWidth[index],
101
99
  content: content,
102
100
  cellType: cellType,
103
101
  rowType: type,
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
2
  import { ContentComponent, TableType } from '../../../../Table';
3
3
  declare type Props = {
4
- columnsHasNumberArr: boolean[];
5
4
  columns: string[];
6
5
  padded: boolean;
7
- columnsWithWidth: number[];
6
+ columnWidth?: number;
8
7
  content: number | string | ContentComponent<any>;
9
8
  colSpan?: number;
10
9
  cellType?: 'financial' | 'normal';
@@ -16,10 +16,9 @@ var _react2 = require("@emotion/react");
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
18
  var ContentCell = function ContentCell(_ref) {
19
- var columnsHasNumberArr = _ref.columnsHasNumberArr,
20
- columns = _ref.columns,
19
+ var columns = _ref.columns,
21
20
  padded = _ref.padded,
22
- columnsWithWidth = _ref.columnsWithWidth,
21
+ columnWidth = _ref.columnWidth,
23
22
  content = _ref.content,
24
23
  colSpan = _ref.colSpan,
25
24
  rowType = _ref.rowType,
@@ -29,13 +28,13 @@ var ContentCell = function ContentCell(_ref) {
29
28
  dataTestIdPrefix = _ref.dataTestIdPrefix,
30
29
  rowIndex = _ref.rowIndex,
31
30
  index = _ref.index;
32
- var isNumeral = columnsHasNumberArr[cellCounter];
31
+ var isNumeral = !Number.isNaN(Number(content));
33
32
  return (0, _react2.jsx)(_TableCell["default"], {
34
33
  textAlign: align ? align : isNumeral ? 'right' : 'left',
35
34
  colSpan: colSpan,
36
35
  type: cellType,
37
36
  padded: padded,
38
- width: columnsWithWidth[cellCounter] ? columnsWithWidth[cellCounter] + "%" : 'initial',
37
+ width: columnWidth ? columnWidth + "%" : 'initial',
39
38
  dataTestIdPrefix: dataTestIdPrefix,
40
39
  rowIndex: rowIndex,
41
40
  index: index
@@ -3,7 +3,6 @@ declare type TableRowWrapperProps<T> = {
3
3
  row: Row<T>;
4
4
  isRowSelected: boolean;
5
5
  onSelectionAdd: (selection: Selection) => void;
6
- columnsHasNumberArr: boolean[];
7
6
  columnsWithWidth: number[];
8
7
  padded: boolean;
9
8
  onSelectionChangeExist: boolean;
@@ -21,7 +21,6 @@ var TableRowWrapper = function TableRowWrapper(props) {
21
21
  columns = props.columns,
22
22
  fixedHeader = props.fixedHeader,
23
23
  type = props.type,
24
- columnsHasNumberArr = props.columnsHasNumberArr,
25
24
  columnsWithWidth = props.columnsWithWidth,
26
25
  columnCount = props.columnCount,
27
26
  onSelectionChangeExist = props.onSelectionChangeExist,
@@ -37,7 +36,6 @@ var TableRowWrapper = function TableRowWrapper(props) {
37
36
  return (0, _react2.jsx)(_TableRowContext.TableRowContext.Provider, {
38
37
  value: {
39
38
  row: row,
40
- columnsHasNumberArr: columnsHasNumberArr,
41
39
  columnsWithWidth: columnsWithWidth,
42
40
  onSelectionChangeExist: onSelectionChangeExist,
43
41
  padded: padded,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orfium/ictinus",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -97,6 +97,7 @@
97
97
  "lodash": "^4.17.19",
98
98
  "pluralize": "^8.0.0",
99
99
  "polished": "^3.4.4",
100
+ "react-fast-compare": "^3.2.0",
100
101
  "react-highlight-words": "^0.17.0",
101
102
  "react-media": "^2.0.0-rc.1",
102
103
  "react-window": "^1.8.6",