@mailstep/design-system 0.7.47-beta.16 → 0.7.47-beta.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.47-beta.16",
3
+ "version": "0.7.47-beta.18",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -7,6 +7,7 @@ import { Row } from './Table';
7
7
  var FilterRow = function (_a) {
8
8
  var columns = _a.columns, groups = _a.groups, actionColumn = _a.actionColumn, onChange = _a.onChange, _b = _a.filterValues, filterValues = _b === void 0 ? {} : _b, displayColumnsWidth = _a.displayColumnsWidth, filters = _a.filters, comparators = _a.comparators, handleUxChange = _a.handleUxChange, rowsData = _a.rowsData, uxState = _a.uxState;
9
9
  var handleOnChange = throttle(onChange, 500);
10
+ console.log('columns', columns);
10
11
  return (_jsx(Row, { className: "filterRow", children: columns.map(function (column, index) { return (_jsx(ColumnFilterCell, { column: column, actionColumn: actionColumn, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange, onChange: handleOnChange, value: get([getFilterName(column), 'value'], filterValues), others: get([getFilterName(column), 'others'], filterValues), displayColumnWidth: displayColumnsWidth[column.name], filters: filters, comparators: comparators, group: groups === null || groups === void 0 ? void 0 : groups[index] }, index)); }) }));
11
12
  };
12
13
  export default FilterRow;
@@ -6,5 +6,5 @@ type Props = {
6
6
  uxState?: UxState;
7
7
  handleUxChange?: GridActionsType['handleUxChange'];
8
8
  };
9
- declare const ActionFilter: FC<Props>;
10
- export default ActionFilter;
9
+ declare const ActionsFilter: FC<Props>;
10
+ export default ActionsFilter;
@@ -2,13 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Checkbox from '../../../../../Forms/Checkbox';
3
3
  import { useToggleAllCheckbox } from '../../../hooks/useToggleAllCheckbox';
4
4
  import { x } from '@xstyled/styled-components';
5
- var ActionFilter = function (_a) {
5
+ var ActionsFilter = function (_a) {
6
6
  var _b, _c;
7
7
  var actionColumn = _a.actionColumn, rowsData = _a.rowsData, uxState = _a.uxState, handleUxChange = _a.handleUxChange;
8
8
  var _d = useToggleAllCheckbox(rowsData || [], uxState || {}, handleUxChange), allChecked = _d[0], toggleCheckbox = _d[1];
9
9
  var displayRowNumberLabel = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.addRowNumbers;
10
10
  var rowsNumberLabel = (_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.addRowNumbersLabel) !== null && _b !== void 0 ? _b : '#';
11
11
  var displayCheckbox = ((_c = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _c === void 0 ? void 0 : _c.length) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.forceCheckboxes);
12
- return (_jsxs(x.div, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "16px", pl: "4px", children: [displayCheckbox && _jsx(Checkbox, { checked: allChecked, onChange: toggleCheckbox, label: "" }, "check-all"), displayRowNumberLabel && _jsx(x.div, { pr: "12px", children: rowsNumberLabel })] }));
12
+ console.log('test');
13
+ return (_jsxs(x.div, { display: "flex", alignItems: "center", justifyContent: "space-between", gap: "16px", pl: "4px", children: [displayCheckbox && (_jsx(x.div, { w: "100%", children: _jsx(Checkbox, { checked: allChecked, onChange: toggleCheckbox, label: "" }, "check-all") })), displayRowNumberLabel && (_jsx(x.div, { pr: "12px", w: "100%", display: "flex", justifyContent: "center", children: rowsNumberLabel }))] }));
13
14
  };
14
- export default ActionFilter;
15
+ export default ActionsFilter;
@@ -53,5 +53,5 @@ export var RowActionsCell = function (_a) {
53
53
  onClick();
54
54
  }
55
55
  }, [onClick]);
56
- return (_jsxs(x.div, { w: "100%", display: "flex", gap: "16px", pl: "4px", pr: "4px", children: [withCheckboxes && (_jsx(x.div, { w: "100%", children: _jsx(Checkbox, { checked: isChecked, onChange: onCheckboxChange, label: "" }) })), addRowNumbers && (_jsx(x.div, { display: "flex", alignItems: "center", pr: "8px", children: rowIndex })), canEdit && _jsx(IconButtonInCell, { icon: "pen", onClick: handleOnClick, linkTo: linkTo }, "edit"), !canEdit && canRead && _jsx(IconButtonInCell, { icon: "chevronRight", onClick: handleOnClick, linkTo: linkTo }, "read")] }));
56
+ return (_jsxs(x.div, { w: "100%", display: "flex", gap: "16px", pl: "4px", pr: "4px", children: [withCheckboxes && (_jsx(x.div, { w: "100%", children: _jsx(Checkbox, { checked: isChecked, onChange: onCheckboxChange, label: "" }) })), addRowNumbers && (_jsx(x.div, { display: "flex", alignItems: "center", justifyContent: "center", pr: "8px", w: "100%", children: rowIndex })), canEdit && _jsx(IconButtonInCell, { icon: "pen", onClick: handleOnClick, linkTo: linkTo }, "edit"), !canEdit && canRead && _jsx(IconButtonInCell, { icon: "chevronRight", onClick: handleOnClick, linkTo: linkTo }, "read")] }));
57
57
  };
@@ -52,9 +52,9 @@ var useEditReadAsColumn = function (props) {
52
52
  var modifiedColumnsDefinitions = useMemo(function () {
53
53
  if (canRowEdit || canRowRead || withCheckboxes || addRowNumbers) {
54
54
  var editReadColumnDefinition = {
55
- name: 'sticky',
55
+ name: 'actions',
56
56
  flexBasis: flexBasis,
57
- filtering: withCheckboxes,
57
+ filtering: withCheckboxes || addRowNumbers,
58
58
  filteringType: 'actions',
59
59
  sorting: false,
60
60
  sticky: true,
@@ -79,6 +79,7 @@ var useEditReadAsColumn = function (props) {
79
79
  return columnsDefinitions;
80
80
  }
81
81
  }, [
82
+ addRowNumbers,
82
83
  flexBasis,
83
84
  stickTo,
84
85
  canRowEdit,
@@ -9,7 +9,7 @@ import { columnDefinitions, enumColumn } from '../utils/columnDefinition';
9
9
  import { ReduxGrid, createRandomData, enumValues, gridDummyActions } from '../utils/utils';
10
10
  import withRedux from '../utils/withRedux';
11
11
  var ActionColumnButtons = {
12
- flexBasis: 75,
12
+ flexBasis: 80,
13
13
  forceCheckboxes: true,
14
14
  addRowNumbers: false,
15
15
  canRowEdit: true,
@@ -164,7 +164,7 @@ export type DataCellProps<T> = {
164
164
  onRowAction?: (id: string, field: string, value: any, rowData?: T) => void | Promise<any>;
165
165
  column: ColumnDefinition;
166
166
  children?: React.ReactNode;
167
- rowIndex: number;
167
+ rowIndex?: number;
168
168
  };
169
169
  type SingleColumnConfig = {
170
170
  isHidden?: boolean;
@@ -87,10 +87,12 @@ export var checksColumnsOrder = function (colsOrder, columnsDefinitions) {
87
87
  if (stickyLeftColls.length > 1 || stickyRightColls.length > 1) {
88
88
  console.error('Grid can have only sticky column on each side.');
89
89
  }
90
- if (stickyLeftColls.length && colsOrder.indexOf(stickyLeftColls[0].name) !== 0) {
90
+ if (stickyLeftColls.length && colsOrder.indexOf(stickyLeftColls[0].name) !== 0 && stickyLeftColls[0].name !== 'actions') {
91
91
  console.error('The left sticky column should be the first one in a row');
92
92
  }
93
- if (stickyRightColls.length && colsOrder.indexOf(stickyRightColls[0].name) !== colsOrder.length - 1) {
93
+ if (stickyRightColls.length &&
94
+ colsOrder.indexOf(stickyRightColls[0].name) !== colsOrder.length - 1 &&
95
+ stickyRightColls[0].name !== 'actions') {
94
96
  console.error('The Right sticky column should be the last one in a row');
95
97
  }
96
98
  };