@atlaskit/link-datasource 2.9.3 → 2.9.5

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/hooks/useDatasourceTableState.js +43 -17
  3. package/dist/cjs/state/actions/index.js +183 -0
  4. package/dist/cjs/state/index.js +8 -4
  5. package/dist/cjs/ui/issue-like-table/index.js +87 -70
  6. package/dist/cjs/ui/issue-like-table/styled.js +22 -3
  7. package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +98 -23
  8. package/dist/es2019/hooks/useDatasourceTableState.js +26 -2
  9. package/dist/es2019/state/actions/index.js +166 -0
  10. package/dist/es2019/state/index.js +11 -5
  11. package/dist/es2019/ui/issue-like-table/index.js +27 -11
  12. package/dist/es2019/ui/issue-like-table/styled.js +28 -0
  13. package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +96 -18
  14. package/dist/esm/hooks/useDatasourceTableState.js +43 -17
  15. package/dist/esm/state/actions/index.js +177 -0
  16. package/dist/esm/state/index.js +8 -4
  17. package/dist/esm/ui/issue-like-table/index.js +88 -71
  18. package/dist/esm/ui/issue-like-table/styled.js +21 -2
  19. package/dist/esm/ui/issue-like-table/table-cell-content/index.js +98 -23
  20. package/dist/types/state/actions/index.d.ts +87 -0
  21. package/dist/types/state/index.d.ts +10 -5
  22. package/dist/types/ui/issue-like-table/styled.d.ts +4 -0
  23. package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +3 -2
  24. package/dist/types-ts4.5/state/actions/index.d.ts +87 -0
  25. package/dist/types-ts4.5/state/index.d.ts +10 -5
  26. package/dist/types-ts4.5/ui/issue-like-table/styled.d.ts +4 -0
  27. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +3 -2
  28. package/package.json +7 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 2.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#127170](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/127170)
8
+ [`48d23d3dfb9a1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/48d23d3dfb9a1) -
9
+ We are testing action discovery for datasources behind a feature flag. If this fix is successful
10
+ it will be available in a later release.
11
+ - Updated dependencies
12
+
13
+ ## 2.9.4
14
+
15
+ ### Patch Changes
16
+
17
+ - [#126601](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126601)
18
+ [`d9862e969b400`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d9862e969b400) -
19
+ [ux] Adds new InlineEditableCell and InlineEditableTableCell for IssueLikeTable behind feature
20
+ gate platform-datasources-enable-two-way-sync
21
+
3
22
  ## 2.9.3
4
23
 
5
24
  ### Patch Changes
@@ -15,6 +15,7 @@ var _linkClientExtension = require("@atlaskit/link-client-extension");
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
16
  var _analytics = require("../analytics");
17
17
  var _state = require("../state");
18
+ var _actions = require("../state/actions");
18
19
  var _useErrorLogger2 = _interopRequireDefault(require("./useErrorLogger"));
19
20
  var useDatasourceTableState = exports.useDatasourceTableState = function useDatasourceTableState(_ref) {
20
21
  var datasourceId = _ref.datasourceId,
@@ -29,6 +30,8 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
29
30
  captureError = _useErrorLogger.captureError;
30
31
  var _useDatasourceActions = (0, _state.useDatasourceActions)(),
31
32
  onAddItems = _useDatasourceActions.onAddItems;
33
+ var _useDiscoverActions = (0, _actions.useDiscoverActions)(),
34
+ discoverActions = _useDiscoverActions.discoverActions;
32
35
  var idFieldCount = 1;
33
36
  var keyFieldCount = 1;
34
37
  var _useState = (0, _react.useState)([]),
@@ -215,6 +218,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
215
218
  _yield$getDatasourceD4,
216
219
  access,
217
220
  _destinationObjectTypes,
221
+ product,
218
222
  _extensionKey,
219
223
  auth,
220
224
  _providerName,
@@ -223,7 +227,9 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
223
227
  nextPageCursor,
224
228
  _totalCount,
225
229
  schema,
230
+ integrationKey,
226
231
  newIds,
232
+ aris,
227
233
  isUserLoadingNextPage,
228
234
  currentLoadedItemCount,
229
235
  newlyLoadedItemCount,
@@ -265,6 +271,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
265
271
  _yield$getDatasourceD4 = _yield$getDatasourceD3.meta;
266
272
  access = _yield$getDatasourceD4.access;
267
273
  _destinationObjectTypes = _yield$getDatasourceD4.destinationObjectTypes;
274
+ product = _yield$getDatasourceD4.product;
268
275
  _extensionKey = _yield$getDatasourceD4.extensionKey;
269
276
  auth = _yield$getDatasourceD4.auth;
270
277
  _providerName = _yield$getDatasourceD4.providerName;
@@ -274,21 +281,21 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
274
281
  _totalCount = _yield$getDatasourceD5.totalCount;
275
282
  schema = _yield$getDatasourceD5.schema;
276
283
  if (!((_currentAbortControll = currentAbortController) !== null && _currentAbortControll !== void 0 && _currentAbortControll.signal.aborted)) {
277
- _context2.next = 27;
284
+ _context2.next = 28;
278
285
  break;
279
286
  }
280
287
  throw new Error('Aborted');
281
- case 27:
288
+ case 28:
282
289
  setExtensionKey(_extensionKey);
283
290
  setProviderName(_providerName);
284
291
  if (!(access === 'unauthorized' || access === 'forbidden')) {
285
- _context2.next = 33;
292
+ _context2.next = 34;
286
293
  break;
287
294
  }
288
295
  setStatus(access);
289
296
  setAuthDetails(auth || initialEmptyArray);
290
297
  return _context2.abrupt("return");
291
- case 33:
298
+ case 34:
292
299
  setDestinationObjectTypes(_destinationObjectTypes);
293
300
  setTotalCount(_totalCount);
294
301
  setNextCursor(nextPageCursor);
@@ -299,10 +306,29 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
299
306
  return [].concat((0, _toConsumableArray2.default)(currentResponseItems), (0, _toConsumableArray2.default)(items));
300
307
  });
301
308
  if ((0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state')) {
302
- newIds = onAddItems(items);
309
+ /**
310
+ * Product is typed as any.
311
+ */
312
+ integrationKey = product;
313
+ newIds = onAddItems(items, typeof integrationKey === 'string' ? integrationKey : undefined);
303
314
  setResponseItemIds(function (currentIds) {
304
315
  return [].concat((0, _toConsumableArray2.default)(currentIds), (0, _toConsumableArray2.default)(newIds));
305
316
  });
317
+ if ((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync')) {
318
+ if (typeof integrationKey === 'string') {
319
+ aris = items.reduce(function (acc, item) {
320
+ var _item$ari;
321
+ 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;
322
+ }, []);
323
+ if (aris.length) {
324
+ discoverActions({
325
+ aris: aris,
326
+ integrationKey: integrationKey,
327
+ fieldKeys: fieldKeys
328
+ });
329
+ }
330
+ }
331
+ }
306
332
  }
307
333
  setHasNextPage(Boolean(nextPageCursor));
308
334
  if (fieldKeys.length > 0) {
@@ -322,39 +348,39 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
322
348
  });
323
349
  }
324
350
  setStatus('resolved');
325
- _context2.next = 58;
351
+ _context2.next = 59;
326
352
  break;
327
- case 46:
328
- _context2.prev = 46;
353
+ case 47:
354
+ _context2.prev = 47;
329
355
  _context2.t0 = _context2["catch"](10);
330
356
  if (!(_context2.t0.message === 'Aborted')) {
331
- _context2.next = 50;
357
+ _context2.next = 51;
332
358
  break;
333
359
  }
334
360
  return _context2.abrupt("return");
335
- case 50:
361
+ case 51:
336
362
  captureError('onNextPage', _context2.t0);
337
363
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 401)) {
338
- _context2.next = 54;
364
+ _context2.next = 55;
339
365
  break;
340
366
  }
341
367
  setStatus('unauthorized');
342
368
  return _context2.abrupt("return");
343
- case 54:
369
+ case 55:
344
370
  if (!(_context2.t0 instanceof Response && _context2.t0.status === 403)) {
345
- _context2.next = 57;
371
+ _context2.next = 58;
346
372
  break;
347
373
  }
348
374
  setStatus('forbidden');
349
375
  return _context2.abrupt("return");
350
- case 57:
351
- setStatus('rejected');
352
376
  case 58:
377
+ setStatus('rejected');
378
+ case 59:
353
379
  case "end":
354
380
  return _context2.stop();
355
381
  }
356
- }, _callee2, null, [[10, 46]]);
357
- })), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray]);
382
+ }, _callee2, null, [[10, 47]]);
383
+ })), [captureError, parameters, fieldKeys, nextCursor, responseItems, setResponseItemIds, onAddItems, getDatasourceData, datasourceId, applySchemaProperties, fireEvent, fullSchema, initialEmptyArray, discoverActions]);
358
384
  var reset = (0, _react.useCallback)(function (options) {
359
385
  setResponseItems(initialEmptyArray);
360
386
  setResponseItemIds(initialEmptyArray);
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useExecuteAtomicAction = exports.useDiscoverActions = exports.useAtomicUpdateActionSchema = exports.actions = exports.ActionsStore = void 0;
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
+ var _react = require("react");
13
+ var _reactSweetState = require("react-sweet-state");
14
+ var _linkClientExtension = require("@atlaskit/link-client-extension");
15
+ 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
+ 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
+ /**
18
+ * Atomic actions available for an integration (by field)
19
+ * @example
20
+ * ```ts
21
+ * {
22
+ * jira: {
23
+ * summary: {
24
+ * actionKey: 'atlassian:issue:update:summary',
25
+ * type: 'string',
26
+ * description: 'Update issue summary',
27
+ * }
28
+ * }
29
+ * }
30
+ * ```
31
+ */
32
+
33
+ /**
34
+ * Permissions available for a target
35
+ */
36
+
37
+ /**
38
+ * User permissions for actions on target (ARI) properties
39
+ * @example
40
+ * ```ts
41
+ * {
42
+ * 'ari:cloud:jira:63cecfe3-16fa-4ee1-8e8d-047cc4b18980:issue/1': {
43
+ * summary: {
44
+ * isEditable: true
45
+ * }
46
+ * }
47
+ * }
48
+ * ```
49
+ */
50
+
51
+ var getInitialState = function getInitialState() {
52
+ return {
53
+ actionsByIntegration: {},
54
+ permissions: {}
55
+ };
56
+ };
57
+ var actions = exports.actions = {
58
+ discoverActions: function discoverActions(api, request) {
59
+ return /*#__PURE__*/function () {
60
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
61
+ var setState, getState, response, _getState, currentActions, currentPermissions, actionsByIntegration, permissions;
62
+ return _regenerator.default.wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ setState = _ref.setState, getState = _ref.getState;
66
+ _context.next = 3;
67
+ return api.getDatasourceActionsAndPermissions(request);
68
+ case 3:
69
+ response = _context.sent;
70
+ if ('permissions' in response) {
71
+ _getState = getState(), currentActions = _getState.actionsByIntegration, currentPermissions = _getState.permissions;
72
+ actionsByIntegration = response.actions.reduce(function (acc, action) {
73
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, action.integrationKey, _objectSpread(_objectSpread({}, acc[action.integrationKey]), {}, (0, _defineProperty2.default)({}, action.fieldKey, {
74
+ actionKey: action.actionKey,
75
+ type: action.type
76
+ }))));
77
+ }, currentActions);
78
+ permissions = response.permissions.data.reduce(function (acc, permission) {
79
+ return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, permission.ari, _objectSpread(_objectSpread({}, acc[permission.ari]), {}, (0, _defineProperty2.default)({}, permission.fieldKey, {
80
+ isEditable: permission.isEditable
81
+ }))));
82
+ }, currentPermissions);
83
+ setState({
84
+ actionsByIntegration: actionsByIntegration,
85
+ permissions: permissions
86
+ });
87
+ }
88
+ case 5:
89
+ case "end":
90
+ return _context.stop();
91
+ }
92
+ }, _callee);
93
+ }));
94
+ return function (_x) {
95
+ return _ref2.apply(this, arguments);
96
+ };
97
+ }();
98
+ }
99
+ };
100
+ var ActionsStore = exports.ActionsStore = (0, _reactSweetState.createStore)({
101
+ name: 'actions-store',
102
+ initialState: getInitialState(),
103
+ actions: actions
104
+ });
105
+ var useActionStoreActions = (0, _reactSweetState.createActionsHook)(ActionsStore);
106
+ var useDiscoverActions = exports.useDiscoverActions = function useDiscoverActions() {
107
+ var _useDatasourceClientE = (0, _linkClientExtension.useDatasourceClientExtension)(),
108
+ getDatasourceActionsAndPermissions = _useDatasourceClientE.getDatasourceActionsAndPermissions;
109
+ var _useActionStoreAction = useActionStoreActions(),
110
+ discoverActions = _useActionStoreAction.discoverActions;
111
+ return {
112
+ discoverActions: (0, _react.useMemo)(function () {
113
+ return discoverActions.bind(null, {
114
+ getDatasourceActionsAndPermissions: getDatasourceActionsAndPermissions
115
+ });
116
+ }, [discoverActions, getDatasourceActionsAndPermissions])
117
+ };
118
+ };
119
+ var getFieldUpdateActionByAri = function getFieldUpdateActionByAri(state, _ref3) {
120
+ var _state$permissions$ar, _state$actionsByInteg;
121
+ var ari = _ref3.ari,
122
+ fieldKey = _ref3.fieldKey,
123
+ integrationKey = _ref3.integrationKey;
124
+ var isEditable = (_state$permissions$ar = state.permissions[ari]) === null || _state$permissions$ar === void 0 || (_state$permissions$ar = _state$permissions$ar[fieldKey]) === null || _state$permissions$ar === void 0 ? void 0 : _state$permissions$ar.isEditable;
125
+ if (isEditable === false) {
126
+ return;
127
+ }
128
+ return (_state$actionsByInteg = state.actionsByIntegration[integrationKey]) === null || _state$actionsByInteg === void 0 ? void 0 : _state$actionsByInteg[fieldKey];
129
+ };
130
+
131
+ /**
132
+ * Retrieves the action schema for a given ARI + fieldKey + integrationKey
133
+ */
134
+ var useAtomicUpdateActionSchema = exports.useAtomicUpdateActionSchema = (0, _reactSweetState.createHook)(ActionsStore, {
135
+ selector: getFieldUpdateActionByAri
136
+ });
137
+
138
+ /**
139
+ * Given an ARI + fieldKey + integrationKey
140
+ * Returns an executable action that updates a field on the entity if the user has permissions to do so
141
+ *
142
+ * @example
143
+ * ```tsx
144
+ * const { execute } = useExecuteAtomicAction({ ari, fieldKey: 'summary', integrationKey: 'jira' });
145
+ *
146
+ * return <button onClick={() => execute('New summary')}>Update summary</button>;
147
+ * ```
148
+ */
149
+ var useExecuteAtomicAction = exports.useExecuteAtomicAction = function useExecuteAtomicAction(_ref4) {
150
+ var ari = _ref4.ari,
151
+ fieldKey = _ref4.fieldKey,
152
+ integrationKey = _ref4.integrationKey;
153
+ var _useAtomicUpdateActio = useAtomicUpdateActionSchema({
154
+ ari: ari,
155
+ fieldKey: fieldKey,
156
+ integrationKey: integrationKey
157
+ }),
158
+ _useAtomicUpdateActio2 = (0, _slicedToArray2.default)(_useAtomicUpdateActio, 1),
159
+ schema = _useAtomicUpdateActio2[0];
160
+ var _useDatasourceClientE2 = (0, _linkClientExtension.useDatasourceClientExtension)(),
161
+ executeAction = _useDatasourceClientE2.executeAtomicAction;
162
+ var execute = (0, _react.useCallback)(function (value) {
163
+ if (!schema) {
164
+ throw new Error('No action schema found.');
165
+ }
166
+ executeAction({
167
+ integrationKey: integrationKey,
168
+ actionKey: schema.actionKey,
169
+ parameters: {
170
+ inputs: (0, _defineProperty2.default)({}, fieldKey, value),
171
+ target: {
172
+ ari: ari
173
+ }
174
+ }
175
+ });
176
+ }, [executeAction, integrationKey, schema, fieldKey, ari]);
177
+ if (!schema) {
178
+ return null;
179
+ }
180
+ return {
181
+ execute: execute
182
+ };
183
+ };
@@ -20,19 +20,22 @@ var getInitialState = function getInitialState() {
20
20
  };
21
21
  };
22
22
  var actions = exports.actions = {
23
- onAddItems: function onAddItems(items) {
23
+ onAddItems: function onAddItems(items, integrationKey) {
24
24
  return function (_ref) {
25
25
  var setState = _ref.setState,
26
26
  getState = _ref.getState;
27
27
  var oldItems = _objectSpread({}, getState().items);
28
28
  var _items$reduce = items.reduce(function (_ref2, item) {
29
- var _item$ari;
29
+ var _item$ari, _oldItems$id;
30
30
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
31
31
  ids = _ref3[0],
32
32
  itemMap = _ref3[1];
33
33
  var ari = typeof ((_item$ari = item['ari']) === null || _item$ari === void 0 ? void 0 : _item$ari.data) === 'string' ? item['ari'].data : undefined;
34
34
  var id = ari !== null && ari !== void 0 ? ari : (0, _uuid.v4)();
35
- return [[].concat((0, _toConsumableArray2.default)(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, (0, _defineProperty2.default)({}, id, _objectSpread(_objectSpread({}, oldItems[id]), item)))];
35
+ return [[].concat((0, _toConsumableArray2.default)(ids), [id]), _objectSpread(_objectSpread({}, itemMap), {}, (0, _defineProperty2.default)({}, id, {
36
+ integrationKey: integrationKey,
37
+ data: _objectSpread(_objectSpread({}, (_oldItems$id = oldItems[id]) === null || _oldItems$id === void 0 ? void 0 : _oldItems$id.data), item)
38
+ }))];
36
39
  }, [[], oldItems]),
37
40
  _items$reduce2 = (0, _slicedToArray2.default)(_items$reduce, 2),
38
41
  newItemIds = _items$reduce2[0],
@@ -51,8 +54,9 @@ var Store = exports.Store = (0, _reactSweetState.createStore)({
51
54
  });
52
55
  var useDatasourceItem = exports.useDatasourceItem = (0, _reactSweetState.createStateHook)(Store, {
53
56
  selector: function selector(state, _ref4) {
57
+ var _state$items$id;
54
58
  var id = _ref4.id;
55
- return state.items[id];
59
+ return (_state$items$id = state.items[id]) === null || _state$items$id === void 0 ? void 0 : _state$items$id.data;
56
60
  }
57
61
  });
58
62
  var useDatasourceActions = exports.useDatasourceActions = (0, _reactSweetState.createActionsHook)(Store);
@@ -460,69 +460,72 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
460
460
  }));
461
461
  }, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
462
462
  var tableRows = (0, _react.useMemo)(function () {
463
- return (0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state') ? itemIds.map(function (id, rowIndex) {
464
- return {
465
- key: id,
466
- cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
467
- var key = _ref12.key,
468
- type = _ref12.type;
469
- return {
470
- key: key,
471
- columnKey: key,
472
- content: (0, _react2.jsx)(_tableCellContent.TableCellContent, {
473
- id: id,
463
+ return (
464
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
465
+ (0, _platformFeatureFlags.fg)('enable_datasource_react_sweet_state') ? itemIds.map(function (id, rowIndex) {
466
+ return {
467
+ key: id,
468
+ cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
469
+ var key = _ref12.key,
470
+ type = _ref12.type;
471
+ return {
472
+ key: key,
474
473
  columnKey: key,
475
- columnType: type,
476
- wrappedColumnKeys: wrappedColumnKeys,
477
- renderItem: renderItem
478
- }),
479
- width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
480
- };
481
- }),
482
- ref: rowIndex === items.length - 1 ? function (el) {
483
- return setLastRowElement(el);
484
- } : undefined
485
- };
486
- }) : items.map(function (newRowData, rowIndex) {
487
- return {
488
- key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
489
- cells: visibleSortedColumns.map(function (_ref13, cellIndex) {
490
- var _newRowData$key;
491
- var key = _ref13.key,
492
- type = _ref13.type;
493
- // Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
494
- var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
495
- var values = Array.isArray(value) ? value : [value];
496
- var renderedValues = renderItem({
497
- type: type,
498
- values: values
499
- });
500
- var stringifiedContent = values.map(function (value) {
501
- return (0, _renderType.stringifyType)({
474
+ content: (0, _react2.jsx)(_tableCellContent.TableCellContent, {
475
+ id: id,
476
+ columnKey: key,
477
+ columnType: type,
478
+ wrappedColumnKeys: wrappedColumnKeys,
479
+ renderItem: renderItem
480
+ }),
481
+ width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
482
+ };
483
+ }),
484
+ ref: rowIndex === items.length - 1 ? function (el) {
485
+ return setLastRowElement(el);
486
+ } : undefined
487
+ };
488
+ }) : items.map(function (newRowData, rowIndex) {
489
+ return {
490
+ key: "".concat(identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex),
491
+ cells: visibleSortedColumns.map(function (_ref13, cellIndex) {
492
+ var _newRowData$key;
493
+ var key = _ref13.key,
494
+ type = _ref13.type;
495
+ // Need to make sure we keep falsy values like 0 and '', as well as the boolean false.
496
+ var value = (_newRowData$key = newRowData[key]) === null || _newRowData$key === void 0 ? void 0 : _newRowData$key.data;
497
+ var values = Array.isArray(value) ? value : [value];
498
+ var renderedValues = renderItem({
502
499
  type: type,
503
- value: value
504
- }, intl.formatMessage, intl.formatDate);
505
- }).filter(function (value) {
506
- return value !== '';
507
- }).join(', ');
508
- var contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? (0, _react2.jsx)(_tooltip.default
509
- // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
510
- , {
511
- tag: _truncateTextTag.TruncateTextTag,
512
- content: stringifiedContent,
513
- testId: "issues-table-cell-tooltip"
514
- }, renderedValues) : renderedValues;
515
- return {
516
- key: key,
517
- content: contentComponent,
518
- width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
519
- };
520
- }),
521
- ref: rowIndex === items.length - 1 ? function (el) {
522
- return setLastRowElement(el);
523
- } : undefined
524
- };
525
- });
500
+ values: values
501
+ });
502
+ var stringifiedContent = values.map(function (value) {
503
+ return (0, _renderType.stringifyType)({
504
+ type: type,
505
+ value: value
506
+ }, intl.formatMessage, intl.formatDate);
507
+ }).filter(function (value) {
508
+ return value !== '';
509
+ }).join(', ');
510
+ var contentComponent = stringifiedContent && !(wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(key)) ? (0, _react2.jsx)(_tooltip.default
511
+ // @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
512
+ , {
513
+ tag: _truncateTextTag.TruncateTextTag,
514
+ content: stringifiedContent,
515
+ testId: "issues-table-cell-tooltip"
516
+ }, renderedValues) : renderedValues;
517
+ return {
518
+ key: key,
519
+ content: contentComponent,
520
+ width: getColumnWidth(key, type, cellIndex === visibleSortedColumns.length - 1)
521
+ };
522
+ }),
523
+ ref: rowIndex === items.length - 1 ? function (el) {
524
+ return setLastRowElement(el);
525
+ } : undefined
526
+ };
527
+ })
528
+ );
526
529
  }, [items, itemIds, renderItem, wrappedColumnKeys, visibleSortedColumns, getColumnWidth, intl.formatMessage, intl.formatDate]);
527
530
  var rows = (0, _react.useMemo)(function () {
528
531
  if (status !== 'loading') {
@@ -703,15 +706,29 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
703
706
  paddingBlock: "var(--ds-space-100, 8px)"
704
707
  });
705
708
  }
706
- return (0, _react2.jsx)(_styled2.TableCell, {
707
- key: cellKey,
708
- "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
709
- colSpan: isEditable && isLastCell ? 2 : undefined
710
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
711
- ,
712
- style: loadingRowStyle,
713
- css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
714
- }, content);
709
+
710
+ // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
711
+ if ((0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync')) {
712
+ return (0, _react2.jsx)(_styled2.InlineEditableTableCell, {
713
+ key: cellKey,
714
+ "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
715
+ colSpan: isEditable && isLastCell ? 2 : undefined
716
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
717
+ ,
718
+ style: loadingRowStyle,
719
+ css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
720
+ }, content);
721
+ } else {
722
+ return (0, _react2.jsx)(_styled2.TableCell, {
723
+ key: cellKey,
724
+ "data-testid": testId && "".concat(testId, "--cell-").concat(cellIndex),
725
+ colSpan: isEditable && isLastCell ? 2 : undefined
726
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
727
+ ,
728
+ style: loadingRowStyle,
729
+ css: [wrappedColumnKeys !== null && wrappedColumnKeys !== void 0 && wrappedColumnKeys.includes(cellKey) ? null : truncateStyles]
730
+ }, content);
731
+ }
715
732
  }));
716
733
  }))));
717
734
  };
@@ -4,12 +4,12 @@ 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.fieldTextFontSize = exports.TableHeading = exports.TableCell = exports.Table = exports.ScrollableContainerHeight = void 0;
7
+ exports.withTablePluginPrefix = exports.withTablePluginHeaderPrefix = exports.withTablePluginBodyPrefix = exports.fieldTextFontSize = exports.TableHeading = exports.TableCell = 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");
11
11
  var _typography = require("@atlaskit/theme/typography");
12
- var _styled$th, _styled$td; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
+ var _styled$th, _styled$td, _styled$td2; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  var ScrollableContainerHeight = exports.ScrollableContainerHeight = 590;
14
14
  var fieldTextFontSize = exports.fieldTextFontSize = "var(--ds-font-body, ".concat(_typography.fontFallback.body.medium, ")");
15
15
 
@@ -93,4 +93,23 @@ var TableCell = exports.TableCell = _styled.default.td((_styled$td = {}, (0, _de
93
93
  paddingRight: "var(--ds-space-100, 8px)"
94
94
  }), (0, _defineProperty2.default)(_styled$td, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
95
95
  whiteSpace: 'unset'
96
- }), _styled$td));
96
+ }), _styled$td));
97
+
98
+ // 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
99
+ var InlineEditableTableCell = exports.InlineEditableTableCell = _styled.default.td((_styled$td2 = {}, (0, _defineProperty2.default)(_styled$td2, "".concat(withTablePluginBodyPrefix()), {
100
+ /* First section here is to override things editor table plugin css defines */
101
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
102
+ font: fieldTextFontSize,
103
+ padding: "var(--ds-space-0, 0)".concat(" ", "var(--ds-space-0, 0)"),
104
+ border: 0,
105
+ minWidth: 'auto',
106
+ verticalAlign: 'inherit',
107
+ boxSizing: 'border-box',
108
+ borderRight: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
109
+ borderBottom: "0.5px solid ".concat("var(--ds-border, ".concat(_colors.N40, ")")),
110
+ overflow: 'hidden'
111
+ }), (0, _defineProperty2.default)(_styled$td2, "".concat(withTablePluginBodyPrefix('&:last-child')), {
112
+ borderRight: 0
113
+ }), (0, _defineProperty2.default)(_styled$td2, "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
114
+ whiteSpace: 'unset'
115
+ }), _styled$td2));