@datarobot/design-system 28.9.1 → 28.9.3

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.
@@ -60,26 +60,29 @@ function TableHeaderCellMenu({
60
60
  return acc;
61
61
  }, {})
62
62
  };
63
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenu, {
64
- options: menuActions,
65
- triggerClassName: (0, _classnames.default)('react-table-cell-menu-trigger', {
66
- 'focused-visible': isVisible
67
- }),
68
- contentClassName: "react-table-cell-menu-content",
69
- selectedKey: sorted || undefined,
70
- onSelect: selectedOption => {
71
- const key = selectedOption?.key;
72
- const handler = actionsHandlers[key] || (() => {});
73
- handler();
74
- },
75
- triggerHideChevron: true,
76
- triggerDynamicContent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
77
- icon: _faEllipsisVertical.faEllipsisVertical
78
- }),
79
- triggerIsIcon: true,
80
- triggerId: `header-menu-actions-${header.column.id}`,
81
- triggerTestId: "header-menu-actions",
82
- triggerAriaLabelText: localizationTextWithDefault?.headerActionsAriaLabel,
83
- contentTestId: "header-menu-actions-content"
63
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
64
+ className: "menu-wrapper",
65
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenu, {
66
+ options: menuActions,
67
+ triggerClassName: (0, _classnames.default)('react-table-cell-menu-trigger', {
68
+ 'focused-visible': isVisible
69
+ }),
70
+ contentClassName: "react-table-cell-menu-content",
71
+ selectedKey: sorted || undefined,
72
+ onSelect: selectedOption => {
73
+ const key = selectedOption?.key;
74
+ const handler = actionsHandlers[key] || (() => {});
75
+ handler();
76
+ },
77
+ triggerHideChevron: true,
78
+ triggerDynamicContent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
79
+ icon: _faEllipsisVertical.faEllipsisVertical
80
+ }),
81
+ triggerIsIcon: true,
82
+ triggerId: `header-menu-actions-${header.column.id}`,
83
+ triggerTestId: "header-menu-actions",
84
+ triggerAriaLabelText: localizationTextWithDefault?.headerActionsAriaLabel,
85
+ contentTestId: "header-menu-actions-content"
86
+ })
84
87
  });
85
88
  }
@@ -138,14 +138,11 @@ function TableHeaderCell({
138
138
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
139
139
  className: "react-table-cell-splitter"
140
140
  })]
141
- }), canShowMenu && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
142
- className: "menu-wrapper",
143
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_tableHeaderCellMenu.TableHeaderCellMenu, {
144
- header: header,
145
- tableContainerWidth: tableContainerWidth,
146
- localizationText: localizationTextWithDefault?.headerMenu,
147
- isVisible: isCurrentCellFocused
148
- })
141
+ }), canShowMenu && /*#__PURE__*/(0, _jsxRuntime.jsx)(_tableHeaderCellMenu.TableHeaderCellMenu, {
142
+ header: header,
143
+ tableContainerWidth: tableContainerWidth,
144
+ localizationText: localizationTextWithDefault?.headerMenu,
145
+ isVisible: isCurrentCellFocused
149
146
  }), !header.column.columnDef.meta?.hideSeparator &&
150
147
  /*#__PURE__*/
151
148
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -14,14 +14,21 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
14
14
  function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visibility = {}) {
15
15
  // we are interested only in visible columns
16
16
  const visibleColumns = columns.filter(({
17
- accessorKey
18
- }) => visibility[accessorKey] !== false);
17
+ accessorKey,
18
+ id
19
+ }) => {
20
+ // visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
21
+ // but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
22
+ // accessorKey would be different from id. Thus we should add a check on columnDef.id here
23
+ const visibilityValue = visibility[id] ?? visibility[accessorKey];
24
+ return visibilityValue !== false;
25
+ });
19
26
  // we need to know columns that do have maxSize set, as it will influence how free space is distributed
20
27
  const columnsWithMaxSize = visibleColumns.filter(column => !!column.maxSize);
21
28
 
22
29
  // calculation of all current columns width
23
30
  const currentWidth = visibleColumns.reduce((acc, current) => {
24
- const resizeValue = columnSizing[current.accessorKey];
31
+ const resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
25
32
  const minWidth = current.minSize || _types.COLUMN_SIZE.MIN_WIDTH;
26
33
  const resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
27
34
  const columnSize = Math.max(current.size || _types.COLUMN_SIZE.WIDTH, minWidth);
@@ -39,8 +46,9 @@ function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visib
39
46
  // whose size was altered manually by drag-n-drop in UI)
40
47
  const notSettedColumns = visibleColumns.filter(({
41
48
  size,
42
- accessorKey
43
- }) => !size && !columnSizing[accessorKey]);
49
+ accessorKey,
50
+ id
51
+ }) => !size && !(columnSizing[id] || columnSizing[accessorKey]));
44
52
  const evenDistribution = delta / notSettedColumns.length;
45
53
 
46
54
  // if there is no max size on any columns - distribute free space evenly across columns
@@ -53,26 +53,29 @@ export function TableHeaderCellMenu({
53
53
  return acc;
54
54
  }, {})
55
55
  };
56
- return /*#__PURE__*/_jsx(DropdownMenu, {
57
- options: menuActions,
58
- triggerClassName: classnames('react-table-cell-menu-trigger', {
59
- 'focused-visible': isVisible
60
- }),
61
- contentClassName: "react-table-cell-menu-content",
62
- selectedKey: sorted || undefined,
63
- onSelect: selectedOption => {
64
- const key = selectedOption?.key;
65
- const handler = actionsHandlers[key] || (() => {});
66
- handler();
67
- },
68
- triggerHideChevron: true,
69
- triggerDynamicContent: () => /*#__PURE__*/_jsx(FontAwesomeIcon, {
70
- icon: faEllipsisVertical
71
- }),
72
- triggerIsIcon: true,
73
- triggerId: `header-menu-actions-${header.column.id}`,
74
- triggerTestId: "header-menu-actions",
75
- triggerAriaLabelText: localizationTextWithDefault?.headerActionsAriaLabel,
76
- contentTestId: "header-menu-actions-content"
56
+ return /*#__PURE__*/_jsx("div", {
57
+ className: "menu-wrapper",
58
+ children: /*#__PURE__*/_jsx(DropdownMenu, {
59
+ options: menuActions,
60
+ triggerClassName: classnames('react-table-cell-menu-trigger', {
61
+ 'focused-visible': isVisible
62
+ }),
63
+ contentClassName: "react-table-cell-menu-content",
64
+ selectedKey: sorted || undefined,
65
+ onSelect: selectedOption => {
66
+ const key = selectedOption?.key;
67
+ const handler = actionsHandlers[key] || (() => {});
68
+ handler();
69
+ },
70
+ triggerHideChevron: true,
71
+ triggerDynamicContent: () => /*#__PURE__*/_jsx(FontAwesomeIcon, {
72
+ icon: faEllipsisVertical
73
+ }),
74
+ triggerIsIcon: true,
75
+ triggerId: `header-menu-actions-${header.column.id}`,
76
+ triggerTestId: "header-menu-actions",
77
+ triggerAriaLabelText: localizationTextWithDefault?.headerActionsAriaLabel,
78
+ contentTestId: "header-menu-actions-content"
79
+ })
77
80
  });
78
81
  }
@@ -130,14 +130,11 @@ export function TableHeaderCell({
130
130
  }), /*#__PURE__*/_jsx("div", {
131
131
  className: "react-table-cell-splitter"
132
132
  })]
133
- }), canShowMenu && /*#__PURE__*/_jsx("div", {
134
- className: "menu-wrapper",
135
- children: /*#__PURE__*/_jsx(TableHeaderCellMenu, {
136
- header: header,
137
- tableContainerWidth: tableContainerWidth,
138
- localizationText: localizationTextWithDefault?.headerMenu,
139
- isVisible: isCurrentCellFocused
140
- })
133
+ }), canShowMenu && /*#__PURE__*/_jsx(TableHeaderCellMenu, {
134
+ header: header,
135
+ tableContainerWidth: tableContainerWidth,
136
+ localizationText: localizationTextWithDefault?.headerMenu,
137
+ isVisible: isCurrentCellFocused
141
138
  }), !header.column.columnDef.meta?.hideSeparator &&
142
139
  /*#__PURE__*/
143
140
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -7,14 +7,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visibility = {}) {
8
8
  // we are interested only in visible columns
9
9
  const visibleColumns = columns.filter(({
10
- accessorKey
11
- }) => visibility[accessorKey] !== false);
10
+ accessorKey,
11
+ id
12
+ }) => {
13
+ // visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
14
+ // but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
15
+ // accessorKey would be different from id. Thus we should add a check on columnDef.id here
16
+ const visibilityValue = visibility[id] ?? visibility[accessorKey];
17
+ return visibilityValue !== false;
18
+ });
12
19
  // we need to know columns that do have maxSize set, as it will influence how free space is distributed
13
20
  const columnsWithMaxSize = visibleColumns.filter(column => !!column.maxSize);
14
21
 
15
22
  // calculation of all current columns width
16
23
  const currentWidth = visibleColumns.reduce((acc, current) => {
17
- const resizeValue = columnSizing[current.accessorKey];
24
+ const resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
18
25
  const minWidth = current.minSize || COLUMN_SIZE.MIN_WIDTH;
19
26
  const resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
20
27
  const columnSize = Math.max(current.size || COLUMN_SIZE.WIDTH, minWidth);
@@ -32,8 +39,9 @@ function calculateDelta(columns, maxWidth, padding = 0, columnSizing = {}, visib
32
39
  // whose size was altered manually by drag-n-drop in UI)
33
40
  const notSettedColumns = visibleColumns.filter(({
34
41
  size,
35
- accessorKey
36
- }) => !size && !columnSizing[accessorKey]);
42
+ accessorKey,
43
+ id
44
+ }) => !size && !(columnSizing[id] || columnSizing[accessorKey]));
37
45
  const evenDistribution = delta / notSettedColumns.length;
38
46
 
39
47
  // if there is no max size on any columns - distribute free space evenly across columns
@@ -75397,7 +75397,9 @@ function TableHeaderCellMenu(_ref) {
75397
75397
  acc[customAction.key] = customAction.onOptionSelect;
75398
75398
  return acc;
75399
75399
  }, {}));
75400
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dropdown_menu__WEBPACK_IMPORTED_MODULE_5__.DropdownMenu, {
75400
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
75401
+ className: "menu-wrapper"
75402
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dropdown_menu__WEBPACK_IMPORTED_MODULE_5__.DropdownMenu, {
75401
75403
  options: menuActions,
75402
75404
  triggerClassName: classnames__WEBPACK_IMPORTED_MODULE_1___default()('react-table-cell-menu-trigger', {
75403
75405
  'focused-visible': isVisible
@@ -75420,7 +75422,7 @@ function TableHeaderCellMenu(_ref) {
75420
75422
  triggerTestId: "header-menu-actions",
75421
75423
  triggerAriaLabelText: localizationTextWithDefault === null || localizationTextWithDefault === void 0 ? void 0 : localizationTextWithDefault.headerActionsAriaLabel,
75422
75424
  contentTestId: "header-menu-actions-content"
75423
- });
75425
+ }));
75424
75426
  }
75425
75427
 
75426
75428
  /***/ }),
@@ -75586,14 +75588,12 @@ function TableHeaderCell(_ref) {
75586
75588
  "test-id": "table-react-header-cell-sorting-icon"
75587
75589
  }, sortingIcon), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
75588
75590
  className: "react-table-cell-splitter"
75589
- })), canShowMenu && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
75590
- className: "menu-wrapper"
75591
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_table_header_cell_menu__WEBPACK_IMPORTED_MODULE_9__.TableHeaderCellMenu, {
75591
+ })), canShowMenu && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_table_header_cell_menu__WEBPACK_IMPORTED_MODULE_9__.TableHeaderCellMenu, {
75592
75592
  header: header,
75593
75593
  tableContainerWidth: tableContainerWidth,
75594
75594
  localizationText: localizationTextWithDefault === null || localizationTextWithDefault === void 0 ? void 0 : localizationTextWithDefault.headerMenu,
75595
75595
  isVisible: isCurrentCellFocused
75596
- })), !((_header$column$column10 = header.column.columnDef.meta) !== null && _header$column$column10 !== void 0 && _header$column$column10.hideSeparator) &&
75596
+ }), !((_header$column$column10 = header.column.columnDef.meta) !== null && _header$column$column10 !== void 0 && _header$column$column10.hideSeparator) &&
75597
75597
  /*#__PURE__*/
75598
75598
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
75599
75599
  react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
@@ -76937,8 +76937,14 @@ function calculateDelta(columns, maxWidth) {
76937
76937
  var visibility = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
76938
76938
  // we are interested only in visible columns
76939
76939
  var visibleColumns = columns.filter(function (_ref) {
76940
- var accessorKey = _ref.accessorKey;
76941
- return visibility[accessorKey] !== false;
76940
+ var _visibility;
76941
+ var accessorKey = _ref.accessorKey,
76942
+ id = _ref.id;
76943
+ // visibility state uses column ids for setting visibility, and for most cases it's the same as accessorKey
76944
+ // but for the case when either 1) user provided an explicit id to the columnDef or 2) accessorKey is a complex get object path like `<object_name>.<object_property_name>`
76945
+ // accessorKey would be different from id. Thus we should add a check on columnDef.id here
76946
+ var visibilityValue = (_visibility = visibility[id]) !== null && _visibility !== void 0 ? _visibility : visibility[accessorKey];
76947
+ return visibilityValue !== false;
76942
76948
  });
76943
76949
  // we need to know columns that do have maxSize set, as it will influence how free space is distributed
76944
76950
  var columnsWithMaxSize = visibleColumns.filter(function (column) {
@@ -76947,7 +76953,7 @@ function calculateDelta(columns, maxWidth) {
76947
76953
 
76948
76954
  // calculation of all current columns width
76949
76955
  var currentWidth = visibleColumns.reduce(function (acc, current) {
76950
- var resizeValue = columnSizing[current.accessorKey];
76956
+ var resizeValue = columnSizing[current.id] || columnSizing[current.accessorKey];
76951
76957
  var minWidth = current.minSize || _types__WEBPACK_IMPORTED_MODULE_1__.COLUMN_SIZE.MIN_WIDTH;
76952
76958
  var resizeWidth = resizeValue ? Math.max(resizeValue, minWidth) : 0;
76953
76959
  var columnSize = Math.max(current.size || _types__WEBPACK_IMPORTED_MODULE_1__.COLUMN_SIZE.WIDTH, minWidth);
@@ -76965,8 +76971,9 @@ function calculateDelta(columns, maxWidth) {
76965
76971
  // whose size was altered manually by drag-n-drop in UI)
76966
76972
  var notSettedColumns = visibleColumns.filter(function (_ref2) {
76967
76973
  var size = _ref2.size,
76968
- accessorKey = _ref2.accessorKey;
76969
- return !size && !columnSizing[accessorKey];
76974
+ accessorKey = _ref2.accessorKey,
76975
+ id = _ref2.id;
76976
+ return !size && !(columnSizing[id] || columnSizing[accessorKey]);
76970
76977
  });
76971
76978
  var evenDistribution = delta / notSettedColumns.length;
76972
76979