@atlaskit/link-datasource 3.13.17 → 3.13.18

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 (53) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/hooks/useLoadOptions.js +20 -9
  3. package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +4 -1
  4. package/dist/cjs/ui/issue-like-table/edit-type/index.js +9 -4
  5. package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +7 -1
  6. package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +3 -1
  7. package/dist/cjs/ui/issue-like-table/edit-type/user/index.js +7 -1
  8. package/dist/cjs/ui/issue-like-table/index.js +6 -2
  9. package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +5 -0
  10. package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +31 -2
  11. package/dist/cjs/ui/issue-like-table/table-cell-content/messages.js +14 -0
  12. package/dist/cjs/ui/issue-like-table/utils.js +21 -1
  13. package/dist/es2019/hooks/useLoadOptions.js +15 -4
  14. package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +4 -1
  15. package/dist/es2019/ui/issue-like-table/edit-type/index.js +9 -4
  16. package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +5 -1
  17. package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +3 -1
  18. package/dist/es2019/ui/issue-like-table/edit-type/user/index.js +5 -1
  19. package/dist/es2019/ui/issue-like-table/index.js +7 -3
  20. package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +5 -0
  21. package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +33 -3
  22. package/dist/es2019/ui/issue-like-table/table-cell-content/messages.js +8 -0
  23. package/dist/es2019/ui/issue-like-table/utils.js +18 -1
  24. package/dist/esm/hooks/useLoadOptions.js +21 -10
  25. package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +4 -1
  26. package/dist/esm/ui/issue-like-table/edit-type/index.js +9 -4
  27. package/dist/esm/ui/issue-like-table/edit-type/status/index.js +7 -1
  28. package/dist/esm/ui/issue-like-table/edit-type/text/index.js +3 -1
  29. package/dist/esm/ui/issue-like-table/edit-type/user/index.js +7 -1
  30. package/dist/esm/ui/issue-like-table/index.js +7 -3
  31. package/dist/esm/ui/issue-like-table/table-cell-content/index.js +5 -0
  32. package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +32 -3
  33. package/dist/esm/ui/issue-like-table/table-cell-content/messages.js +8 -0
  34. package/dist/esm/ui/issue-like-table/utils.js +19 -0
  35. package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
  36. package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
  37. package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  38. package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
  39. package/dist/types/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
  40. package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
  41. package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  42. package/dist/types/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
  43. package/dist/types/ui/issue-like-table/utils.d.ts +20 -0
  44. package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
  45. package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
  46. package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  47. package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
  48. package/dist/types-ts4.5/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
  49. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
  50. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  51. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
  52. package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +20 -0
  53. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.13.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [#172124](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172124)
8
+ [`e1ccef8760b47`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e1ccef8760b47) -
9
+ Add labels to inline editable fields to improve accessibility
10
+ - [#168855](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168855)
11
+ [`eb71b8f29a212`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eb71b8f29a212) -
12
+ Refactor behind ff - Fixes loading state not showing on user typeahead search
13
+ - Updated dependencies
14
+
3
15
  ## 3.13.17
4
16
 
5
17
  ### Patch Changes
@@ -8,10 +8,13 @@ exports.useLoadOptions = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
13
  var _react = require("react");
13
14
  var _linkingTypes = require("@atlaskit/linking-types");
14
15
  var _useDatasourceTableFlag = require("./useDatasourceTableFlag");
16
+ 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; }
17
+ 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; }
15
18
  var loadOptions = /*#__PURE__*/function () {
16
19
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
17
20
  var fetchInputs,
@@ -53,30 +56,38 @@ var loadOptions = /*#__PURE__*/function () {
53
56
  return _ref.apply(this, arguments);
54
57
  };
55
58
  }();
59
+ var reducer = function reducer(state, payload) {
60
+ return _objectSpread(_objectSpread({}, state), payload);
61
+ };
56
62
  var useLoadOptions = exports.useLoadOptions = function useLoadOptions(_ref2) {
57
63
  var fetchInputs = _ref2.fetchInputs,
58
64
  executeFetch = _ref2.executeFetch,
59
65
  emptyOption = _ref2.emptyOption;
60
- var _useState = (0, _react.useState)({
66
+ var _useReducer = (0, _react.useReducer)(reducer, {
61
67
  isLoading: true,
62
68
  options: [],
63
69
  hasFailed: false
64
70
  }),
65
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
66
- _useState2$ = _useState2[0],
67
- options = _useState2$.options,
68
- isLoading = _useState2$.isLoading,
69
- hasFailed = _useState2$.hasFailed,
70
- setOptions = _useState2[1];
71
+ _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
72
+ _useReducer2$ = _useReducer2[0],
73
+ options = _useReducer2$.options,
74
+ isLoading = _useReducer2$.isLoading,
75
+ hasFailed = _useReducer2$.hasFailed,
76
+ dispatch = _useReducer2[1];
71
77
  var _useDatasourceTableFl = (0, _useDatasourceTableFlag.useDatasourceTableFlag)({
72
78
  isFetchAction: true
73
79
  }),
74
80
  showErrorFlag = _useDatasourceTableFl.showErrorFlag;
75
81
  (0, _react.useEffect)(function () {
76
82
  var isMounted = true;
83
+ // Set the loading state before sending the request
84
+ dispatch({
85
+ isLoading: true
86
+ });
87
+ // Query the options
77
88
  loadOptions(fetchInputs, executeFetch).then(function (options) {
78
89
  if (isMounted) {
79
- setOptions({
90
+ dispatch({
80
91
  isLoading: false,
81
92
  options: emptyOption ? [emptyOption].concat((0, _toConsumableArray2.default)(options)) : options,
82
93
  hasFailed: false
@@ -84,7 +95,7 @@ var useLoadOptions = exports.useLoadOptions = function useLoadOptions(_ref2) {
84
95
  }
85
96
  }).catch(function (err) {
86
97
  showErrorFlag();
87
- setOptions({
98
+ dispatch({
88
99
  isLoading: false,
89
100
  options: [],
90
101
  hasFailed: true
@@ -16,6 +16,7 @@ var _datasourceExperienceId = require("../../../../contexts/datasource-experienc
16
16
  var _useLoadOptions2 = require("../../../../hooks/useLoadOptions");
17
17
  var _icon = require("../../shared-components/icon");
18
18
  var _inlineEdit = require("../../table-cell-content/inline-edit");
19
+ var _utils = require("../../utils");
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
22
  /**
@@ -24,6 +25,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
24
25
  var IconEditType = function IconEditType(props) {
25
26
  var _currentValue$values;
26
27
  var currentValue = props.currentValue,
28
+ labelId = props.labelId,
27
29
  executeFetch = props.executeFetch;
28
30
  var _useLoadOptions = (0, _useLoadOptions2.useLoadOptions)({
29
31
  executeFetch: executeFetch
@@ -48,7 +50,7 @@ var IconEditType = function IconEditType(props) {
48
50
  }, [experienceId, isLoading, hasFailed]);
49
51
  return /*#__PURE__*/_react.default.createElement(_layering.Layering, {
50
52
  isDisabled: false
51
- }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
53
+ }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, (0, _utils.getCleanedSelectProps)(props), {
52
54
  autoFocus: true,
53
55
  blurInputOnSelect: true,
54
56
  defaultMenuIsOpen: true,
@@ -58,6 +60,7 @@ var IconEditType = function IconEditType(props) {
58
60
  filterOption: filterOption,
59
61
  testId: "inline-edit-priority",
60
62
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
63
+ labelId: labelId,
61
64
  getOptionValue: function getOptionValue(option) {
62
65
  return option.text || '';
63
66
  },
@@ -22,6 +22,7 @@ var editType = exports.editType = function editType(_ref) {
22
22
  var _toValueType, _value$atlassianUserI;
23
23
  var defaultValue = _ref.defaultValue,
24
24
  currentValue = _ref.currentValue,
25
+ labelId = _ref.labelId,
25
26
  setEditValues = _ref.setEditValues,
26
27
  executeFetch = _ref.executeFetch;
27
28
  switch (defaultValue.type) {
@@ -33,7 +34,8 @@ var editType = exports.editType = function editType(_ref) {
33
34
  return /*#__PURE__*/_react.default.createElement(_text.default, (0, _extends2.default)({}, fieldProps, {
34
35
  currentValue: currentValue,
35
36
  setEditValues: setEditValues,
36
- id: ACTIVE_INLINE_EDIT_ID
37
+ id: ACTIVE_INLINE_EDIT_ID,
38
+ labelId: labelId
37
39
  }));
38
40
  }
39
41
  };
@@ -47,7 +49,8 @@ var editType = exports.editType = function editType(_ref) {
47
49
  currentValue: currentValue,
48
50
  setEditValues: setEditValues,
49
51
  id: ACTIVE_INLINE_EDIT_ID,
50
- executeFetch: executeFetch
52
+ executeFetch: executeFetch,
53
+ labelId: labelId
51
54
  }));
52
55
  }
53
56
  };
@@ -60,7 +63,8 @@ var editType = exports.editType = function editType(_ref) {
60
63
  currentValue: currentValue,
61
64
  setEditValues: setEditValues,
62
65
  id: ACTIVE_INLINE_EDIT_ID,
63
- executeFetch: executeFetch
66
+ executeFetch: executeFetch,
67
+ labelId: labelId
64
68
  }));
65
69
  }
66
70
  };
@@ -74,7 +78,8 @@ var editType = exports.editType = function editType(_ref) {
74
78
  currentValue: currentValue,
75
79
  setEditValues: setEditValues,
76
80
  id: ACTIVE_INLINE_EDIT_ID,
77
- executeFetch: executeFetch
81
+ executeFetch: executeFetch,
82
+ labelId: labelId
78
83
  }));
79
84
  }
80
85
  };
@@ -16,11 +16,13 @@ var _ufoExperiences = require("../../../../analytics/ufoExperiences");
16
16
  var _datasourceExperienceId = require("../../../../contexts/datasource-experience-id");
17
17
  var _useLoadOptions2 = require("../../../../hooks/useLoadOptions");
18
18
  var _inlineEdit = require("../../table-cell-content/inline-edit");
19
+ var _utils = require("../../utils");
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
22
  var StatusEditType = function StatusEditType(props) {
22
23
  var _currentValue$values;
23
24
  var currentValue = props.currentValue,
25
+ labelId = props.labelId,
24
26
  executeFetch = props.executeFetch;
25
27
  var _useLoadOptions = (0, _useLoadOptions2.useLoadOptions)({
26
28
  executeFetch: executeFetch
@@ -45,7 +47,7 @@ var StatusEditType = function StatusEditType(props) {
45
47
  }, [experienceId, isLoading, hasFailed]);
46
48
  return /*#__PURE__*/_react.default.createElement(_layering.Layering, {
47
49
  isDisabled: false
48
- }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
50
+ }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, (0, _utils.getCleanedSelectProps)(props), {
49
51
  autoFocus: true,
50
52
  options: options,
51
53
  defaultMenuIsOpen: true,
@@ -58,6 +60,7 @@ var StatusEditType = function StatusEditType(props) {
58
60
  return option.text;
59
61
  },
60
62
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
63
+ labelId: labelId,
61
64
  formatOptionLabel: function formatOptionLabel(option) {
62
65
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
63
66
  content: option.text
@@ -65,6 +68,9 @@ var StatusEditType = function StatusEditType(props) {
65
68
  testId: "inline-edit-status-option-".concat(option.text)
66
69
  }, option.style), option.text));
67
70
  },
71
+ getOptionLabel: function getOptionLabel(option) {
72
+ return option.text;
73
+ },
68
74
  onChange: function onChange(e) {
69
75
  return props.setEditValues({
70
76
  type: 'status',
@@ -17,7 +17,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
17
17
  var TextEditType = function TextEditType(props) {
18
18
  var _currentValue$values$, _currentValue$values;
19
19
  var experienceId = (0, _datasourceExperienceId.useDatasourceExperienceId)();
20
- var currentValue = props.currentValue;
20
+ var currentValue = props.currentValue,
21
+ labelId = props.labelId;
21
22
  (0, _react.useEffect)(function () {
22
23
  if (experienceId) {
23
24
  (0, _ufoExperiences.succeedUfoExperience)({
@@ -36,6 +37,7 @@ var TextEditType = function TextEditType(props) {
36
37
  padding: "var(--ds-space-100, 8px)".concat(" calc(", "var(--ds-space-100, 8px)", " - 1px)")
37
38
  },
38
39
  value: (_currentValue$values$ = currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0]) !== null && _currentValue$values$ !== void 0 ? _currentValue$values$ : '',
40
+ "aria-labelledby": labelId,
39
41
  onChange: function onChange(e) {
40
42
  return props.setEditValues({
41
43
  type: 'string',
@@ -22,11 +22,13 @@ var _constants = require("../../../common/modal/popup-select/constants");
22
22
  var _user = require("../../render-type/user");
23
23
  var _messages = require("../../render-type/user/messages");
24
24
  var _inlineEdit = require("../../table-cell-content/inline-edit");
25
+ var _utils = require("../../utils");
25
26
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
26
27
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
28
  var UserEditType = function UserEditType(props) {
28
29
  var _currentValue$values;
29
30
  var currentValue = props.currentValue,
31
+ labelId = props.labelId,
30
32
  executeFetch = props.executeFetch;
31
33
  var _useState = (0, _react.useState)({
32
34
  query: ''
@@ -75,7 +77,7 @@ var UserEditType = function UserEditType(props) {
75
77
  }, [experienceId, isLoading, hasFailed]);
76
78
  return /*#__PURE__*/_react.default.createElement(_layering.Layering, {
77
79
  isDisabled: false
78
- }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, props, {
80
+ }, /*#__PURE__*/_react.default.createElement(_select.default, (0, _extends2.default)({}, (0, _utils.getCleanedSelectProps)(props), {
79
81
  autoFocus: true,
80
82
  defaultMenuIsOpen: true,
81
83
  blurInputOnSelect: true,
@@ -86,9 +88,13 @@ var UserEditType = function UserEditType(props) {
86
88
  menuPlacement: "auto",
87
89
  onInputChange: handleUserInputDebounced,
88
90
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
91
+ labelId: labelId,
89
92
  getOptionValue: function getOptionValue(option) {
90
93
  return option.atlassianUserId;
91
94
  },
95
+ getOptionLabel: function getOptionLabel(option) {
96
+ return option.displayName || '';
97
+ },
92
98
  formatOptionLabel: function formatOptionLabel(option) {
93
99
  var _option$displayName;
94
100
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
@@ -477,7 +477,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
477
477
  key: id,
478
478
  cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
479
479
  var key = _ref12.key,
480
- type = _ref12.type;
480
+ type = _ref12.type,
481
+ title = _ref12.title;
481
482
  return {
482
483
  key: key,
483
484
  columnKey: key,
@@ -486,11 +487,13 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
486
487
  id: id,
487
488
  columnKey: key,
488
489
  columnType: type,
490
+ columnTitle: title,
489
491
  wrappedColumnKeys: wrappedColumnKeys,
490
492
  renderItem: renderItem
491
493
  }) : (0, _react2.jsx)(_tableCellContent.ReadOnlyCell, {
492
494
  id: id,
493
495
  columnKey: key,
496
+ columnTitle: title,
494
497
  columnType: type,
495
498
  wrappedColumnKeys: wrappedColumnKeys,
496
499
  renderItem: renderItem
@@ -646,7 +649,8 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
646
649
  position: "bottom-start",
647
650
  testId: 'datasource-header-content'
648
651
  }, (0, _react2.jsx)("span", {
649
- css: headerStyles
652
+ css: headerStyles,
653
+ id: (0, _utils.getFieldLabelById)(key)
650
654
  }, content));
651
655
  var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
652
656
  if (isHeadingOutsideButton) {
@@ -82,6 +82,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
82
82
  var ari = _ref3.ari,
83
83
  values = _ref3.values,
84
84
  columnKey = _ref3.columnKey,
85
+ columnTitle = _ref3.columnTitle,
85
86
  renderItem = _ref3.renderItem,
86
87
  integrationKey = _ref3.integrationKey,
87
88
  wrappedColumnKeys = _ref3.wrappedColumnKeys;
@@ -121,6 +122,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
121
122
  executeFetch: executeFetch,
122
123
  readView: readView,
123
124
  columnKey: columnKey,
125
+ columnTitle: columnTitle,
124
126
  datasourceTypeWithValues: values
125
127
  });
126
128
  };
@@ -140,6 +142,7 @@ var toDatasourceTypeWithValues = function toDatasourceTypeWithValues(_ref4) {
140
142
  var TableCellContent = exports.TableCellContent = function TableCellContent(_ref5) {
141
143
  var id = _ref5.id,
142
144
  columnKey = _ref5.columnKey,
145
+ columnTitle = _ref5.columnTitle,
143
146
  columnType = _ref5.columnType,
144
147
  renderItem = _ref5.renderItem,
145
148
  wrappedColumnKeys = _ref5.wrappedColumnKeys;
@@ -155,6 +158,7 @@ var TableCellContent = exports.TableCellContent = function TableCellContent(_ref
155
158
  return /*#__PURE__*/_react.default.createElement(InlineEditableCell, {
156
159
  ari: ari,
157
160
  columnKey: columnKey,
161
+ columnTitle: columnTitle,
158
162
  renderItem: renderItem,
159
163
  integrationKey: integrationKey,
160
164
  values: toDatasourceTypeWithValues({
@@ -174,6 +178,7 @@ var TableCellContent = exports.TableCellContent = function TableCellContent(_ref
174
178
  }, /*#__PURE__*/_react.default.createElement(ReadOnlyCell, {
175
179
  id: id,
176
180
  columnKey: columnKey,
181
+ columnTitle: columnTitle,
177
182
  columnType: columnType,
178
183
  wrappedColumnKeys: wrappedColumnKeys,
179
184
  renderItem: renderItem
@@ -11,6 +11,7 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
+ var _reactIntlNext = require("react-intl-next");
14
15
  var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
15
16
  var _primitives = require("@atlaskit/primitives");
16
17
  var _hooks = require("@atlaskit/smart-card/hooks");
@@ -21,6 +22,8 @@ var _useDatasourceTableFlag = require("../../../hooks/useDatasourceTableFlag");
21
22
  var _state = require("../../../state");
22
23
  var _editType = require("../edit-type");
23
24
  var _avatar = require("../shared-components/avatar");
25
+ var _utils = require("../utils");
26
+ var _messages = require("./messages");
24
27
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
28
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
29
  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; }
@@ -43,6 +46,21 @@ var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
43
46
  }
44
47
  throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
45
48
  };
49
+ var getCurrentFieldLabel = function getCurrentFieldLabel(typedNewValue) {
50
+ var _typedNewValue$values4, _typedNewValue$values5, _typedNewValue$values6;
51
+ switch (typedNewValue.type) {
52
+ case 'string':
53
+ return typedNewValue.values[0] || '';
54
+ case 'status':
55
+ return ((_typedNewValue$values4 = typedNewValue.values[0]) === null || _typedNewValue$values4 === void 0 ? void 0 : _typedNewValue$values4.text) || '';
56
+ case 'user':
57
+ return ((_typedNewValue$values5 = typedNewValue.values[0]) === null || _typedNewValue$values5 === void 0 ? void 0 : _typedNewValue$values5.displayName) || '';
58
+ case 'icon':
59
+ return ((_typedNewValue$values6 = typedNewValue.values[0]) === null || _typedNewValue$values6 === void 0 ? void 0 : _typedNewValue$values6.text) || '';
60
+ default:
61
+ return '';
62
+ }
63
+ };
46
64
  var mapUpdatedItem = function mapUpdatedItem(existingItem, columnKey, newValue) {
47
65
  switch (newValue.type) {
48
66
  case 'string':
@@ -83,6 +101,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
83
101
  executeFetch = _ref.executeFetch,
84
102
  readView = _ref.readView,
85
103
  columnKey = _ref.columnKey,
104
+ columnTitle = _ref.columnTitle,
86
105
  datasourceTypeWithValues = _ref.datasourceTypeWithValues;
87
106
  var _useState = (0, _react.useState)(false),
88
107
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -153,13 +172,22 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
153
172
  });
154
173
  }
155
174
  }, [columnKey, entityType, fireEvent, integrationKey]);
175
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
176
+ formatMessage = _useIntl.formatMessage;
177
+ var editButtonLabel = (0, _react.useMemo)(function () {
178
+ return formatMessage(_messages.tableCellMessages.editButtonLabel, {
179
+ fieldName: columnTitle,
180
+ fieldValue: getCurrentFieldLabel(editValues)
181
+ });
182
+ }, [columnTitle, formatMessage, editValues]);
156
183
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
157
184
  xcss: editContainerStyles
158
185
  }, /*#__PURE__*/_react.default.createElement(_inlineEdit.default, (0, _extends2.default)({}, (0, _editType.editType)({
159
186
  defaultValue: datasourceTypeWithValues,
160
187
  currentValue: editValues,
161
188
  setEditValues: setEditValues,
162
- executeFetch: executeFetch
189
+ executeFetch: executeFetch,
190
+ labelId: (0, _utils.getFieldLabelById)(columnKey)
163
191
  }), {
164
192
  hideActionButtons: true,
165
193
  readView: editableRenderType({
@@ -172,7 +200,8 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
172
200
  onCancel: onCancelEdit,
173
201
  onConfirm: function onConfirm() {
174
202
  return onCommitUpdate(editValues);
175
- }
203
+ },
204
+ editButtonLabel: editButtonLabel
176
205
  })));
177
206
  };
178
207
 
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tableCellMessages = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var tableCellMessages = exports.tableCellMessages = (0, _reactIntlNext.defineMessages)({
9
+ editButtonLabel: {
10
+ id: 'linkDataSource.issue-line-table.edit-button-label.non-final',
11
+ description: 'Label of inline editable field, used mostly for screen readers. This label is used to describe the field that is editable and can be changed. e.g John Doe, Assignee field',
12
+ defaultMessage: '{fieldValue}, {fieldName} field'
13
+ }
14
+ });
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.getWidthCss = exports.getColumnMinWidth = exports.getColumnAction = exports.COLUMN_BASE_WIDTH = void 0;
7
+ exports.getWidthCss = exports.getFieldLabelById = exports.getColumnMinWidth = exports.getColumnAction = exports.getCleanedSelectProps = exports.COLUMN_BASE_WIDTH = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
7
9
  var _types = require("../../analytics/types");
10
+ var _excluded = ["aria-labelledby"];
8
11
  var COLUMN_BASE_WIDTH = exports.COLUMN_BASE_WIDTH = 8;
9
12
  var COLUMN_MIN_WIDTH = COLUMN_BASE_WIDTH * 4;
10
13
  var keyBasedMinWidthMap = {
@@ -58,4 +61,21 @@ var getColumnAction = exports.getColumnAction = function getColumnAction(oldVisi
58
61
  } else {
59
62
  return _types.DatasourceAction.COLUMN_REORDERED;
60
63
  }
64
+ };
65
+
66
+ /**
67
+ * Remove deprecated `aria-labelledby` prop from select component props.
68
+ */
69
+ var getCleanedSelectProps = exports.getCleanedSelectProps = function getCleanedSelectProps(props) {
70
+ // Component Field auto adds `aria-labelledby` prop, which is deprecated and should not be used - https://hello.jira.atlassian.cloud/browse/ENGHEALTH-14529
71
+ var removedLabelByProps = props['aria-labelledby'],
72
+ selectProps = (0, _objectWithoutProperties2.default)(props, _excluded);
73
+ return selectProps;
74
+ };
75
+
76
+ /**
77
+ * Create id for table header to be used as aria-labelledby on form fields.
78
+ */
79
+ var getFieldLabelById = exports.getFieldLabelById = function getFieldLabelById(fieldId) {
80
+ return "datasource-header-title-".concat(fieldId);
61
81
  };
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useEffect, useReducer } from 'react';
2
2
  import { ActionOperationStatus } from '@atlaskit/linking-types';
3
3
  import { useDatasourceTableFlag } from './useDatasourceTableFlag';
4
4
  const loadOptions = async (fetchInputs = {}, executeFetch) => {
@@ -15,6 +15,12 @@ const loadOptions = async (fetchInputs = {}, executeFetch) => {
15
15
  }
16
16
  return entities !== null && entities !== void 0 ? entities : [];
17
17
  };
18
+ const reducer = (state, payload) => {
19
+ return {
20
+ ...state,
21
+ ...payload
22
+ };
23
+ };
18
24
  export const useLoadOptions = ({
19
25
  fetchInputs,
20
26
  executeFetch,
@@ -24,7 +30,7 @@ export const useLoadOptions = ({
24
30
  options,
25
31
  isLoading,
26
32
  hasFailed
27
- }, setOptions] = useState({
33
+ }, dispatch] = useReducer(reducer, {
28
34
  isLoading: true,
29
35
  options: [],
30
36
  hasFailed: false
@@ -36,9 +42,14 @@ export const useLoadOptions = ({
36
42
  });
37
43
  useEffect(() => {
38
44
  let isMounted = true;
45
+ // Set the loading state before sending the request
46
+ dispatch({
47
+ isLoading: true
48
+ });
49
+ // Query the options
39
50
  loadOptions(fetchInputs, executeFetch).then(options => {
40
51
  if (isMounted) {
41
- setOptions({
52
+ dispatch({
42
53
  isLoading: false,
43
54
  options: emptyOption ? [emptyOption, ...options] : options,
44
55
  hasFailed: false
@@ -46,7 +57,7 @@ export const useLoadOptions = ({
46
57
  }
47
58
  }).catch(err => {
48
59
  showErrorFlag();
49
- setOptions({
60
+ dispatch({
50
61
  isLoading: false,
51
62
  options: [],
52
63
  hasFailed: true
@@ -8,6 +8,7 @@ import { useDatasourceExperienceId } from '../../../../contexts/datasource-exper
8
8
  import { useLoadOptions } from '../../../../hooks/useLoadOptions';
9
9
  import { SharedIconComponent } from '../../shared-components/icon';
10
10
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
11
+ import { getCleanedSelectProps } from '../../utils';
11
12
  /**
12
13
  * Should be gated by FF rollout of platform-datasources-enable-two-way-sync-priority
13
14
  */
@@ -15,6 +16,7 @@ const IconEditType = props => {
15
16
  var _currentValue$values;
16
17
  const {
17
18
  currentValue,
19
+ labelId,
18
20
  executeFetch
19
21
  } = props;
20
22
  const {
@@ -41,7 +43,7 @@ const IconEditType = props => {
41
43
  }, [experienceId, isLoading, hasFailed]);
42
44
  return /*#__PURE__*/React.createElement(Layering, {
43
45
  isDisabled: false
44
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
46
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
45
47
  autoFocus: true,
46
48
  blurInputOnSelect: true,
47
49
  defaultMenuIsOpen: true,
@@ -51,6 +53,7 @@ const IconEditType = props => {
51
53
  filterOption: filterOption,
52
54
  testId: "inline-edit-priority",
53
55
  value: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
56
+ labelId: labelId,
54
57
  getOptionValue: option => option.text || '',
55
58
  formatOptionLabel: ({
56
59
  source,
@@ -11,6 +11,7 @@ const ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
11
11
  export const editType = ({
12
12
  defaultValue,
13
13
  currentValue,
14
+ labelId,
14
15
  setEditValues,
15
16
  executeFetch
16
17
  }) => {
@@ -24,7 +25,8 @@ export const editType = ({
24
25
  }) => /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
25
26
  currentValue: currentValue,
26
27
  setEditValues: setEditValues,
27
- id: ACTIVE_INLINE_EDIT_ID
28
+ id: ACTIVE_INLINE_EDIT_ID,
29
+ labelId: labelId
28
30
  }))
29
31
  };
30
32
  case 'icon':
@@ -37,7 +39,8 @@ export const editType = ({
37
39
  currentValue: currentValue,
38
40
  setEditValues: setEditValues,
39
41
  id: ACTIVE_INLINE_EDIT_ID,
40
- executeFetch: executeFetch
42
+ executeFetch: executeFetch,
43
+ labelId: labelId
41
44
  }))
42
45
  };
43
46
  case 'status':
@@ -49,7 +52,8 @@ export const editType = ({
49
52
  currentValue: currentValue,
50
53
  setEditValues: setEditValues,
51
54
  id: ACTIVE_INLINE_EDIT_ID,
52
- executeFetch: executeFetch
55
+ executeFetch: executeFetch,
56
+ labelId: labelId
53
57
  }))
54
58
  };
55
59
  case 'user':
@@ -62,7 +66,8 @@ export const editType = ({
62
66
  currentValue: currentValue,
63
67
  setEditValues: setEditValues,
64
68
  id: ACTIVE_INLINE_EDIT_ID,
65
- executeFetch: executeFetch
69
+ executeFetch: executeFetch,
70
+ labelId: labelId
66
71
  }))
67
72
  };
68
73
  }
@@ -8,10 +8,12 @@ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/u
8
8
  import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
9
9
  import { useLoadOptions } from '../../../../hooks/useLoadOptions';
10
10
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
11
+ import { getCleanedSelectProps } from '../../utils';
11
12
  const StatusEditType = props => {
12
13
  var _currentValue$values;
13
14
  const {
14
15
  currentValue,
16
+ labelId,
15
17
  executeFetch
16
18
  } = props;
17
19
  const {
@@ -38,7 +40,7 @@ const StatusEditType = props => {
38
40
  }, [experienceId, isLoading, hasFailed]);
39
41
  return /*#__PURE__*/React.createElement(Layering, {
40
42
  isDisabled: false
41
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
43
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
42
44
  autoFocus: true,
43
45
  options: options,
44
46
  defaultMenuIsOpen: true,
@@ -49,11 +51,13 @@ const StatusEditType = props => {
49
51
  testId: "inline-edit-status",
50
52
  getOptionValue: option => option.text,
51
53
  value: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
54
+ labelId: labelId,
52
55
  formatOptionLabel: option => /*#__PURE__*/React.createElement(Tooltip, {
53
56
  content: option.text
54
57
  }, /*#__PURE__*/React.createElement(Lozenge, _extends({
55
58
  testId: `inline-edit-status-option-${option.text}`
56
59
  }, option.style), option.text)),
60
+ getOptionLabel: option => option.text,
57
61
  onChange: e => props.setEditValues({
58
62
  type: 'status',
59
63
  values: e ? [e] : []