@atlaskit/link-datasource 3.15.13 → 3.16.0

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.
@@ -66,29 +66,6 @@ export var TableHeading = styled.th(_defineProperty(_defineProperty(_definePrope
66
66
  wordWrap: 'break-word'
67
67
  }));
68
68
 
69
- // 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
70
- export var TableCell = styled.td(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(withTablePluginBodyPrefix()), {
71
- /* First section here is to override things editor table plugin css defines */
72
- font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
73
- padding: "var(--ds-space-050, 4px)".concat(" ", "var(--ds-space-100, 8px)"),
74
- border: 0,
75
- minWidth: 'auto',
76
- height: '32px',
77
- verticalAlign: 'inherit',
78
- boxSizing: 'content-box',
79
- // Due to padding, content-box makes td height 40px equal to InlineEdit on height of 32px
80
- borderRight: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(N40, ")")),
81
- borderBottom: "var(--ds-border-width, 1px)".concat(" solid ", "var(--ds-border, ".concat(N40, ")")),
82
- overflow: 'hidden'
83
- }), "".concat(withTablePluginBodyPrefix('&:first-child')), {
84
- paddingLeft: "var(--ds-space-100, 8px)"
85
- }), "".concat(withTablePluginBodyPrefix('&:last-child')), {
86
- borderRight: 0,
87
- paddingRight: "var(--ds-space-100, 8px)"
88
- }), "& [data-testid='inline-card-icon-and-title'], " + "& [data-testid='button-connect-account'] > span", {
89
- whiteSpace: 'unset'
90
- }));
91
-
92
69
  // 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
93
70
  export var InlineEditableTableCell = styled.td(_defineProperty(_defineProperty(_defineProperty({}, "".concat(withTablePluginBodyPrefix()), {
94
71
  /* First section here is to override things editor table plugin css defines */
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import React, { useCallback, useMemo, useState } from 'react';
8
8
  import { useIntl } from 'react-intl-next';
9
9
  import AKInlineEdit from '@atlaskit/inline-edit';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  import { Box, xcss } from '@atlaskit/primitives';
11
12
  import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
12
13
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
@@ -22,6 +23,38 @@ export var InlineEditUFOExperience = 'inline-edit-rendered';
22
23
  var editContainerStyles = xcss({
23
24
  marginBlockStart: 'space.negative.100'
24
25
  });
26
+ /**
27
+ * @returns String of the new field value, or ID of status transition / atlassian user ID / priority ID.
28
+ * @throws Error if the value is not supplied.
29
+ */
30
+ export var newGetBackendUpdateValue = function newGetBackendUpdateValue(typedNewValue) {
31
+ if (typedNewValue.values.length === 0) {
32
+ throw new Error("Datasource 2 way sync: Backend update value or value ID not supplied for type ".concat(typedNewValue.type));
33
+ }
34
+ switch (typedNewValue.type) {
35
+ case 'string':
36
+ return typedNewValue.values[0];
37
+ case 'status':
38
+ var transitionId = typedNewValue.values[0].transitionId;
39
+ if (transitionId === undefined || transitionId === '') {
40
+ throw new Error("Datasource 2 way sync: Backend status transition ID not supplied for type transition");
41
+ }
42
+ return transitionId;
43
+ case 'user':
44
+ var atlassianUserId = typedNewValue.values[0].atlassianUserId;
45
+ if (atlassianUserId === undefined || atlassianUserId === '') {
46
+ throw new Error("Datasource 2 way sync: Backend atlasian user ID not supplied for type user");
47
+ }
48
+ return atlassianUserId;
49
+ case 'icon':
50
+ var id = typedNewValue.values[0].id;
51
+ if (id === undefined || id === '') {
52
+ throw new Error("Datasource 2 way sync: Backend update ID not supplied for type icon");
53
+ }
54
+ return id;
55
+ }
56
+ throw new Error("Datasource 2 way sync Backend update value not implemented for type ".concat(typedNewValue.type));
57
+ };
25
58
  var getBackendUpdateValue = function getBackendUpdateValue(typedNewValue) {
26
59
  var _typedNewValue$values, _typedNewValue$values2, _typedNewValue$values3;
27
60
  switch (typedNewValue.type) {
@@ -128,7 +161,26 @@ export var InlineEdit = function InlineEdit(_ref) {
128
161
  }
129
162
  onUpdateItem(ari, newItem);
130
163
  fireEvent('ui.form.submitted.inlineEdit', {});
131
- execute(getBackendUpdateValue(newValue)).then(refreshDatasourceItem).catch(function (error) {
164
+ var updateValue;
165
+ if (fg('platform-datasources-inline-edit-id-checks')) {
166
+ try {
167
+ // TODO: Refactor types so that valid update values are guaranteed for
168
+ // all object types. Invalid options should be filtered out of options -
169
+ // this frontend error flag is a last resort.
170
+ updateValue = newGetBackendUpdateValue(newValue);
171
+ } catch (_unused) {
172
+ // Show an error as the new value that was going to be sent to the
173
+ // backend is invalid (and would have failed anyway, silently to the user)
174
+ showErrorFlag({});
175
+ onUpdateItem(ari, existingData);
176
+ setIsEditing(false);
177
+ return;
178
+ }
179
+ }
180
+ execute(updateValue !== undefined && fg('platform-datasources-inline-edit-id-checks') ? updateValue :
181
+ // Old behaviour is preserved in non-FFed path: errors thrown by getBackendUpdateValue are caught by
182
+ // the error boundary, _not_ by the catch block & frontend flag here.
183
+ getBackendUpdateValue(newValue)).then(refreshDatasourceItem).catch(function (error) {
132
184
  var status = error && _typeof(error) === 'object' ? error.status : undefined;
133
185
  showErrorFlag({
134
186
  status: status
@@ -17,10 +17,6 @@ export declare const TableHeading: import("@emotion/styled").StyledComponent<{
17
17
  theme?: import("@emotion/react").Theme | undefined;
18
18
  as?: import("react").ElementType<any> | undefined;
19
19
  }, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
20
- export declare const TableCell: import("@emotion/styled").StyledComponent<{
21
- theme?: import("@emotion/react").Theme | undefined;
22
- as?: import("react").ElementType<any> | undefined;
23
- }, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
24
20
  export declare const InlineEditableTableCell: import("@emotion/styled").StyledComponent<{
25
21
  theme?: import("@emotion/react").Theme | undefined;
26
22
  as?: import("react").ElementType<any> | undefined;
@@ -11,5 +11,10 @@ interface InlineEditProps {
11
11
  execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
12
12
  executeFetch?: <E>(inputs: any) => Promise<E>;
13
13
  }
14
+ /**
15
+ * @returns String of the new field value, or ID of status transition / atlassian user ID / priority ID.
16
+ * @throws Error if the value is not supplied.
17
+ */
18
+ export declare const newGetBackendUpdateValue: (typedNewValue: DatasourceTypeWithOnlyValues) => string;
14
19
  export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, columnTitle, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
15
20
  export {};
@@ -17,10 +17,6 @@ export declare const TableHeading: import("@emotion/styled").StyledComponent<{
17
17
  theme?: import("@emotion/react").Theme | undefined;
18
18
  as?: import("react").ElementType<any> | undefined;
19
19
  }, import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, {}>;
20
- export declare const TableCell: import("@emotion/styled").StyledComponent<{
21
- theme?: import("@emotion/react").Theme | undefined;
22
- as?: import("react").ElementType<any> | undefined;
23
- }, import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, {}>;
24
20
  export declare const InlineEditableTableCell: import("@emotion/styled").StyledComponent<{
25
21
  theme?: import("@emotion/react").Theme | undefined;
26
22
  as?: import("react").ElementType<any> | undefined;
@@ -11,5 +11,10 @@ interface InlineEditProps {
11
11
  execute: (value: string | number) => Promise<AtomicActionExecuteResponse>;
12
12
  executeFetch?: <E>(inputs: any) => Promise<E>;
13
13
  }
14
+ /**
15
+ * @returns String of the new field value, or ID of status transition / atlassian user ID / priority ID.
16
+ * @throws Error if the value is not supplied.
17
+ */
18
+ export declare const newGetBackendUpdateValue: (typedNewValue: DatasourceTypeWithOnlyValues) => string;
14
19
  export declare const InlineEdit: ({ ari, execute, executeFetch, readView, columnKey, columnTitle, datasourceTypeWithValues, }: InlineEditProps) => JSX.Element;
15
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.15.13",
3
+ "version": "3.16.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  "@atlaskit/badge": "^17.0.0",
43
43
  "@atlaskit/button": "^20.3.0",
44
44
  "@atlaskit/datetime-picker": "^15.11.0",
45
- "@atlaskit/dropdown-menu": "^12.24.0",
45
+ "@atlaskit/dropdown-menu": "^12.25.0",
46
46
  "@atlaskit/editor-prosemirror": "6.2.1",
47
47
  "@atlaskit/empty-state": "^8.1.0",
48
48
  "@atlaskit/flag": "^15.8.0",
@@ -73,13 +73,13 @@
73
73
  "@atlaskit/primitives": "^13.3.0",
74
74
  "@atlaskit/react-select": "^1.6.0",
75
75
  "@atlaskit/select": "^18.9.0",
76
- "@atlaskit/smart-card": "^34.4.0",
76
+ "@atlaskit/smart-card": "^34.6.0",
77
77
  "@atlaskit/smart-user-picker": "6.11.2",
78
78
  "@atlaskit/spinner": "^16.3.0",
79
79
  "@atlaskit/tag": "^12.6.0",
80
80
  "@atlaskit/textfield": "6.7.2",
81
81
  "@atlaskit/theme": "^14.0.0",
82
- "@atlaskit/tokens": "^3.1.0",
82
+ "@atlaskit/tokens": "^3.2.0",
83
83
  "@atlaskit/tooltip": "^19.0.0",
84
84
  "@atlaskit/ufo": "^0.3.0",
85
85
  "@atlaskit/width-detector": "^4.3.0",
@@ -156,9 +156,6 @@
156
156
  "./elements": "./src/elements.ts"
157
157
  },
158
158
  "platform-feature-flags": {
159
- "enable_datasource_react_sweet_state": {
160
- "type": "boolean"
161
- },
162
159
  "enable_datasource_supporting_actions": {
163
160
  "type": "boolean"
164
161
  },
@@ -168,6 +165,9 @@
168
165
  "platform-datasources-enable-two-way-sync-priority": {
169
166
  "type": "boolean"
170
167
  },
168
+ "platform-datasources-inline-edit-id-checks": {
169
+ "type": "boolean"
170
+ },
171
171
  "platform-datasources-enable-two-way-sync-assignee": {
172
172
  "type": "boolean"
173
173
  },