@atlaskit/media-table 12.0.0 → 13.0.1
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/CHANGELOG.md +23 -0
- package/dist/cjs/component/mediaTable.js +12 -9
- package/dist/cjs/component/nameCell.js +9 -5
- package/dist/cjs/component/styles.js +23 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/component/mediaTable.js +11 -6
- package/dist/es2019/component/nameCell.js +11 -5
- package/dist/es2019/component/{styled.js → styles.js} +4 -4
- package/dist/es2019/version.json +1 -1
- package/dist/esm/component/mediaTable.js +11 -7
- package/dist/esm/component/nameCell.js +11 -5
- package/dist/esm/component/styles.js +9 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/component/mediaTable.d.ts +3 -1
- package/dist/types/component/styles.d.ts +3 -0
- package/example-helpers/helpers.tsx +5 -5
- package/example-helpers/{styled.tsx → styles.tsx} +14 -2
- package/package.json +11 -11
- package/report.api.md +85 -0
- package/dist/cjs/component/styled.js +0 -28
- package/dist/esm/component/styled.js +0 -9
- package/dist/types/component/styled.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/media-table
|
|
2
2
|
|
|
3
|
+
## 13.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 13.0.0
|
|
11
|
+
|
|
12
|
+
### Major Changes
|
|
13
|
+
|
|
14
|
+
- [`af775dcb785`](https://bitbucket.org/atlassian/atlassian-frontend/commits/af775dcb785) - [MEX-1034] Migrated from styled-components library to @emotion/react in @atlaskit/media-table
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 12.0.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 12.0.0
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -27,7 +27,9 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
27
27
|
|
|
28
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
29
|
|
|
30
|
-
var _react =
|
|
30
|
+
var _react = require("@emotion/react");
|
|
31
|
+
|
|
32
|
+
var _react2 = _interopRequireWildcard(require("react"));
|
|
31
33
|
|
|
32
34
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
33
35
|
|
|
@@ -39,7 +41,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
39
41
|
|
|
40
42
|
var _mediaViewer = require("@atlaskit/media-viewer");
|
|
41
43
|
|
|
42
|
-
var
|
|
44
|
+
var _styles = require("./styles");
|
|
43
45
|
|
|
44
46
|
var _downloadButton = _interopRequireDefault(require("./downloadButton"));
|
|
45
47
|
|
|
@@ -90,7 +92,7 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
90
92
|
var cellValues = [];
|
|
91
93
|
var columns = _this.props.columns;
|
|
92
94
|
columns.cells.forEach(function (cell) {
|
|
93
|
-
var content = cell.key === _util.CELL_KEY_DOWNLOAD ?
|
|
95
|
+
var content = cell.key === _util.CELL_KEY_DOWNLOAD ? (0, _react.jsx)(_downloadButton.default, {
|
|
94
96
|
onClick: _this.onDownloadClick(identifier)
|
|
95
97
|
}) : cell.key && data[cell.key] || '';
|
|
96
98
|
cellValues.push({
|
|
@@ -164,7 +166,7 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
164
166
|
validTotalItems = _getValidTableProps.validTotalItems;
|
|
165
167
|
|
|
166
168
|
var rowsPerPage = validTotalItems <= validItemsPerPage ? undefined : validItemsPerPage;
|
|
167
|
-
return
|
|
169
|
+
return (0, _react.jsx)(_dynamicTable.DynamicTableStateless, {
|
|
168
170
|
caption: '',
|
|
169
171
|
head: (0, _util.generateHeadValues)(columns),
|
|
170
172
|
rows: _this.renderRowValues(validItemsPerPage, validPageNumber, validTotalItems),
|
|
@@ -244,7 +246,7 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
244
246
|
})
|
|
245
247
|
};
|
|
246
248
|
var collectionName = (0, _mediaClient.isFileIdentifier)(mediaViewerSelectedItem) && mediaViewerSelectedItem.collectionName || '';
|
|
247
|
-
return /*#__PURE__*/_reactDom.default.createPortal(
|
|
249
|
+
return /*#__PURE__*/_reactDom.default.createPortal((0, _react.jsx)(_mediaViewer.MediaViewer, {
|
|
248
250
|
mediaClientConfig: mediaClient.config,
|
|
249
251
|
dataSource: dataSource,
|
|
250
252
|
selectedItem: mediaViewerSelectedItem,
|
|
@@ -318,15 +320,16 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
318
320
|
}, {
|
|
319
321
|
key: "render",
|
|
320
322
|
value: function render() {
|
|
321
|
-
var content =
|
|
322
|
-
|
|
323
|
-
|
|
323
|
+
var content = (0, _react.jsx)("div", {
|
|
324
|
+
css: _styles.mediaTableWrapperStyles
|
|
325
|
+
}, this.renderTable(), this.renderMediaViewer());
|
|
326
|
+
return this.props.intl ? content : (0, _react.jsx)(_reactIntlNext.IntlProvider, {
|
|
324
327
|
locale: "en"
|
|
325
328
|
}, content);
|
|
326
329
|
}
|
|
327
330
|
}]);
|
|
328
331
|
return MediaTable;
|
|
329
|
-
}(
|
|
332
|
+
}(_react2.Component);
|
|
330
333
|
|
|
331
334
|
exports.MediaTable = MediaTable;
|
|
332
335
|
|
|
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
|
|
12
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
13
|
|
|
14
|
-
var _react =
|
|
14
|
+
var _react = require("@emotion/react");
|
|
15
15
|
|
|
16
16
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ var _truncateText = require("@atlaskit/media-ui/truncateText");
|
|
|
19
19
|
|
|
20
20
|
var _mediaTypeIcon = require("@atlaskit/media-ui/media-type-icon");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _styles = require("./styles");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["mediaType", "text"];
|
|
25
25
|
|
|
@@ -27,11 +27,15 @@ var NameCell = function NameCell(props) {
|
|
|
27
27
|
var mediaType = props.mediaType,
|
|
28
28
|
text = props.text,
|
|
29
29
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
30
|
-
return
|
|
30
|
+
return (0, _react.jsx)("div", {
|
|
31
|
+
css: _styles.nameCellWrapperStyles
|
|
32
|
+
}, mediaType && (0, _react.jsx)(_mediaTypeIcon.MediaTypeIcon, {
|
|
31
33
|
type: mediaType
|
|
32
|
-
}),
|
|
34
|
+
}), (0, _react.jsx)("div", {
|
|
35
|
+
css: _styles.truncateWrapperStyles
|
|
36
|
+
}, (0, _react.jsx)(_tooltip.default, {
|
|
33
37
|
content: text
|
|
34
|
-
},
|
|
38
|
+
}, (0, _react.jsx)(_truncateText.Truncate, (0, _extends2.default)({
|
|
35
39
|
text: text
|
|
36
40
|
}, rest)))));
|
|
37
41
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.truncateWrapperStyles = exports.nameCellWrapperStyles = exports.mediaTableWrapperStyles = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
+
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
17
|
+
|
|
18
|
+
var nameCellWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
19
|
+
exports.nameCellWrapperStyles = nameCellWrapperStyles;
|
|
20
|
+
var truncateWrapperStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 0;\n width: 100%;\n margin-left: 4px;\n\n span:first-of-type {\n &::first-letter {\n text-transform: capitalize;\n }\n }\n"])));
|
|
21
|
+
exports.truncateWrapperStyles = truncateWrapperStyles;
|
|
22
|
+
var mediaTableWrapperStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n tr {\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n\n td:empty {\n padding: 0;\n }\n }\n"])), _colors.N20);
|
|
23
|
+
exports.mediaTableWrapperStyles = mediaTableWrapperStyles;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/**@jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
2
5
|
import React, { Component } from 'react';
|
|
3
6
|
import ReactDOM from 'react-dom'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
7
|
|
|
@@ -6,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
6
9
|
import { DynamicTableStateless } from '@atlaskit/dynamic-table';
|
|
7
10
|
import { isFileIdentifier, withMediaClient, isProcessedFileState } from '@atlaskit/media-client';
|
|
8
11
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
9
|
-
import {
|
|
12
|
+
import { mediaTableWrapperStyles } from './styles';
|
|
10
13
|
import DownloadButton from './downloadButton';
|
|
11
14
|
import { generateRowValues, getValidTableProps, generateHeadValues, CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
12
15
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -33,7 +36,7 @@ export class MediaTable extends Component {
|
|
|
33
36
|
columns
|
|
34
37
|
} = this.props;
|
|
35
38
|
columns.cells.forEach(cell => {
|
|
36
|
-
const content = cell.key === CELL_KEY_DOWNLOAD ?
|
|
39
|
+
const content = cell.key === CELL_KEY_DOWNLOAD ? jsx(DownloadButton, {
|
|
37
40
|
onClick: this.onDownloadClick(identifier)
|
|
38
41
|
}) : cell.key && data[cell.key] || '';
|
|
39
42
|
cellValues.push({
|
|
@@ -123,7 +126,7 @@ export class MediaTable extends Component {
|
|
|
123
126
|
validTotalItems
|
|
124
127
|
} = getValidTableProps(items.length, itemsPerPage, pageNumber, totalItems);
|
|
125
128
|
const rowsPerPage = validTotalItems <= validItemsPerPage ? undefined : validItemsPerPage;
|
|
126
|
-
return
|
|
129
|
+
return jsx(DynamicTableStateless, {
|
|
127
130
|
caption: '',
|
|
128
131
|
head: generateHeadValues(columns),
|
|
129
132
|
rows: this.renderRowValues(validItemsPerPage, validPageNumber, validTotalItems),
|
|
@@ -210,7 +213,7 @@ export class MediaTable extends Component {
|
|
|
210
213
|
list: items.map(item => item.identifier)
|
|
211
214
|
};
|
|
212
215
|
const collectionName = isFileIdentifier(mediaViewerSelectedItem) && mediaViewerSelectedItem.collectionName || '';
|
|
213
|
-
return /*#__PURE__*/ReactDOM.createPortal(
|
|
216
|
+
return /*#__PURE__*/ReactDOM.createPortal(jsx(MediaViewer, {
|
|
214
217
|
mediaClientConfig: mediaClient.config,
|
|
215
218
|
dataSource: dataSource,
|
|
216
219
|
selectedItem: mediaViewerSelectedItem,
|
|
@@ -265,8 +268,10 @@ export class MediaTable extends Component {
|
|
|
265
268
|
}
|
|
266
269
|
|
|
267
270
|
render() {
|
|
268
|
-
const content =
|
|
269
|
-
|
|
271
|
+
const content = jsx("div", {
|
|
272
|
+
css: mediaTableWrapperStyles
|
|
273
|
+
}, this.renderTable(), this.renderMediaViewer());
|
|
274
|
+
return this.props.intl ? content : jsx(IntlProvider, {
|
|
270
275
|
locale: "en"
|
|
271
276
|
}, content);
|
|
272
277
|
}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/**@jsx jsx */
|
|
4
|
+
import { jsx } from '@emotion/react';
|
|
3
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
4
6
|
import { Truncate } from '@atlaskit/media-ui/truncateText';
|
|
5
7
|
import { MediaTypeIcon } from '@atlaskit/media-ui/media-type-icon';
|
|
6
|
-
import {
|
|
8
|
+
import { nameCellWrapperStyles, truncateWrapperStyles } from './styles';
|
|
7
9
|
export const NameCell = props => {
|
|
8
10
|
const {
|
|
9
11
|
mediaType,
|
|
10
12
|
text,
|
|
11
13
|
...rest
|
|
12
14
|
} = props;
|
|
13
|
-
return
|
|
15
|
+
return jsx("div", {
|
|
16
|
+
css: nameCellWrapperStyles
|
|
17
|
+
}, mediaType && jsx(MediaTypeIcon, {
|
|
14
18
|
type: mediaType
|
|
15
|
-
}),
|
|
19
|
+
}), jsx("div", {
|
|
20
|
+
css: truncateWrapperStyles
|
|
21
|
+
}, jsx(Tooltip, {
|
|
16
22
|
content: text
|
|
17
|
-
},
|
|
23
|
+
}, jsx(Truncate, _extends({
|
|
18
24
|
text: text
|
|
19
25
|
}, rest)))));
|
|
20
26
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
import { N20 } from '@atlaskit/theme/colors';
|
|
3
|
-
export const
|
|
3
|
+
export const nameCellWrapperStyles = css`
|
|
4
4
|
display: flex;
|
|
5
5
|
align-content: center;
|
|
6
6
|
align-items: center;
|
|
7
7
|
`;
|
|
8
|
-
export const
|
|
8
|
+
export const truncateWrapperStyles = css`
|
|
9
9
|
min-width: 0;
|
|
10
10
|
width: 100%;
|
|
11
11
|
margin-left: 4px;
|
|
@@ -16,7 +16,7 @@ export const TruncateWrapper = styled.div`
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
`;
|
|
19
|
-
export const
|
|
19
|
+
export const mediaTableWrapperStyles = css`
|
|
20
20
|
tr {
|
|
21
21
|
cursor: pointer;
|
|
22
22
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
10
|
|
|
11
11
|
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; }
|
|
12
12
|
|
|
@@ -16,6 +16,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
16
16
|
|
|
17
17
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
18
|
|
|
19
|
+
/**@jsx jsx */
|
|
20
|
+
import { jsx } from '@emotion/react';
|
|
19
21
|
import React, { Component } from 'react';
|
|
20
22
|
import ReactDOM from 'react-dom'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
21
23
|
|
|
@@ -23,7 +25,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
23
25
|
import { DynamicTableStateless } from '@atlaskit/dynamic-table';
|
|
24
26
|
import { isFileIdentifier, withMediaClient, isProcessedFileState } from '@atlaskit/media-client';
|
|
25
27
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
26
|
-
import {
|
|
28
|
+
import { mediaTableWrapperStyles } from './styles';
|
|
27
29
|
import DownloadButton from './downloadButton';
|
|
28
30
|
import { generateRowValues, getValidTableProps, generateHeadValues, CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
29
31
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -63,7 +65,7 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
63
65
|
var cellValues = [];
|
|
64
66
|
var columns = _this.props.columns;
|
|
65
67
|
columns.cells.forEach(function (cell) {
|
|
66
|
-
var content = cell.key === CELL_KEY_DOWNLOAD ?
|
|
68
|
+
var content = cell.key === CELL_KEY_DOWNLOAD ? jsx(DownloadButton, {
|
|
67
69
|
onClick: _this.onDownloadClick(identifier)
|
|
68
70
|
}) : cell.key && data[cell.key] || '';
|
|
69
71
|
cellValues.push({
|
|
@@ -141,7 +143,7 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
141
143
|
validTotalItems = _getValidTableProps.validTotalItems;
|
|
142
144
|
|
|
143
145
|
var rowsPerPage = validTotalItems <= validItemsPerPage ? undefined : validItemsPerPage;
|
|
144
|
-
return
|
|
146
|
+
return jsx(DynamicTableStateless, {
|
|
145
147
|
caption: '',
|
|
146
148
|
head: generateHeadValues(columns),
|
|
147
149
|
rows: _this.renderRowValues(validItemsPerPage, validPageNumber, validTotalItems),
|
|
@@ -227,7 +229,7 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
227
229
|
})
|
|
228
230
|
};
|
|
229
231
|
var collectionName = isFileIdentifier(mediaViewerSelectedItem) && mediaViewerSelectedItem.collectionName || '';
|
|
230
|
-
return /*#__PURE__*/ReactDOM.createPortal(
|
|
232
|
+
return /*#__PURE__*/ReactDOM.createPortal(jsx(MediaViewer, {
|
|
231
233
|
mediaClientConfig: mediaClient.config,
|
|
232
234
|
dataSource: dataSource,
|
|
233
235
|
selectedItem: mediaViewerSelectedItem,
|
|
@@ -302,8 +304,10 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
302
304
|
}, {
|
|
303
305
|
key: "render",
|
|
304
306
|
value: function render() {
|
|
305
|
-
var content =
|
|
306
|
-
|
|
307
|
+
var content = jsx("div", {
|
|
308
|
+
css: mediaTableWrapperStyles
|
|
309
|
+
}, this.renderTable(), this.renderMediaViewer());
|
|
310
|
+
return this.props.intl ? content : jsx(IntlProvider, {
|
|
307
311
|
locale: "en"
|
|
308
312
|
}, content);
|
|
309
313
|
}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["mediaType", "text"];
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/**@jsx jsx */
|
|
6
|
+
import { jsx } from '@emotion/react';
|
|
5
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
8
|
import { Truncate } from '@atlaskit/media-ui/truncateText';
|
|
7
9
|
import { MediaTypeIcon } from '@atlaskit/media-ui/media-type-icon';
|
|
8
|
-
import {
|
|
10
|
+
import { nameCellWrapperStyles, truncateWrapperStyles } from './styles';
|
|
9
11
|
export var NameCell = function NameCell(props) {
|
|
10
12
|
var mediaType = props.mediaType,
|
|
11
13
|
text = props.text,
|
|
12
14
|
rest = _objectWithoutProperties(props, _excluded);
|
|
13
15
|
|
|
14
|
-
return
|
|
16
|
+
return jsx("div", {
|
|
17
|
+
css: nameCellWrapperStyles
|
|
18
|
+
}, mediaType && jsx(MediaTypeIcon, {
|
|
15
19
|
type: mediaType
|
|
16
|
-
}),
|
|
20
|
+
}), jsx("div", {
|
|
21
|
+
css: truncateWrapperStyles
|
|
22
|
+
}, jsx(Tooltip, {
|
|
17
23
|
content: text
|
|
18
|
-
},
|
|
24
|
+
}, jsx(Truncate, _extends({
|
|
19
25
|
text: text
|
|
20
26
|
}, rest)))));
|
|
21
27
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
+
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
import { N20 } from '@atlaskit/theme/colors';
|
|
7
|
+
export var nameCellWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
8
|
+
export var truncateWrapperStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 0;\n width: 100%;\n margin-left: 4px;\n\n span:first-of-type {\n &::first-letter {\n text-transform: capitalize;\n }\n }\n"])));
|
|
9
|
+
export var mediaTableWrapperStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n tr {\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n\n td:empty {\n padding: 0;\n }\n }\n"])), N20);
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/**@jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import React, { Component } from 'react';
|
|
2
4
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
3
5
|
import { MediaTableProps, MediaTableState } from '../types';
|
|
@@ -19,7 +21,7 @@ export declare class MediaTable extends Component<MediaTableProps & WrappedCompo
|
|
|
19
21
|
private safeSetState;
|
|
20
22
|
private onMediaViewerClose;
|
|
21
23
|
private renderMediaViewer;
|
|
22
|
-
render(): JSX.Element;
|
|
24
|
+
render(): jsx.JSX.Element;
|
|
23
25
|
}
|
|
24
26
|
declare const _default: React.ComponentType<import("@atlaskit/media-client").WithMediaClientConfigProps<Omit<React.PropsWithChildren<import("react-intl-next").WithIntlProps<MediaTableProps & WrappedComponentProps<"intl">>>, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any>>>;
|
|
25
27
|
export default _default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/**@jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
1
3
|
import React, { useState } from 'react';
|
|
2
4
|
import dateFnsFormat from 'date-fns/format';
|
|
3
5
|
import { MediaType } from '@atlaskit/media-client';
|
|
4
|
-
import {
|
|
6
|
+
import { exampleWrapperStyles, ROW_HIGHLIGHT_CLASSNAME } from './styles';
|
|
5
7
|
import Range from '@atlaskit/range';
|
|
6
8
|
import { toHumanReadableMediaSize } from '@atlaskit/media-ui';
|
|
7
9
|
import {
|
|
@@ -15,8 +17,6 @@ import {
|
|
|
15
17
|
import { MediaTableItem, NameCell } from '../src';
|
|
16
18
|
import { IntlProvider } from 'react-intl-next';
|
|
17
19
|
|
|
18
|
-
export { ROW_HIGHLIGHT_CLASSNAME } from './styled';
|
|
19
|
-
|
|
20
20
|
export const createMockFileData = (name: string, mediaType: MediaType) => {
|
|
21
21
|
return <NameCell text={name} mediaType={mediaType} endFixedChars={4} />;
|
|
22
22
|
};
|
|
@@ -31,7 +31,7 @@ export const RenderMediaTableWithFieldRange = (
|
|
|
31
31
|
const [width, setWidth] = useState(1000);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
|
-
<
|
|
34
|
+
<div css={exampleWrapperStyles}>
|
|
35
35
|
<IntlProvider locale="en">
|
|
36
36
|
<div>
|
|
37
37
|
Parent width: {width}px
|
|
@@ -45,7 +45,7 @@ export const RenderMediaTableWithFieldRange = (
|
|
|
45
45
|
</div>
|
|
46
46
|
<div style={{ width: `${width}px` }}>{MediaTableNode}</div>
|
|
47
47
|
</IntlProvider>
|
|
48
|
-
</
|
|
48
|
+
</div>
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { css } from '@emotion/react';
|
|
2
2
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
3
3
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
4
4
|
import { colors } from '@atlaskit/theme';
|
|
5
5
|
|
|
6
6
|
export const ROW_HIGHLIGHT_CLASSNAME = 'media-table-row-highlighted';
|
|
7
|
-
export const
|
|
7
|
+
export const ROW_CLASSNAME = 'media-table-row';
|
|
8
|
+
|
|
9
|
+
export const exampleWrapperStyles = css`
|
|
8
10
|
display: flex;
|
|
9
11
|
flex-direction: column;
|
|
10
12
|
align-items: center;
|
|
@@ -17,3 +19,13 @@ export const ExampleWrapper = styled.div`
|
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
`;
|
|
22
|
+
|
|
23
|
+
export const greenOnHoverStyles = css`
|
|
24
|
+
background-color: red;
|
|
25
|
+
height: 8px;
|
|
26
|
+
width: 8px;
|
|
27
|
+
|
|
28
|
+
.${ROW_CLASSNAME}:hover & {
|
|
29
|
+
background-color: green;
|
|
30
|
+
}
|
|
31
|
+
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.1",
|
|
4
4
|
"description": "Table UI component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,38 +28,38 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/analytics-next": "^8.0.0",
|
|
30
30
|
"@atlaskit/button": "^16.3.0",
|
|
31
|
-
"@atlaskit/dynamic-table": "^14.
|
|
31
|
+
"@atlaskit/dynamic-table": "^14.7.0",
|
|
32
32
|
"@atlaskit/icon": "^21.10.0",
|
|
33
|
-
"@atlaskit/media-client": "^
|
|
34
|
-
"@atlaskit/media-ui": "^22.
|
|
35
|
-
"@atlaskit/media-viewer": "^
|
|
33
|
+
"@atlaskit/media-client": "^17.1.0",
|
|
34
|
+
"@atlaskit/media-ui": "^22.1.0",
|
|
35
|
+
"@atlaskit/media-viewer": "^47.0.0",
|
|
36
36
|
"@atlaskit/theme": "^12.1.0",
|
|
37
37
|
"@atlaskit/tooltip": "^17.5.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"memoize-one": "^6.0.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@atlaskit/media-core": "^33.0.
|
|
42
|
+
"@atlaskit/media-core": "^33.0.2",
|
|
43
|
+
"@emotion/react": "^11.7.1",
|
|
43
44
|
"react": "^16.8.0",
|
|
44
45
|
"react-dom": "^16.8.0",
|
|
45
|
-
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
46
|
-
"styled-components": "^3.2.6"
|
|
46
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@atlaskit/docs": "^9.0.0",
|
|
50
50
|
"@atlaskit/icon-file-type": "^6.3.0",
|
|
51
|
-
"@atlaskit/media-common": "^2.
|
|
51
|
+
"@atlaskit/media-common": "^2.16.0",
|
|
52
52
|
"@atlaskit/media-core": "^33.0.0",
|
|
53
53
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
54
54
|
"@atlaskit/range": "^6.0.0",
|
|
55
55
|
"@atlaskit/ssr": "*",
|
|
56
56
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
57
|
+
"@emotion/react": "^11.7.1",
|
|
57
58
|
"date-fns": "^2.17.0",
|
|
58
59
|
"enzyme": "^3.10.0",
|
|
59
60
|
"react": "^16.8.0",
|
|
60
61
|
"react-dom": "^16.8.0",
|
|
61
|
-
"
|
|
62
|
-
"typescript": "4.2.4"
|
|
62
|
+
"typescript": "4.3.5"
|
|
63
63
|
},
|
|
64
64
|
"resolutions": {
|
|
65
65
|
"lru-fast": "0.2.2"
|
package/report.api.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/media-table"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
/// <reference types="react" />
|
|
7
|
+
|
|
8
|
+
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
|
+
import { FC } from 'react';
|
|
10
|
+
import { FileIdentifier } from '@atlaskit/media-client';
|
|
11
|
+
import { HeadType } from '@atlaskit/dynamic-table/types';
|
|
12
|
+
import { MediaClient } from '@atlaskit/media-client';
|
|
13
|
+
import { MediaType } from '@atlaskit/media-client';
|
|
14
|
+
import { default as React_2 } from 'react';
|
|
15
|
+
import { SortOrderType } from '@atlaskit/dynamic-table/types';
|
|
16
|
+
import { TruncateProps } from '@atlaskit/media-ui/truncateText';
|
|
17
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
18
|
+
import { WithIntlProps } from 'react-intl-next';
|
|
19
|
+
import { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
20
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
21
|
+
|
|
22
|
+
export declare const MediaTable: React_2.ComponentType<WithMediaClientConfigProps<
|
|
23
|
+
Omit<
|
|
24
|
+
React_2.PropsWithChildren<
|
|
25
|
+
WithIntlProps<MediaTableProps & WrappedComponentProps<'intl'>>
|
|
26
|
+
>,
|
|
27
|
+
keyof WithAnalyticsEventsProps
|
|
28
|
+
> &
|
|
29
|
+
React_2.RefAttributes<any>
|
|
30
|
+
>>;
|
|
31
|
+
|
|
32
|
+
export declare interface MediaTableItem {
|
|
33
|
+
data: RowData;
|
|
34
|
+
identifier: FileIdentifier;
|
|
35
|
+
/** An object containing props that will be applied to the row component */
|
|
36
|
+
rowProps?: RowProps;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export declare interface MediaTableProps {
|
|
40
|
+
/** The table rows to display in the current page */
|
|
41
|
+
items: MediaTableItem[];
|
|
42
|
+
mediaClient: MediaClient;
|
|
43
|
+
/** Object describing the column headings */
|
|
44
|
+
columns: HeadType;
|
|
45
|
+
/** The total number of table rows. This is used to calculate pagination */
|
|
46
|
+
totalItems: number;
|
|
47
|
+
/** The maximum number of rows per page. No maximum by default */
|
|
48
|
+
itemsPerPage?: number;
|
|
49
|
+
/** The current page number */
|
|
50
|
+
pageNumber?: number;
|
|
51
|
+
/** The property that the table items are sorted by. This must match a key in columns.cells */
|
|
52
|
+
sortKey?: string;
|
|
53
|
+
/** The direction that the table items are sorted in - ascending or descending */
|
|
54
|
+
sortOrder?: SortOrderType;
|
|
55
|
+
/** Whether to show the loading state or not */
|
|
56
|
+
isLoading?: boolean;
|
|
57
|
+
/** Called when a pagination control is clicked. Provides the new page number to paginate by */
|
|
58
|
+
onSetPage?: (pageNumber: number) => void;
|
|
59
|
+
/** Called when a column header is clicked. Provides the key of the column and the new sortOrder to sort by */
|
|
60
|
+
onSort?: (key: string, sortOrder: SortOrderType) => void;
|
|
61
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
62
|
+
/** Called when the preview is opened by the user clicking on an item in the table */
|
|
63
|
+
onPreviewOpen?: () => void;
|
|
64
|
+
/** Called when the preview is closed */
|
|
65
|
+
onPreviewClose?: () => void;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export declare const NameCell: FC<NameCellProps>;
|
|
69
|
+
|
|
70
|
+
export declare interface NameCellProps extends TruncateProps {
|
|
71
|
+
mediaType?: MediaType;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare interface RowData {
|
|
75
|
+
[key: string]: string | React.ReactNode;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
declare interface RowProps {
|
|
79
|
+
className?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { SortOrderType };
|
|
83
|
+
|
|
84
|
+
export {};
|
|
85
|
+
```
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.TruncateWrapper = exports.NameCellWrapper = exports.MediaTableWrapper = void 0;
|
|
9
|
-
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
-
|
|
12
|
-
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
-
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
|
|
16
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
17
|
-
|
|
18
|
-
var NameCellWrapper = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
19
|
-
|
|
20
|
-
exports.NameCellWrapper = NameCellWrapper;
|
|
21
|
-
|
|
22
|
-
var TruncateWrapper = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 0;\n width: 100%;\n margin-left: 4px;\n\n span:first-of-type {\n &::first-letter {\n text-transform: capitalize;\n }\n }\n"])));
|
|
23
|
-
|
|
24
|
-
exports.TruncateWrapper = TruncateWrapper;
|
|
25
|
-
|
|
26
|
-
var MediaTableWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n tr {\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n\n td:empty {\n padding: 0;\n }\n }\n"])), _colors.N20);
|
|
27
|
-
|
|
28
|
-
exports.MediaTableWrapper = MediaTableWrapper;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
-
|
|
5
|
-
import styled from 'styled-components';
|
|
6
|
-
import { N20 } from '@atlaskit/theme/colors';
|
|
7
|
-
export var NameCellWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
8
|
-
export var TruncateWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n min-width: 0;\n width: 100%;\n margin-left: 4px;\n\n span:first-of-type {\n &::first-letter {\n text-transform: capitalize;\n }\n }\n"])));
|
|
9
|
-
export var MediaTableWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n tr {\n cursor: pointer;\n\n &:hover {\n background: ", ";\n }\n\n td:empty {\n padding: 0;\n }\n }\n"])), N20);
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const NameCellWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
|
|
3
|
-
export declare const TruncateWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
|
|
4
|
-
export declare const MediaTableWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement>>;
|