@atlaskit/link-datasource 3.15.13 → 3.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/hooks/useDatasourceTableState.js +37 -39
- package/dist/cjs/state/index.js +3 -7
- package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +8 -2
- package/dist/cjs/ui/issue-like-table/index.js +44 -111
- package/dist/cjs/ui/issue-like-table/styled.js +1 -24
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +54 -2
- package/dist/es2019/hooks/useDatasourceTableState.js +24 -26
- package/dist/es2019/state/index.js +3 -7
- package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +6 -2
- package/dist/es2019/ui/issue-like-table/index.js +5 -65
- package/dist/es2019/ui/issue-like-table/styled.js +0 -34
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +59 -1
- package/dist/esm/hooks/useDatasourceTableState.js +37 -39
- package/dist/esm/state/index.js +3 -7
- package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +8 -2
- package/dist/esm/ui/issue-like-table/index.js +46 -113
- package/dist/esm/ui/issue-like-table/styled.js +0 -23
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +53 -1
- package/dist/types/ui/issue-like-table/styled.d.ts +0 -4
- package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +0 -4
- package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +5 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 3.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#103370](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/103370)
|
|
14
|
+
[`8e2f83c636875`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8e2f83c636875) -
|
|
15
|
+
Cleans up feature flag enable_datasource_react_sweet_state to release react sweet state which now
|
|
16
|
+
handles the state and creation of IssueLikeTable in datasources
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [#104950](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/104950)
|
|
21
|
+
[`39e7768169d56`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/39e7768169d56) -
|
|
22
|
+
EDM-11475 Validate datasources inline-edit update ID
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 3.15.13
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -13,7 +13,6 @@ var _react = require("react");
|
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _atlassianContext = require("@atlaskit/atlassian-context");
|
|
15
15
|
var _linkClientExtension = require("@atlaskit/link-client-extension");
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _analytics = require("../analytics");
|
|
18
17
|
var _state = require("../state");
|
|
19
18
|
var _actions = require("../state/actions");
|
|
@@ -312,33 +311,32 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
312
311
|
}
|
|
313
312
|
return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(items));
|
|
314
313
|
});
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Product is typed as any.
|
|
317
|
+
*/
|
|
318
|
+
integrationKey = product;
|
|
319
|
+
/**
|
|
320
|
+
* When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
|
|
321
|
+
*/
|
|
322
|
+
entityType = objectTypesEntity;
|
|
323
|
+
newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
324
|
+
setResponseItemIds(function (currentIds) {
|
|
325
|
+
return [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
|
|
326
|
+
});
|
|
327
|
+
if (!(0, _atlassianContext.isFedRamp)()) {
|
|
328
|
+
if (typeof integrationKey === 'string') {
|
|
329
|
+
aris = items.reduce(function (acc, item) {
|
|
330
|
+
var _item$ari;
|
|
331
|
+
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [].concat((0, _toConsumableArray2.default)(acc), [item.ari.data]) : acc;
|
|
332
|
+
}, []);
|
|
333
|
+
if (aris.length && entityType) {
|
|
334
|
+
discoverActions({
|
|
335
|
+
aris: aris,
|
|
336
|
+
integrationKey: integrationKey,
|
|
337
|
+
fieldKeys: fieldKeys,
|
|
338
|
+
entityType: entityType
|
|
339
|
+
});
|
|
342
340
|
}
|
|
343
341
|
}
|
|
344
342
|
}
|
|
@@ -360,38 +358,38 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
360
358
|
});
|
|
361
359
|
}
|
|
362
360
|
setStatus('resolved');
|
|
363
|
-
_context2.next =
|
|
361
|
+
_context2.next = 64;
|
|
364
362
|
break;
|
|
365
|
-
case
|
|
366
|
-
_context2.prev =
|
|
363
|
+
case 52:
|
|
364
|
+
_context2.prev = 52;
|
|
367
365
|
_context2.t0 = _context2["catch"](10);
|
|
368
366
|
if (!(_context2.t0.message === 'Aborted')) {
|
|
369
|
-
_context2.next =
|
|
367
|
+
_context2.next = 56;
|
|
370
368
|
break;
|
|
371
369
|
}
|
|
372
370
|
return _context2.abrupt("return");
|
|
373
|
-
case
|
|
371
|
+
case 56:
|
|
374
372
|
captureError('onNextPage', _context2.t0);
|
|
375
373
|
if (!(_context2.t0 instanceof Response && _context2.t0.status === 401)) {
|
|
376
|
-
_context2.next =
|
|
374
|
+
_context2.next = 60;
|
|
377
375
|
break;
|
|
378
376
|
}
|
|
379
377
|
setStatus('unauthorized');
|
|
380
378
|
return _context2.abrupt("return");
|
|
381
|
-
case
|
|
379
|
+
case 60:
|
|
382
380
|
if (!(_context2.t0 instanceof Response && _context2.t0.status === 403)) {
|
|
383
|
-
_context2.next =
|
|
381
|
+
_context2.next = 63;
|
|
384
382
|
break;
|
|
385
383
|
}
|
|
386
384
|
setStatus('forbidden');
|
|
387
385
|
return _context2.abrupt("return");
|
|
388
|
-
case
|
|
386
|
+
case 63:
|
|
389
387
|
setStatus('rejected');
|
|
390
|
-
case
|
|
388
|
+
case 64:
|
|
391
389
|
case "end":
|
|
392
390
|
return _context2.stop();
|
|
393
391
|
}
|
|
394
|
-
}, _callee2, null, [[10,
|
|
392
|
+
}, _callee2, null, [[10, 52]]);
|
|
395
393
|
})), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions]);
|
|
396
394
|
var reset = (0, _react.useCallback)(function (options) {
|
|
397
395
|
setResponseItems(initialEmptyArray);
|
package/dist/cjs/state/index.js
CHANGED
|
@@ -11,7 +11,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
12
|
var _reactSweetState = require("react-sweet-state");
|
|
13
13
|
var _uuid = require("uuid");
|
|
14
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
16
|
var getInitialState = function getInitialState() {
|
|
@@ -82,10 +81,7 @@ var useDatasourceActions = exports.useDatasourceActions = (0, _reactSweetState.c
|
|
|
82
81
|
var Container = (0, _reactSweetState.createContainer)(Store);
|
|
83
82
|
var StoreContainer = exports.StoreContainer = function StoreContainer(_ref6) {
|
|
84
83
|
var children = _ref6.children;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, children);
|
|
89
|
-
}
|
|
90
|
-
return children;
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(Container, {
|
|
85
|
+
scope: "datasource"
|
|
86
|
+
}, children);
|
|
91
87
|
};
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _layering = require("@atlaskit/layering");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
13
|
var _select = _interopRequireDefault(require("@atlaskit/select"));
|
|
13
14
|
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
14
15
|
var _ufoExperiences = require("../../../../analytics/ufoExperiences");
|
|
@@ -53,8 +54,13 @@ var IconEditType = function IconEditType(props) {
|
|
|
53
54
|
}, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, (0, _utils.getCleanedSelectProps)(props), {
|
|
54
55
|
autoFocus: true,
|
|
55
56
|
blurInputOnSelect: true,
|
|
56
|
-
defaultMenuIsOpen: true
|
|
57
|
-
|
|
57
|
+
defaultMenuIsOpen: true
|
|
58
|
+
// We can't update the status if we don't have an ID - however the ID
|
|
59
|
+
// is typed optional.
|
|
60
|
+
,
|
|
61
|
+
options: (0, _platformFeatureFlags.fg)('platform-datasources-inline-edit-id-checks') ? options.filter(function (option) {
|
|
62
|
+
return option.id;
|
|
63
|
+
}) : options,
|
|
58
64
|
menuPlacement: "auto",
|
|
59
65
|
isLoading: isLoading,
|
|
60
66
|
filterOption: filterOption,
|
|
@@ -14,11 +14,9 @@ var _react = require("react");
|
|
|
14
14
|
var _react2 = require("@emotion/react");
|
|
15
15
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
16
16
|
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
17
|
-
var _reactIntlNext = require("react-intl-next");
|
|
18
17
|
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
19
18
|
var _flag = require("@atlaskit/flag");
|
|
20
19
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
21
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
20
|
var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
|
|
23
21
|
var _reorderWithEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge");
|
|
24
22
|
var _pragmaticDragAndDropReactBeautifulDndAutoscroll = require("@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll");
|
|
@@ -39,7 +37,6 @@ var _emptyState = _interopRequireDefault(require("./empty-state"));
|
|
|
39
37
|
var _renderType = require("./render-type");
|
|
40
38
|
var _styled2 = require("./styled");
|
|
41
39
|
var _tableCellContent = require("./table-cell-content");
|
|
42
|
-
var _truncateTextTag = require("./truncate-text-tag");
|
|
43
40
|
var _useIsOnScreen = require("./useIsOnScreen");
|
|
44
41
|
var _utils = require("./utils");
|
|
45
42
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -276,7 +273,6 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
276
273
|
var tableId = (0, _react.useMemo)(function () {
|
|
277
274
|
return Symbol('unique-id');
|
|
278
275
|
}, []);
|
|
279
|
-
var intl = (0, _reactIntlNext.useIntl)();
|
|
280
276
|
var experienceId = (0, _datasourceExperienceId.useDatasourceExperienceId)();
|
|
281
277
|
var tableHeaderRowRef = (0, _react.useRef)(null);
|
|
282
278
|
var _useState = (0, _react.useState)(null),
|
|
@@ -332,8 +328,6 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
332
328
|
// TODO seems like this component can't handle some combination of incremental data retrieval.
|
|
333
329
|
// If data comes first, then columns and then visibleColumnKeys it blows up,
|
|
334
330
|
// or some other combination.
|
|
335
|
-
|
|
336
|
-
var identityColumnKey = 'id';
|
|
337
331
|
var columnsWidthsSum = (0, _react.useMemo)(function () {
|
|
338
332
|
return visibleSortedColumns.map(function (_ref7) {
|
|
339
333
|
var key = _ref7.key,
|
|
@@ -464,76 +458,34 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
464
458
|
}));
|
|
465
459
|
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
|
|
466
460
|
var tableRows = (0, _react.useMemo)(function () {
|
|
467
|
-
return (
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
key
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
461
|
+
return itemIds.map(function (id, rowIndex) {
|
|
462
|
+
return {
|
|
463
|
+
key: id,
|
|
464
|
+
cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
|
|
465
|
+
var key = _ref12.key,
|
|
466
|
+
type = _ref12.type,
|
|
467
|
+
title = _ref12.title;
|
|
468
|
+
return {
|
|
469
|
+
key: key,
|
|
470
|
+
columnKey: key,
|
|
471
|
+
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
472
|
+
content: (0, _react2.jsx)(_tableCellContent.TableCellContent, {
|
|
473
|
+
id: id,
|
|
478
474
|
columnKey: key,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
} : undefined
|
|
494
|
-
};
|
|
495
|
-
}) : items.map(function (newRowData, rowIndex) {
|
|
496
|
-
return {
|
|
497
|
-
key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
|
|
498
|
-
cells: visibleSortedColumns.map(function (_ref13, cellIndex) {
|
|
499
|
-
var _newRowData$key;
|
|
500
|
-
var key = _ref13.key,
|
|
501
|
-
type = _ref13.type;
|
|
502
|
-
// Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
|
|
503
|
-
var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
|
|
504
|
-
var values = Array.isArray(value) ? value : [value];
|
|
505
|
-
var renderedValues = renderItem({
|
|
506
|
-
type: type,
|
|
507
|
-
values: values
|
|
508
|
-
});
|
|
509
|
-
var stringifiedContent = values.map(function (value) {
|
|
510
|
-
return (0, _renderType.stringifyType)({
|
|
511
|
-
type: type,
|
|
512
|
-
value: value
|
|
513
|
-
}, intl.formatMessage, intl.formatDate);
|
|
514
|
-
}).filter(function (value) {
|
|
515
|
-
return value !== '';
|
|
516
|
-
}).join(', ');
|
|
517
|
-
var contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? (0, _react2.jsx)(_tooltip.default
|
|
518
|
-
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
519
|
-
, {
|
|
520
|
-
tag: _truncateTextTag.TruncateTextTag,
|
|
521
|
-
content: stringifiedContent,
|
|
522
|
-
testId: "issues-table-cell-tooltip"
|
|
523
|
-
}, renderedValues) : renderedValues;
|
|
524
|
-
return {
|
|
525
|
-
key: key,
|
|
526
|
-
content: contentComponent,
|
|
527
|
-
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
528
|
-
};
|
|
529
|
-
}),
|
|
530
|
-
ref: rowIndex === items.length - 1 ? function (el) {
|
|
531
|
-
return setLastRowElement(el);
|
|
532
|
-
} : undefined
|
|
533
|
-
};
|
|
534
|
-
})
|
|
535
|
-
);
|
|
536
|
-
}, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth, intl.formatMessage, intl.formatDate]);
|
|
475
|
+
columnType: type,
|
|
476
|
+
columnTitle: title,
|
|
477
|
+
wrappedColumnKeys: wrappedColumnKeys,
|
|
478
|
+
renderItem: renderItem
|
|
479
|
+
}),
|
|
480
|
+
width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
|
|
481
|
+
};
|
|
482
|
+
}),
|
|
483
|
+
ref: rowIndex === items.length - 1 ? function (el) {
|
|
484
|
+
return setLastRowElement(el);
|
|
485
|
+
} : undefined
|
|
486
|
+
};
|
|
487
|
+
});
|
|
488
|
+
}, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth]);
|
|
537
489
|
var rows = (0, _react.useMemo)(function () {
|
|
538
490
|
if (status !== 'loading') {
|
|
539
491
|
return tableRows;
|
|
@@ -626,10 +578,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
626
578
|
className: !!onVisibleColumnKeysChange ? 'has-column-picker' : ''
|
|
627
579
|
}, (0, _react2.jsx)("tr", {
|
|
628
580
|
ref: tableHeaderRowRef
|
|
629
|
-
}, headerColumns.map(function (
|
|
630
|
-
var key =
|
|
631
|
-
content =
|
|
632
|
-
width =
|
|
581
|
+
}, headerColumns.map(function (_ref14, cellIndex) {
|
|
582
|
+
var key = _ref14.key,
|
|
583
|
+
content = _ref14.content,
|
|
584
|
+
width = _ref14.width;
|
|
633
585
|
var heading = (0, _react2.jsx)(_tooltip.default, {
|
|
634
586
|
content: content,
|
|
635
587
|
tag: "span",
|
|
@@ -647,10 +599,10 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
647
599
|
}
|
|
648
600
|
if (isEditable) {
|
|
649
601
|
var _containerRef$current3;
|
|
650
|
-
var previewRows = tableRows.map(function (
|
|
651
|
-
var cells =
|
|
652
|
-
var cell = cells.find(function (
|
|
653
|
-
var cellKey =
|
|
602
|
+
var previewRows = tableRows.map(function (_ref15) {
|
|
603
|
+
var cells = _ref15.cells;
|
|
604
|
+
var cell = cells.find(function (_ref16) {
|
|
605
|
+
var cellKey = _ref16.key;
|
|
654
606
|
return cellKey === key;
|
|
655
607
|
});
|
|
656
608
|
if (cell) {
|
|
@@ -693,43 +645,24 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
693
645
|
})))), (0, _react2.jsx)("tbody", {
|
|
694
646
|
css: noDefaultBorderStyles,
|
|
695
647
|
"data-testid": testId && "".concat(testId, "--body")
|
|
696
|
-
}, rows.map(function (
|
|
697
|
-
var key =
|
|
698
|
-
cells =
|
|
699
|
-
ref =
|
|
648
|
+
}, rows.map(function (_ref17) {
|
|
649
|
+
var key = _ref17.key,
|
|
650
|
+
cells = _ref17.cells,
|
|
651
|
+
ref = _ref17.ref;
|
|
700
652
|
return (0, _react2.jsx)("tr", {
|
|
701
653
|
key: key,
|
|
702
654
|
"data-testid": testId && "".concat(testId, "--row-").concat(key),
|
|
703
655
|
ref: ref
|
|
704
|
-
}, cells.map(function (
|
|
705
|
-
var cellKey =
|
|
706
|
-
content =
|
|
707
|
-
width =
|
|
656
|
+
}, cells.map(function (_ref18, cellIndex) {
|
|
657
|
+
var cellKey = _ref18.key,
|
|
658
|
+
content = _ref18.content,
|
|
659
|
+
width = _ref18.width;
|
|
708
660
|
var isLastCell = cellIndex === cells.length - 1;
|
|
709
661
|
var loadingRowStyle = (0, _utils.getWidthCss)({
|
|
710
662
|
shouldUseWidth: shouldUseWidth,
|
|
711
663
|
width: width
|
|
712
664
|
});
|
|
713
|
-
|
|
714
|
-
if ((0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state')) {
|
|
715
|
-
return (0, _react2.jsx)(_styled2.InlineEditableTableCell, {
|
|
716
|
-
key: cellKey,
|
|
717
|
-
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
718
|
-
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
719
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
720
|
-
,
|
|
721
|
-
style: loadingRowStyle,
|
|
722
|
-
css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
|
|
723
|
-
}, content);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
// extra padding is required around skeleton loader to avoid vertical jumps when data loads
|
|
727
|
-
if (key !== null && key !== void 0 && key.includes('loading')) {
|
|
728
|
-
loadingRowStyle = _objectSpread(_objectSpread({}, loadingRowStyle), {}, {
|
|
729
|
-
paddingBlock: "var(--ds-space-100, 8px)"
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
return (0, _react2.jsx)(_styled2.TableCell, {
|
|
665
|
+
return (0, _react2.jsx)(_styled2.InlineEditableTableCell, {
|
|
733
666
|
key: cellKey,
|
|
734
667
|
"data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
|
|
735
668
|
colSpan: isEditable && isLastCell ? 2 : undefined
|
|
@@ -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.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.TableHeading = exports.
|
|
7
|
+
exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.TableHeading = exports.Table = exports.ScrollableContainerHeight = exports.InlineEditableTableCell = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -74,29 +74,6 @@ var TableHeading = exports.TableHeading = _styled.default.th((0, _defineProperty
|
|
|
74
74
|
wordWrap: 'break-word'
|
|
75
75
|
}));
|
|
76
76
|
|
|
77
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/ui-styling-standard/no-styled -- To migrate as part of go/ui-styling-standard
|
|
78
|
-
var TableCell = exports.TableCell = _styled.default.td((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(withTablePluginBodyPrefix()), {
|
|
79
|
-
/* First section here is to override things editor table plugin css defines */
|
|
80
|
-
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
81
|
-
padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
|
|
82
|
-
border: 0,
|
|
83
|
-
minWidth: 'auto',
|
|
84
|
-
height: '32px',
|
|
85
|
-
verticalAlign: 'inherit',
|
|
86
|
-
boxSizing: 'content-box',
|
|
87
|
-
// Due to padding, content-box makes td height 40px equal to InlineEdit on height of 32px
|
|
88
|
-
borderRight: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(_colors.N40, ")")),
|
|
89
|
-
borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(_colors.N40, ")")),
|
|
90
|
-
overflow: 'hidden'
|
|
91
|
-
}), "".concat(withTablePluginBodyPrefix('&:first-child')), {
|
|
92
|
-
paddingLeft: "var(--ds-space-100, 8px)"
|
|
93
|
-
}), "".concat(withTablePluginBodyPrefix('&:last-child')), {
|
|
94
|
-
borderRight: 0,
|
|
95
|
-
paddingRight: "var(--ds-space-100, 8px)"
|
|
96
|
-
}), "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
|
|
97
|
-
whiteSpace: 'unset'
|
|
98
|
-
}));
|
|
99
|
-
|
|
100
77
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled, @atlaskit/ui-styling-standard/no-exported-styles -- To migrate as part of go/ui-styling-standard
|
|
101
78
|
var InlineEditableTableCell = exports.InlineEditableTableCell = _styled.default.td((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(withTablePluginBodyPrefix()), {
|
|
102
79
|
/* First section here is to override things editor table plugin css defines */
|
|
@@ -5,7 +5,7 @@ var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.InlineEditUFOExperience = exports.InlineEdit = void 0;
|
|
8
|
+
exports.newGetBackendUpdateValue = exports.InlineEditUFOExperience = exports.InlineEdit = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -13,6 +13,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactIntlNext = require("react-intl-next");
|
|
15
15
|
var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
|
|
16
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
17
|
var _primitives = require("@atlaskit/primitives");
|
|
17
18
|
var _hooks = require("@atlaskit/smart-card/hooks");
|
|
18
19
|
var _analytics = require("../../../analytics");
|
|
@@ -32,6 +33,38 @@ var InlineEditUFOExperience = exports.InlineEditUFOExperience = 'inline-edit-ren
|
|
|
32
33
|
var editContainerStyles = (0, _primitives.xcss)({
|
|
33
34
|
marginBlockStart: 'space.negative.100'
|
|
34
35
|
});
|
|
36
|
+
/**
|
|
37
|
+
* @returns String of the new field value, or ID of status transition / atlassian user ID / priority ID.
|
|
38
|
+
* @throws Error if the value is not supplied.
|
|
39
|
+
*/
|
|
40
|
+
var newGetBackendUpdateValue = exports.newGetBackendUpdateValue = function newGetBackendUpdateValue(typedNewValue) {
|
|
41
|
+
if (typedNewValue.values.length === 0) {
|
|
42
|
+
throw new Error("Datasource 2 way sync: Backend update value or value ID not supplied for type ".concat(typedNewValue.type));
|
|
43
|
+
}
|
|
44
|
+
switch (typedNewValue.type) {
|
|
45
|
+
case 'string':
|
|
46
|
+
return typedNewValue.values[0];
|
|
47
|
+
case 'status':
|
|
48
|
+
var transitionId = typedNewValue.values[0].transitionId;
|
|
49
|
+
if (transitionId === undefined || transitionId === '') {
|
|
50
|
+
throw new Error("Datasource 2 way sync: Backend status transition ID not supplied for type transition");
|
|
51
|
+
}
|
|
52
|
+
return transitionId;
|
|
53
|
+
case 'user':
|
|
54
|
+
var atlassianUserId = typedNewValue.values[0].atlassianUserId;
|
|
55
|
+
if (atlassianUserId === undefined || atlassianUserId === '') {
|
|
56
|
+
throw new Error("Datasource 2 way sync: Backend atlasian user ID not supplied for type user");
|
|
57
|
+
}
|
|
58
|
+
return atlassianUserId;
|
|
59
|
+
case 'icon':
|
|
60
|
+
var id = typedNewValue.values[0].id;
|
|
61
|
+
if (id === undefined || id === '') {
|
|
62
|
+
throw new Error("Datasource 2 way sync: Backend update ID not supplied for type icon");
|
|
63
|
+
}
|
|
64
|
+
return id;
|
|
65
|
+
}
|
|
66
|
+
throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
|
|
67
|
+
};
|
|
35
68
|
var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
|
|
36
69
|
var _typedNewValue$values, _typedNewValue$values2, _typedNewValue$values3;
|
|
37
70
|
switch (typedNewValue.type) {
|
|
@@ -138,7 +171,26 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
138
171
|
}
|
|
139
172
|
onUpdateItem(ari, newItem);
|
|
140
173
|
fireEvent('ui.form.submitted.inlineEdit', {});
|
|
141
|
-
|
|
174
|
+
var updateValue;
|
|
175
|
+
if ((0, _platformFeatureFlags.fg)('platform-datasources-inline-edit-id-checks')) {
|
|
176
|
+
try {
|
|
177
|
+
// TODO: Refactor types so that valid update values are guaranteed for
|
|
178
|
+
// all object types. Invalid options should be filtered out of options -
|
|
179
|
+
// this frontend error flag is a last resort.
|
|
180
|
+
updateValue = newGetBackendUpdateValue(newValue);
|
|
181
|
+
} catch (_unused) {
|
|
182
|
+
// Show an error as the new value that was going to be sent to the
|
|
183
|
+
// backend is invalid (and would have failed anyway, silently to the user)
|
|
184
|
+
showErrorFlag({});
|
|
185
|
+
onUpdateItem(ari, existingData);
|
|
186
|
+
setIsEditing(false);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
execute(updateValue !== undefined && (0, _platformFeatureFlags.fg)('platform-datasources-inline-edit-id-checks') ? updateValue :
|
|
191
|
+
// Old behaviour is preserved in non-FFed path: errors thrown by getBackendUpdateValue are caught by
|
|
192
|
+
// the error boundary, _not_ by the catch block & frontend flag here.
|
|
193
|
+
getBackendUpdateValue(newValue)).then(refreshDatasourceItem).catch(function (error) {
|
|
142
194
|
var status = error && (0, _typeof2.default)(error) === 'object' ? error.status : undefined;
|
|
143
195
|
showErrorFlag({
|
|
144
196
|
status: status
|
|
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import { isFedRamp } from '@atlaskit/atlassian-context';
|
|
4
4
|
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
7
6
|
import { useDatasourceActions } from '../state';
|
|
8
7
|
import { useDiscoverActions } from '../state/actions';
|
|
@@ -196,32 +195,31 @@ export const useDatasourceTableState = ({
|
|
|
196
195
|
}
|
|
197
196
|
return [...currentResponseItems, ...items];
|
|
198
197
|
});
|
|
199
|
-
if (fg('enable_datasource_react_sweet_state')) {
|
|
200
|
-
/**
|
|
201
|
-
* Product is typed as any.
|
|
202
|
-
*/
|
|
203
|
-
const integrationKey = product;
|
|
204
198
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Product is typed as any.
|
|
201
|
+
*/
|
|
202
|
+
const integrationKey = product;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* When `entityType` is undefined, we should not discover actions it prevents unnecessary requests to Actions service
|
|
206
|
+
*/
|
|
207
|
+
const entityType = objectTypesEntity;
|
|
208
|
+
const newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined, entityType);
|
|
209
|
+
setResponseItemIds(currentIds => [...currentIds, ...newIds]);
|
|
210
|
+
if (!isFedRamp()) {
|
|
211
|
+
if (typeof integrationKey === 'string') {
|
|
212
|
+
const aris = items.reduce((acc, item) => {
|
|
213
|
+
var _item$ari;
|
|
214
|
+
return typeof ((_item$ari = item.ari) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? [...acc, item.ari.data] : acc;
|
|
215
|
+
}, []);
|
|
216
|
+
if (aris.length && entityType) {
|
|
217
|
+
discoverActions({
|
|
218
|
+
aris,
|
|
219
|
+
integrationKey,
|
|
220
|
+
fieldKeys,
|
|
221
|
+
entityType
|
|
222
|
+
});
|
|
225
223
|
}
|
|
226
224
|
}
|
|
227
225
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createActionsHook, createContainer, createStateHook, createStore } from 'react-sweet-state';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
const getInitialState = () => ({
|
|
6
5
|
items: {}
|
|
7
6
|
});
|
|
@@ -75,10 +74,7 @@ const Container = createContainer(Store);
|
|
|
75
74
|
export const StoreContainer = ({
|
|
76
75
|
children
|
|
77
76
|
}) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, children);
|
|
82
|
-
}
|
|
83
|
-
return children;
|
|
77
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
78
|
+
scope: "datasource"
|
|
79
|
+
}, children);
|
|
84
80
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { Layering } from '@atlaskit/layering';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import Select from '@atlaskit/select';
|
|
5
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
7
|
import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/ufoExperiences';
|
|
@@ -46,8 +47,11 @@ const IconEditType = props => {
|
|
|
46
47
|
}, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
|
|
47
48
|
autoFocus: true,
|
|
48
49
|
blurInputOnSelect: true,
|
|
49
|
-
defaultMenuIsOpen: true
|
|
50
|
-
|
|
50
|
+
defaultMenuIsOpen: true
|
|
51
|
+
// We can't update the status if we don't have an ID - however the ID
|
|
52
|
+
// is typed optional.
|
|
53
|
+
,
|
|
54
|
+
options: fg('platform-datasources-inline-edit-id-checks') ? options.filter(option => option.id) : options,
|
|
51
55
|
menuPlacement: "auto",
|
|
52
56
|
isLoading: isLoading,
|
|
53
57
|
filterOption: filterOption,
|