@atlaskit/media-table 13.0.2 → 14.1.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.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/component/downloadButton.js +3 -1
- package/dist/cjs/component/mediaTable.js +40 -17
- package/dist/cjs/component/previewButton.js +63 -0
- package/dist/cjs/component/styles.js +1 -3
- package/dist/cjs/util/constants.js +3 -1
- package/dist/cjs/util/generateHeadValues.js +1 -1
- package/dist/cjs/util/index.js +6 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/component/downloadButton.js +2 -1
- package/dist/es2019/component/mediaTable.js +32 -12
- package/dist/es2019/component/previewButton.js +40 -0
- package/dist/es2019/component/styles.js +0 -5
- package/dist/es2019/util/constants.js +1 -0
- package/dist/es2019/util/generateHeadValues.js +2 -2
- package/dist/es2019/util/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/component/downloadButton.js +2 -1
- package/dist/esm/component/mediaTable.js +41 -18
- package/dist/esm/component/previewButton.js +49 -0
- package/dist/esm/component/styles.js +1 -2
- package/dist/esm/util/constants.js +1 -0
- package/dist/esm/util/generateHeadValues.js +2 -2
- package/dist/esm/util/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/component/mediaTable.d.ts +1 -0
- package/dist/{types-ts4.0/component/downloadButton.d.ts → types/component/previewButton.d.ts} +0 -0
- package/dist/types/types.d.ts +4 -0
- package/dist/types/util/constants.d.ts +1 -0
- package/dist/types/util/index.d.ts +1 -1
- package/example-helpers/styles.tsx +11 -4
- package/package.json +17 -20
- package/report.api.md +59 -41
- package/dist/types-ts4.0/component/mediaTable.d.ts +0 -27
- package/dist/types-ts4.0/component/nameCell.d.ts +0 -7
- package/dist/types-ts4.0/component/styles.d.ts +0 -3
- package/dist/types-ts4.0/index.d.ts +0 -4
- package/dist/types-ts4.0/types.d.ts +0 -69
- package/dist/types-ts4.0/util/constants.d.ts +0 -2
- package/dist/types-ts4.0/util/generateHeadValues.d.ts +0 -3
- package/dist/types-ts4.0/util/generateRowValues.d.ts +0 -11
- package/dist/types-ts4.0/util/getValidTableProps.d.ts +0 -3
- package/dist/types-ts4.0/util/index.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/media-table
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2c1a0c45a0b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c1a0c45a0b) - [ux] Instrumented `@atlaskit/media-table` with the new theming package, `@atlaskit/tokens`.
|
|
8
|
+
|
|
9
|
+
New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).
|
|
10
|
+
These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`7fc3932cc78`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7fc3932cc78) - [ux] Removed hover and focus state styling as the base component applies those already.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 14.0.0
|
|
18
|
+
|
|
19
|
+
### Major Changes
|
|
20
|
+
|
|
21
|
+
- [`64a9be7d742`](https://bitbucket.org/atlassian/atlassian-frontend/commits/64a9be7d742) - [ux] Add a preconfiguration for columns with the key 'preview' to display a media preview button
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [`692477d9854`](https://bitbucket.org/atlassian/atlassian-frontend/commits/692477d9854) - [ux] Adds row selection & row highlighting to media table component
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`153829bfcb3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/153829bfcb3) - Upgrade caching algorithm library lru-fast to lru_map.
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
3
32
|
## 13.0.2
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -9,6 +9,8 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
|
|
12
|
+
var _tokens = require("@atlaskit/tokens");
|
|
13
|
+
|
|
12
14
|
var _react = _interopRequireDefault(require("react"));
|
|
13
15
|
|
|
14
16
|
var _reactIntlNext = require("react-intl-next");
|
|
@@ -54,7 +56,7 @@ var MediaDownloadButton = function MediaDownloadButton(props) {
|
|
|
54
56
|
buttonStyles: _objectSpread(_objectSpread({}, current(themeProps).buttonStyles), {}, {
|
|
55
57
|
minWidth: 'max-content',
|
|
56
58
|
'&:hover': {
|
|
57
|
-
background: _colors.N40
|
|
59
|
+
background: (0, _tokens.token)('color.background.neutral.hovered', _colors.N40)
|
|
58
60
|
}
|
|
59
61
|
}),
|
|
60
62
|
spinnerStyles: current(themeProps).spinnerStyles
|
|
@@ -45,6 +45,8 @@ var _styles = require("./styles");
|
|
|
45
45
|
|
|
46
46
|
var _downloadButton = _interopRequireDefault(require("./downloadButton"));
|
|
47
47
|
|
|
48
|
+
var _previewButton = _interopRequireDefault(require("./previewButton"));
|
|
49
|
+
|
|
48
50
|
var _util = require("../util");
|
|
49
51
|
|
|
50
52
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
@@ -94,6 +96,8 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
94
96
|
columns.cells.forEach(function (cell) {
|
|
95
97
|
var content = cell.key === _util.CELL_KEY_DOWNLOAD ? (0, _react.jsx)(_downloadButton.default, {
|
|
96
98
|
onClick: _this.onDownloadClick(identifier)
|
|
99
|
+
}) : cell.key === _util.CELL_KEY_PREVIEW ? (0, _react.jsx)(_previewButton.default, {
|
|
100
|
+
onClick: _this.onPreviewClick(identifier)
|
|
97
101
|
}) : cell.key && data[cell.key] || '';
|
|
98
102
|
cellValues.push({
|
|
99
103
|
key: cell.key,
|
|
@@ -113,6 +117,13 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
113
117
|
mediaClient.file.downloadBinary(id, nameInfo ? nameInfo.fileName : '', collectionName);
|
|
114
118
|
};
|
|
115
119
|
});
|
|
120
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onPreviewClick", function (identifier) {
|
|
121
|
+
return function (event) {
|
|
122
|
+
event.stopPropagation();
|
|
123
|
+
|
|
124
|
+
_this.openPreview(identifier);
|
|
125
|
+
};
|
|
126
|
+
});
|
|
116
127
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onSort", function (data) {
|
|
117
128
|
var onSort = _this.props.onSort;
|
|
118
129
|
var key = data.key,
|
|
@@ -124,7 +135,7 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
124
135
|
var _this$props = _this.props,
|
|
125
136
|
items = _this$props.items,
|
|
126
137
|
columns = _this$props.columns;
|
|
127
|
-
var rowValues = items.map(function (item) {
|
|
138
|
+
var rowValues = items.map(function (item, index) {
|
|
128
139
|
var data = item.data,
|
|
129
140
|
identifier = item.identifier,
|
|
130
141
|
rowProps = item.rowProps;
|
|
@@ -132,10 +143,10 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
132
143
|
cells: _this.generateCellValues(data, identifier),
|
|
133
144
|
key: identifier.id,
|
|
134
145
|
tabIndex: 0,
|
|
135
|
-
onClick: _this.onRowClick(identifier),
|
|
146
|
+
onClick: _this.onRowClick(identifier, data, index),
|
|
136
147
|
onKeyPress: function onKeyPress(event) {
|
|
137
148
|
if (event.key === 'Enter') {
|
|
138
|
-
_this.onRowEnterKeyPressed(identifier);
|
|
149
|
+
_this.onRowEnterKeyPressed(identifier, data, index);
|
|
139
150
|
}
|
|
140
151
|
}
|
|
141
152
|
}, rowProps);
|
|
@@ -158,7 +169,8 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
158
169
|
totalItems = _this$props2.totalItems,
|
|
159
170
|
items = _this$props2.items,
|
|
160
171
|
sortKey = _this$props2.sortKey,
|
|
161
|
-
sortOrder = _this$props2.sortOrder
|
|
172
|
+
sortOrder = _this$props2.sortOrder,
|
|
173
|
+
highlightedRowIndex = _this$props2.highlightedRowIndex;
|
|
162
174
|
|
|
163
175
|
var _getValidTableProps = (0, _util.getValidTableProps)(items.length, itemsPerPage, pageNumber, totalItems),
|
|
164
176
|
validItemsPerPage = _getValidTableProps.validItemsPerPage,
|
|
@@ -178,7 +190,8 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
178
190
|
sortOrder: sortOrder,
|
|
179
191
|
onSort: _this.onSort,
|
|
180
192
|
onSetPage: onSetPage,
|
|
181
|
-
isFixedSize: true
|
|
193
|
+
isFixedSize: true,
|
|
194
|
+
highlightedRowIndex: highlightedRowIndex
|
|
182
195
|
});
|
|
183
196
|
});
|
|
184
197
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "openPreview", function (identifier) {
|
|
@@ -190,8 +203,10 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
190
203
|
|
|
191
204
|
onPreviewOpen && onPreviewOpen();
|
|
192
205
|
});
|
|
193
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRowEnterKeyPressed", function (identifier) {
|
|
194
|
-
var
|
|
206
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRowEnterKeyPressed", function (identifier, data, index) {
|
|
207
|
+
var _this$props3 = _this.props,
|
|
208
|
+
createAnalyticsEvent = _this$props3.createAnalyticsEvent,
|
|
209
|
+
onRowClick = _this$props3.onRowClick;
|
|
195
210
|
var ev = createAnalyticsEvent({
|
|
196
211
|
eventType: 'ui',
|
|
197
212
|
action: 'keyPressed',
|
|
@@ -199,12 +214,17 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
199
214
|
actionSubjectId: 'mediaFileRow'
|
|
200
215
|
});
|
|
201
216
|
ev.fire(_util.ANALYTICS_MEDIA_CHANNEL);
|
|
217
|
+
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
202
218
|
|
|
203
|
-
|
|
219
|
+
if (!shouldPreventDefaultRowClick) {
|
|
220
|
+
_this.openPreview(identifier);
|
|
221
|
+
}
|
|
204
222
|
});
|
|
205
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRowClick", function (identifier) {
|
|
223
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onRowClick", function (identifier, data, index) {
|
|
206
224
|
return function () {
|
|
207
|
-
var
|
|
225
|
+
var _this$props4 = _this.props,
|
|
226
|
+
createAnalyticsEvent = _this$props4.createAnalyticsEvent,
|
|
227
|
+
onRowClick = _this$props4.onRowClick;
|
|
208
228
|
var ev = createAnalyticsEvent({
|
|
209
229
|
eventType: 'ui',
|
|
210
230
|
action: 'clicked',
|
|
@@ -212,8 +232,11 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
212
232
|
actionSubjectId: 'mediaFileRow'
|
|
213
233
|
});
|
|
214
234
|
ev.fire(_util.ANALYTICS_MEDIA_CHANNEL);
|
|
235
|
+
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
215
236
|
|
|
216
|
-
|
|
237
|
+
if (!shouldPreventDefaultRowClick) {
|
|
238
|
+
_this.openPreview(identifier);
|
|
239
|
+
}
|
|
217
240
|
};
|
|
218
241
|
});
|
|
219
242
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "safeSetState", function (state) {
|
|
@@ -232,9 +255,9 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
232
255
|
});
|
|
233
256
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderMediaViewer", function () {
|
|
234
257
|
var mediaViewerSelectedItem = _this.state.mediaViewerSelectedItem;
|
|
235
|
-
var _this$
|
|
236
|
-
mediaClient = _this$
|
|
237
|
-
items = _this$
|
|
258
|
+
var _this$props5 = _this.props,
|
|
259
|
+
mediaClient = _this$props5.mediaClient,
|
|
260
|
+
items = _this$props5.items;
|
|
238
261
|
|
|
239
262
|
if (!mediaViewerSelectedItem) {
|
|
240
263
|
return null;
|
|
@@ -263,9 +286,9 @@ var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
263
286
|
var _this2 = this;
|
|
264
287
|
|
|
265
288
|
this.hasBeenMounted = true;
|
|
266
|
-
var _this$
|
|
267
|
-
items = _this$
|
|
268
|
-
mediaClient = _this$
|
|
289
|
+
var _this$props6 = this.props,
|
|
290
|
+
items = _this$props6.items,
|
|
291
|
+
mediaClient = _this$props6.mediaClient;
|
|
269
292
|
items.forEach( /*#__PURE__*/function () {
|
|
270
293
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(item) {
|
|
271
294
|
var _item$identifier, id, _item$identifier$coll, collectionName, subscription;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _reactIntlNext = require("react-intl-next");
|
|
15
|
+
|
|
16
|
+
var _filePreview = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/file-preview"));
|
|
17
|
+
|
|
18
|
+
var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
|
|
19
|
+
|
|
20
|
+
var _mediaUi = require("@atlaskit/media-ui");
|
|
21
|
+
|
|
22
|
+
var _util = require("../util");
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
27
|
+
|
|
28
|
+
var MediaPreviewButton = function MediaPreviewButton(props) {
|
|
29
|
+
var _onClick = props.onClick,
|
|
30
|
+
formatMessage = props.intl.formatMessage;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_customThemeButton.default, {
|
|
32
|
+
appearance: "subtle",
|
|
33
|
+
testId: "preview-button",
|
|
34
|
+
iconAfter: /*#__PURE__*/_react.default.createElement(_filePreview.default, {
|
|
35
|
+
label: formatMessage(_mediaUi.messages.preview)
|
|
36
|
+
}),
|
|
37
|
+
onKeyPress: function onKeyPress(event) {
|
|
38
|
+
return event.stopPropagation();
|
|
39
|
+
},
|
|
40
|
+
onClick: function onClick(event, analyticsEvent) {
|
|
41
|
+
analyticsEvent.update(function (payload) {
|
|
42
|
+
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
43
|
+
eventType: 'ui',
|
|
44
|
+
actionSubjectId: 'mediaTablePreview'
|
|
45
|
+
});
|
|
46
|
+
}).fire(_util.ANALYTICS_MEDIA_CHANNEL);
|
|
47
|
+
|
|
48
|
+
_onClick(event);
|
|
49
|
+
},
|
|
50
|
+
theme: function theme(current, themeProps) {
|
|
51
|
+
return {
|
|
52
|
+
buttonStyles: _objectSpread(_objectSpread({}, current(themeProps).buttonStyles), {}, {
|
|
53
|
+
minWidth: 'max-content'
|
|
54
|
+
}),
|
|
55
|
+
spinnerStyles: current(themeProps).spinnerStyles
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var _default = (0, _reactIntlNext.injectIntl)(MediaPreviewButton);
|
|
62
|
+
|
|
63
|
+
exports.default = _default;
|
|
@@ -11,13 +11,11 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
11
11
|
|
|
12
12
|
var _react = require("@emotion/react");
|
|
13
13
|
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
|
|
16
14
|
var _templateObject, _templateObject2, _templateObject3;
|
|
17
15
|
|
|
18
16
|
var nameCellWrapperStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
19
17
|
exports.nameCellWrapperStyles = nameCellWrapperStyles;
|
|
20
18
|
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
19
|
exports.truncateWrapperStyles = truncateWrapperStyles;
|
|
22
|
-
var mediaTableWrapperStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n tr {\n cursor: pointer;\n\n
|
|
20
|
+
var mediaTableWrapperStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n tr {\n cursor: pointer;\n\n td:empty {\n padding: 0;\n }\n }\n"])));
|
|
23
21
|
exports.mediaTableWrapperStyles = mediaTableWrapperStyles;
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.CELL_KEY_DOWNLOAD = exports.ANALYTICS_MEDIA_CHANNEL = void 0;
|
|
6
|
+
exports.CELL_KEY_PREVIEW = exports.CELL_KEY_DOWNLOAD = exports.ANALYTICS_MEDIA_CHANNEL = void 0;
|
|
7
7
|
var CELL_KEY_DOWNLOAD = 'download';
|
|
8
8
|
exports.CELL_KEY_DOWNLOAD = CELL_KEY_DOWNLOAD;
|
|
9
|
+
var CELL_KEY_PREVIEW = 'preview';
|
|
10
|
+
exports.CELL_KEY_PREVIEW = CELL_KEY_PREVIEW;
|
|
9
11
|
var ANALYTICS_MEDIA_CHANNEL = 'media';
|
|
10
12
|
exports.ANALYTICS_MEDIA_CHANNEL = ANALYTICS_MEDIA_CHANNEL;
|
|
@@ -20,7 +20,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
20
20
|
var generateHeadValues = (0, _memoizeOne.default)(function (columns) {
|
|
21
21
|
return {
|
|
22
22
|
cells: columns.cells.map(function (cell) {
|
|
23
|
-
return cell.key === _constants.CELL_KEY_DOWNLOAD ? _objectSpread({
|
|
23
|
+
return cell.key === _constants.CELL_KEY_DOWNLOAD || cell.key === _constants.CELL_KEY_PREVIEW ? _objectSpread({
|
|
24
24
|
style: {
|
|
25
25
|
width: '48px'
|
|
26
26
|
}
|
package/dist/cjs/util/index.js
CHANGED
|
@@ -17,6 +17,12 @@ Object.defineProperty(exports, "CELL_KEY_DOWNLOAD", {
|
|
|
17
17
|
return _constants.CELL_KEY_DOWNLOAD;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
+
Object.defineProperty(exports, "CELL_KEY_PREVIEW", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _constants.CELL_KEY_PREVIEW;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
20
26
|
Object.defineProperty(exports, "generateHeadValues", {
|
|
21
27
|
enumerable: true,
|
|
22
28
|
get: function get() {
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { token } from '@atlaskit/tokens';
|
|
1
2
|
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
3
|
|
|
3
4
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -33,7 +34,7 @@ const MediaDownloadButton = props => {
|
|
|
33
34
|
buttonStyles: { ...current(themeProps).buttonStyles,
|
|
34
35
|
minWidth: 'max-content',
|
|
35
36
|
'&:hover': {
|
|
36
|
-
background: N40
|
|
37
|
+
background: token('color.background.neutral.hovered', N40)
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
spinnerStyles: current(themeProps).spinnerStyles
|
|
@@ -11,7 +11,8 @@ import { isFileIdentifier, withMediaClient, isProcessedFileState } from '@atlask
|
|
|
11
11
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
12
12
|
import { mediaTableWrapperStyles } from './styles';
|
|
13
13
|
import DownloadButton from './downloadButton';
|
|
14
|
-
import
|
|
14
|
+
import PreviewButton from './previewButton';
|
|
15
|
+
import { generateRowValues, getValidTableProps, generateHeadValues, CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW, ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
15
16
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
17
|
export class MediaTable extends Component {
|
|
17
18
|
constructor(...args) {
|
|
@@ -38,6 +39,8 @@ export class MediaTable extends Component {
|
|
|
38
39
|
columns.cells.forEach(cell => {
|
|
39
40
|
const content = cell.key === CELL_KEY_DOWNLOAD ? jsx(DownloadButton, {
|
|
40
41
|
onClick: this.onDownloadClick(identifier)
|
|
42
|
+
}) : cell.key === CELL_KEY_PREVIEW ? jsx(PreviewButton, {
|
|
43
|
+
onClick: this.onPreviewClick(identifier)
|
|
41
44
|
}) : cell.key && data[cell.key] || '';
|
|
42
45
|
cellValues.push({
|
|
43
46
|
key: cell.key,
|
|
@@ -63,6 +66,11 @@ export class MediaTable extends Component {
|
|
|
63
66
|
mediaClient.file.downloadBinary(id, nameInfo ? nameInfo.fileName : '', collectionName);
|
|
64
67
|
});
|
|
65
68
|
|
|
69
|
+
_defineProperty(this, "onPreviewClick", identifier => event => {
|
|
70
|
+
event.stopPropagation();
|
|
71
|
+
this.openPreview(identifier);
|
|
72
|
+
});
|
|
73
|
+
|
|
66
74
|
_defineProperty(this, "onSort", data => {
|
|
67
75
|
const {
|
|
68
76
|
onSort
|
|
@@ -80,7 +88,7 @@ export class MediaTable extends Component {
|
|
|
80
88
|
items,
|
|
81
89
|
columns
|
|
82
90
|
} = this.props;
|
|
83
|
-
const rowValues = items.map(item => {
|
|
91
|
+
const rowValues = items.map((item, index) => {
|
|
84
92
|
const {
|
|
85
93
|
data,
|
|
86
94
|
identifier,
|
|
@@ -90,10 +98,10 @@ export class MediaTable extends Component {
|
|
|
90
98
|
cells: this.generateCellValues(data, identifier),
|
|
91
99
|
key: identifier.id,
|
|
92
100
|
tabIndex: 0,
|
|
93
|
-
onClick: this.onRowClick(identifier),
|
|
101
|
+
onClick: this.onRowClick(identifier, data, index),
|
|
94
102
|
onKeyPress: event => {
|
|
95
103
|
if (event.key === 'Enter') {
|
|
96
|
-
this.onRowEnterKeyPressed(identifier);
|
|
104
|
+
this.onRowEnterKeyPressed(identifier, data, index);
|
|
97
105
|
}
|
|
98
106
|
},
|
|
99
107
|
...rowProps
|
|
@@ -118,7 +126,8 @@ export class MediaTable extends Component {
|
|
|
118
126
|
totalItems,
|
|
119
127
|
items,
|
|
120
128
|
sortKey,
|
|
121
|
-
sortOrder
|
|
129
|
+
sortOrder,
|
|
130
|
+
highlightedRowIndex
|
|
122
131
|
} = this.props;
|
|
123
132
|
const {
|
|
124
133
|
validItemsPerPage,
|
|
@@ -138,7 +147,8 @@ export class MediaTable extends Component {
|
|
|
138
147
|
sortOrder: sortOrder,
|
|
139
148
|
onSort: this.onSort,
|
|
140
149
|
onSetPage: onSetPage,
|
|
141
|
-
isFixedSize: true
|
|
150
|
+
isFixedSize: true,
|
|
151
|
+
highlightedRowIndex: highlightedRowIndex
|
|
142
152
|
});
|
|
143
153
|
});
|
|
144
154
|
|
|
@@ -152,9 +162,10 @@ export class MediaTable extends Component {
|
|
|
152
162
|
onPreviewOpen && onPreviewOpen();
|
|
153
163
|
});
|
|
154
164
|
|
|
155
|
-
_defineProperty(this, "onRowEnterKeyPressed", identifier => {
|
|
165
|
+
_defineProperty(this, "onRowEnterKeyPressed", (identifier, data, index) => {
|
|
156
166
|
const {
|
|
157
|
-
createAnalyticsEvent
|
|
167
|
+
createAnalyticsEvent,
|
|
168
|
+
onRowClick
|
|
158
169
|
} = this.props;
|
|
159
170
|
const ev = createAnalyticsEvent({
|
|
160
171
|
eventType: 'ui',
|
|
@@ -163,12 +174,17 @@ export class MediaTable extends Component {
|
|
|
163
174
|
actionSubjectId: 'mediaFileRow'
|
|
164
175
|
});
|
|
165
176
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
166
|
-
|
|
177
|
+
const shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
178
|
+
|
|
179
|
+
if (!shouldPreventDefaultRowClick) {
|
|
180
|
+
this.openPreview(identifier);
|
|
181
|
+
}
|
|
167
182
|
});
|
|
168
183
|
|
|
169
|
-
_defineProperty(this, "onRowClick", identifier => () => {
|
|
184
|
+
_defineProperty(this, "onRowClick", (identifier, data, index) => () => {
|
|
170
185
|
const {
|
|
171
|
-
createAnalyticsEvent
|
|
186
|
+
createAnalyticsEvent,
|
|
187
|
+
onRowClick
|
|
172
188
|
} = this.props;
|
|
173
189
|
const ev = createAnalyticsEvent({
|
|
174
190
|
eventType: 'ui',
|
|
@@ -177,7 +193,11 @@ export class MediaTable extends Component {
|
|
|
177
193
|
actionSubjectId: 'mediaFileRow'
|
|
178
194
|
});
|
|
179
195
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
180
|
-
|
|
196
|
+
const shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
197
|
+
|
|
198
|
+
if (!shouldPreventDefaultRowClick) {
|
|
199
|
+
this.openPreview(identifier);
|
|
200
|
+
}
|
|
181
201
|
});
|
|
182
202
|
|
|
183
203
|
_defineProperty(this, "safeSetState", state => {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
|
+
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import EditorFilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
5
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
6
|
+
import { messages } from '@atlaskit/media-ui'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
|
+
|
|
8
|
+
import { ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
9
|
+
|
|
10
|
+
const MediaPreviewButton = props => {
|
|
11
|
+
const {
|
|
12
|
+
onClick,
|
|
13
|
+
intl: {
|
|
14
|
+
formatMessage
|
|
15
|
+
}
|
|
16
|
+
} = props;
|
|
17
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
18
|
+
appearance: "subtle",
|
|
19
|
+
testId: "preview-button",
|
|
20
|
+
iconAfter: /*#__PURE__*/React.createElement(EditorFilePreviewIcon, {
|
|
21
|
+
label: formatMessage(messages.preview)
|
|
22
|
+
}),
|
|
23
|
+
onKeyPress: event => event.stopPropagation(),
|
|
24
|
+
onClick: (event, analyticsEvent) => {
|
|
25
|
+
analyticsEvent.update(payload => ({ ...payload,
|
|
26
|
+
eventType: 'ui',
|
|
27
|
+
actionSubjectId: 'mediaTablePreview'
|
|
28
|
+
})).fire(ANALYTICS_MEDIA_CHANNEL);
|
|
29
|
+
onClick(event);
|
|
30
|
+
},
|
|
31
|
+
theme: (current, themeProps) => ({
|
|
32
|
+
buttonStyles: { ...current(themeProps).buttonStyles,
|
|
33
|
+
minWidth: 'max-content'
|
|
34
|
+
},
|
|
35
|
+
spinnerStyles: current(themeProps).spinnerStyles
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default injectIntl(MediaPreviewButton);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { N20 } from '@atlaskit/theme/colors';
|
|
3
2
|
export const nameCellWrapperStyles = css`
|
|
4
3
|
display: flex;
|
|
5
4
|
align-content: center;
|
|
@@ -20,10 +19,6 @@ export const mediaTableWrapperStyles = css`
|
|
|
20
19
|
tr {
|
|
21
20
|
cursor: pointer;
|
|
22
21
|
|
|
23
|
-
&:hover {
|
|
24
|
-
background: ${N20};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
td:empty {
|
|
28
23
|
padding: 0;
|
|
29
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
|
-
import { CELL_KEY_DOWNLOAD } from './constants';
|
|
2
|
+
import { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW } from './constants';
|
|
3
3
|
const generateHeadValues = memoizeOne(columns => ({
|
|
4
|
-
cells: columns.cells.map(cell => cell.key === CELL_KEY_DOWNLOAD ? {
|
|
4
|
+
cells: columns.cells.map(cell => cell.key === CELL_KEY_DOWNLOAD || cell.key === CELL_KEY_PREVIEW ? {
|
|
5
5
|
style: {
|
|
6
6
|
width: '48px'
|
|
7
7
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as generateRowValues } from './generateRowValues';
|
|
2
2
|
export { default as getValidTableProps } from './getValidTableProps';
|
|
3
3
|
export { default as generateHeadValues } from './generateHeadValues';
|
|
4
|
-
export { CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
4
|
+
export { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW, ANALYTICS_MEDIA_CHANNEL } from './constants';
|
package/dist/es2019/version.json
CHANGED
|
@@ -4,6 +4,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
4
4
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
7
8
|
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
9
|
|
|
9
10
|
import { injectIntl } from 'react-intl-next';
|
|
@@ -41,7 +42,7 @@ var MediaDownloadButton = function MediaDownloadButton(props) {
|
|
|
41
42
|
buttonStyles: _objectSpread(_objectSpread({}, current(themeProps).buttonStyles), {}, {
|
|
42
43
|
minWidth: 'max-content',
|
|
43
44
|
'&:hover': {
|
|
44
|
-
background: N40
|
|
45
|
+
background: token('color.background.neutral.hovered', N40)
|
|
45
46
|
}
|
|
46
47
|
}),
|
|
47
48
|
spinnerStyles: current(themeProps).spinnerStyles
|
|
@@ -27,7 +27,8 @@ import { isFileIdentifier, withMediaClient, isProcessedFileState } from '@atlask
|
|
|
27
27
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
28
28
|
import { mediaTableWrapperStyles } from './styles';
|
|
29
29
|
import DownloadButton from './downloadButton';
|
|
30
|
-
import
|
|
30
|
+
import PreviewButton from './previewButton';
|
|
31
|
+
import { generateRowValues, getValidTableProps, generateHeadValues, CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW, ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
31
32
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
32
33
|
export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
33
34
|
_inherits(MediaTable, _Component);
|
|
@@ -67,6 +68,8 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
67
68
|
columns.cells.forEach(function (cell) {
|
|
68
69
|
var content = cell.key === CELL_KEY_DOWNLOAD ? jsx(DownloadButton, {
|
|
69
70
|
onClick: _this.onDownloadClick(identifier)
|
|
71
|
+
}) : cell.key === CELL_KEY_PREVIEW ? jsx(PreviewButton, {
|
|
72
|
+
onClick: _this.onPreviewClick(identifier)
|
|
70
73
|
}) : cell.key && data[cell.key] || '';
|
|
71
74
|
cellValues.push({
|
|
72
75
|
key: cell.key,
|
|
@@ -88,6 +91,14 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
88
91
|
};
|
|
89
92
|
});
|
|
90
93
|
|
|
94
|
+
_defineProperty(_assertThisInitialized(_this), "onPreviewClick", function (identifier) {
|
|
95
|
+
return function (event) {
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
|
|
98
|
+
_this.openPreview(identifier);
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
|
|
91
102
|
_defineProperty(_assertThisInitialized(_this), "onSort", function (data) {
|
|
92
103
|
var onSort = _this.props.onSort;
|
|
93
104
|
var key = data.key,
|
|
@@ -100,7 +111,7 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
100
111
|
var _this$props = _this.props,
|
|
101
112
|
items = _this$props.items,
|
|
102
113
|
columns = _this$props.columns;
|
|
103
|
-
var rowValues = items.map(function (item) {
|
|
114
|
+
var rowValues = items.map(function (item, index) {
|
|
104
115
|
var data = item.data,
|
|
105
116
|
identifier = item.identifier,
|
|
106
117
|
rowProps = item.rowProps;
|
|
@@ -108,10 +119,10 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
108
119
|
cells: _this.generateCellValues(data, identifier),
|
|
109
120
|
key: identifier.id,
|
|
110
121
|
tabIndex: 0,
|
|
111
|
-
onClick: _this.onRowClick(identifier),
|
|
122
|
+
onClick: _this.onRowClick(identifier, data, index),
|
|
112
123
|
onKeyPress: function onKeyPress(event) {
|
|
113
124
|
if (event.key === 'Enter') {
|
|
114
|
-
_this.onRowEnterKeyPressed(identifier);
|
|
125
|
+
_this.onRowEnterKeyPressed(identifier, data, index);
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
}, rowProps);
|
|
@@ -135,7 +146,8 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
135
146
|
totalItems = _this$props2.totalItems,
|
|
136
147
|
items = _this$props2.items,
|
|
137
148
|
sortKey = _this$props2.sortKey,
|
|
138
|
-
sortOrder = _this$props2.sortOrder
|
|
149
|
+
sortOrder = _this$props2.sortOrder,
|
|
150
|
+
highlightedRowIndex = _this$props2.highlightedRowIndex;
|
|
139
151
|
|
|
140
152
|
var _getValidTableProps = getValidTableProps(items.length, itemsPerPage, pageNumber, totalItems),
|
|
141
153
|
validItemsPerPage = _getValidTableProps.validItemsPerPage,
|
|
@@ -155,7 +167,8 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
155
167
|
sortOrder: sortOrder,
|
|
156
168
|
onSort: _this.onSort,
|
|
157
169
|
onSetPage: onSetPage,
|
|
158
|
-
isFixedSize: true
|
|
170
|
+
isFixedSize: true,
|
|
171
|
+
highlightedRowIndex: highlightedRowIndex
|
|
159
172
|
});
|
|
160
173
|
});
|
|
161
174
|
|
|
@@ -169,8 +182,10 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
169
182
|
onPreviewOpen && onPreviewOpen();
|
|
170
183
|
});
|
|
171
184
|
|
|
172
|
-
_defineProperty(_assertThisInitialized(_this), "onRowEnterKeyPressed", function (identifier) {
|
|
173
|
-
var
|
|
185
|
+
_defineProperty(_assertThisInitialized(_this), "onRowEnterKeyPressed", function (identifier, data, index) {
|
|
186
|
+
var _this$props3 = _this.props,
|
|
187
|
+
createAnalyticsEvent = _this$props3.createAnalyticsEvent,
|
|
188
|
+
onRowClick = _this$props3.onRowClick;
|
|
174
189
|
var ev = createAnalyticsEvent({
|
|
175
190
|
eventType: 'ui',
|
|
176
191
|
action: 'keyPressed',
|
|
@@ -178,13 +193,18 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
178
193
|
actionSubjectId: 'mediaFileRow'
|
|
179
194
|
});
|
|
180
195
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
196
|
+
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
181
197
|
|
|
182
|
-
|
|
198
|
+
if (!shouldPreventDefaultRowClick) {
|
|
199
|
+
_this.openPreview(identifier);
|
|
200
|
+
}
|
|
183
201
|
});
|
|
184
202
|
|
|
185
|
-
_defineProperty(_assertThisInitialized(_this), "onRowClick", function (identifier) {
|
|
203
|
+
_defineProperty(_assertThisInitialized(_this), "onRowClick", function (identifier, data, index) {
|
|
186
204
|
return function () {
|
|
187
|
-
var
|
|
205
|
+
var _this$props4 = _this.props,
|
|
206
|
+
createAnalyticsEvent = _this$props4.createAnalyticsEvent,
|
|
207
|
+
onRowClick = _this$props4.onRowClick;
|
|
188
208
|
var ev = createAnalyticsEvent({
|
|
189
209
|
eventType: 'ui',
|
|
190
210
|
action: 'clicked',
|
|
@@ -192,8 +212,11 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
192
212
|
actionSubjectId: 'mediaFileRow'
|
|
193
213
|
});
|
|
194
214
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
215
|
+
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
195
216
|
|
|
196
|
-
|
|
217
|
+
if (!shouldPreventDefaultRowClick) {
|
|
218
|
+
_this.openPreview(identifier);
|
|
219
|
+
}
|
|
197
220
|
};
|
|
198
221
|
});
|
|
199
222
|
|
|
@@ -215,9 +238,9 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
215
238
|
|
|
216
239
|
_defineProperty(_assertThisInitialized(_this), "renderMediaViewer", function () {
|
|
217
240
|
var mediaViewerSelectedItem = _this.state.mediaViewerSelectedItem;
|
|
218
|
-
var _this$
|
|
219
|
-
mediaClient = _this$
|
|
220
|
-
items = _this$
|
|
241
|
+
var _this$props5 = _this.props,
|
|
242
|
+
mediaClient = _this$props5.mediaClient,
|
|
243
|
+
items = _this$props5.items;
|
|
221
244
|
|
|
222
245
|
if (!mediaViewerSelectedItem) {
|
|
223
246
|
return null;
|
|
@@ -247,9 +270,9 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
247
270
|
var _this2 = this;
|
|
248
271
|
|
|
249
272
|
this.hasBeenMounted = true;
|
|
250
|
-
var _this$
|
|
251
|
-
items = _this$
|
|
252
|
-
mediaClient = _this$
|
|
273
|
+
var _this$props6 = this.props,
|
|
274
|
+
items = _this$props6.items,
|
|
275
|
+
mediaClient = _this$props6.mediaClient;
|
|
253
276
|
items.forEach( /*#__PURE__*/function () {
|
|
254
277
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
255
278
|
var _item$identifier, id, _item$identifier$coll, collectionName, subscription;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
import React from 'react'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
+
|
|
9
|
+
import { injectIntl } from 'react-intl-next';
|
|
10
|
+
import EditorFilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
11
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
12
|
+
import { messages } from '@atlaskit/media-ui'; // eslint-disable-next-line import/no-extraneous-dependencies
|
|
13
|
+
|
|
14
|
+
import { ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
15
|
+
|
|
16
|
+
var MediaPreviewButton = function MediaPreviewButton(props) {
|
|
17
|
+
var _onClick = props.onClick,
|
|
18
|
+
formatMessage = props.intl.formatMessage;
|
|
19
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
20
|
+
appearance: "subtle",
|
|
21
|
+
testId: "preview-button",
|
|
22
|
+
iconAfter: /*#__PURE__*/React.createElement(EditorFilePreviewIcon, {
|
|
23
|
+
label: formatMessage(messages.preview)
|
|
24
|
+
}),
|
|
25
|
+
onKeyPress: function onKeyPress(event) {
|
|
26
|
+
return event.stopPropagation();
|
|
27
|
+
},
|
|
28
|
+
onClick: function onClick(event, analyticsEvent) {
|
|
29
|
+
analyticsEvent.update(function (payload) {
|
|
30
|
+
return _objectSpread(_objectSpread({}, payload), {}, {
|
|
31
|
+
eventType: 'ui',
|
|
32
|
+
actionSubjectId: 'mediaTablePreview'
|
|
33
|
+
});
|
|
34
|
+
}).fire(ANALYTICS_MEDIA_CHANNEL);
|
|
35
|
+
|
|
36
|
+
_onClick(event);
|
|
37
|
+
},
|
|
38
|
+
theme: function theme(current, themeProps) {
|
|
39
|
+
return {
|
|
40
|
+
buttonStyles: _objectSpread(_objectSpread({}, current(themeProps).buttonStyles), {}, {
|
|
41
|
+
minWidth: 'max-content'
|
|
42
|
+
}),
|
|
43
|
+
spinnerStyles: current(themeProps).spinnerStyles
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default injectIntl(MediaPreviewButton);
|
|
@@ -3,7 +3,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject, _templateObject2, _templateObject3;
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
|
-
import { N20 } from '@atlaskit/theme/colors';
|
|
7
6
|
export var nameCellWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
8
7
|
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
|
|
8
|
+
export var mediaTableWrapperStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n tr {\n cursor: pointer;\n\n td:empty {\n padding: 0;\n }\n }\n"])));
|
|
@@ -5,11 +5,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
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; }
|
|
6
6
|
|
|
7
7
|
import memoizeOne from 'memoize-one';
|
|
8
|
-
import { CELL_KEY_DOWNLOAD } from './constants';
|
|
8
|
+
import { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW } from './constants';
|
|
9
9
|
var generateHeadValues = memoizeOne(function (columns) {
|
|
10
10
|
return {
|
|
11
11
|
cells: columns.cells.map(function (cell) {
|
|
12
|
-
return cell.key === CELL_KEY_DOWNLOAD ? _objectSpread({
|
|
12
|
+
return cell.key === CELL_KEY_DOWNLOAD || cell.key === CELL_KEY_PREVIEW ? _objectSpread({
|
|
13
13
|
style: {
|
|
14
14
|
width: '48px'
|
|
15
15
|
}
|
package/dist/esm/util/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as generateRowValues } from './generateRowValues';
|
|
2
2
|
export { default as getValidTableProps } from './getValidTableProps';
|
|
3
3
|
export { default as generateHeadValues } from './generateHeadValues';
|
|
4
|
-
export { CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
4
|
+
export { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW, ANALYTICS_MEDIA_CHANNEL } from './constants';
|
package/dist/esm/version.json
CHANGED
|
@@ -12,6 +12,7 @@ export declare class MediaTable extends Component<MediaTableProps & WrappedCompo
|
|
|
12
12
|
componentWillUnmount(): void;
|
|
13
13
|
private generateCellValues;
|
|
14
14
|
private onDownloadClick;
|
|
15
|
+
private onPreviewClick;
|
|
15
16
|
private onSort;
|
|
16
17
|
private renderRowValues;
|
|
17
18
|
private renderTable;
|
package/dist/{types-ts4.0/component/downloadButton.d.ts → types/component/previewButton.d.ts}
RENAMED
|
File without changes
|
package/dist/types/types.d.ts
CHANGED
|
@@ -57,6 +57,10 @@ export interface MediaTableProps {
|
|
|
57
57
|
onPreviewOpen?: () => void;
|
|
58
58
|
/** Called when the preview is closed */
|
|
59
59
|
onPreviewClose?: () => void;
|
|
60
|
+
/** Row index that will be highlighted **/
|
|
61
|
+
highlightedRowIndex?: number[];
|
|
62
|
+
/** callback triggered when row click is passed, if returned true it will prevent default behaviour. **/
|
|
63
|
+
onRowClick?: (rowData: RowData, index: number) => boolean;
|
|
60
64
|
}
|
|
61
65
|
export interface MediaTableState {
|
|
62
66
|
mediaViewerSelectedItem?: Identifier;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as generateRowValues } from './generateRowValues';
|
|
2
2
|
export { default as getValidTableProps } from './getValidTableProps';
|
|
3
3
|
export { default as generateHeadValues } from './generateHeadValues';
|
|
4
|
-
export { CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
4
|
+
export { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW, ANALYTICS_MEDIA_CHANNEL, } from './constants';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { token } from '@atlaskit/tokens';
|
|
1
2
|
import { css } from '@emotion/react';
|
|
2
3
|
// AFP-2532 TODO: Fix automatic suppressions below
|
|
3
4
|
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
@@ -12,20 +13,26 @@ export const exampleWrapperStyles = css`
|
|
|
12
13
|
align-items: center;
|
|
13
14
|
|
|
14
15
|
.${ROW_HIGHLIGHT_CLASSNAME} {
|
|
15
|
-
background-color: ${colors.Y50};
|
|
16
|
+
background-color: ${token('color.background.warning', colors.Y50)};
|
|
16
17
|
|
|
17
18
|
&:hover {
|
|
18
|
-
background-color: ${
|
|
19
|
+
background-color: ${token(
|
|
20
|
+
'color.background.warning.hovered',
|
|
21
|
+
colors.Y75,
|
|
22
|
+
)};
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
`;
|
|
22
26
|
|
|
23
27
|
export const greenOnHoverStyles = css`
|
|
24
|
-
background-color: red;
|
|
28
|
+
background-color: ${token('color.background.danger.bold', 'red')};
|
|
25
29
|
height: 8px;
|
|
26
30
|
width: 8px;
|
|
27
31
|
|
|
28
32
|
.${ROW_CLASSNAME}:hover & {
|
|
29
|
-
background-color:
|
|
33
|
+
background-color: ${token(
|
|
34
|
+
'color.background.success.bold.hovered',
|
|
35
|
+
'green',
|
|
36
|
+
)};
|
|
30
37
|
}
|
|
31
38
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-table",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "Table UI component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,13 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
15
|
"sideEffects": false,
|
|
23
16
|
"atlaskit:src": "src/index.ts",
|
|
24
17
|
"af:exports": {
|
|
@@ -34,19 +27,20 @@
|
|
|
34
27
|
},
|
|
35
28
|
"dependencies": {
|
|
36
29
|
"@atlaskit/analytics-next": "^8.0.0",
|
|
37
|
-
"@atlaskit/button": "^16.
|
|
30
|
+
"@atlaskit/button": "^16.5.0",
|
|
38
31
|
"@atlaskit/dynamic-table": "^14.8.0",
|
|
39
|
-
"@atlaskit/icon": "^21.
|
|
40
|
-
"@atlaskit/media-client": "^
|
|
41
|
-
"@atlaskit/media-ui": "^22.
|
|
42
|
-
"@atlaskit/media-viewer": "^47.
|
|
32
|
+
"@atlaskit/icon": "^21.11.0",
|
|
33
|
+
"@atlaskit/media-client": "^19.0.0",
|
|
34
|
+
"@atlaskit/media-ui": "^22.2.0",
|
|
35
|
+
"@atlaskit/media-viewer": "^47.2.0",
|
|
43
36
|
"@atlaskit/theme": "^12.2.0",
|
|
44
|
-
"@atlaskit/
|
|
37
|
+
"@atlaskit/tokens": "^0.11.1",
|
|
38
|
+
"@atlaskit/tooltip": "^17.6.0",
|
|
45
39
|
"@babel/runtime": "^7.0.0",
|
|
46
40
|
"memoize-one": "^6.0.0"
|
|
47
41
|
},
|
|
48
42
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/media-core": "^
|
|
43
|
+
"@atlaskit/media-core": "^34.0.0",
|
|
50
44
|
"@emotion/react": "^11.7.1",
|
|
51
45
|
"react": "^16.8.0",
|
|
52
46
|
"react-dom": "^16.8.0",
|
|
@@ -55,10 +49,10 @@
|
|
|
55
49
|
"devDependencies": {
|
|
56
50
|
"@atlaskit/docs": "^9.0.0",
|
|
57
51
|
"@atlaskit/icon-file-type": "^6.3.0",
|
|
58
|
-
"@atlaskit/media-common": "^2.
|
|
59
|
-
"@atlaskit/media-core": "^
|
|
52
|
+
"@atlaskit/media-common": "^2.17.0",
|
|
53
|
+
"@atlaskit/media-core": "^34.0.0",
|
|
60
54
|
"@atlaskit/media-test-helpers": "^30.0.0",
|
|
61
|
-
"@atlaskit/range": "^
|
|
55
|
+
"@atlaskit/range": "^7.0.0",
|
|
62
56
|
"@atlaskit/ssr": "*",
|
|
63
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
64
58
|
"@emotion/react": "^11.7.1",
|
|
@@ -68,8 +62,11 @@
|
|
|
68
62
|
"react-dom": "^16.8.0",
|
|
69
63
|
"typescript": "4.5.5"
|
|
70
64
|
},
|
|
71
|
-
"
|
|
72
|
-
"
|
|
65
|
+
"techstack": {
|
|
66
|
+
"@repo/internal": {
|
|
67
|
+
"theming": "tokens"
|
|
68
|
+
}
|
|
73
69
|
},
|
|
70
|
+
"resolutions": {},
|
|
74
71
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
75
72
|
}
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
<!-- API Report Version: 2.2 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/media-table"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
4
15
|
|
|
5
16
|
```ts
|
|
6
17
|
/// <reference types="react" />
|
|
@@ -19,67 +30,74 @@ import { WithIntlProps } from 'react-intl-next';
|
|
|
19
30
|
import { WithMediaClientConfigProps } from '@atlaskit/media-client';
|
|
20
31
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
21
32
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
// @public (undocumented)
|
|
34
|
+
export const MediaTable: React_2.ComponentType<
|
|
35
|
+
WithMediaClientConfigProps<
|
|
36
|
+
Omit<
|
|
37
|
+
React_2.PropsWithChildren<
|
|
38
|
+
WithIntlProps<MediaTableProps & WrappedComponentProps<'intl'>>
|
|
39
|
+
>,
|
|
40
|
+
keyof WithAnalyticsEventsProps
|
|
41
|
+
> &
|
|
42
|
+
React_2.RefAttributes<any>
|
|
43
|
+
>
|
|
44
|
+
>;
|
|
45
|
+
|
|
46
|
+
// @public (undocumented)
|
|
47
|
+
export interface MediaTableItem {
|
|
48
|
+
// (undocumented)
|
|
33
49
|
data: RowData;
|
|
50
|
+
// (undocumented)
|
|
34
51
|
identifier: FileIdentifier;
|
|
35
|
-
/** An object containing props that will be applied to the row component */
|
|
36
52
|
rowProps?: RowProps;
|
|
37
53
|
}
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
items: MediaTableItem[];
|
|
42
|
-
mediaClient: MediaClient;
|
|
43
|
-
/** Object describing the column headings */
|
|
55
|
+
// @public (undocumented)
|
|
56
|
+
export interface MediaTableProps {
|
|
44
57
|
columns: HeadType;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
// (undocumented)
|
|
59
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
60
|
+
highlightedRowIndex?: number[];
|
|
61
|
+
isLoading?: boolean;
|
|
62
|
+
items: MediaTableItem[];
|
|
48
63
|
itemsPerPage?: number;
|
|
49
|
-
|
|
64
|
+
// (undocumented)
|
|
65
|
+
mediaClient: MediaClient;
|
|
66
|
+
onPreviewClose?: () => void;
|
|
67
|
+
onPreviewOpen?: () => void;
|
|
68
|
+
onRowClick?: (rowData: RowData, index: number) => boolean;
|
|
69
|
+
onSetPage?: (pageNumber: number) => void;
|
|
70
|
+
onSort?: (key: string, sortOrder: SortOrderType) => void;
|
|
50
71
|
pageNumber?: number;
|
|
51
|
-
/** The property that the table items are sorted by. This must match a key in columns.cells */
|
|
52
72
|
sortKey?: string;
|
|
53
|
-
/** The direction that the table items are sorted in - ascending or descending */
|
|
54
73
|
sortOrder?: SortOrderType;
|
|
55
|
-
|
|
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;
|
|
74
|
+
totalItems: number;
|
|
66
75
|
}
|
|
67
76
|
|
|
68
|
-
|
|
77
|
+
// @public (undocumented)
|
|
78
|
+
export const NameCell: FC<NameCellProps>;
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
// @public (undocumented)
|
|
81
|
+
export interface NameCellProps extends TruncateProps {
|
|
82
|
+
// (undocumented)
|
|
71
83
|
mediaType?: MediaType;
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
|
|
75
|
-
|
|
86
|
+
// @public (undocumented)
|
|
87
|
+
interface RowData {
|
|
88
|
+
// (undocumented)
|
|
89
|
+
[key: string]: React.ReactNode | string;
|
|
76
90
|
}
|
|
77
91
|
|
|
78
|
-
|
|
92
|
+
// @public (undocumented)
|
|
93
|
+
interface RowProps {
|
|
94
|
+
// (undocumented)
|
|
79
95
|
className?: string;
|
|
80
96
|
}
|
|
81
97
|
|
|
82
98
|
export { SortOrderType };
|
|
83
99
|
|
|
84
|
-
|
|
100
|
+
// (No @packageDocumentation comment for this package)
|
|
85
101
|
```
|
|
102
|
+
|
|
103
|
+
<!--SECTION END: Main Entry Types-->
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**@jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
|
-
import React, { Component } from 'react';
|
|
4
|
-
import { WrappedComponentProps } from 'react-intl-next';
|
|
5
|
-
import { MediaTableProps, MediaTableState } from '../types';
|
|
6
|
-
export declare class MediaTable extends Component<MediaTableProps & WrappedComponentProps, MediaTableState> {
|
|
7
|
-
state: MediaTableState;
|
|
8
|
-
private subscriptions;
|
|
9
|
-
private hasBeenMounted;
|
|
10
|
-
componentDidMount(): void;
|
|
11
|
-
private unsubscribe;
|
|
12
|
-
componentWillUnmount(): void;
|
|
13
|
-
private generateCellValues;
|
|
14
|
-
private onDownloadClick;
|
|
15
|
-
private onSort;
|
|
16
|
-
private renderRowValues;
|
|
17
|
-
private renderTable;
|
|
18
|
-
private openPreview;
|
|
19
|
-
private onRowEnterKeyPressed;
|
|
20
|
-
private onRowClick;
|
|
21
|
-
private safeSetState;
|
|
22
|
-
private onMediaViewerClose;
|
|
23
|
-
private renderMediaViewer;
|
|
24
|
-
render(): jsx.JSX.Element;
|
|
25
|
-
}
|
|
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>>>;
|
|
27
|
-
export default _default;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { MediaType } from '@atlaskit/media-client';
|
|
3
|
-
import { TruncateProps } from '@atlaskit/media-ui/truncateText';
|
|
4
|
-
export interface NameCellProps extends TruncateProps {
|
|
5
|
-
mediaType?: MediaType;
|
|
6
|
-
}
|
|
7
|
-
export declare const NameCell: FC<NameCellProps>;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Identifier, FileIdentifier, MediaClient } from '@atlaskit/media-client';
|
|
3
|
-
import { HeadType } from '@atlaskit/dynamic-table/types';
|
|
4
|
-
import { SortOrderType } from '@atlaskit/dynamic-table/types';
|
|
5
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
-
export type { SortOrderType };
|
|
7
|
-
export interface FileInfo {
|
|
8
|
-
fileName: string;
|
|
9
|
-
id: string;
|
|
10
|
-
}
|
|
11
|
-
export interface RowData {
|
|
12
|
-
[key: string]: string | React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export interface RowProps {
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface MediaTableItem {
|
|
18
|
-
data: RowData;
|
|
19
|
-
identifier: FileIdentifier;
|
|
20
|
-
/** An object containing props that will be applied to the row component */
|
|
21
|
-
rowProps?: RowProps;
|
|
22
|
-
}
|
|
23
|
-
export interface OnSortData {
|
|
24
|
-
key: string;
|
|
25
|
-
sortOrder: SortOrderType;
|
|
26
|
-
item: {
|
|
27
|
-
content: React.ReactNode | string;
|
|
28
|
-
isSortable: boolean;
|
|
29
|
-
key: string;
|
|
30
|
-
width: number;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface MediaTableProps {
|
|
34
|
-
/** The table rows to display in the current page */
|
|
35
|
-
items: MediaTableItem[];
|
|
36
|
-
mediaClient: MediaClient;
|
|
37
|
-
/** Object describing the column headings */
|
|
38
|
-
columns: HeadType;
|
|
39
|
-
/** The total number of table rows. This is used to calculate pagination */
|
|
40
|
-
totalItems: number;
|
|
41
|
-
/** The maximum number of rows per page. No maximum by default */
|
|
42
|
-
itemsPerPage?: number;
|
|
43
|
-
/** The current page number */
|
|
44
|
-
pageNumber?: number;
|
|
45
|
-
/** The property that the table items are sorted by. This must match a key in columns.cells */
|
|
46
|
-
sortKey?: string;
|
|
47
|
-
/** The direction that the table items are sorted in - ascending or descending */
|
|
48
|
-
sortOrder?: SortOrderType;
|
|
49
|
-
/** Whether to show the loading state or not */
|
|
50
|
-
isLoading?: boolean;
|
|
51
|
-
/** Called when a pagination control is clicked. Provides the new page number to paginate by */
|
|
52
|
-
onSetPage?: (pageNumber: number) => void;
|
|
53
|
-
/** Called when a column header is clicked. Provides the key of the column and the new sortOrder to sort by */
|
|
54
|
-
onSort?: (key: string, sortOrder: SortOrderType) => void;
|
|
55
|
-
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
56
|
-
/** Called when the preview is opened by the user clicking on an item in the table */
|
|
57
|
-
onPreviewOpen?: () => void;
|
|
58
|
-
/** Called when the preview is closed */
|
|
59
|
-
onPreviewClose?: () => void;
|
|
60
|
-
}
|
|
61
|
-
export interface MediaTableState {
|
|
62
|
-
mediaViewerSelectedItem?: Identifier;
|
|
63
|
-
fileInfoState: Map<string, FileInfo>;
|
|
64
|
-
}
|
|
65
|
-
export interface ValidatedProps {
|
|
66
|
-
validPageNumber: number;
|
|
67
|
-
validTotalItems: number;
|
|
68
|
-
validItemsPerPage: number;
|
|
69
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RowType, HeadCellType, RowCellType } from '@atlaskit/dynamic-table/types';
|
|
2
|
-
export declare const generateEmptyRow: import("memoize-one").MemoizedFn<(headerCells: HeadCellType[]) => RowCellType[]>;
|
|
3
|
-
export declare const prependRows: import("memoize-one").MemoizedFn<(emptyCells: RowCellType[], itemsPerPage?: number | undefined, pageNumber?: number | undefined) => RowType[]>;
|
|
4
|
-
export declare const appendRows: import("memoize-one").MemoizedFn<(emptyCells: RowCellType[], rowsLength: number, itemsPerPage?: number | undefined, pageNumber?: number | undefined, totalItems?: number | undefined) => RowType[]>;
|
|
5
|
-
export default function generateRowValues({ itemsPerPage, pageNumber, totalItems, rowValues, headerCells, }: {
|
|
6
|
-
itemsPerPage?: number;
|
|
7
|
-
pageNumber?: number;
|
|
8
|
-
totalItems?: number;
|
|
9
|
-
rowValues: RowType[];
|
|
10
|
-
headerCells: HeadCellType[];
|
|
11
|
-
}): RowType[];
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as generateRowValues } from './generateRowValues';
|
|
2
|
-
export { default as getValidTableProps } from './getValidTableProps';
|
|
3
|
-
export { default as generateHeadValues } from './generateHeadValues';
|
|
4
|
-
export { CELL_KEY_DOWNLOAD, ANALYTICS_MEDIA_CHANNEL } from './constants';
|