@atlaskit/link-datasource 1.6.2 → 1.6.3
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 +7 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/ui/assets-modal/modal/index.js +1 -1
- package/dist/cjs/ui/issue-like-table/index.js +62 -64
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/ui/assets-modal/modal/index.js +1 -1
- package/dist/es2019/ui/issue-like-table/index.js +8 -15
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/ui/assets-modal/modal/index.js +1 -1
- package/dist/esm/ui/issue-like-table/index.js +61 -63
- package/dist/types/ui/issue-like-table/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#41133](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41133) [`598eb394b7e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/598eb394b7e) - [ux] fix the order of columns is incorrect in column picker problem
|
|
8
|
+
[ux] Do not reorder columns when the column picker is open
|
|
9
|
+
|
|
3
10
|
## 1.6.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -234,7 +234,7 @@ var analyticsContextAttributes = {
|
|
|
234
234
|
};
|
|
235
235
|
var analyticsContextData = {
|
|
236
236
|
packageName: "@atlaskit/link-datasource",
|
|
237
|
-
packageVersion: "1.6.
|
|
237
|
+
packageVersion: "1.6.3",
|
|
238
238
|
source: 'datasourceConfigModal'
|
|
239
239
|
};
|
|
240
240
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.IssueLikeDataTableView = exports.EmptyState = void 0;
|
|
7
|
+
exports.orderColumns = exports.IssueLikeDataTableView = exports.EmptyState = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -72,22 +72,18 @@ function extractIndex(data) {
|
|
|
72
72
|
(0, _tinyInvariant.default)(typeof index === 'number');
|
|
73
73
|
return index;
|
|
74
74
|
}
|
|
75
|
-
var orderColumns = function orderColumns(columns, visibleColumnKeys) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
columns.forEach(function (_ref, index) {
|
|
80
|
-
var key = _ref.key;
|
|
81
|
-
if (!visibleColumnKeys.includes(key)) {
|
|
82
|
-
visibleColumnKeys.splice(index, 0, key);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
columns.sort(function (a, b) {
|
|
75
|
+
var orderColumns = exports.orderColumns = function orderColumns(columns, visibleColumnKeys) {
|
|
76
|
+
var visibleColumns = columns.filter(function (column) {
|
|
77
|
+
return visibleColumnKeys.includes(column.key);
|
|
78
|
+
}).sort(function (a, b) {
|
|
86
79
|
var indexB = visibleColumnKeys.indexOf(b.key);
|
|
87
80
|
var indexA = visibleColumnKeys.indexOf(a.key);
|
|
88
81
|
return indexA - indexB;
|
|
89
82
|
});
|
|
90
|
-
|
|
83
|
+
var invisibleColumns = columns.filter(function (column) {
|
|
84
|
+
return !visibleColumnKeys.includes(column.key);
|
|
85
|
+
});
|
|
86
|
+
return [].concat((0, _toConsumableArray2.default)(visibleColumns), (0, _toConsumableArray2.default)(invisibleColumns));
|
|
91
87
|
};
|
|
92
88
|
var BASE_WIDTH = 8;
|
|
93
89
|
function getColumnWidth(key, type) {
|
|
@@ -112,21 +108,21 @@ function getColumnWidth(key, type) {
|
|
|
112
108
|
return undefined;
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
|
-
var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLikeDataTableView(
|
|
116
|
-
var testId =
|
|
117
|
-
onNextPage =
|
|
118
|
-
onLoadDatasourceDetails =
|
|
119
|
-
items =
|
|
120
|
-
columns =
|
|
121
|
-
|
|
122
|
-
renderItem =
|
|
123
|
-
visibleColumnKeys =
|
|
124
|
-
onVisibleColumnKeysChange =
|
|
125
|
-
status =
|
|
126
|
-
hasNextPage =
|
|
127
|
-
scrollableContainerHeight =
|
|
128
|
-
parentContainerRenderInstanceId =
|
|
129
|
-
extensionKey =
|
|
111
|
+
var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
112
|
+
var testId = _ref.testId,
|
|
113
|
+
onNextPage = _ref.onNextPage,
|
|
114
|
+
onLoadDatasourceDetails = _ref.onLoadDatasourceDetails,
|
|
115
|
+
items = _ref.items,
|
|
116
|
+
columns = _ref.columns,
|
|
117
|
+
_ref$renderItem = _ref.renderItem,
|
|
118
|
+
renderItem = _ref$renderItem === void 0 ? _renderType.fallbackRenderType : _ref$renderItem,
|
|
119
|
+
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
120
|
+
onVisibleColumnKeysChange = _ref.onVisibleColumnKeysChange,
|
|
121
|
+
status = _ref.status,
|
|
122
|
+
hasNextPage = _ref.hasNextPage,
|
|
123
|
+
scrollableContainerHeight = _ref.scrollableContainerHeight,
|
|
124
|
+
parentContainerRenderInstanceId = _ref.parentContainerRenderInstanceId,
|
|
125
|
+
extensionKey = _ref.extensionKey;
|
|
130
126
|
var tableId = (0, _react.useMemo)(function () {
|
|
131
127
|
return Symbol('unique-id');
|
|
132
128
|
}, []);
|
|
@@ -147,8 +143,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
147
143
|
orderedColumns = _useState6[0],
|
|
148
144
|
setOrderedColumns = _useState6[1];
|
|
149
145
|
(0, _react.useEffect)(function () {
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
if (!hasFullSchema) {
|
|
147
|
+
setOrderedColumns(orderColumns((0, _toConsumableArray2.default)(columns), (0, _toConsumableArray2.default)(visibleColumnKeys)));
|
|
148
|
+
}
|
|
149
|
+
}, [columns, visibleColumnKeys, hasFullSchema]);
|
|
152
150
|
(0, _react.useEffect)(function () {
|
|
153
151
|
if (parentContainerRenderInstanceId && status === 'resolved') {
|
|
154
152
|
(0, _ufoExperiences.succeedUfoExperience)({
|
|
@@ -158,8 +156,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
158
156
|
}, [parentContainerRenderInstanceId, status]);
|
|
159
157
|
var visibleSortedColumns = (0, _react.useMemo)(function () {
|
|
160
158
|
return visibleColumnKeys.map(function (visibleKey) {
|
|
161
|
-
return orderedColumns.find(function (
|
|
162
|
-
var key =
|
|
159
|
+
return orderedColumns.find(function (_ref2) {
|
|
160
|
+
var key = _ref2.key;
|
|
163
161
|
return visibleKey === key;
|
|
164
162
|
});
|
|
165
163
|
}).filter(Boolean);
|
|
@@ -173,8 +171,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
173
171
|
var loadingRow = (0, _react.useMemo)(function () {
|
|
174
172
|
return {
|
|
175
173
|
key: 'loading',
|
|
176
|
-
cells: visibleSortedColumns.map(function (
|
|
177
|
-
var key =
|
|
174
|
+
cells: visibleSortedColumns.map(function (_ref3) {
|
|
175
|
+
var key = _ref3.key;
|
|
178
176
|
var content = (0, _react2.jsx)(_linkingCommon.Skeleton, {
|
|
179
177
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
180
178
|
width: '100%',
|
|
@@ -188,10 +186,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
188
186
|
};
|
|
189
187
|
}, [visibleSortedColumns]);
|
|
190
188
|
var headColumns = (0, _react.useMemo)(function () {
|
|
191
|
-
return visibleSortedColumns.map(function (
|
|
192
|
-
var key =
|
|
193
|
-
title =
|
|
194
|
-
type =
|
|
189
|
+
return visibleSortedColumns.map(function (_ref4) {
|
|
190
|
+
var key = _ref4.key,
|
|
191
|
+
title = _ref4.title,
|
|
192
|
+
type = _ref4.type;
|
|
195
193
|
return {
|
|
196
194
|
key: key,
|
|
197
195
|
content: title,
|
|
@@ -218,9 +216,9 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
218
216
|
return;
|
|
219
217
|
}
|
|
220
218
|
return (0, _combine.combine)((0, _element.monitorForElements)({
|
|
221
|
-
onDragStart: function onDragStart(
|
|
219
|
+
onDragStart: function onDragStart(_ref5) {
|
|
222
220
|
var _containerRef$current;
|
|
223
|
-
var location =
|
|
221
|
+
var location = _ref5.location;
|
|
224
222
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
225
223
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.start({
|
|
226
224
|
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
@@ -233,18 +231,18 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
233
231
|
behavior: 'container-only'
|
|
234
232
|
});
|
|
235
233
|
},
|
|
236
|
-
onDrag: function onDrag(
|
|
234
|
+
onDrag: function onDrag(_ref6) {
|
|
237
235
|
var _containerRef$current2;
|
|
238
|
-
var location =
|
|
236
|
+
var location = _ref6.location;
|
|
239
237
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.updateInput({
|
|
240
238
|
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
241
239
|
clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
|
|
242
240
|
})
|
|
243
241
|
});
|
|
244
242
|
},
|
|
245
|
-
onDrop: function onDrop(
|
|
246
|
-
var source =
|
|
247
|
-
location =
|
|
243
|
+
onDrop: function onDrop(_ref7) {
|
|
244
|
+
var source = _ref7.source,
|
|
245
|
+
location = _ref7.location;
|
|
248
246
|
_pragmaticDragAndDropReactBeautifulDndAutoscroll.autoScroller.stop();
|
|
249
247
|
if (location.current.dropTargets.length === 0) {
|
|
250
248
|
return;
|
|
@@ -279,10 +277,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
279
277
|
return items.map(function (newRowData, rowIndex) {
|
|
280
278
|
return {
|
|
281
279
|
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
282
|
-
cells: visibleSortedColumns.map(function (
|
|
280
|
+
cells: visibleSortedColumns.map(function (_ref8) {
|
|
283
281
|
var _newRowData$key;
|
|
284
|
-
var key =
|
|
285
|
-
type =
|
|
282
|
+
var key = _ref8.key,
|
|
283
|
+
type = _ref8.type;
|
|
286
284
|
var value = ((_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data) || newRowData[key];
|
|
287
285
|
var values = Array.isArray(value) ? value : [value];
|
|
288
286
|
var content = values.map(function (value) {
|
|
@@ -356,10 +354,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
356
354
|
}, (0, _react2.jsx)("thead", {
|
|
357
355
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
358
356
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
359
|
-
}, (0, _react2.jsx)("tr", null, headColumns.map(function (
|
|
360
|
-
var key =
|
|
361
|
-
content =
|
|
362
|
-
maxWidth =
|
|
357
|
+
}, (0, _react2.jsx)("tr", null, headColumns.map(function (_ref10, cellIndex) {
|
|
358
|
+
var key = _ref10.key,
|
|
359
|
+
content = _ref10.content,
|
|
360
|
+
maxWidth = _ref10.maxWidth;
|
|
363
361
|
var heading = (0, _react2.jsx)(_tooltip.default, {
|
|
364
362
|
content: content,
|
|
365
363
|
tag: "span",
|
|
@@ -370,10 +368,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
370
368
|
}, content));
|
|
371
369
|
if (onVisibleColumnKeysChange && hasData) {
|
|
372
370
|
var _containerRef$current3;
|
|
373
|
-
var previewRows = tableRows.map(function (
|
|
374
|
-
var cells =
|
|
375
|
-
var cell = cells.find(function (
|
|
376
|
-
var cellKey =
|
|
371
|
+
var previewRows = tableRows.map(function (_ref11) {
|
|
372
|
+
var cells = _ref11.cells;
|
|
373
|
+
var cell = cells.find(function (_ref12) {
|
|
374
|
+
var cellKey = _ref12.key;
|
|
377
375
|
return cellKey === key;
|
|
378
376
|
});
|
|
379
377
|
if (cell) {
|
|
@@ -411,18 +409,18 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
411
409
|
})))), (0, _react2.jsx)("tbody", {
|
|
412
410
|
css: noDefaultBorderStyles,
|
|
413
411
|
"data-testid": testId && "".concat(testId, "--body")
|
|
414
|
-
}, rows.map(function (
|
|
415
|
-
var key =
|
|
416
|
-
cells =
|
|
417
|
-
ref =
|
|
412
|
+
}, rows.map(function (_ref13) {
|
|
413
|
+
var key = _ref13.key,
|
|
414
|
+
cells = _ref13.cells,
|
|
415
|
+
ref = _ref13.ref;
|
|
418
416
|
return (0, _react2.jsx)("tr", {
|
|
419
417
|
key: key,
|
|
420
418
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
421
419
|
ref: ref
|
|
422
|
-
}, cells.map(function (
|
|
423
|
-
var cellKey =
|
|
424
|
-
content =
|
|
425
|
-
maxWidth =
|
|
420
|
+
}, cells.map(function (_ref14, cellIndex) {
|
|
421
|
+
var cellKey = _ref14.key,
|
|
422
|
+
content = _ref14.content,
|
|
423
|
+
maxWidth = _ref14.maxWidth;
|
|
426
424
|
return (0, _react2.jsx)("td", {
|
|
427
425
|
key: cellKey,
|
|
428
426
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
@@ -73,23 +73,14 @@ function extractIndex(data) {
|
|
|
73
73
|
invariant(typeof index === 'number');
|
|
74
74
|
return index;
|
|
75
75
|
}
|
|
76
|
-
const orderColumns = (columns, visibleColumnKeys) => {
|
|
77
|
-
|
|
78
|
-
// In order to sort all the columns we need to insert unselected ones into this list
|
|
79
|
-
// We put them into their absolution position as it was in unchanged (before column move) order.
|
|
80
|
-
columns.forEach(({
|
|
81
|
-
key
|
|
82
|
-
}, index) => {
|
|
83
|
-
if (!visibleColumnKeys.includes(key)) {
|
|
84
|
-
visibleColumnKeys.splice(index, 0, key);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
columns.sort((a, b) => {
|
|
76
|
+
export const orderColumns = (columns, visibleColumnKeys) => {
|
|
77
|
+
const visibleColumns = columns.filter(column => visibleColumnKeys.includes(column.key)).sort((a, b) => {
|
|
88
78
|
const indexB = visibleColumnKeys.indexOf(b.key);
|
|
89
79
|
const indexA = visibleColumnKeys.indexOf(a.key);
|
|
90
80
|
return indexA - indexB;
|
|
91
81
|
});
|
|
92
|
-
|
|
82
|
+
const invisibleColumns = columns.filter(column => !visibleColumnKeys.includes(column.key));
|
|
83
|
+
return [...visibleColumns, ...invisibleColumns];
|
|
93
84
|
};
|
|
94
85
|
const BASE_WIDTH = 8;
|
|
95
86
|
function getColumnWidth(key, type) {
|
|
@@ -136,8 +127,10 @@ export const IssueLikeDataTableView = ({
|
|
|
136
127
|
const containerRef = useRef(null);
|
|
137
128
|
const [orderedColumns, setOrderedColumns] = useState(() => orderColumns([...columns], [...visibleColumnKeys]));
|
|
138
129
|
useEffect(() => {
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
if (!hasFullSchema) {
|
|
131
|
+
setOrderedColumns(orderColumns([...columns], [...visibleColumnKeys]));
|
|
132
|
+
}
|
|
133
|
+
}, [columns, visibleColumnKeys, hasFullSchema]);
|
|
141
134
|
useEffect(() => {
|
|
142
135
|
if (parentContainerRenderInstanceId && status === 'resolved') {
|
|
143
136
|
succeedUfoExperience({
|
|
@@ -225,7 +225,7 @@ var analyticsContextAttributes = {
|
|
|
225
225
|
};
|
|
226
226
|
var analyticsContextData = {
|
|
227
227
|
packageName: "@atlaskit/link-datasource",
|
|
228
|
-
packageVersion: "1.6.
|
|
228
|
+
packageVersion: "1.6.3",
|
|
229
229
|
source: 'datasourceConfigModal'
|
|
230
230
|
};
|
|
231
231
|
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
@@ -65,22 +65,18 @@ function extractIndex(data) {
|
|
|
65
65
|
invariant(typeof index === 'number');
|
|
66
66
|
return index;
|
|
67
67
|
}
|
|
68
|
-
var orderColumns = function orderColumns(columns, visibleColumnKeys) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
columns.forEach(function (_ref, index) {
|
|
73
|
-
var key = _ref.key;
|
|
74
|
-
if (!visibleColumnKeys.includes(key)) {
|
|
75
|
-
visibleColumnKeys.splice(index, 0, key);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
columns.sort(function (a, b) {
|
|
68
|
+
export var orderColumns = function orderColumns(columns, visibleColumnKeys) {
|
|
69
|
+
var visibleColumns = columns.filter(function (column) {
|
|
70
|
+
return visibleColumnKeys.includes(column.key);
|
|
71
|
+
}).sort(function (a, b) {
|
|
79
72
|
var indexB = visibleColumnKeys.indexOf(b.key);
|
|
80
73
|
var indexA = visibleColumnKeys.indexOf(a.key);
|
|
81
74
|
return indexA - indexB;
|
|
82
75
|
});
|
|
83
|
-
|
|
76
|
+
var invisibleColumns = columns.filter(function (column) {
|
|
77
|
+
return !visibleColumnKeys.includes(column.key);
|
|
78
|
+
});
|
|
79
|
+
return [].concat(_toConsumableArray(visibleColumns), _toConsumableArray(invisibleColumns));
|
|
84
80
|
};
|
|
85
81
|
var BASE_WIDTH = 8;
|
|
86
82
|
function getColumnWidth(key, type) {
|
|
@@ -105,21 +101,21 @@ function getColumnWidth(key, type) {
|
|
|
105
101
|
return undefined;
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
|
-
export var IssueLikeDataTableView = function IssueLikeDataTableView(
|
|
109
|
-
var testId =
|
|
110
|
-
onNextPage =
|
|
111
|
-
onLoadDatasourceDetails =
|
|
112
|
-
items =
|
|
113
|
-
columns =
|
|
114
|
-
|
|
115
|
-
renderItem =
|
|
116
|
-
visibleColumnKeys =
|
|
117
|
-
onVisibleColumnKeysChange =
|
|
118
|
-
status =
|
|
119
|
-
hasNextPage =
|
|
120
|
-
scrollableContainerHeight =
|
|
121
|
-
parentContainerRenderInstanceId =
|
|
122
|
-
extensionKey =
|
|
104
|
+
export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref) {
|
|
105
|
+
var testId = _ref.testId,
|
|
106
|
+
onNextPage = _ref.onNextPage,
|
|
107
|
+
onLoadDatasourceDetails = _ref.onLoadDatasourceDetails,
|
|
108
|
+
items = _ref.items,
|
|
109
|
+
columns = _ref.columns,
|
|
110
|
+
_ref$renderItem = _ref.renderItem,
|
|
111
|
+
renderItem = _ref$renderItem === void 0 ? fallbackRenderType : _ref$renderItem,
|
|
112
|
+
visibleColumnKeys = _ref.visibleColumnKeys,
|
|
113
|
+
onVisibleColumnKeysChange = _ref.onVisibleColumnKeysChange,
|
|
114
|
+
status = _ref.status,
|
|
115
|
+
hasNextPage = _ref.hasNextPage,
|
|
116
|
+
scrollableContainerHeight = _ref.scrollableContainerHeight,
|
|
117
|
+
parentContainerRenderInstanceId = _ref.parentContainerRenderInstanceId,
|
|
118
|
+
extensionKey = _ref.extensionKey;
|
|
123
119
|
var tableId = useMemo(function () {
|
|
124
120
|
return Symbol('unique-id');
|
|
125
121
|
}, []);
|
|
@@ -140,8 +136,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
140
136
|
orderedColumns = _useState6[0],
|
|
141
137
|
setOrderedColumns = _useState6[1];
|
|
142
138
|
useEffect(function () {
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
if (!hasFullSchema) {
|
|
140
|
+
setOrderedColumns(orderColumns(_toConsumableArray(columns), _toConsumableArray(visibleColumnKeys)));
|
|
141
|
+
}
|
|
142
|
+
}, [columns, visibleColumnKeys, hasFullSchema]);
|
|
145
143
|
useEffect(function () {
|
|
146
144
|
if (parentContainerRenderInstanceId && status === 'resolved') {
|
|
147
145
|
succeedUfoExperience({
|
|
@@ -151,8 +149,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
151
149
|
}, [parentContainerRenderInstanceId, status]);
|
|
152
150
|
var visibleSortedColumns = useMemo(function () {
|
|
153
151
|
return visibleColumnKeys.map(function (visibleKey) {
|
|
154
|
-
return orderedColumns.find(function (
|
|
155
|
-
var key =
|
|
152
|
+
return orderedColumns.find(function (_ref2) {
|
|
153
|
+
var key = _ref2.key;
|
|
156
154
|
return visibleKey === key;
|
|
157
155
|
});
|
|
158
156
|
}).filter(Boolean);
|
|
@@ -166,8 +164,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
166
164
|
var loadingRow = useMemo(function () {
|
|
167
165
|
return {
|
|
168
166
|
key: 'loading',
|
|
169
|
-
cells: visibleSortedColumns.map(function (
|
|
170
|
-
var key =
|
|
167
|
+
cells: visibleSortedColumns.map(function (_ref3) {
|
|
168
|
+
var key = _ref3.key;
|
|
171
169
|
var content = jsx(Skeleton, {
|
|
172
170
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
173
171
|
width: '100%',
|
|
@@ -181,10 +179,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
181
179
|
};
|
|
182
180
|
}, [visibleSortedColumns]);
|
|
183
181
|
var headColumns = useMemo(function () {
|
|
184
|
-
return visibleSortedColumns.map(function (
|
|
185
|
-
var key =
|
|
186
|
-
title =
|
|
187
|
-
type =
|
|
182
|
+
return visibleSortedColumns.map(function (_ref4) {
|
|
183
|
+
var key = _ref4.key,
|
|
184
|
+
title = _ref4.title,
|
|
185
|
+
type = _ref4.type;
|
|
188
186
|
return {
|
|
189
187
|
key: key,
|
|
190
188
|
content: title,
|
|
@@ -211,9 +209,9 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
211
209
|
return;
|
|
212
210
|
}
|
|
213
211
|
return combine(monitorForElements({
|
|
214
|
-
onDragStart: function onDragStart(
|
|
212
|
+
onDragStart: function onDragStart(_ref5) {
|
|
215
213
|
var _containerRef$current;
|
|
216
|
-
var location =
|
|
214
|
+
var location = _ref5.location;
|
|
217
215
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
218
216
|
autoScroller.start({
|
|
219
217
|
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
@@ -226,18 +224,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
226
224
|
behavior: 'container-only'
|
|
227
225
|
});
|
|
228
226
|
},
|
|
229
|
-
onDrag: function onDrag(
|
|
227
|
+
onDrag: function onDrag(_ref6) {
|
|
230
228
|
var _containerRef$current2;
|
|
231
|
-
var location =
|
|
229
|
+
var location = _ref6.location;
|
|
232
230
|
autoScroller.updateInput({
|
|
233
231
|
input: _objectSpread(_objectSpread({}, location.current.input), {}, {
|
|
234
232
|
clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
|
|
235
233
|
})
|
|
236
234
|
});
|
|
237
235
|
},
|
|
238
|
-
onDrop: function onDrop(
|
|
239
|
-
var source =
|
|
240
|
-
location =
|
|
236
|
+
onDrop: function onDrop(_ref7) {
|
|
237
|
+
var source = _ref7.source,
|
|
238
|
+
location = _ref7.location;
|
|
241
239
|
autoScroller.stop();
|
|
242
240
|
if (location.current.dropTargets.length === 0) {
|
|
243
241
|
return;
|
|
@@ -272,10 +270,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
272
270
|
return items.map(function (newRowData, rowIndex) {
|
|
273
271
|
return {
|
|
274
272
|
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
275
|
-
cells: visibleSortedColumns.map(function (
|
|
273
|
+
cells: visibleSortedColumns.map(function (_ref8) {
|
|
276
274
|
var _newRowData$key;
|
|
277
|
-
var key =
|
|
278
|
-
type =
|
|
275
|
+
var key = _ref8.key,
|
|
276
|
+
type = _ref8.type;
|
|
279
277
|
var value = ((_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data) || newRowData[key];
|
|
280
278
|
var values = Array.isArray(value) ? value : [value];
|
|
281
279
|
var content = values.map(function (value) {
|
|
@@ -349,10 +347,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
349
347
|
}, jsx("thead", {
|
|
350
348
|
"data-testid": testId && "".concat(testId, "--head"),
|
|
351
349
|
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
352
|
-
}, jsx("tr", null, headColumns.map(function (
|
|
353
|
-
var key =
|
|
354
|
-
content =
|
|
355
|
-
maxWidth =
|
|
350
|
+
}, jsx("tr", null, headColumns.map(function (_ref10, cellIndex) {
|
|
351
|
+
var key = _ref10.key,
|
|
352
|
+
content = _ref10.content,
|
|
353
|
+
maxWidth = _ref10.maxWidth;
|
|
356
354
|
var heading = jsx(Tooltip, {
|
|
357
355
|
content: content,
|
|
358
356
|
tag: "span",
|
|
@@ -363,10 +361,10 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
363
361
|
}, content));
|
|
364
362
|
if (onVisibleColumnKeysChange && hasData) {
|
|
365
363
|
var _containerRef$current3;
|
|
366
|
-
var previewRows = tableRows.map(function (
|
|
367
|
-
var cells =
|
|
368
|
-
var cell = cells.find(function (
|
|
369
|
-
var cellKey =
|
|
364
|
+
var previewRows = tableRows.map(function (_ref11) {
|
|
365
|
+
var cells = _ref11.cells;
|
|
366
|
+
var cell = cells.find(function (_ref12) {
|
|
367
|
+
var cellKey = _ref12.key;
|
|
370
368
|
return cellKey === key;
|
|
371
369
|
});
|
|
372
370
|
if (cell) {
|
|
@@ -404,18 +402,18 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref2) {
|
|
|
404
402
|
})))), jsx("tbody", {
|
|
405
403
|
css: noDefaultBorderStyles,
|
|
406
404
|
"data-testid": testId && "".concat(testId, "--body")
|
|
407
|
-
}, rows.map(function (
|
|
408
|
-
var key =
|
|
409
|
-
cells =
|
|
410
|
-
ref =
|
|
405
|
+
}, rows.map(function (_ref13) {
|
|
406
|
+
var key = _ref13.key,
|
|
407
|
+
cells = _ref13.cells,
|
|
408
|
+
ref = _ref13.ref;
|
|
411
409
|
return jsx("tr", {
|
|
412
410
|
key: key,
|
|
413
411
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
414
412
|
ref: ref
|
|
415
|
-
}, cells.map(function (
|
|
416
|
-
var cellKey =
|
|
417
|
-
content =
|
|
418
|
-
maxWidth =
|
|
413
|
+
}, cells.map(function (_ref14, cellIndex) {
|
|
414
|
+
var cellKey = _ref14.key,
|
|
415
|
+
content = _ref14.content,
|
|
416
|
+
maxWidth = _ref14.maxWidth;
|
|
419
417
|
return jsx("td", {
|
|
420
418
|
key: cellKey,
|
|
421
419
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Ref } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
4
5
|
import { IssueLikeDataTableViewProps } from './types';
|
|
5
6
|
export interface RowType {
|
|
6
7
|
cells: Array<RowCellType>;
|
|
@@ -12,5 +13,6 @@ export interface RowCellType {
|
|
|
12
13
|
content?: React.ReactNode | string;
|
|
13
14
|
maxWidth?: number;
|
|
14
15
|
}
|
|
16
|
+
export declare const orderColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
15
17
|
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
|
|
16
18
|
export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Ref } from 'react';
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
+
import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
|
|
4
5
|
import { IssueLikeDataTableViewProps } from './types';
|
|
5
6
|
export interface RowType {
|
|
6
7
|
cells: Array<RowCellType>;
|
|
@@ -12,5 +13,6 @@ export interface RowCellType {
|
|
|
12
13
|
content?: React.ReactNode | string;
|
|
13
14
|
maxWidth?: number;
|
|
14
15
|
}
|
|
16
|
+
export declare const orderColumns: (columns: DatasourceResponseSchemaProperty[], visibleColumnKeys: string[]) => DatasourceResponseSchemaProperty[];
|
|
15
17
|
export declare const IssueLikeDataTableView: ({ testId, onNextPage, onLoadDatasourceDetails, items, columns, renderItem, visibleColumnKeys, onVisibleColumnKeysChange, status, hasNextPage, scrollableContainerHeight, parentContainerRenderInstanceId, extensionKey, }: IssueLikeDataTableViewProps) => jsx.JSX.Element;
|
|
16
18
|
export declare const EmptyState: ({ isCompact, isLoading, testId }: import("./empty-state").Props) => jsx.JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
34
34
|
"@atlaskit/analytics-next": "^9.1.3",
|
|
35
|
-
"@atlaskit/avatar": "^21.
|
|
35
|
+
"@atlaskit/avatar": "^21.4.0",
|
|
36
36
|
"@atlaskit/button": "^16.10.0",
|
|
37
37
|
"@atlaskit/dropdown-menu": "^11.14.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.0",
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-indicator": "^0.16.0",
|
|
57
57
|
"@atlaskit/select": "^16.7.0",
|
|
58
|
-
"@atlaskit/smart-card": "^26.
|
|
58
|
+
"@atlaskit/smart-card": "^26.34.0",
|
|
59
59
|
"@atlaskit/spinner": "^15.6.0",
|
|
60
60
|
"@atlaskit/tag": "^11.6.0",
|
|
61
61
|
"@atlaskit/textfield": "5.6.8",
|