@atlaskit/media-table 14.1.2 → 14.1.4
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 +12 -0
- package/dist/cjs/component/downloadButton.js +2 -19
- package/dist/cjs/component/mediaTable.js +28 -86
- package/dist/cjs/component/nameCell.js +2 -13
- package/dist/cjs/component/previewButton.js +1 -15
- package/dist/cjs/component/styles.js +0 -5
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/util/generateHeadValues.js +0 -9
- package/dist/cjs/util/generateRowValues.js +5 -12
- package/dist/cjs/util/getValidTableProps.js +9 -19
- package/dist/cjs/util/index.js +0 -5
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/component/downloadButton.js +9 -9
- package/dist/es2019/component/mediaTable.js +2 -29
- package/dist/es2019/component/nameCell.js +0 -1
- package/dist/es2019/component/previewButton.js +8 -7
- package/dist/es2019/util/generateRowValues.js +0 -4
- package/dist/es2019/util/getValidTableProps.js +8 -15
- package/dist/es2019/version.json +1 -1
- package/dist/esm/component/downloadButton.js +6 -12
- package/dist/esm/component/mediaTable.js +30 -78
- package/dist/esm/component/nameCell.js +2 -4
- package/dist/esm/component/previewButton.js +5 -10
- package/dist/esm/component/styles.js +0 -2
- package/dist/esm/util/generateHeadValues.js +0 -3
- package/dist/esm/util/generateRowValues.js +4 -8
- package/dist/esm/util/getValidTableProps.js +8 -15
- package/dist/esm/version.json +1 -1
- package/package.json +8 -8
- package/report.api.md +18 -1
|
@@ -7,20 +7,15 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
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
|
-
|
|
13
11
|
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; }
|
|
14
|
-
|
|
15
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
-
|
|
17
13
|
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
|
-
|
|
19
14
|
/**@jsx jsx */
|
|
20
15
|
import { jsx } from '@emotion/react';
|
|
21
16
|
import React, { Component } from 'react';
|
|
22
|
-
import ReactDOM from 'react-dom';
|
|
23
|
-
|
|
17
|
+
import ReactDOM from 'react-dom';
|
|
18
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
24
19
|
import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
25
20
|
import { DynamicTableStateless } from '@atlaskit/dynamic-table';
|
|
26
21
|
import { isFileIdentifier, withMediaClient, isProcessedFileState } from '@atlaskit/media-client';
|
|
@@ -32,36 +27,25 @@ import { generateRowValues, getValidTableProps, generateHeadValues, CELL_KEY_DOW
|
|
|
32
27
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
33
28
|
export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
34
29
|
_inherits(MediaTable, _Component);
|
|
35
|
-
|
|
36
30
|
var _super = _createSuper(MediaTable);
|
|
37
|
-
|
|
38
31
|
function MediaTable() {
|
|
39
32
|
var _this;
|
|
40
|
-
|
|
41
33
|
_classCallCheck(this, MediaTable);
|
|
42
|
-
|
|
43
34
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
35
|
args[_key] = arguments[_key];
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
48
|
-
|
|
49
38
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
50
39
|
fileInfoState: new Map()
|
|
51
40
|
});
|
|
52
|
-
|
|
53
41
|
_defineProperty(_assertThisInitialized(_this), "subscriptions", []);
|
|
54
|
-
|
|
55
42
|
_defineProperty(_assertThisInitialized(_this), "hasBeenMounted", false);
|
|
56
|
-
|
|
57
43
|
_defineProperty(_assertThisInitialized(_this), "unsubscribe", function () {
|
|
58
44
|
_this.subscriptions.forEach(function (subscription) {
|
|
59
45
|
return subscription.unsubscribe();
|
|
60
46
|
});
|
|
61
|
-
|
|
62
47
|
_this.subscriptions = [];
|
|
63
48
|
});
|
|
64
|
-
|
|
65
49
|
_defineProperty(_assertThisInitialized(_this), "generateCellValues", function (data, identifier) {
|
|
66
50
|
var cellValues = [];
|
|
67
51
|
var columns = _this.props.columns;
|
|
@@ -78,11 +62,10 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
78
62
|
});
|
|
79
63
|
return cellValues;
|
|
80
64
|
});
|
|
81
|
-
|
|
82
65
|
_defineProperty(_assertThisInitialized(_this), "onDownloadClick", function (identifier) {
|
|
83
66
|
return function (event) {
|
|
84
67
|
var id = identifier.id,
|
|
85
|
-
|
|
68
|
+
collectionName = identifier.collectionName;
|
|
86
69
|
event.stopPropagation();
|
|
87
70
|
var mediaClient = _this.props.mediaClient;
|
|
88
71
|
var fileInfoState = _this.state.fileInfoState;
|
|
@@ -90,31 +73,27 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
90
73
|
mediaClient.file.downloadBinary(id, nameInfo ? nameInfo.fileName : '', collectionName);
|
|
91
74
|
};
|
|
92
75
|
});
|
|
93
|
-
|
|
94
76
|
_defineProperty(_assertThisInitialized(_this), "onPreviewClick", function (identifier) {
|
|
95
77
|
return function (event) {
|
|
96
78
|
event.stopPropagation();
|
|
97
|
-
|
|
98
79
|
_this.openPreview(identifier);
|
|
99
80
|
};
|
|
100
81
|
});
|
|
101
|
-
|
|
102
82
|
_defineProperty(_assertThisInitialized(_this), "onSort", function (data) {
|
|
103
83
|
var onSort = _this.props.onSort;
|
|
104
84
|
var key = data.key,
|
|
105
|
-
|
|
106
|
-
|
|
85
|
+
sortOrder = data.sortOrder,
|
|
86
|
+
item = data.item;
|
|
107
87
|
item && item.isSortable && onSort && onSort(key, sortOrder);
|
|
108
88
|
});
|
|
109
|
-
|
|
110
89
|
_defineProperty(_assertThisInitialized(_this), "renderRowValues", function (validItemsPerPage, validPageNumber, validTotalItems) {
|
|
111
90
|
var _this$props = _this.props,
|
|
112
|
-
|
|
113
|
-
|
|
91
|
+
items = _this$props.items,
|
|
92
|
+
columns = _this$props.columns;
|
|
114
93
|
var rowValues = items.map(function (item, index) {
|
|
115
94
|
var data = item.data,
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
identifier = item.identifier,
|
|
96
|
+
rowProps = item.rowProps;
|
|
118
97
|
return _objectSpread({
|
|
119
98
|
cells: _this.generateCellValues(data, identifier),
|
|
120
99
|
key: identifier.id,
|
|
@@ -135,25 +114,22 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
135
114
|
headerCells: columns.cells
|
|
136
115
|
});
|
|
137
116
|
});
|
|
138
|
-
|
|
139
117
|
_defineProperty(_assertThisInitialized(_this), "renderTable", function () {
|
|
140
118
|
var _this$props2 = _this.props,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
119
|
+
columns = _this$props2.columns,
|
|
120
|
+
itemsPerPage = _this$props2.itemsPerPage,
|
|
121
|
+
isLoading = _this$props2.isLoading,
|
|
122
|
+
pageNumber = _this$props2.pageNumber,
|
|
123
|
+
onSetPage = _this$props2.onSetPage,
|
|
124
|
+
totalItems = _this$props2.totalItems,
|
|
125
|
+
items = _this$props2.items,
|
|
126
|
+
sortKey = _this$props2.sortKey,
|
|
127
|
+
sortOrder = _this$props2.sortOrder,
|
|
128
|
+
highlightedRowIndex = _this$props2.highlightedRowIndex;
|
|
152
129
|
var _getValidTableProps = getValidTableProps(items.length, itemsPerPage, pageNumber, totalItems),
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
130
|
+
validItemsPerPage = _getValidTableProps.validItemsPerPage,
|
|
131
|
+
validPageNumber = _getValidTableProps.validPageNumber,
|
|
132
|
+
validTotalItems = _getValidTableProps.validTotalItems;
|
|
157
133
|
var rowsPerPage = validTotalItems <= validItemsPerPage ? undefined : validItemsPerPage;
|
|
158
134
|
return jsx(DynamicTableStateless, {
|
|
159
135
|
caption: '',
|
|
@@ -171,21 +147,17 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
171
147
|
highlightedRowIndex: highlightedRowIndex
|
|
172
148
|
});
|
|
173
149
|
});
|
|
174
|
-
|
|
175
150
|
_defineProperty(_assertThisInitialized(_this), "openPreview", function (identifier) {
|
|
176
151
|
var onPreviewOpen = _this.props.onPreviewOpen;
|
|
177
|
-
|
|
178
152
|
_this.safeSetState({
|
|
179
153
|
mediaViewerSelectedItem: identifier
|
|
180
154
|
});
|
|
181
|
-
|
|
182
155
|
onPreviewOpen && onPreviewOpen();
|
|
183
156
|
});
|
|
184
|
-
|
|
185
157
|
_defineProperty(_assertThisInitialized(_this), "onRowEnterKeyPressed", function (identifier, data, index) {
|
|
186
158
|
var _this$props3 = _this.props,
|
|
187
|
-
|
|
188
|
-
|
|
159
|
+
createAnalyticsEvent = _this$props3.createAnalyticsEvent,
|
|
160
|
+
onRowClick = _this$props3.onRowClick;
|
|
189
161
|
var ev = createAnalyticsEvent({
|
|
190
162
|
eventType: 'ui',
|
|
191
163
|
action: 'keyPressed',
|
|
@@ -194,17 +166,15 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
194
166
|
});
|
|
195
167
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
196
168
|
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
197
|
-
|
|
198
169
|
if (!shouldPreventDefaultRowClick) {
|
|
199
170
|
_this.openPreview(identifier);
|
|
200
171
|
}
|
|
201
172
|
});
|
|
202
|
-
|
|
203
173
|
_defineProperty(_assertThisInitialized(_this), "onRowClick", function (identifier, data, index) {
|
|
204
174
|
return function () {
|
|
205
175
|
var _this$props4 = _this.props,
|
|
206
|
-
|
|
207
|
-
|
|
176
|
+
createAnalyticsEvent = _this$props4.createAnalyticsEvent,
|
|
177
|
+
onRowClick = _this$props4.onRowClick;
|
|
208
178
|
var ev = createAnalyticsEvent({
|
|
209
179
|
eventType: 'ui',
|
|
210
180
|
action: 'clicked',
|
|
@@ -213,39 +183,31 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
213
183
|
});
|
|
214
184
|
ev.fire(ANALYTICS_MEDIA_CHANNEL);
|
|
215
185
|
var shouldPreventDefaultRowClick = onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(data, index);
|
|
216
|
-
|
|
217
186
|
if (!shouldPreventDefaultRowClick) {
|
|
218
187
|
_this.openPreview(identifier);
|
|
219
188
|
}
|
|
220
189
|
};
|
|
221
190
|
});
|
|
222
|
-
|
|
223
191
|
_defineProperty(_assertThisInitialized(_this), "safeSetState", function (state) {
|
|
224
192
|
if (_this.hasBeenMounted) {
|
|
225
193
|
_this.setState(state);
|
|
226
194
|
}
|
|
227
195
|
});
|
|
228
|
-
|
|
229
196
|
_defineProperty(_assertThisInitialized(_this), "onMediaViewerClose", function () {
|
|
230
197
|
var onPreviewClose = _this.props.onPreviewClose;
|
|
231
|
-
|
|
232
198
|
_this.safeSetState({
|
|
233
199
|
mediaViewerSelectedItem: undefined
|
|
234
200
|
});
|
|
235
|
-
|
|
236
201
|
onPreviewClose && onPreviewClose();
|
|
237
202
|
});
|
|
238
|
-
|
|
239
203
|
_defineProperty(_assertThisInitialized(_this), "renderMediaViewer", function () {
|
|
240
204
|
var mediaViewerSelectedItem = _this.state.mediaViewerSelectedItem;
|
|
241
205
|
var _this$props5 = _this.props,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
206
|
+
mediaClient = _this$props5.mediaClient,
|
|
207
|
+
items = _this$props5.items;
|
|
245
208
|
if (!mediaViewerSelectedItem) {
|
|
246
209
|
return null;
|
|
247
210
|
}
|
|
248
|
-
|
|
249
211
|
var dataSource = {
|
|
250
212
|
list: items.map(function (item) {
|
|
251
213
|
return item.identifier;
|
|
@@ -260,23 +222,19 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
260
222
|
collectionName: collectionName
|
|
261
223
|
}), document.body);
|
|
262
224
|
});
|
|
263
|
-
|
|
264
225
|
return _this;
|
|
265
226
|
}
|
|
266
|
-
|
|
267
227
|
_createClass(MediaTable, [{
|
|
268
228
|
key: "componentDidMount",
|
|
269
229
|
value: function componentDidMount() {
|
|
270
230
|
var _this2 = this;
|
|
271
|
-
|
|
272
231
|
this.hasBeenMounted = true;
|
|
273
232
|
var _this$props6 = this.props,
|
|
274
|
-
|
|
275
|
-
|
|
233
|
+
items = _this$props6.items,
|
|
234
|
+
mediaClient = _this$props6.mediaClient;
|
|
276
235
|
items.forEach( /*#__PURE__*/function () {
|
|
277
236
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
278
237
|
var _item$identifier, id, _item$identifier$coll, collectionName, subscription;
|
|
279
|
-
|
|
280
238
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
281
239
|
while (1) {
|
|
282
240
|
switch (_context.prev = _context.next) {
|
|
@@ -287,13 +245,11 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
287
245
|
}).subscribe({
|
|
288
246
|
next: function next(fileState) {
|
|
289
247
|
var fileInfoState = _this2.state.fileInfoState;
|
|
290
|
-
|
|
291
248
|
if (isProcessedFileState(fileState)) {
|
|
292
249
|
fileInfoState.set(id, {
|
|
293
250
|
fileName: fileState.name,
|
|
294
251
|
id: id
|
|
295
252
|
});
|
|
296
|
-
|
|
297
253
|
if (_this2.hasBeenMounted) {
|
|
298
254
|
_this2.safeSetState({
|
|
299
255
|
fileInfoState: fileInfoState
|
|
@@ -302,9 +258,7 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
302
258
|
}
|
|
303
259
|
}
|
|
304
260
|
});
|
|
305
|
-
|
|
306
261
|
_this2.subscriptions.push(subscription);
|
|
307
|
-
|
|
308
262
|
case 3:
|
|
309
263
|
case "end":
|
|
310
264
|
return _context.stop();
|
|
@@ -312,7 +266,6 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
312
266
|
}
|
|
313
267
|
}, _callee);
|
|
314
268
|
}));
|
|
315
|
-
|
|
316
269
|
return function (_x) {
|
|
317
270
|
return _ref.apply(this, arguments);
|
|
318
271
|
};
|
|
@@ -335,7 +288,6 @@ export var MediaTable = /*#__PURE__*/function (_Component) {
|
|
|
335
288
|
}, content);
|
|
336
289
|
}
|
|
337
290
|
}]);
|
|
338
|
-
|
|
339
291
|
return MediaTable;
|
|
340
292
|
}(Component);
|
|
341
293
|
export default withMediaClient(withAnalyticsEvents()(injectIntl(MediaTable, {
|
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
|
|
5
4
|
/**@jsx jsx */
|
|
6
5
|
import { jsx } from '@emotion/react';
|
|
7
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -10,9 +9,8 @@ import { MediaTypeIcon } from '@atlaskit/media-ui/media-type-icon';
|
|
|
10
9
|
import { nameCellWrapperStyles, truncateWrapperStyles } from './styles';
|
|
11
10
|
export var NameCell = function NameCell(props) {
|
|
12
11
|
var mediaType = props.mediaType,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
text = props.text,
|
|
13
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
16
14
|
return jsx("div", {
|
|
17
15
|
css: nameCellWrapperStyles
|
|
18
16
|
}, mediaType && jsx(MediaTypeIcon, {
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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
3
|
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
|
-
|
|
8
|
-
|
|
4
|
+
import React from 'react';
|
|
5
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
9
6
|
import { injectIntl } from 'react-intl-next';
|
|
10
7
|
import EditorFilePreviewIcon from '@atlaskit/icon/glyph/editor/file-preview';
|
|
11
8
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
12
|
-
import { messages } from '@atlaskit/media-ui';
|
|
9
|
+
import { messages } from '@atlaskit/media-ui';
|
|
10
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
13
11
|
|
|
14
12
|
import { ANALYTICS_MEDIA_CHANNEL } from '../util';
|
|
15
|
-
|
|
16
13
|
var MediaPreviewButton = function MediaPreviewButton(props) {
|
|
17
14
|
var _onClick = props.onClick,
|
|
18
|
-
|
|
15
|
+
formatMessage = props.intl.formatMessage;
|
|
19
16
|
return /*#__PURE__*/React.createElement(Button, {
|
|
20
17
|
appearance: "subtle",
|
|
21
18
|
testId: "preview-button",
|
|
@@ -32,7 +29,6 @@ var MediaPreviewButton = function MediaPreviewButton(props) {
|
|
|
32
29
|
actionSubjectId: 'mediaTablePreview'
|
|
33
30
|
});
|
|
34
31
|
}).fire(ANALYTICS_MEDIA_CHANNEL);
|
|
35
|
-
|
|
36
32
|
_onClick(event);
|
|
37
33
|
},
|
|
38
34
|
theme: function theme(current, themeProps) {
|
|
@@ -45,5 +41,4 @@ var MediaPreviewButton = function MediaPreviewButton(props) {
|
|
|
45
41
|
}
|
|
46
42
|
});
|
|
47
43
|
};
|
|
48
|
-
|
|
49
44
|
export default injectIntl(MediaPreviewButton);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
-
|
|
5
3
|
import { css } from '@emotion/react';
|
|
6
4
|
export var nameCellWrapperStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-content: center;\n align-items: center;\n"])));
|
|
7
5
|
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"])));
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
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
3
|
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
4
|
import memoizeOne from 'memoize-one';
|
|
8
5
|
import { CELL_KEY_DOWNLOAD, CELL_KEY_PREVIEW } from './constants';
|
|
9
6
|
var generateHeadValues = memoizeOne(function (columns) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
3
|
import memoizeOne from 'memoize-one';
|
|
4
|
-
|
|
5
4
|
function generateEmptyRows(emptyCells, length) {
|
|
6
5
|
var itemsArray = Array.from({
|
|
7
6
|
length: length
|
|
@@ -12,7 +11,6 @@ function generateEmptyRows(emptyCells, length) {
|
|
|
12
11
|
};
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
export var generateEmptyRow = memoizeOne(function (headerCells) {
|
|
17
15
|
return headerCells.map(function (cell) {
|
|
18
16
|
return {
|
|
@@ -25,7 +23,6 @@ export var prependRows = memoizeOne(function (emptyCells, itemsPerPage, pageNumb
|
|
|
25
23
|
if (!itemsPerPage || !pageNumber) {
|
|
26
24
|
return [];
|
|
27
25
|
}
|
|
28
|
-
|
|
29
26
|
var itemsCount = (pageNumber - 1) * itemsPerPage;
|
|
30
27
|
return generateEmptyRows(emptyCells, itemsCount);
|
|
31
28
|
});
|
|
@@ -33,17 +30,16 @@ export var appendRows = memoizeOne(function (emptyCells, rowsLength, itemsPerPag
|
|
|
33
30
|
if (!itemsPerPage || !pageNumber || !totalItems) {
|
|
34
31
|
return [];
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
var rowsDiff = rowsLength > itemsPerPage ? rowsLength - itemsPerPage : 0;
|
|
38
34
|
var itemsCount = (Math.ceil(totalItems / itemsPerPage) - pageNumber) * itemsPerPage - rowsDiff;
|
|
39
35
|
return generateEmptyRows(emptyCells, itemsCount);
|
|
40
36
|
});
|
|
41
37
|
export default function generateRowValues(_ref) {
|
|
42
38
|
var itemsPerPage = _ref.itemsPerPage,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
pageNumber = _ref.pageNumber,
|
|
40
|
+
totalItems = _ref.totalItems,
|
|
41
|
+
rowValues = _ref.rowValues,
|
|
42
|
+
headerCells = _ref.headerCells;
|
|
47
43
|
var emptyCells = generateEmptyRow(headerCells);
|
|
48
44
|
return [].concat(_toConsumableArray(prependRows(emptyCells, itemsPerPage, pageNumber)), _toConsumableArray(rowValues), _toConsumableArray(appendRows(emptyCells, rowValues.length, itemsPerPage, pageNumber, totalItems)));
|
|
49
45
|
}
|
|
@@ -1,43 +1,36 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
2
|
import memoizeOne from 'memoize-one';
|
|
3
3
|
var DEFAULT_ITEMS_PER_PAGE = 6;
|
|
4
|
-
|
|
5
4
|
var getValidTableProps = function getValidTableProps(itemsCount, itemsPerPage, pageNumber, totalItems) {
|
|
6
5
|
var validItemsPerPage = itemsPerPage || DEFAULT_ITEMS_PER_PAGE;
|
|
7
6
|
var validTotalItems = totalItems || itemsCount;
|
|
8
7
|
var validPageNumber = pageNumber || 1;
|
|
9
|
-
|
|
10
8
|
if (validItemsPerPage < 0) {
|
|
11
|
-
validItemsPerPage = DEFAULT_ITEMS_PER_PAGE;
|
|
12
|
-
|
|
9
|
+
validItemsPerPage = DEFAULT_ITEMS_PER_PAGE;
|
|
10
|
+
// eslint-disable-next-line no-console
|
|
13
11
|
console.warn('Invalid itemsPerPage prop provided to MediaTable. Setting value to default.');
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
if (validTotalItems < 0) {
|
|
17
|
-
validTotalItems = itemsCount;
|
|
18
|
-
|
|
14
|
+
validTotalItems = itemsCount;
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
19
16
|
console.warn('Invalid totalItems prop provided to MediaTable. Defaulting to length of items array.');
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
if (validPageNumber < 0) {
|
|
23
|
-
validPageNumber = 1;
|
|
24
|
-
|
|
19
|
+
validPageNumber = 1;
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
25
21
|
console.warn('Invalid pageNumber prop provided to MediaTable. Defaulting to first page.');
|
|
26
22
|
} else {
|
|
27
23
|
var totalPages = Math.ceil(validTotalItems / validItemsPerPage);
|
|
28
|
-
|
|
29
24
|
if (validPageNumber > totalPages) {
|
|
30
|
-
validPageNumber = totalPages;
|
|
31
|
-
|
|
25
|
+
validPageNumber = totalPages;
|
|
26
|
+
// eslint-disable-next-line no-console
|
|
32
27
|
console.warn('Invalid pageNumber prop provided to MediaTable. Defaulting to last page.');
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
return {
|
|
37
31
|
validPageNumber: validPageNumber,
|
|
38
32
|
validTotalItems: validTotalItems,
|
|
39
33
|
validItemsPerPage: validItemsPerPage
|
|
40
34
|
};
|
|
41
35
|
};
|
|
42
|
-
|
|
43
36
|
export default memoizeOne(getValidTableProps);
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-table",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.4",
|
|
4
4
|
"description": "Table UI component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
"@atlaskit/button": "^16.5.0",
|
|
31
31
|
"@atlaskit/dynamic-table": "^14.8.0",
|
|
32
32
|
"@atlaskit/icon": "^21.11.0",
|
|
33
|
-
"@atlaskit/media-client": "^
|
|
34
|
-
"@atlaskit/media-ui": "^22.
|
|
35
|
-
"@atlaskit/media-viewer": "^47.
|
|
33
|
+
"@atlaskit/media-client": "^20.0.0",
|
|
34
|
+
"@atlaskit/media-ui": "^22.3.0",
|
|
35
|
+
"@atlaskit/media-viewer": "^47.4.0",
|
|
36
36
|
"@atlaskit/theme": "^12.2.0",
|
|
37
|
-
"@atlaskit/tokens": "^0.
|
|
37
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
38
38
|
"@atlaskit/tooltip": "^17.6.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"memoize-one": "^6.0.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@atlaskit/media-core": "^34.0.
|
|
43
|
+
"@atlaskit/media-core": "^34.0.1",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
45
45
|
"react": "^16.8.0",
|
|
46
46
|
"react-dom": "^16.8.0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@atlaskit/docs": "^9.0.0",
|
|
51
51
|
"@atlaskit/icon-file-type": "^6.3.0",
|
|
52
|
-
"@atlaskit/media-common": "^2.
|
|
52
|
+
"@atlaskit/media-common": "^2.19.0",
|
|
53
53
|
"@atlaskit/media-core": "^34.0.0",
|
|
54
|
-
"@atlaskit/media-test-helpers": "^30.
|
|
54
|
+
"@atlaskit/media-test-helpers": "^30.1.0",
|
|
55
55
|
"@atlaskit/range": "^7.0.0",
|
|
56
56
|
"@atlaskit/ssr": "*",
|
|
57
57
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
package/report.api.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- API Report Version: 2.
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
2
|
|
|
3
3
|
## API Report File for "@atlaskit/media-table"
|
|
4
4
|
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -101,3 +102,19 @@ export { SortOrderType };
|
|
|
101
102
|
```
|
|
102
103
|
|
|
103
104
|
<!--SECTION END: Main Entry Types-->
|
|
105
|
+
|
|
106
|
+
### Peer Dependencies
|
|
107
|
+
|
|
108
|
+
<!--SECTION START: Peer Dependencies-->
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"@atlaskit/media-core": "^34.0.1",
|
|
113
|
+
"@emotion/react": "^11.7.1",
|
|
114
|
+
"react": "^16.8.0",
|
|
115
|
+
"react-dom": "^16.8.0",
|
|
116
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<!--SECTION END: Peer Dependencies-->
|