hrm_ui_lib 2.0.0-alpha.5 → 2.0.0-alpha.7

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.
@@ -5,6 +5,7 @@ type Props = {
5
5
  withSelect: boolean;
6
6
  tableWidth: number;
7
7
  headerGroup: HeaderGroup;
8
+ uniqueKey: string;
8
9
  };
9
- export declare function Header({ headerGroup, tableWidth, withSelect, fixedHeader }: Props): ReactElement;
10
+ export declare function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHeader }: Props): ReactElement;
10
11
  export {};
@@ -1,5 +1,6 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
3
4
  import React from 'react';
4
5
  import classNames from 'classnames';
5
6
  import { CHECKBOX_DEFAULT_WIDTH, calcColumnWidth, CHECKBOX_HEADER_ID } from './utils.js';
@@ -10,7 +11,6 @@ import '@babel/runtime/helpers/toConsumableArray';
10
11
  import './IndeterminateCheckbox.js';
11
12
  import '../../Alert-CMRDKdZp.js';
12
13
  import '../Alert/consts.js';
13
- import '@babel/runtime/helpers/objectWithoutProperties';
14
14
  import 'dayjs';
15
15
  import '../../helperComponents/Loader/Loader.js';
16
16
  import '@babel/runtime/helpers/slicedToArray';
@@ -55,15 +55,21 @@ import '../SVGIcons/IconArrowDownloadFilled.js';
55
55
  import '../../helpers/download-file.js';
56
56
  import '../Button/consts.js';
57
57
 
58
+ var _excluded = ["key"],
59
+ _excluded2 = ["key"];
58
60
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
59
61
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
60
62
  function Header(_ref) {
61
63
  var headerGroup = _ref.headerGroup,
62
64
  tableWidth = _ref.tableWidth,
63
65
  withSelect = _ref.withSelect,
66
+ uniqueKey = _ref.uniqueKey,
64
67
  _ref$fixedHeader = _ref.fixedHeader,
65
68
  fixedHeader = _ref$fixedHeader === void 0 ? false : _ref$fixedHeader;
66
- return /*#__PURE__*/React.createElement("tr", _extends({}, headerGroup.getHeaderGroupProps(), {
69
+ var _headerGroup$getHeade = headerGroup.getHeaderGroupProps();
70
+ _headerGroup$getHeade.key;
71
+ var headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
72
+ return /*#__PURE__*/React.createElement("tr", _extends({}, headerGroupProps, {
67
73
  className: classNames({
68
74
  fixed_header: fixedHeader
69
75
  })
@@ -92,9 +98,12 @@ function Header(_ref) {
92
98
  } : {}), !isSelection && width ? {
93
99
  width: width
94
100
  } : {});
101
+ var _getHeaderProps = getHeaderProps(columnProps !== null && columnProps !== void 0 && columnProps.sortable ? getSortByToggleProps() : undefined);
102
+ _getHeaderProps.key;
103
+ var headProps = _objectWithoutProperties(_getHeaderProps, _excluded2);
95
104
  return /*#__PURE__*/React.createElement("th", _extends({
96
- key: i
97
- }, getHeaderProps(columnProps !== null && columnProps !== void 0 && columnProps.sortable ? getSortByToggleProps() : undefined), {
105
+ key: "table_head_".concat(uniqueKey, "_").concat(i)
106
+ }, headProps, {
98
107
  className: classNames({
99
108
  fixed_column_left: fixed === 'left',
100
109
  fixed_column_right: fixed === 'right',
@@ -5,6 +5,7 @@ type Props = {
5
5
  handleRowClick?: (row: any) => void;
6
6
  withSelect: boolean;
7
7
  selectedFlatRows: RowType[];
8
+ uniqueKey: string;
8
9
  };
9
- export declare function Row({ row, selectedFlatRows, withSelect, handleRowClick }: Props): ReactElement;
10
+ export declare function Row({ row, selectedFlatRows, withSelect, uniqueKey, handleRowClick }: Props): ReactElement;
10
11
  export {};
@@ -1,4 +1,5 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
3
  import React, { useMemo } from 'react';
3
4
  import classNames from 'classnames';
4
5
  import { CHECKBOX_HEADER_ID, CHECKBOX_DEFAULT_WIDTH } from './utils.js';
@@ -10,7 +11,6 @@ import '../Text/Text.js';
10
11
  import '../../utils/helpers.js';
11
12
  import 'dayjs';
12
13
  import '@babel/runtime/helpers/defineProperty';
13
- import '@babel/runtime/helpers/objectWithoutProperties';
14
14
  import '../../helperComponents/Loader/Loader.js';
15
15
  import '@babel/runtime/helpers/slicedToArray';
16
16
  import '../../consts/index.js';
@@ -53,17 +53,23 @@ import '../SVGIcons/IconArrowDownloadFilled.js';
53
53
  import '../../helpers/download-file.js';
54
54
  import '../Button/consts.js';
55
55
 
56
+ var _excluded = ["key"],
57
+ _excluded2 = ["key"];
56
58
  function Row(_ref) {
57
59
  var row = _ref.row,
58
60
  selectedFlatRows = _ref.selectedFlatRows,
59
61
  withSelect = _ref.withSelect,
62
+ uniqueKey = _ref.uniqueKey,
60
63
  handleRowClick = _ref.handleRowClick;
61
64
  var isRowSelected = useMemo(function () {
62
65
  return selectedFlatRows.find(function (r) {
63
66
  return r.id === row.id;
64
67
  });
65
68
  }, [selectedFlatRows]);
66
- return /*#__PURE__*/React.createElement("tr", _extends({}, row.getRowProps(), {
69
+ var _row$getRowProps = row.getRowProps();
70
+ _row$getRowProps.key;
71
+ var rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
72
+ return /*#__PURE__*/React.createElement("tr", _extends({}, rowProps, {
67
73
  className: classNames({
68
74
  selected: Boolean(isRowSelected)
69
75
  }),
@@ -76,9 +82,12 @@ function Row(_ref) {
76
82
  column = _ref2.column,
77
83
  render = _ref2.render;
78
84
  var isSelection = column.id === CHECKBOX_HEADER_ID;
85
+ var _getCellProps = getCellProps();
86
+ _getCellProps.key;
87
+ var cellProps = _objectWithoutProperties(_getCellProps, _excluded2);
79
88
  return /*#__PURE__*/React.createElement("td", _extends({
80
- key: i
81
- }, getCellProps(), {
89
+ key: "table_cell_".concat(uniqueKey, "_").concat(i)
90
+ }, cellProps, {
82
91
  style: {
83
92
  left: !isSelection && withSelect && (column === null || column === void 0 ? void 0 : column.fixed) === 'left' ? CHECKBOX_DEFAULT_WIDTH : 0
84
93
  },
@@ -1,7 +1,7 @@
1
1
  import _extends from '@babel/runtime/helpers/extends';
2
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
3
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
- import React, { useRef, useState, useMemo, useEffect } from 'react';
4
+ import React, { useRef, useState, useId, useMemo, useEffect } from 'react';
5
5
  import { useTable, useSortBy, useRowSelect } from 'react-table';
6
6
  import { setSelectedRows } from './utils.js';
7
7
  import { Row } from './Row.js';
@@ -74,6 +74,7 @@ function Table(_ref) {
74
74
  _useState2 = _slicedToArray(_useState, 2),
75
75
  tableWidth = _useState2[0],
76
76
  setTableWidth = _useState2[1];
77
+ var uniqueKey = useId();
77
78
  var dispatchScrollEvent = useDispatchEventOnScroll();
78
79
  var sortedColumns = useMemo(function () {
79
80
  var condition1 = function condition1(item) {
@@ -142,11 +143,12 @@ function Table(_ref) {
142
143
  ref: tableRef
143
144
  }), /*#__PURE__*/React.createElement("thead", null, headerGroups.map(function (headerGroup, i) {
144
145
  return /*#__PURE__*/React.createElement(Header, {
145
- key: i,
146
+ key: "table_head_".concat(uniqueKey, "_").concat(i),
146
147
  withSelect: withSelect,
147
148
  fixedHeader: Boolean(fixedHeader),
148
149
  headerGroup: headerGroup,
149
- tableWidth: tableWidth
150
+ tableWidth: tableWidth,
151
+ uniqueKey: uniqueKey
150
152
  });
151
153
  })), /*#__PURE__*/React.createElement("tbody", getTableBodyProps(), rows.map(function (row) {
152
154
  prepareRow(row);
@@ -155,7 +157,8 @@ function Table(_ref) {
155
157
  withSelect: withSelect,
156
158
  selectedFlatRows: selectedFlatRows,
157
159
  row: row,
158
- key: row.id
160
+ key: "table_row_".concat(uniqueKey, "_").concat(row.id),
161
+ uniqueKey: uniqueKey
159
162
  });
160
163
  }))));
161
164
  }
package/package.json CHANGED
@@ -1,21 +1,18 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "2.0.0-alpha.5",
3
+ "version": "2.0.0-alpha.7",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
7
- "author": "",
8
7
  "license": "ISC",
9
8
  "repository": {
10
9
  "type": "git",
11
10
  "url": "https://github.com/hrmuilibrary/hrm_ui_library.git"
12
11
  },
13
12
  "peerDependencies": {
14
- "@emotion/is-prop-valid": "^1.3.1",
15
- "date-fns": "^4.1.0",
16
- "react": "^18.2.0",
17
- "react-dom": "^18.2.0",
18
- "yup": "^1.2.0"
13
+ "react": "18.3.1",
14
+ "react-dom": "18.3.1",
15
+ "yup": "1.7.0"
19
16
  },
20
17
  "dependencies": {
21
18
  "@dnd-kit/core": "^6.3.1",