@atlaskit/link-datasource 3.0.0 → 3.0.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 +8 -0
- package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +18 -2
- package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +18 -2
- package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +18 -2
- package/dist/types/state/index.d.ts +1 -1
- package/dist/types-ts4.5/state/index.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#139854](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139854)
|
|
8
|
+
[`02487a1a06283`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/02487a1a06283) -
|
|
9
|
+
fix an issue where jira issue hover card is not updated after user updates the summary via j2ws
|
|
10
|
+
|
|
3
11
|
## 3.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -13,6 +13,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _inlineEdit = _interopRequireDefault(require("@atlaskit/inline-edit"));
|
|
15
15
|
var _primitives = require("@atlaskit/primitives");
|
|
16
|
+
var _hooks = require("@atlaskit/smart-card/hooks");
|
|
16
17
|
var _analytics = require("../../../analytics");
|
|
17
18
|
var _useDatasourceTableFlag = require("../../../hooks/useDatasourceTableFlag");
|
|
18
19
|
var _state = require("../../../state");
|
|
@@ -37,6 +38,20 @@ var mapUpdatedItem = function mapUpdatedItem(type, existingItem, columnKey, newV
|
|
|
37
38
|
var isNewValue = function isNewValue(columnKey, newItem, existingData) {
|
|
38
39
|
return newItem[columnKey].data && newItem[columnKey].data !== existingData[columnKey].data;
|
|
39
40
|
};
|
|
41
|
+
var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
42
|
+
var _item$data;
|
|
43
|
+
var url = item === null || item === void 0 || (_item$data = item.data) === null || _item$data === void 0 || (_item$data = _item$data.key) === null || _item$data === void 0 || (_item$data = _item$data.data) === null || _item$data === void 0 ? void 0 : _item$data.url;
|
|
44
|
+
|
|
45
|
+
// passing empty string to the hook isn't ideal, but the alternatives are too much effort for this small fix.
|
|
46
|
+
var reloadSmartLinkAction = (0, _hooks.useSmartLinkReload)({
|
|
47
|
+
url: url || ''
|
|
48
|
+
});
|
|
49
|
+
return (0, _react.useCallback)(function () {
|
|
50
|
+
if (url) {
|
|
51
|
+
reloadSmartLinkAction();
|
|
52
|
+
}
|
|
53
|
+
}, [reloadSmartLinkAction, url]);
|
|
54
|
+
};
|
|
40
55
|
var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
41
56
|
var ari = _ref.ari,
|
|
42
57
|
execute = _ref.execute,
|
|
@@ -59,6 +74,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
59
74
|
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
60
75
|
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
61
76
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
77
|
+
var refreshDatasourceItem = useRefreshDatasourceItem(item);
|
|
62
78
|
var onCommitUpdate = (0, _react.useCallback)(function (value) {
|
|
63
79
|
if (!item) {
|
|
64
80
|
setIsEditing(false);
|
|
@@ -72,7 +88,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
72
88
|
}
|
|
73
89
|
onUpdateItem(ari, newItem);
|
|
74
90
|
fireEvent('ui.form.submitted.inlineEdit', {});
|
|
75
|
-
execute(value).catch(function (error) {
|
|
91
|
+
execute(value).then(refreshDatasourceItem).catch(function (error) {
|
|
76
92
|
var status = error && (0, _typeof2.default)(error) === 'object' ? error.status : undefined;
|
|
77
93
|
showErrorFlag({
|
|
78
94
|
status: status
|
|
@@ -80,7 +96,7 @@ var InlineEdit = exports.InlineEdit = function InlineEdit(_ref) {
|
|
|
80
96
|
onUpdateItem(ari, existingData);
|
|
81
97
|
});
|
|
82
98
|
setIsEditing(false);
|
|
83
|
-
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari,
|
|
99
|
+
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, refreshDatasourceItem, fireEvent, execute, showErrorFlag]);
|
|
84
100
|
var onEdit = (0, _react.useCallback)(function () {
|
|
85
101
|
setIsEditing(true);
|
|
86
102
|
if (integrationKey && entityType) {
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
4
4
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
5
|
+
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
5
6
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
6
7
|
import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
7
8
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
@@ -25,6 +26,20 @@ const mapUpdatedItem = (type, existingItem, columnKey, newValue) => {
|
|
|
25
26
|
const isNewValue = (columnKey, newItem, existingData) => {
|
|
26
27
|
return newItem[columnKey].data && newItem[columnKey].data !== existingData[columnKey].data;
|
|
27
28
|
};
|
|
29
|
+
const useRefreshDatasourceItem = item => {
|
|
30
|
+
var _item$data, _item$data$key, _item$data$key$data;
|
|
31
|
+
const url = item === null || item === void 0 ? void 0 : (_item$data = item.data) === null || _item$data === void 0 ? void 0 : (_item$data$key = _item$data.key) === null || _item$data$key === void 0 ? void 0 : (_item$data$key$data = _item$data$key.data) === null || _item$data$key$data === void 0 ? void 0 : _item$data$key$data.url;
|
|
32
|
+
|
|
33
|
+
// passing empty string to the hook isn't ideal, but the alternatives are too much effort for this small fix.
|
|
34
|
+
const reloadSmartLinkAction = useSmartLinkReload({
|
|
35
|
+
url: url || ''
|
|
36
|
+
});
|
|
37
|
+
return useCallback(() => {
|
|
38
|
+
if (url) {
|
|
39
|
+
reloadSmartLinkAction();
|
|
40
|
+
}
|
|
41
|
+
}, [reloadSmartLinkAction, url]);
|
|
42
|
+
};
|
|
28
43
|
export const InlineEdit = ({
|
|
29
44
|
ari,
|
|
30
45
|
execute,
|
|
@@ -49,6 +64,7 @@ export const InlineEdit = ({
|
|
|
49
64
|
const {
|
|
50
65
|
fireEvent
|
|
51
66
|
} = useDatasourceAnalyticsEvents();
|
|
67
|
+
const refreshDatasourceItem = useRefreshDatasourceItem(item);
|
|
52
68
|
const onCommitUpdate = useCallback(value => {
|
|
53
69
|
if (!item) {
|
|
54
70
|
setIsEditing(false);
|
|
@@ -62,7 +78,7 @@ export const InlineEdit = ({
|
|
|
62
78
|
}
|
|
63
79
|
onUpdateItem(ari, newItem);
|
|
64
80
|
fireEvent('ui.form.submitted.inlineEdit', {});
|
|
65
|
-
execute(value).catch(error => {
|
|
81
|
+
execute(value).then(refreshDatasourceItem).catch(error => {
|
|
66
82
|
const status = error && typeof error === 'object' ? error.status : undefined;
|
|
67
83
|
showErrorFlag({
|
|
68
84
|
status
|
|
@@ -70,7 +86,7 @@ export const InlineEdit = ({
|
|
|
70
86
|
onUpdateItem(ari, existingData);
|
|
71
87
|
});
|
|
72
88
|
setIsEditing(false);
|
|
73
|
-
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari,
|
|
89
|
+
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, refreshDatasourceItem, fireEvent, execute, showErrorFlag]);
|
|
74
90
|
const onEdit = useCallback(() => {
|
|
75
91
|
setIsEditing(true);
|
|
76
92
|
if (integrationKey && entityType) {
|
|
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import React, { useCallback, useState } from 'react';
|
|
8
8
|
import AKInlineEdit from '@atlaskit/inline-edit';
|
|
9
9
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
10
|
+
import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
|
|
10
11
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
11
12
|
import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
|
|
12
13
|
import { useDatasourceActions, useDatasourceItem } from '../../../state';
|
|
@@ -27,6 +28,20 @@ var mapUpdatedItem = function mapUpdatedItem(type, existingItem, columnKey, newV
|
|
|
27
28
|
var isNewValue = function isNewValue(columnKey, newItem, existingData) {
|
|
28
29
|
return newItem[columnKey].data && newItem[columnKey].data !== existingData[columnKey].data;
|
|
29
30
|
};
|
|
31
|
+
var useRefreshDatasourceItem = function useRefreshDatasourceItem(item) {
|
|
32
|
+
var _item$data;
|
|
33
|
+
var url = item === null || item === void 0 || (_item$data = item.data) === null || _item$data === void 0 || (_item$data = _item$data.key) === null || _item$data === void 0 || (_item$data = _item$data.data) === null || _item$data === void 0 ? void 0 : _item$data.url;
|
|
34
|
+
|
|
35
|
+
// passing empty string to the hook isn't ideal, but the alternatives are too much effort for this small fix.
|
|
36
|
+
var reloadSmartLinkAction = useSmartLinkReload({
|
|
37
|
+
url: url || ''
|
|
38
|
+
});
|
|
39
|
+
return useCallback(function () {
|
|
40
|
+
if (url) {
|
|
41
|
+
reloadSmartLinkAction();
|
|
42
|
+
}
|
|
43
|
+
}, [reloadSmartLinkAction, url]);
|
|
44
|
+
};
|
|
30
45
|
export var InlineEdit = function InlineEdit(_ref) {
|
|
31
46
|
var ari = _ref.ari,
|
|
32
47
|
execute = _ref.execute,
|
|
@@ -49,6 +64,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
49
64
|
onUpdateItem = _useDatasourceActions.onUpdateItem;
|
|
50
65
|
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
51
66
|
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
67
|
+
var refreshDatasourceItem = useRefreshDatasourceItem(item);
|
|
52
68
|
var onCommitUpdate = useCallback(function (value) {
|
|
53
69
|
if (!item) {
|
|
54
70
|
setIsEditing(false);
|
|
@@ -62,7 +78,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
62
78
|
}
|
|
63
79
|
onUpdateItem(ari, newItem);
|
|
64
80
|
fireEvent('ui.form.submitted.inlineEdit', {});
|
|
65
|
-
execute(value).catch(function (error) {
|
|
81
|
+
execute(value).then(refreshDatasourceItem).catch(function (error) {
|
|
66
82
|
var status = error && _typeof(error) === 'object' ? error.status : undefined;
|
|
67
83
|
showErrorFlag({
|
|
68
84
|
status: status
|
|
@@ -70,7 +86,7 @@ export var InlineEdit = function InlineEdit(_ref) {
|
|
|
70
86
|
onUpdateItem(ari, existingData);
|
|
71
87
|
});
|
|
72
88
|
setIsEditing(false);
|
|
73
|
-
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari,
|
|
89
|
+
}, [item, datasourceTypeWithValues.type, columnKey, onUpdateItem, ari, refreshDatasourceItem, fireEvent, execute, showErrorFlag]);
|
|
74
90
|
var onEdit = useCallback(function () {
|
|
75
91
|
setIsEditing(true);
|
|
76
92
|
if (integrationKey && entityType) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type Action } from 'react-sweet-state';
|
|
3
3
|
import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
|
-
interface DatasourceItem {
|
|
5
|
+
export interface DatasourceItem {
|
|
6
6
|
ari: string | undefined;
|
|
7
7
|
entityType: string | undefined;
|
|
8
8
|
integrationKey: string | undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { type Action } from 'react-sweet-state';
|
|
3
3
|
import type { DatasourceDataResponseItem } from '@atlaskit/linking-types';
|
|
4
4
|
type UniqueIdentifier = string;
|
|
5
|
-
interface DatasourceItem {
|
|
5
|
+
export interface DatasourceItem {
|
|
6
6
|
ari: string | undefined;
|
|
7
7
|
entityType: string | undefined;
|
|
8
8
|
integrationKey: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/flag": "^15.8.0",
|
|
49
49
|
"@atlaskit/form": "^10.5.0",
|
|
50
50
|
"@atlaskit/heading": "^2.4.0",
|
|
51
|
-
"@atlaskit/icon": "^22.
|
|
51
|
+
"@atlaskit/icon": "^22.17.0",
|
|
52
52
|
"@atlaskit/icon-object": "^6.5.0",
|
|
53
53
|
"@atlaskit/image": "^1.3.0",
|
|
54
54
|
"@atlaskit/inline-edit": "^13.7.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^1.2.0",
|
|
72
72
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
73
73
|
"@atlaskit/primitives": "^12.1.0",
|
|
74
|
-
"@atlaskit/select": "^17.
|
|
74
|
+
"@atlaskit/select": "^17.17.0",
|
|
75
75
|
"@atlaskit/smart-card": "^28.1.0",
|
|
76
76
|
"@atlaskit/smart-user-picker": "6.10.2",
|
|
77
77
|
"@atlaskit/spinner": "^16.3.0",
|