cozy-ui 123.2.0 → 124.0.0

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 (58) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/package.json +11 -6
  3. package/react/ActionsMenu/ActionsMenuWrapper.jsx +21 -15
  4. package/react/Filename/Readme.md +10 -8
  5. package/react/Filename/index.jsx +56 -10
  6. package/react/Filename/styles.styl +3 -0
  7. package/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +60 -0
  8. package/react/Table/Readme.md +80 -0
  9. package/react/Table/Virtualized/Cell.jsx +41 -0
  10. package/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer.jsx +45 -0
  11. package/react/Table/Virtualized/Dnd/CustomDrag/DragPreview.jsx +43 -0
  12. package/react/Table/Virtualized/Dnd/CustomDrag/DragPreviewWrapper.jsx +52 -0
  13. package/react/Table/Virtualized/Dnd/DnDConfigWrapper.jsx +48 -0
  14. package/react/Table/Virtualized/Dnd/TableRow.jsx +86 -0
  15. package/react/Table/Virtualized/FixedHeaderContent.jsx +58 -0
  16. package/react/Table/Virtualized/HeadCell.jsx +45 -0
  17. package/react/Table/Virtualized/RowContent.jsx +35 -0
  18. package/react/Table/Virtualized/helpers.js +41 -0
  19. package/react/Table/Virtualized/helpers.spec.js +108 -0
  20. package/react/Table/Virtualized/index.jsx +104 -0
  21. package/react/Table/Virtualized/virtuosoComponents.jsx +61 -0
  22. package/react/TableRow/index.js +16 -1
  23. package/transpiled/react/ActionsMenu/ActionsMenuWrapper.js +14 -10
  24. package/transpiled/react/Filename/index.d.ts +2 -1
  25. package/transpiled/react/Filename/index.js +49 -16
  26. package/transpiled/react/MuiCozyTheme/overrides/makeDarkInvertedOverrides.d.ts +56 -0
  27. package/transpiled/react/MuiCozyTheme/overrides/makeDarkNormalOverrides.d.ts +56 -0
  28. package/transpiled/react/MuiCozyTheme/overrides/makeLightInvertedOverrides.d.ts +56 -0
  29. package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.d.ts +56 -0
  30. package/transpiled/react/MuiCozyTheme/overrides/makeLightNormalOverrides.js +59 -0
  31. package/transpiled/react/Table/Virtualized/Cell.d.ts +8 -0
  32. package/transpiled/react/Table/Virtualized/Cell.js +46 -0
  33. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer.d.ts +4 -0
  34. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer.js +47 -0
  35. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/DragPreview.d.ts +6 -0
  36. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/DragPreview.js +34 -0
  37. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/DragPreviewWrapper.d.ts +8 -0
  38. package/transpiled/react/Table/Virtualized/Dnd/CustomDrag/DragPreviewWrapper.js +63 -0
  39. package/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper.d.ts +2 -0
  40. package/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper.js +55 -0
  41. package/transpiled/react/Table/Virtualized/Dnd/TableRow.d.ts +8 -0
  42. package/transpiled/react/Table/Virtualized/Dnd/TableRow.js +130 -0
  43. package/transpiled/react/Table/Virtualized/FixedHeaderContent.d.ts +10 -0
  44. package/transpiled/react/Table/Virtualized/FixedHeaderContent.js +54 -0
  45. package/transpiled/react/Table/Virtualized/HeadCell.d.ts +8 -0
  46. package/transpiled/react/Table/Virtualized/HeadCell.js +44 -0
  47. package/transpiled/react/Table/Virtualized/RowContent.d.ts +10 -0
  48. package/transpiled/react/Table/Virtualized/RowContent.js +34 -0
  49. package/transpiled/react/Table/Virtualized/helpers.d.ts +2 -0
  50. package/transpiled/react/Table/Virtualized/helpers.js +64 -0
  51. package/transpiled/react/Table/Virtualized/helpers.spec.d.ts +1 -0
  52. package/transpiled/react/Table/Virtualized/index.d.ts +2 -0
  53. package/transpiled/react/Table/Virtualized/index.js +115 -0
  54. package/transpiled/react/Table/Virtualized/virtuosoComponents.d.ts +10 -0
  55. package/transpiled/react/Table/Virtualized/virtuosoComponents.js +100 -0
  56. package/transpiled/react/TableRow/index.d.ts +2 -1
  57. package/transpiled/react/TableRow/index.js +20 -1
  58. package/transpiled/react/stylesheet.css +1 -1
@@ -0,0 +1,8 @@
1
+ export default TableRow;
2
+ declare function TableRow({ item, context, selected, disabled, ...props }: {
3
+ [x: string]: any;
4
+ item: any;
5
+ context: any;
6
+ selected: any;
7
+ disabled: any;
8
+ }): JSX.Element;
@@ -0,0 +1,130 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["item", "context", "selected", "disabled"];
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
7
+ import React, { useEffect } from 'react';
8
+ import { useDrag, useDrop } from 'react-dnd';
9
+ import { getEmptyImage } from 'react-dnd-html5-backend';
10
+ import TableRowClassic from "cozy-ui/transpiled/react/TableRow";
11
+
12
+ var TableRow = function TableRow(_ref) {
13
+ var item = _ref.item,
14
+ context = _ref.context,
15
+ selected = _ref.selected,
16
+ disabled = _ref.disabled,
17
+ props = _objectWithoutProperties(_ref, _excluded);
18
+
19
+ var selectedItems = context.selectedItems,
20
+ setItemsInDropProcess = context.setItemsInDropProcess,
21
+ dragProps = context.dragProps;
22
+ var onDrop = dragProps.onDrop,
23
+ canDropProps = dragProps.canDrop,
24
+ canDragProps = dragProps.canDrag,
25
+ dragId = dragProps.dragId;
26
+
27
+ var _useDrag = useDrag(function () {
28
+ return {
29
+ type: dragId,
30
+ isDragging: function isDragging(monitor) {
31
+ // put all selected items in isDragging state
32
+ if (selectedItems.length > 0) {
33
+ return selectedItems.some(function (selectedItem) {
34
+ return selectedItem._id === item._id;
35
+ });
36
+ }
37
+
38
+ return item._id === monitor.getItem().draggedItems[0]._id;
39
+ },
40
+ item: {
41
+ draggedItems: selectedItems.length > 0 ? selectedItems : [item]
42
+ },
43
+ canDrag: function canDrag() {
44
+ var defaultCanDrag = (canDragProps === null || canDragProps === void 0 ? void 0 : canDragProps(item)) || true; // if selectedItems is not empty, only the selected items can be dragged
45
+
46
+ // if selectedItems is not empty, only the selected items can be dragged
47
+ if (selectedItems.length > 0) {
48
+ return defaultCanDrag && selected;
49
+ }
50
+
51
+ return defaultCanDrag;
52
+ },
53
+ collect: function collect(monitor) {
54
+ return {
55
+ isDragging: monitor.isDragging()
56
+ };
57
+ }
58
+ };
59
+ }, [item, selectedItems] // used to pass args inside returned object attributes
60
+ ),
61
+ _useDrag2 = _slicedToArray(_useDrag, 3),
62
+ dragCollect = _useDrag2[0],
63
+ dragRef = _useDrag2[1],
64
+ dragRefPreview = _useDrag2[2];
65
+
66
+ var _useDrop = useDrop(function () {
67
+ return {
68
+ accept: dragId,
69
+ canDrop: function canDrop() {
70
+ return canDropProps ? canDropProps(item) : true;
71
+ },
72
+ drop: function () {
73
+ var _drop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(draggedItem) {
74
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
75
+ while (1) {
76
+ switch (_context.prev = _context.next) {
77
+ case 0:
78
+ setItemsInDropProcess(draggedItem.draggedItems.map(function (draggedItem) {
79
+ return draggedItem._id;
80
+ }));
81
+ _context.next = 3;
82
+ return onDrop(draggedItem.draggedItems, item, selectedItems);
83
+
84
+ case 3:
85
+ setItemsInDropProcess([]);
86
+
87
+ case 4:
88
+ case "end":
89
+ return _context.stop();
90
+ }
91
+ }
92
+ }, _callee);
93
+ }));
94
+
95
+ function drop(_x) {
96
+ return _drop.apply(this, arguments);
97
+ }
98
+
99
+ return drop;
100
+ }(),
101
+ collect: function collect(monitor) {
102
+ return {
103
+ isOver: monitor.isOver()
104
+ };
105
+ }
106
+ };
107
+ }, [item._id, selectedItems] // used to pass args inside returned object attributes
108
+ ),
109
+ _useDrop2 = _slicedToArray(_useDrop, 2),
110
+ dropCollect = _useDrop2[0],
111
+ dropRef = _useDrop2[1]; // Tricks for the preview image to be empty
112
+ // https://react-dnd.github.io/react-dnd/examples/drag-around/custom-drag-layer
113
+
114
+
115
+ useEffect(function () {
116
+ dragRefPreview(getEmptyImage(), {
117
+ captureDraggingState: true
118
+ });
119
+ }, [dragRefPreview]);
120
+ return /*#__PURE__*/React.createElement(TableRowClassic, _extends({}, props, {
121
+ ref: function ref(node) {
122
+ return dragRef(dropRef(node));
123
+ },
124
+ selected: selected || dropCollect.isOver,
125
+ className: dragCollect.isDragging ? 'u-o-50' : '',
126
+ disabled: disabled
127
+ }));
128
+ };
129
+
130
+ export default TableRow;
@@ -0,0 +1,10 @@
1
+ export default FixedHeaderContent;
2
+ declare function FixedHeaderContent({ columns, order, orderBy, rowCount, selectedCount, onClick, onSelectAllClick }: {
3
+ columns: any;
4
+ order: any;
5
+ orderBy: any;
6
+ rowCount: any;
7
+ selectedCount: any;
8
+ onClick: any;
9
+ onSelectAllClick: any;
10
+ }): JSX.Element;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import TableHeadCell from "cozy-ui/transpiled/react/Table/Virtualized/HeadCell";
3
+ import Checkbox from "cozy-ui/transpiled/react/Checkbox";
4
+ import TableCell from "cozy-ui/transpiled/react/TableCell";
5
+ import TableRow from "cozy-ui/transpiled/react/TableRow";
6
+ import { makeStyles } from "cozy-ui/transpiled/react/styles";
7
+ var useStyles = makeStyles({
8
+ visuallyHidden: {
9
+ border: 0,
10
+ clip: 'rect(0 0 0 0)',
11
+ height: 1,
12
+ margin: -1,
13
+ overflow: 'hidden',
14
+ padding: 0,
15
+ position: 'absolute',
16
+ top: 20,
17
+ width: 1
18
+ }
19
+ });
20
+
21
+ var FixedHeaderContent = function FixedHeaderContent(_ref) {
22
+ var columns = _ref.columns,
23
+ order = _ref.order,
24
+ orderBy = _ref.orderBy,
25
+ rowCount = _ref.rowCount,
26
+ selectedCount = _ref.selectedCount,
27
+ _onClick = _ref.onClick,
28
+ onSelectAllClick = _ref.onSelectAllClick;
29
+ var classes = useStyles();
30
+ return /*#__PURE__*/React.createElement(TableRow, null, /*#__PURE__*/React.createElement(TableCell, {
31
+ align: "center",
32
+ padding: "checkbox"
33
+ }, /*#__PURE__*/React.createElement(Checkbox, {
34
+ indeterminate: selectedCount > 0 && selectedCount < rowCount,
35
+ checked: rowCount > 0 && selectedCount === rowCount,
36
+ inputProps: {
37
+ 'aria-label': 'select all'
38
+ },
39
+ onChange: onSelectAllClick
40
+ })), columns.map(function (column) {
41
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
42
+ key: column.id,
43
+ className: classes.visuallyHidden,
44
+ column: column,
45
+ order: order,
46
+ orderBy: orderBy,
47
+ onClick: function onClick() {
48
+ return _onClick(column.id);
49
+ }
50
+ });
51
+ }));
52
+ };
53
+
54
+ export default FixedHeaderContent;
@@ -0,0 +1,8 @@
1
+ export default TableHeadCell;
2
+ declare function TableHeadCell({ className, column, orderBy, order, onClick }: {
3
+ className: any;
4
+ column: any;
5
+ orderBy: any;
6
+ order: any;
7
+ onClick: any;
8
+ }): JSX.Element;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import TableCell from "cozy-ui/transpiled/react/TableCell";
3
+ import TableSortLabel from "cozy-ui/transpiled/react/TableSortLabel";
4
+ import { makeStyles } from "cozy-ui/transpiled/react/styles";
5
+ var useStyles = makeStyles({
6
+ root: {
7
+ width: function width(_ref) {
8
+ var column = _ref.column;
9
+ return column.width;
10
+ },
11
+ maxWidth: function maxWidth(_ref2) {
12
+ var column = _ref2.column;
13
+ return column.maxWidth;
14
+ }
15
+ }
16
+ });
17
+
18
+ var TableHeadCell = function TableHeadCell(_ref3) {
19
+ var _column$textAlign;
20
+
21
+ var className = _ref3.className,
22
+ column = _ref3.column,
23
+ orderBy = _ref3.orderBy,
24
+ order = _ref3.order,
25
+ onClick = _ref3.onClick;
26
+ var classes = useStyles({
27
+ column: column
28
+ });
29
+ return /*#__PURE__*/React.createElement(TableCell, {
30
+ key: column.id,
31
+ classes: classes,
32
+ align: (_column$textAlign = column.textAlign) !== null && _column$textAlign !== void 0 ? _column$textAlign : 'left',
33
+ padding: column.disablePadding ? 'none' : 'normal',
34
+ sortDirection: orderBy === column.id ? order : false
35
+ }, column.sortable !== false ? /*#__PURE__*/React.createElement(TableSortLabel, {
36
+ active: orderBy === column.id,
37
+ direction: orderBy === column.id ? order : 'asc',
38
+ onClick: onClick
39
+ }, column.label, orderBy === column.id && /*#__PURE__*/React.createElement("span", {
40
+ className: className
41
+ }, order === 'desc' ? 'sorted descending' : 'sorted ascending')) : column.label);
42
+ };
43
+
44
+ export default TableHeadCell;
@@ -0,0 +1,10 @@
1
+ declare var _default: React.MemoExoticComponent<({ index, row, columns, isSelectedItem, children, onSelectClick }: {
2
+ index: any;
3
+ row: any;
4
+ columns: any;
5
+ isSelectedItem: any;
6
+ children: any;
7
+ onSelectClick: any;
8
+ }) => JSX.Element>;
9
+ export default _default;
10
+ import React from "react";
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import Cell from "cozy-ui/transpiled/react/Table/Virtualized/Cell";
3
+ import Checkbox from "cozy-ui/transpiled/react/Checkbox";
4
+ import TableCell from "cozy-ui/transpiled/react/TableCell";
5
+
6
+ var RowContent = function RowContent(_ref) {
7
+ var index = _ref.index,
8
+ row = _ref.row,
9
+ columns = _ref.columns,
10
+ isSelectedItem = _ref.isSelectedItem,
11
+ children = _ref.children,
12
+ onSelectClick = _ref.onSelectClick;
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableCell, {
14
+ align: "center",
15
+ padding: "checkbox"
16
+ }, /*#__PURE__*/React.createElement(Checkbox, {
17
+ checked: isSelectedItem(row),
18
+ inputProps: {
19
+ 'aria-labelledby': "enhanced-table-checkbox-".concat(index)
20
+ },
21
+ onChange: function onChange() {
22
+ return onSelectClick(row);
23
+ }
24
+ })), columns.map(function (column) {
25
+ return /*#__PURE__*/React.createElement(Cell, {
26
+ key: column.id,
27
+ row: row,
28
+ columns: columns,
29
+ column: column
30
+ }, children);
31
+ }));
32
+ };
33
+
34
+ export default /*#__PURE__*/React.memo(RowContent);
@@ -0,0 +1,2 @@
1
+ export function getComparator(order: any, orderBy: any, lang: any): (a: any, b: any) => number;
2
+ export function stableSort(array: any, comparator: any): any;
@@ -0,0 +1,64 @@
1
+ var descendingComparator = function descendingComparator(_ref) {
2
+ var a = _ref.a,
3
+ b = _ref.b,
4
+ order = _ref.order,
5
+ orderBy = _ref.orderBy,
6
+ lang = _ref.lang;
7
+ var aValue = a[orderBy];
8
+ var bValue = b[orderBy];
9
+
10
+ if (typeof aValue === 'string') {
11
+ var isDate = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}/.test(aValue);
12
+ var isNumber = !isNaN(parseInt(aValue));
13
+
14
+ if (isDate) {
15
+ return new Date(bValue) - new Date(aValue);
16
+ }
17
+
18
+ if (isNumber) {
19
+ return parseInt(bValue) - parseInt(aValue);
20
+ }
21
+
22
+ var _Intl$Collator = Intl.Collator(lang || 'en', {
23
+ caseFirst: order === 'asc' ? 'upper' : 'lower'
24
+ }),
25
+ compare = _Intl$Collator.compare;
26
+
27
+ return compare(bValue, aValue);
28
+ }
29
+
30
+ return bValue - aValue;
31
+ };
32
+
33
+ export var getComparator = function getComparator(order, orderBy, lang) {
34
+ return order === 'desc' ? function (a, b) {
35
+ return descendingComparator({
36
+ a: a,
37
+ b: b,
38
+ order: order,
39
+ orderBy: orderBy,
40
+ lang: lang
41
+ });
42
+ } : function (a, b) {
43
+ return -descendingComparator({
44
+ a: a,
45
+ b: b,
46
+ order: order,
47
+ orderBy: orderBy,
48
+ lang: lang
49
+ });
50
+ };
51
+ };
52
+ export var stableSort = function stableSort(array, comparator) {
53
+ var stabilizedThis = array.map(function (el, index) {
54
+ return [el, index];
55
+ });
56
+ stabilizedThis.sort(function (a, b) {
57
+ var order = comparator(a[0], b[0]);
58
+ if (order !== 0) return order;
59
+ return a[1] - b[1];
60
+ });
61
+ return stabilizedThis.map(function (el) {
62
+ return el[0];
63
+ });
64
+ };
@@ -0,0 +1,2 @@
1
+ export default VirtuosoTableWrapper;
2
+ declare function VirtuosoTableWrapper(props: any): JSX.Element;
@@ -0,0 +1,115 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["rows", "columns", "defaultOrder", "secondarySort", "selectedItems", "onSelect", "onSelectAll", "isSelectedItem", "componentsProps", "dragProps"];
5
+ import React, { useState, forwardRef } from 'react';
6
+ import { TableVirtuoso } from 'react-virtuoso';
7
+ import CustomDragLayer from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer";
8
+ import FixedHeaderContent from "cozy-ui/transpiled/react/Table/Virtualized/FixedHeaderContent";
9
+ import RowContent from "cozy-ui/transpiled/react/Table/Virtualized/RowContent";
10
+ import { stableSort, getComparator } from "cozy-ui/transpiled/react/Table/Virtualized/helpers";
11
+ import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
12
+ var VirtualizedTable = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
+ var rows = _ref.rows,
14
+ columns = _ref.columns,
15
+ defaultOrder = _ref.defaultOrder,
16
+ secondarySort = _ref.secondarySort,
17
+ _ref$selectedItems = _ref.selectedItems,
18
+ selectedItems = _ref$selectedItems === void 0 ? [] : _ref$selectedItems,
19
+ _ref$onSelect = _ref.onSelect,
20
+ onSelect = _ref$onSelect === void 0 ? function () {} : _ref$onSelect,
21
+ _ref$onSelectAll = _ref.onSelectAll,
22
+ onSelectAll = _ref$onSelectAll === void 0 ? function () {} : _ref$onSelectAll,
23
+ _ref$isSelectedItem = _ref.isSelectedItem,
24
+ isSelectedItem = _ref$isSelectedItem === void 0 ? function () {} : _ref$isSelectedItem,
25
+ componentsProps = _ref.componentsProps,
26
+ dragProps = _ref.dragProps,
27
+ props = _objectWithoutProperties(_ref, _excluded);
28
+
29
+ var _useState = useState('asc'),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ order = _useState2[0],
32
+ setOrder = _useState2[1];
33
+
34
+ var _useState3 = useState(defaultOrder),
35
+ _useState4 = _slicedToArray(_useState3, 2),
36
+ orderBy = _useState4[0],
37
+ setOrderBy = _useState4[1];
38
+
39
+ var _useState5 = useState([]),
40
+ _useState6 = _slicedToArray(_useState5, 2),
41
+ itemsInDropProcess = _useState6[0],
42
+ setItemsInDropProcess = _useState6[1]; // array of Ids, for dragndrop feature
43
+
44
+
45
+ var sortedData = stableSort(rows, getComparator(order, orderBy));
46
+ var data = secondarySort ? secondarySort(sortedData) : sortedData;
47
+
48
+ var handleSort = function handleSort(property) {
49
+ var isAsc = orderBy === property && order === 'asc';
50
+ setOrder(isAsc ? 'desc' : 'asc');
51
+ setOrderBy(property);
52
+ };
53
+
54
+ var handleSelectAll = function handleSelectAll(event) {
55
+ var _event$target;
56
+
57
+ if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && _event$target.checked) {
58
+ onSelectAll(rows);
59
+ return;
60
+ }
61
+
62
+ onSelectAll([]);
63
+ };
64
+
65
+ return /*#__PURE__*/React.createElement(TableVirtuoso, _extends({}, props, {
66
+ ref: ref,
67
+ data: data,
68
+ context: {
69
+ isSelectedItem: isSelectedItem,
70
+ selectedItems: selectedItems,
71
+ dragProps: dragProps,
72
+ itemsInDropProcess: itemsInDropProcess,
73
+ setItemsInDropProcess: setItemsInDropProcess
74
+ },
75
+ components: virtuosoComponents,
76
+ fixedHeaderContent: function fixedHeaderContent() {
77
+ return /*#__PURE__*/React.createElement(FixedHeaderContent, {
78
+ columns: columns,
79
+ rowCount: rows.length,
80
+ selectedCount: selectedItems.length,
81
+ order: order,
82
+ orderBy: orderBy,
83
+ onClick: handleSort,
84
+ onSelectAllClick: handleSelectAll
85
+ });
86
+ },
87
+ itemContent: function itemContent(_index, row) {
88
+ var _componentsProps$rowC;
89
+
90
+ return /*#__PURE__*/React.createElement(RowContent, {
91
+ index: _index,
92
+ row: row,
93
+ columns: columns,
94
+ isSelectedItem: isSelectedItem,
95
+ onSelectClick: onSelect
96
+ }, componentsProps === null || componentsProps === void 0 ? void 0 : (_componentsProps$rowC = componentsProps.rowContent) === null || _componentsProps$rowC === void 0 ? void 0 : _componentsProps$rowC.children);
97
+ },
98
+ rowSpan: 2
99
+ }));
100
+ });
101
+ VirtualizedTable.displayName = 'VirtualizedTable';
102
+
103
+ var VirtuosoTableWrapper = function VirtuosoTableWrapper(props) {
104
+ var _props$dragProps;
105
+
106
+ if (!((_props$dragProps = props.dragProps) !== null && _props$dragProps !== void 0 && _props$dragProps.enabled)) {
107
+ return /*#__PURE__*/React.createElement(VirtualizedTable, props);
108
+ }
109
+
110
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
111
+ dragId: props.dragProps.dragId
112
+ }), /*#__PURE__*/React.createElement(VirtualizedTable, props));
113
+ };
114
+
115
+ export default VirtuosoTableWrapper;
@@ -0,0 +1,10 @@
1
+ export default virtuosoComponents;
2
+ declare namespace virtuosoComponents {
3
+ const Scroller: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
4
+ const Table: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ const TableHead: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
6
+ const TableBody: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
7
+ const TableFooter: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
8
+ const TableRow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
9
+ }
10
+ import React from "react";
@@ -0,0 +1,100 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ var _excluded = ["context"],
5
+ _excluded2 = ["item", "context"];
6
+
7
+ function ownKeys(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; }
8
+
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
+
11
+ import React, { forwardRef } from 'react';
12
+ import DnDConfigWrapper from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper";
13
+ import TableRowDnD from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/TableRow";
14
+ import Table from "cozy-ui/transpiled/react/Table";
15
+ import Paper from "cozy-ui/transpiled/react/Paper";
16
+ import TableBody from "cozy-ui/transpiled/react/TableBody";
17
+ import TableContainer from "cozy-ui/transpiled/react/TableContainer";
18
+ import TableFooter from "cozy-ui/transpiled/react/TableFooter";
19
+ import TableHead from "cozy-ui/transpiled/react/TableHead";
20
+ import TableRow from "cozy-ui/transpiled/react/TableRow";
21
+
22
+ var _TableContainer = /*#__PURE__*/forwardRef(function (props, ref) {
23
+ return /*#__PURE__*/React.createElement(TableContainer, _extends({}, props, {
24
+ ref: ref,
25
+ component: Paper,
26
+ style: _objectSpread({
27
+ zIndex: 'var(--zIndex-app)'
28
+ }, props.style),
29
+ elevation: 0
30
+ }));
31
+ });
32
+
33
+ _TableContainer.displayName = '_TableContainer';
34
+ var virtuosoComponents = {
35
+ Scroller: /*#__PURE__*/forwardRef(function (_ref, ref) {
36
+ var _context$dragProps;
37
+
38
+ var context = _ref.context,
39
+ props = _objectWithoutProperties(_ref, _excluded);
40
+
41
+ if (!((_context$dragProps = context.dragProps) !== null && _context$dragProps !== void 0 && _context$dragProps.enabled)) {
42
+ return /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
43
+ ref: ref
44
+ }));
45
+ }
46
+
47
+ return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
48
+ ref: ref
49
+ }, /*#__PURE__*/React.createElement(_TableContainer, _extends({}, props, {
50
+ ref: ref
51
+ })));
52
+ }),
53
+ Table: /*#__PURE__*/forwardRef(function (props, ref) {
54
+ return /*#__PURE__*/React.createElement(Table, _extends({}, props, {
55
+ ref: ref
56
+ }));
57
+ }),
58
+ TableHead: /*#__PURE__*/forwardRef(function (props, ref) {
59
+ return /*#__PURE__*/React.createElement(TableHead, _extends({}, props, {
60
+ ref: ref
61
+ }));
62
+ }),
63
+ TableBody: /*#__PURE__*/forwardRef(function (props, ref) {
64
+ return /*#__PURE__*/React.createElement(TableBody, _extends({}, props, {
65
+ ref: ref
66
+ }));
67
+ }),
68
+ TableFooter: /*#__PURE__*/forwardRef(function (props, ref) {
69
+ return /*#__PURE__*/React.createElement(TableFooter, _extends({}, props, {
70
+ ref: ref
71
+ }));
72
+ }),
73
+ TableRow: /*#__PURE__*/forwardRef(function (_ref2, ref) {
74
+ var _context$dragProps2;
75
+
76
+ var item = _ref2.item,
77
+ context = _ref2.context,
78
+ props = _objectWithoutProperties(_ref2, _excluded2);
79
+
80
+ var isSelected = context === null || context === void 0 ? void 0 : context.isSelectedItem(item);
81
+ var isDisabled = context === null || context === void 0 ? void 0 : context.itemsInDropProcess.includes(item._id);
82
+
83
+ if (!((_context$dragProps2 = context.dragProps) !== null && _context$dragProps2 !== void 0 && _context$dragProps2.enabled)) {
84
+ return /*#__PURE__*/React.createElement(TableRow, _extends({}, props, {
85
+ ref: ref,
86
+ selected: isSelected,
87
+ hover: true
88
+ }));
89
+ }
90
+
91
+ return /*#__PURE__*/React.createElement(TableRowDnD, _extends({}, props, {
92
+ item: item,
93
+ context: context,
94
+ selected: isSelected,
95
+ disabled: isDisabled,
96
+ hover: true
97
+ }));
98
+ })
99
+ };
100
+ export default virtuosoComponents;
@@ -1,2 +1,3 @@
1
1
  export default TableRow;
2
- import TableRow from "@material-ui/core/TableRow";
2
+ declare const TableRow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
@@ -1,2 +1,21 @@
1
- import TableRow from '@material-ui/core/TableRow';
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["disabled", "className"];
4
+ import MuiTableRow from '@material-ui/core/TableRow';
5
+ import cx from 'classnames';
6
+ import React, { forwardRef } from 'react';
7
+ var TableRow = /*#__PURE__*/forwardRef(function (_ref, ref) {
8
+ var disabled = _ref.disabled,
9
+ className = _ref.className,
10
+ props = _objectWithoutProperties(_ref, _excluded);
11
+
12
+ return /*#__PURE__*/React.createElement(MuiTableRow, _extends({}, props, {
13
+ className: cx(className, {
14
+ disabled: disabled
15
+ }),
16
+ disabled: disabled,
17
+ ref: ref
18
+ }));
19
+ });
20
+ TableRow.displayName = 'TableRow';
2
21
  export default TableRow;