@bigbinary/neetoui 8.2.68 → 8.2.70

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.
@@ -26,7 +26,7 @@ import 'react-i18next';
26
26
  import './useRecentlyUsedColors-CvgVrIg-.js';
27
27
  import './Dropdown.js';
28
28
  import './index-C9RIWUPw.js';
29
- export { D as default } from './index-yn29djNX.js';
29
+ export { D as default } from './index-C_NVUIv9.js';
30
30
  import './Input.js';
31
31
  import './Label.js';
32
32
  import './MultiEmailInput.js';
@@ -62,7 +62,7 @@ import './Switch.js';
62
62
  import './Tab.js';
63
63
  import 'antd/lib/table';
64
64
  import 'react-drag-listview';
65
- import './useRestoreScrollPosition-Bpc2-JNF.js';
65
+ import './useRestoreScrollPosition-BTy4iNK-.js';
66
66
  import 'react-resizable';
67
67
  import './Tag.js';
68
68
  import './Toastr.js';
package/dist/Table.js CHANGED
@@ -7,8 +7,8 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
7
7
  import React__default, { useRef, useEffect, useState, useMemo, useCallback } from 'react';
8
8
  import classnames from 'classnames';
9
9
  import { isPresent, noop, snakeToCamelCase, camelToSnakeCase, isNotEmpty, modifyBy, dynamicArray } from '@bigbinary/neeto-cist';
10
- import { UpArrow, DownArrow, Left, Right, MenuHorizontal } from '@bigbinary/neeto-icons';
11
- import { isNil, move, isEmpty, all, includes, __, pipe, filter, pluck, has, without, append, union, equals, props, mergeLeft, assoc } from 'ramda';
10
+ import { UpArrow, DownArrow, InfoRound, Left, Right, MenuHorizontal } from '@bigbinary/neeto-icons';
11
+ import { isNil, move, isEmpty, all, includes, __, pipe, filter, pluck, equals, has, without, append, union, props, mergeLeft, assoc } from 'ramda';
12
12
  import ReactDragListView from 'react-drag-listview';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useHistory } from 'react-router-dom';
@@ -20,8 +20,9 @@ import { u as useQueryParams } from './useQueryParams-b60CHFUx.js';
20
20
  import Button from './Button.js';
21
21
  import Callout from './Callout.js';
22
22
  import Typography from './Typography.js';
23
- import { T as TABLE_SORT_ORDERS, U as URL_SORT_ORDERS, H as HeaderCellMenu, C as COLUMN_FIXED_VALUES, S as SELECT_ALL_ROWS_CALLOUT_MOBILE_HEIGHT, a as SELECT_ALL_ROWS_CALLOUT_DESKTOP_HEIGHT, u as useRestoreScrollPosition } from './useRestoreScrollPosition-Bpc2-JNF.js';
23
+ import { T as TABLE_SORT_ORDERS, U as URL_SORT_ORDERS, H as HeaderCellMenu, C as COLUMN_FIXED_VALUES, S as SELECT_ALL_ROWS_CALLOUT_MOBILE_HEIGHT, a as SELECT_ALL_ROWS_CALLOUT_DESKTOP_HEIGHT, u as useRestoreScrollPosition } from './useRestoreScrollPosition-BTy4iNK-.js';
24
24
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
25
+ import Popover from './Popover.js';
25
26
  import { Resizable } from 'react-resizable';
26
27
  import Spinner from './Spinner.js';
27
28
  import 'antd/locale/de_DE';
@@ -44,7 +45,6 @@ import './Tooltip.js';
44
45
  import '@tippyjs/react';
45
46
  import 'tippy.js';
46
47
  import './Dropdown.js';
47
- import './Popover.js';
48
48
  import 'zustand';
49
49
 
50
50
  var useTimeout = function useTimeout(callback, delay) {
@@ -181,6 +181,31 @@ var SortIcon = function SortIcon(_ref) {
181
181
  return null;
182
182
  };
183
183
 
184
+ var _excluded$5 = ["title", "description"];
185
+ var TitleWithInfoIcon = function TitleWithInfoIcon(_ref) {
186
+ var title = _ref.title,
187
+ description = _ref.description,
188
+ rest = _objectWithoutProperties(_ref, _excluded$5);
189
+ var popoverRef = useRef();
190
+ return /*#__PURE__*/React__default.createElement("span", {
191
+ className: "relative pr-5"
192
+ }, typeof title === "function" ? title(rest) : title, description && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
193
+ className: "neeto-ui-table__column-title-info-icon",
194
+ ref: popoverRef
195
+ }, /*#__PURE__*/React__default.createElement(InfoRound, {
196
+ color: "currentColor",
197
+ size: 14
198
+ })), /*#__PURE__*/React__default.createElement(Popover, {
199
+ appendTo: function appendTo() {
200
+ return document.body;
201
+ },
202
+ reference: popoverRef
203
+ }, /*#__PURE__*/React__default.createElement(Typography, {
204
+ lineHeight: "normal",
205
+ style: "body2"
206
+ }, description))));
207
+ };
208
+
184
209
  var _excluded$4 = ["children", "isSortable", "isAddEnabled", "sortedInfo", "onSort", "isHidable", "isDeletable", "isFixedColumn", "isColumnFreezeEnabled", "onColumnHide", "onAddColumn", "onColumnDelete", "onColumnFreeze", "onMoreActionClick", "column", "moreActions"];
185
210
  var CellContent = function CellContent(_ref) {
186
211
  var children = _ref.children,
@@ -206,7 +231,7 @@ var CellContent = function CellContent(_ref) {
206
231
  var isColumnHidable = isHidable && isPresent(onColumnHide);
207
232
  var isColumnDeletable = isDeletable && isPresent(onColumnDelete);
208
233
  var hasMoreActions = !isEmpty(moreActions) && isPresent(onMoreActionClick);
209
- var hasMoreMenu = isSortable || isPresent(column === null || column === void 0 ? void 0 : column.description) || isColumnHidable || isAddEnabled || hasMoreActions || isPresent(column) && isColumnFreezeEnabled;
234
+ var hasMoreMenu = isSortable || isColumnHidable || isAddEnabled || hasMoreActions || isPresent(column) && isColumnFreezeEnabled;
210
235
  return /*#__PURE__*/React__default.createElement("th", _extends({}, headerProps, {
211
236
  title: "",
212
237
  onClick: isSortable ? noop : headerProps.onClick
@@ -214,7 +239,7 @@ var CellContent = function CellContent(_ref) {
214
239
  className: "neeto-ui-flex neeto-ui-items-center neeto-ui-justify-between",
215
240
  "data-cy": "".concat(hyphenize(headerProps.title), "-header-title")
216
241
  }, /*#__PURE__*/React__default.createElement("div", {
217
- className: "neeto-ui-min-w-0 neeto-ui-flex-grow neeto-ui-truncate"
242
+ className: "neeto-ui-min-w-0 neeto-ui-flex-grow neeto-ui-truncate neeto-ui-table__column-title-content"
218
243
  }, children), hasMoreMenu && /*#__PURE__*/React__default.createElement(HeaderCellMenu, {
219
244
  column: column,
220
245
  hasMoreActions: hasMoreActions,
@@ -231,7 +256,6 @@ var CellContent = function CellContent(_ref) {
231
256
  onMoreActionClick: onMoreActionClick,
232
257
  onSort: onSort,
233
258
  sortedInfo: sortedInfo,
234
- columnTitle: headerProps.title,
235
259
  isHidable: isColumnHidable
236
260
  })));
237
261
  };
@@ -361,7 +385,7 @@ var getFixedColumns = function getFixedColumns(columnData) {
361
385
  }), pluck("dataIndex"))(columnData);
362
386
  };
363
387
  var getColumnSortOrder = function getColumnSortOrder(col, sortedInfo) {
364
- return sortedInfo.field === col.dataIndex || sortedInfo.field === col.key ? sortedInfo.order : null;
388
+ return equals(sortedInfo.field, col.dataIndex) || equals(sortedInfo.field, col.key) ? sortedInfo.order : null;
365
389
  };
366
390
  var getColumFixedValue = function getColumFixedValue(col, frozenColumns) {
367
391
  return frozenColumns.indexOf(col.dataIndex) !== -1 ? COLUMN_FIXED_VALUES.LEFT : null;
@@ -370,6 +394,20 @@ var getFrozenColumnsLocalStorageKey = function getFrozenColumnsLocalStorageKey(l
370
394
  var prefix = isPresent(localStorageKeyPrefix) ? localStorageKeyPrefix : convertLocationPathnameToId();
371
395
  return "NEETOUI-".concat(prefix, "-FIXED_COLUMNS");
372
396
  };
397
+ var getSortInfoFromQueryParams = function getSortInfoFromQueryParams(queryParams) {
398
+ var sortedInfo = {};
399
+ if (isPresent(queryParams.sort_by) && isPresent(queryParams.order_by) && isPresent(TABLE_SORT_ORDERS[queryParams.order_by])) {
400
+ sortedInfo.field = queryParams.sort_by.includes("+") ? queryParams.sort_by.split("+").map(snakeToCamelCase) : snakeToCamelCase(queryParams.sort_by);
401
+ sortedInfo.order = TABLE_SORT_ORDERS[queryParams.order_by];
402
+ }
403
+ return sortedInfo;
404
+ };
405
+ var getSortField = function getSortField(field) {
406
+ if (Array.isArray(field)) {
407
+ return field.map(camelToSnakeCase).join("+");
408
+ }
409
+ return camelToSnakeCase(field);
410
+ };
373
411
 
374
412
  function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
375
413
  function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -427,12 +465,19 @@ var useResizableColumns = function useResizableColumns(_ref) {
427
465
  isHidable: col.isHidable,
428
466
  isDeletable: col.isDeletable,
429
467
  moreActions: col.moreActions,
430
- column: col
468
+ column: col,
469
+ "data-text-align": column.align
431
470
  };
432
471
  },
433
472
  sortIcon: SortIcon,
434
473
  sortOrder: getColumnSortOrder(col, sortedInfo),
435
- fixed: fixed
474
+ fixed: fixed,
475
+ title: col.description ? function (props) {
476
+ return /*#__PURE__*/React__default.createElement(TitleWithInfoIcon, _extends({}, props, {
477
+ description: col.description,
478
+ title: col.title
479
+ }));
480
+ } : col.title
436
481
  });
437
482
  if (!has("ellipsis", col)) modifiedColumn.ellipsis = true;
438
483
  return modifiedColumn;
@@ -530,14 +575,6 @@ var useColumns = function useColumns(_ref) {
530
575
  };
531
576
  };
532
577
 
533
- var getSortInfoFromQueryParams = function getSortInfoFromQueryParams(queryParams) {
534
- var sortedInfo = {};
535
- if (isPresent(queryParams.sort_by) && isPresent(queryParams.order_by) && isPresent(TABLE_SORT_ORDERS[queryParams.order_by])) {
536
- sortedInfo.field = snakeToCamelCase(queryParams.sort_by);
537
- sortedInfo.order = TABLE_SORT_ORDERS[queryParams.order_by];
538
- }
539
- return sortedInfo;
540
- };
541
578
  var useTableSort = function useTableSort() {
542
579
  var queryParams = useQueryParams();
543
580
  var _useState = useState(function () {
@@ -552,7 +589,7 @@ var useTableSort = function useTableSort() {
552
589
  var history = useHistory();
553
590
  var handleTableChange = function handleTableChange(pagination, sorter) {
554
591
  var params = {
555
- sort_by: sorter.order ? camelToSnakeCase(sorter.field) : undefined,
592
+ sort_by: sorter.order ? getSortField(sorter.field) : undefined,
556
593
  order_by: URL_SORT_ORDERS[sorter.order],
557
594
  page: pagination.current
558
595
  };
@@ -721,16 +758,6 @@ var Table = function Table(_ref) {
721
758
  style: "body2"
722
759
  }, "No Data")
723
760
  };
724
- var sortedColumnsWithAlignment = sortedColumns.map(function (sortedColumn) {
725
- return _objectSpread(_objectSpread({}, sortedColumn), {}, {
726
- onHeaderCell: function onHeaderCell(column) {
727
- var _sortedColumn$onHeade;
728
- return _objectSpread(_objectSpread({}, (_sortedColumn$onHeade = sortedColumn.onHeaderCell) === null || _sortedColumn$onHeade === void 0 ? void 0 : _sortedColumn$onHeade.call(sortedColumn, column)), {}, {
729
- "data-text-align": column.align
730
- });
731
- }
732
- });
733
- });
734
761
  var selectedRowKeys = bulkSelectedAllRows ? pluck(rowKey, rowData) : initialSelectedRowKeys;
735
762
  var showBulkSelectionCallout = useMemo(function () {
736
763
  return isIncludedIn(selectedRowKeys, pluck(rowKey, rowData)) && selectedRowKeys.length !== totalCount && !bulkSelectedAllRows;
@@ -893,7 +920,7 @@ var Table = function Table(_ref) {
893
920
  bordered: bordered,
894
921
  locale: locale,
895
922
  rowKey: rowKey,
896
- columns: sortedColumnsWithAlignment,
923
+ columns: sortedColumns,
897
924
  components: componentOverrides,
898
925
  dataSource: rowData,
899
926
  loading: {