@mailstep/design-system 0.7.47-beta.8 → 0.7.47

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.
Files changed (36) hide show
  1. package/package.json +1 -1
  2. package/ui/Blocks/CommonGrid/CommonGrid.d.ts +2 -2
  3. package/ui/Blocks/CommonGrid/CommonGrid.js +2 -3
  4. package/ui/Blocks/CommonGrid/components/ColumnFilterCell.d.ts +6 -2
  5. package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +2 -2
  6. package/ui/Blocks/CommonGrid/components/DataCell.d.ts +1 -0
  7. package/ui/Blocks/CommonGrid/components/DataCell.js +2 -2
  8. package/ui/Blocks/CommonGrid/components/DataRow.d.ts +2 -3
  9. package/ui/Blocks/CommonGrid/components/DataRow.js +4 -21
  10. package/ui/Blocks/CommonGrid/components/FilterRow.d.ts +1 -1
  11. package/ui/Blocks/CommonGrid/components/FilterRow.js +5 -29
  12. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/ActionsFilter.d.ts +10 -0
  13. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/ActionsFilter.js +14 -0
  14. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/index.d.ts +2 -0
  15. package/ui/Blocks/CommonGrid/components/Filters/ActionsFilter/index.js +2 -0
  16. package/ui/Blocks/CommonGrid/components/GroupRow.d.ts +1 -1
  17. package/ui/Blocks/CommonGrid/components/GroupRow.js +2 -4
  18. package/ui/Blocks/CommonGrid/components/HeadRow.js +3 -3
  19. package/ui/Blocks/CommonGrid/components/gridCells/Date.js +1 -1
  20. package/ui/Blocks/CommonGrid/components/gridCells/DateTime.js +1 -1
  21. package/ui/Blocks/CommonGrid/components/gridCells/EnumInCell.js +1 -1
  22. package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.d.ts +3 -1
  23. package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.js +3 -20
  24. package/ui/Blocks/CommonGrid/components/gridCells/StringJoin.js +1 -1
  25. package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.d.ts +0 -1
  26. package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.js +20 -27
  27. package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.d.ts +2 -2
  28. package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.js +3 -3
  29. package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +4 -1
  30. package/ui/Blocks/CommonGrid/styles.d.ts +1 -1
  31. package/ui/Blocks/CommonGrid/styles.js +2 -2
  32. package/ui/Blocks/CommonGrid/types.d.ts +2 -1
  33. package/ui/Blocks/CommonGrid/utils/index.d.ts +1 -2
  34. package/ui/Blocks/CommonGrid/utils/index.js +12 -15
  35. package/ui/index.es.js +21983 -21991
  36. package/ui/index.umd.js +708 -702
@@ -6,7 +6,7 @@ import { gridRowHeight, gridFooterHeight, gridButtonStripHeight, gridHeadHeight,
6
6
  import styled, { x } from '@xstyled/styled-components';
7
7
  import { th } from '@xstyled/system';
8
8
  import CommonGrid from './CommonGrid';
9
- export var BottomWrapper = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n & > * {\n @media (min-width: 1024px) {\n justify-content: flex-end;\n }\n }\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"], ["\n position: fixed;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n & > * {\n @media (min-width: 1024px) {\n justify-content: flex-end;\n }\n }\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"])), function (_a) {
9
+ export var BottomWrapper = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: 2;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n & > * {\n @media (min-width: 1024px) {\n justify-content: flex-end;\n }\n }\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"], ["\n position: fixed;\n z-index: 2;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n & > * {\n @media (min-width: 1024px) {\n justify-content: flex-end;\n }\n }\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"])), function (_a) {
10
10
  var withPagination = _a.withPagination;
11
11
  return (withPagination ? '10px 0' : '0px');
12
12
  }, function (_a) {
@@ -22,7 +22,7 @@ export var CommonGridWrap = styled(x.div)(templateObject_3 || (templateObject_3
22
22
  return (withPagination ? gridFooterHeight : 0);
23
23
  });
24
24
  export var StyledButtonStrip = styled(x.div)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n padding: 18px 20px;\n display: flex;\n justify-content: space-between;\n width: 100%;\n min-height: ", "px;\n flex-wrap: wrap;\n z-index: 3;\n"], ["\n position: relative;\n padding: 18px 20px;\n display: flex;\n justify-content: space-between;\n width: 100%;\n min-height: ", "px;\n flex-wrap: wrap;\n z-index: 3;\n"])), gridButtonStripHeight);
25
- export var CommonGridWithStyles = styled(CommonGrid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n height: calc(100% - ", "px);\n\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: ", "px;\n }\n & .gridHead {\n height: ", "px;\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 2;\n border-top: 1px solid ", ";\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n max-height: 32px;\n position: relative;\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n }\n\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n flex-grow: 1;\n }\n\n & .gridWrapper {\n background-color: ", ";\n width: auto;\n padding-bottom: 35px;\n\n @media (min-width: 1024px) {\n height: 100%;\n overflow-y: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right,\n .sticky-left {\n background: white;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n .dataRow:nth-child(even) {\n .sticky-left,\n .sticky-right {\n background-color: bgLightGray;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n z-index: 1;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"], ["\n height: calc(100% - ", "px);\n\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: ", "px;\n }\n & .gridHead {\n height: ", "px;\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 2;\n border-top: 1px solid ", ";\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n max-height: 32px;\n position: relative;\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n }\n\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n\n & .body {\n margin: 0 1px 1px 1px; // matching margin with .gridHead\n flex-grow: 1;\n }\n\n & .gridWrapper {\n background-color: ", ";\n width: auto;\n padding-bottom: 35px;\n\n @media (min-width: 1024px) {\n height: 100%;\n overflow-y: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 2px;\n padding-right: 2px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right,\n .sticky-left {\n background: white;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n }\n\n .dataRow:nth-child(even) {\n .sticky-left,\n .sticky-right {\n background-color: bgLightGray;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n z-index: 1;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"])), function (_a) {
25
+ export var CommonGridWithStyles = styled(CommonGrid)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n height: calc(100% - ", "px);\n\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: ", "px;\n }\n & .gridHead {\n height: ", "px;\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 2;\n border-top: 1px solid ", ";\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n max-height: 32px;\n position: relative;\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n }\n\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n\n & .body {\n flex-grow: 1;\n }\n\n & .gridWrapper {\n background-color: ", ";\n width: auto;\n padding-bottom: 35px;\n\n @media (min-width: 1024px) {\n height: 100%;\n overflow-y: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 4px;\n padding-right: 4px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right,\n .sticky-left {\n background: white;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n\n &:hover,\n &.checked,\n &.selected {\n background-color: red30;\n }\n }\n\n .dataRow:nth-child(even) {\n .sticky-left,\n .sticky-right {\n background-color: bgLightGray;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n z-index: 1;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"], ["\n height: calc(100% - ", "px);\n\n & .cell {\n padding: 0 4px;\n }\n & .dataRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: normal;\n border-bottom: 1px solid;\n border-color: lightGray3;\n height: ", "px;\n }\n & .gridHead {\n height: ", "px;\n background-color: neutral20;\n padding-bottom: 8px;\n position: sticky;\n top: -1px;\n z-index: 2;\n border-top: 1px solid ", ";\n }\n & .headRow {\n font-size: 12px;\n font-family: ", ";\n color: typoPrimary;\n font-weight: bold;\n border-bottom: none; // TODO fix in common-grid\n\n & .cell {\n overflow: hidden;\n max-height: 32px;\n position: relative;\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n }\n\n & .filterRow {\n & .cell {\n overflow: visible;\n }\n\n & .cell > div {\n width: 100%; // TODO fix in common-grid\n }\n\n & .sticky {\n background-color: bgLightGray1;\n }\n border-bottom: none; // TODO fix in common-grid\n }\n\n & .body {\n flex-grow: 1;\n }\n\n & .gridWrapper {\n background-color: ", ";\n width: auto;\n padding-bottom: 35px;\n\n @media (min-width: 1024px) {\n height: 100%;\n overflow-y: auto;\n padding-bottom: 0;\n }\n @media print {\n margin: 0;\n width: 100%;\n height: auto;\n overflow-x: hidden;\n }\n }\n\n & .fullWidthGrid > .gridWrapper > div {\n width: 100% !important;\n }\n\n & .paginatorWrapper,\n & .buttonsStrip {\n @media print {\n display: none;\n }\n }\n & .cell {\n padding-left: 4px;\n padding-right: 4px;\n @media print {\n white-space: unset;\n }\n }\n\n .dataRow {\n &.grayedOut {\n background: lightGray1;\n }\n\n .sticky-right,\n .sticky-left {\n background: white;\n }\n\n .sticky-right {\n border-left: 1px solid #dfe1e6;\n }\n\n .sticky-left {\n border-right: 1px solid #dfe1e6;\n }\n\n &:hover,\n &.checked,\n &.selected {\n background-color: red30;\n }\n }\n\n .dataRow:nth-child(even) {\n .sticky-left,\n .sticky-right {\n background-color: bgLightGray;\n }\n }\n\n @media print {\n .filterRow .sticky {\n display: none;\n }\n\n .headRow .sticky {\n display: none;\n }\n\n .dataRow .sticky {\n display: none;\n }\n }\n\n .resizer {\n z-index: unset;\n }\n\n // hotfix table head\n .cell .sortable {\n display: flex;\n align-items: center;\n padding-right: 2px;\n }\n\n .sticky {\n position: sticky !important;\n z-index: 1;\n }\n\n .sticky-left {\n left: 0;\n }\n\n .sticky-right {\n right: 0;\n }\n"])), function (_a) {
26
26
  var withButtonStrip = _a.withButtonStrip;
27
27
  return (withButtonStrip ? gridButtonStripHeight : 0);
28
28
  }, th('fonts.primary'), gridRowHeight, function (_a) {
@@ -106,7 +106,7 @@ export type ColumnDefinition<ColumnName extends string = string> = ColumnBasePro
106
106
  systemFilter?: string;
107
107
  title?: string | JSX.Element;
108
108
  filtering?: boolean;
109
- filteringType?: 'number' | 'text' | 'date' | 'flag' | 'options';
109
+ filteringType?: 'number' | 'text' | 'date' | 'flag' | 'options' | 'actions';
110
110
  disableRowTouch?: boolean;
111
111
  filterExtraProps?: {
112
112
  isMulti?: boolean;
@@ -164,6 +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
168
  };
168
169
  type SingleColumnConfig = {
169
170
  isHidden?: boolean;
@@ -1,5 +1,4 @@
1
- import { ColumnDefinition, ActionColumn, ColumnConfig, FilterProps, Group, StickTo, FiltersConfig } from '../types';
2
- export declare const getActionCellSizeProps: (column: ActionColumn) => object;
1
+ import type { ColumnDefinition, ColumnConfig, FilterProps, Group, StickTo, FiltersConfig } from '../types';
3
2
  export declare const getCellSizeProps: (column: ColumnDefinition, columnWidth: number) => object;
4
3
  export declare const getSortName: (column: ColumnDefinition) => string;
5
4
  export declare const getFilterName: (column: ColumnDefinition) => string;
@@ -1,16 +1,10 @@
1
- import NumberRange from '../components/Filters/NumberRange';
2
- import TextRange from '../components/Filters/TextRange';
3
- import DatePickerRange from '../components/Filters/DatePickerRange';
1
+ import ActionsFilter from '../components/Filters/ActionsFilter';
4
2
  import BooleanSelect from '../components/Filters/BooleanSelect';
3
+ import DatePickerRange from '../components/Filters/DatePickerRange';
5
4
  import GridSelect from '../components/Filters/GridSelect';
5
+ import NumberRange from '../components/Filters/NumberRange';
6
+ import TextRange from '../components/Filters/TextRange';
6
7
  var isDefined = function (val) { return typeof val !== 'undefined'; };
7
- export var getActionCellSizeProps = function (column) {
8
- return {
9
- flexBasis: column.flexBasis,
10
- flexGrow: 0,
11
- flexShrink: 0,
12
- };
13
- };
14
8
  export var getCellSizeProps = function (column, columnWidth) {
15
9
  if (!column)
16
10
  return {};
@@ -19,7 +13,7 @@ export var getCellSizeProps = function (column, columnWidth) {
19
13
  flexBasis: columnWidth,
20
14
  flexGrow: fixedSize ? 0 : isDefined(flexGrow) ? flexGrow : 1,
21
15
  flexShrink: isDefined(flexShrink) ? flexShrink : 1,
22
- maxWidth: sticky ? columnWidth : 'auto',
16
+ maxWidth: sticky ? columnWidth : 'auto'
23
17
  };
24
18
  };
25
19
  export var getSortName = function (column) {
@@ -42,7 +36,7 @@ export var isColumnOn = function (column, columnConfig) {
42
36
  };
43
37
  export var calculatePaginator = function (page, rowsPerPage) { return ({
44
38
  offset: rowsPerPage ? rowsPerPage * (page - 1) : rowsPerPage,
45
- limit: rowsPerPage,
39
+ limit: rowsPerPage
46
40
  }); };
47
41
  export var createFilterType = function (columnDefinition) {
48
42
  if (columnDefinition.filterOptions)
@@ -56,7 +50,7 @@ export var getGroups = function (columns) {
56
50
  return {
57
51
  name: column.group,
58
52
  start: !!(column.group && (!previousGroup || (previousGroup && previousGroup !== column.group))),
59
- end: !!(column.group && (!columns[key + 1] || columns[key + 1].group !== column.group)),
53
+ end: !!(column.group && (!columns[key + 1] || columns[key + 1].group !== column.group))
60
54
  };
61
55
  });
62
56
  };
@@ -73,6 +67,7 @@ export var getFilters = function (optimizeFilters) {
73
67
  date: { CellComponent: DatePickerRange },
74
68
  flag: { CellComponent: BooleanSelect },
75
69
  options: { CellComponent: GridSelect },
70
+ actions: { CellComponent: ActionsFilter }
76
71
  };
77
72
  if (optimizeFilters) {
78
73
  filters.text.defaultExtraProps = { defaultComparator: 'eq' };
@@ -85,10 +80,12 @@ export var checksColumnsOrder = function (colsOrder, columnsDefinitions) {
85
80
  if (stickyLeftColls.length > 1 || stickyRightColls.length > 1) {
86
81
  console.error('Grid can have only sticky column on each side.');
87
82
  }
88
- if (stickyLeftColls.length && colsOrder.indexOf(stickyLeftColls[0].name) !== 0) {
83
+ if (stickyLeftColls.length && colsOrder.indexOf(stickyLeftColls[0].name) !== 0 && stickyLeftColls[0].name !== 'actions') {
89
84
  console.error('The left sticky column should be the first one in a row');
90
85
  }
91
- if (stickyRightColls.length && colsOrder.indexOf(stickyRightColls[0].name) !== colsOrder.length - 1) {
86
+ if (stickyRightColls.length &&
87
+ colsOrder.indexOf(stickyRightColls[0].name) !== colsOrder.length - 1 &&
88
+ stickyRightColls[0].name !== 'actions') {
92
89
  console.error('The Right sticky column should be the last one in a row');
93
90
  }
94
91
  };