@atlaskit/link-datasource 3.8.9 → 3.8.10

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 3.8.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#164025](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164025)
8
+ [`1eb78af6a417e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1eb78af6a417e) -
9
+ Prevent inline edit on dropdown fields without executeFetch
10
+
3
11
  ## 3.8.9
4
12
 
5
13
  ### Patch Changes
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.isEditTypeSupported = exports.editType = void 0;
8
+ exports.isEditTypeSupported = exports.isEditTypeSelectable = exports.editType = void 0;
9
9
  var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _react = _interopRequireDefault(require("react"));
@@ -59,4 +59,8 @@ var editType = exports.editType = function editType(_ref) {
59
59
  var isEditTypeSupported = exports.isEditTypeSupported = function isEditTypeSupported(type) {
60
60
  var supportedEditType = (0, _platformFeatureFlags.fg)('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
61
61
  return supportedEditType.includes(type);
62
+ };
63
+ var isEditTypeSelectable = exports.isEditTypeSelectable = function isEditTypeSelectable(type) {
64
+ var selectEditTypes = ['status', 'icon', 'user'];
65
+ return selectEditTypes.includes(type);
62
66
  };
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.TableCellContent = exports.ReadOnlyCell = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _primitives = require("@atlaskit/primitives");
11
12
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
12
13
  var _state = require("../../../state");
@@ -85,7 +86,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
85
86
  renderItem = _ref3.renderItem,
86
87
  integrationKey = _ref3.integrationKey,
87
88
  wrappedColumnKeys = _ref3.wrappedColumnKeys;
88
- // Execute fn is only returned when the field is editable and the action schema exists
89
+ // Callbacks are returned only when the ari is editable and the action schemas exist in the store
89
90
  var _useExecuteAtomicActi = (0, _actions.useExecuteAtomicAction)({
90
91
  ari: ari,
91
92
  fieldKey: columnKey,
@@ -93,7 +94,10 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
93
94
  }),
94
95
  execute = _useExecuteAtomicActi.execute,
95
96
  executeFetch = _useExecuteAtomicActi.executeFetch;
96
- var isEditable = !!execute;
97
+
98
+ // A field is editable when `execute` is returned from the store
99
+ // if the field requires to fetch options to execute, then is editable only if `executeFetch` is also returned
100
+ var isEditable = !!execute && ((0, _editType.isEditTypeSelectable)(values.type) && (0, _platformFeatureFlags.fg)('enable_datasource_supporting_actions') ? !!executeFetch : true);
97
101
  var readView = /*#__PURE__*/_react.default.createElement(TooltipWrapper, {
98
102
  columnKey: columnKey,
99
103
  datasourceTypeWithValues: values,
@@ -46,4 +46,8 @@ export const editType = ({
46
46
  export const isEditTypeSupported = type => {
47
47
  const supportedEditType = fg('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
48
48
  return supportedEditType.includes(type);
49
+ };
50
+ export const isEditTypeSelectable = type => {
51
+ const selectEditTypes = ['status', 'icon', 'user'];
52
+ return selectEditTypes.includes(type);
49
53
  };
@@ -3,9 +3,9 @@ import React, { useEffect, useState } from 'react';
3
3
  import { ActionOperationStatus } from '@atlaskit/linking-types';
4
4
  import Lozenge from '@atlaskit/lozenge';
5
5
  import Select from '@atlaskit/select';
6
- import { failUfoExperience, succeedUfoExperience } from "../../../../analytics/ufoExperiences";
7
- import { useDatasourceExperienceId } from "../../../../contexts/datasource-experience-id";
8
- import { InlineEditUFOExperience } from "../../table-cell-content/inline-edit";
6
+ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/ufoExperiences';
7
+ import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
8
+ import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
9
9
  const StatusEditType = props => {
10
10
  var _currentValue$values;
11
11
  const {
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect } from 'react';
3
3
  import { Layering } from '@atlaskit/layering';
4
4
  import Textfield from '@atlaskit/textfield';
5
- import { succeedUfoExperience } from "../../../../analytics/ufoExperiences";
6
- import { useDatasourceExperienceId } from "../../../../contexts/datasource-experience-id";
5
+ import { succeedUfoExperience } from '../../../../analytics/ufoExperiences';
6
+ import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
7
7
  export const toTextValue = typeWithValues => {
8
8
  var _ref, _typeWithValues$value;
9
9
  return (_ref = (_typeWithValues$value = typeWithValues.values) === null || _typeWithValues$value === void 0 ? void 0 : _typeWithValues$value[0]) !== null && _ref !== void 0 ? _ref : '';
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { Box, xcss } from '@atlaskit/primitives';
4
5
  import Tooltip from '@atlaskit/tooltip';
5
6
  import { useDatasourceItem } from '../../../state';
6
7
  import { useExecuteAtomicAction } from '../../../state/actions';
7
- import { isEditTypeSupported } from '../edit-type';
8
+ import { isEditTypeSelectable, isEditTypeSupported } from '../edit-type';
8
9
  import { stringifyType } from '../render-type';
9
10
  import { TruncateTextTag } from '../truncate-text-tag';
10
11
  import { InlineEdit } from './inline-edit';
@@ -77,7 +78,7 @@ const InlineEditableCell = ({
77
78
  integrationKey,
78
79
  wrappedColumnKeys
79
80
  }) => {
80
- // Execute fn is only returned when the field is editable and the action schema exists
81
+ // Callbacks are returned only when the ari is editable and the action schemas exist in the store
81
82
  const {
82
83
  execute,
83
84
  executeFetch
@@ -86,7 +87,10 @@ const InlineEditableCell = ({
86
87
  fieldKey: columnKey,
87
88
  integrationKey
88
89
  });
89
- const isEditable = !!execute;
90
+
91
+ // A field is editable when `execute` is returned from the store
92
+ // if the field requires to fetch options to execute, then is editable only if `executeFetch` is also returned
93
+ const isEditable = !!execute && (isEditTypeSelectable(values.type) && fg('enable_datasource_supporting_actions') ? !!executeFetch : true);
90
94
  const readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
91
95
  columnKey: columnKey,
92
96
  datasourceTypeWithValues: values,
@@ -4,8 +4,8 @@ import AKInlineEdit from '@atlaskit/inline-edit';
4
4
  import { Box, xcss } from '@atlaskit/primitives';
5
5
  import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
6
6
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
7
- import { startUfoExperience } from "../../../analytics/ufoExperiences";
8
- import { useDatasourceExperienceId } from "../../../contexts/datasource-experience-id";
7
+ import { startUfoExperience } from '../../../analytics/ufoExperiences';
8
+ import { useDatasourceExperienceId } from '../../../contexts/datasource-experience-id';
9
9
  import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
10
10
  import { useDatasourceActions, useDatasourceItem } from '../../../state';
11
11
  import { editType } from '../edit-type';
@@ -50,4 +50,8 @@ export var editType = function editType(_ref) {
50
50
  export var isEditTypeSupported = function isEditTypeSupported(type) {
51
51
  var supportedEditType = fg('platform-datasources-enable-two-way-sync-statuses') ? ['string', 'status'] : ['string'];
52
52
  return supportedEditType.includes(type);
53
+ };
54
+ export var isEditTypeSelectable = function isEditTypeSelectable(type) {
55
+ var selectEditTypes = ['status', 'icon', 'user'];
56
+ return selectEditTypes.includes(type);
53
57
  };
@@ -6,9 +6,9 @@ import React, { useEffect, useState } from 'react';
6
6
  import { ActionOperationStatus } from '@atlaskit/linking-types';
7
7
  import Lozenge from '@atlaskit/lozenge';
8
8
  import Select from '@atlaskit/select';
9
- import { failUfoExperience, succeedUfoExperience } from "../../../../analytics/ufoExperiences";
10
- import { useDatasourceExperienceId } from "../../../../contexts/datasource-experience-id";
11
- import { InlineEditUFOExperience } from "../../table-cell-content/inline-edit";
9
+ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/ufoExperiences';
10
+ import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
11
+ import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
12
12
  var StatusEditType = function StatusEditType(props) {
13
13
  var _currentValue$values;
14
14
  var currentValue = props.currentValue,
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect } from 'react';
3
3
  import { Layering } from '@atlaskit/layering';
4
4
  import Textfield from '@atlaskit/textfield';
5
- import { succeedUfoExperience } from "../../../../analytics/ufoExperiences";
6
- import { useDatasourceExperienceId } from "../../../../contexts/datasource-experience-id";
5
+ import { succeedUfoExperience } from '../../../../analytics/ufoExperiences';
6
+ import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
7
7
  export var toTextValue = function toTextValue(typeWithValues) {
8
8
  var _ref, _typeWithValues$value;
9
9
  return (_ref = (_typeWithValues$value = typeWithValues.values) === null || _typeWithValues$value === void 0 ? void 0 : _typeWithValues$value[0]) !== null && _ref !== void 0 ? _ref : '';
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { useIntl } from 'react-intl-next';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { Box, xcss } from '@atlaskit/primitives';
4
5
  import Tooltip from '@atlaskit/tooltip';
5
6
  import { useDatasourceItem } from '../../../state';
6
7
  import { useExecuteAtomicAction } from '../../../state/actions';
7
- import { isEditTypeSupported } from '../edit-type';
8
+ import { isEditTypeSelectable, isEditTypeSupported } from '../edit-type';
8
9
  import { stringifyType } from '../render-type';
9
10
  import { TruncateTextTag } from '../truncate-text-tag';
10
11
  import { InlineEdit } from './inline-edit';
@@ -78,7 +79,7 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
78
79
  renderItem = _ref3.renderItem,
79
80
  integrationKey = _ref3.integrationKey,
80
81
  wrappedColumnKeys = _ref3.wrappedColumnKeys;
81
- // Execute fn is only returned when the field is editable and the action schema exists
82
+ // Callbacks are returned only when the ari is editable and the action schemas exist in the store
82
83
  var _useExecuteAtomicActi = useExecuteAtomicAction({
83
84
  ari: ari,
84
85
  fieldKey: columnKey,
@@ -86,7 +87,10 @@ var InlineEditableCell = function InlineEditableCell(_ref3) {
86
87
  }),
87
88
  execute = _useExecuteAtomicActi.execute,
88
89
  executeFetch = _useExecuteAtomicActi.executeFetch;
89
- var isEditable = !!execute;
90
+
91
+ // A field is editable when `execute` is returned from the store
92
+ // if the field requires to fetch options to execute, then is editable only if `executeFetch` is also returned
93
+ var isEditable = !!execute && (isEditTypeSelectable(values.type) && fg('enable_datasource_supporting_actions') ? !!executeFetch : true);
90
94
  var readView = /*#__PURE__*/React.createElement(TooltipWrapper, {
91
95
  columnKey: columnKey,
92
96
  datasourceTypeWithValues: values,
@@ -9,8 +9,8 @@ import AKInlineEdit from '@atlaskit/inline-edit';
9
9
  import { Box, xcss } from '@atlaskit/primitives';
10
10
  import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
11
11
  import { useDatasourceAnalyticsEvents } from '../../../analytics';
12
- import { startUfoExperience } from "../../../analytics/ufoExperiences";
13
- import { useDatasourceExperienceId } from "../../../contexts/datasource-experience-id";
12
+ import { startUfoExperience } from '../../../analytics/ufoExperiences';
13
+ import { useDatasourceExperienceId } from '../../../contexts/datasource-experience-id';
14
14
  import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
15
15
  import { useDatasourceActions, useDatasourceItem } from '../../../state';
16
16
  import { editType } from '../edit-type';
@@ -9,3 +9,4 @@ export declare const editType: ({ defaultValue, currentValue, setEditValues, exe
9
9
  executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
10
10
  }) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
11
11
  export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
12
+ export declare const isEditTypeSelectable: (type: DatasourceType['type']) => boolean;
@@ -9,3 +9,4 @@ export declare const editType: ({ defaultValue, currentValue, setEditValues, exe
9
9
  executeFetch?: (<E>(inputs: any) => Promise<E>) | undefined;
10
10
  }) => Pick<React.ComponentProps<typeof InlineEdit>, 'defaultValue' | 'editView'>;
11
11
  export declare const isEditTypeSupported: (type: DatasourceType['type']) => boolean;
12
+ export declare const isEditTypeSelectable: (type: DatasourceType['type']) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "3.8.9",
3
+ "version": "3.8.10",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",