@atlaskit/link-datasource 0.23.0 → 0.24.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 0.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`108aa0ad121`](https://bitbucket.org/atlassian/atlassian-frontend/commits/108aa0ad121) - [ux] Fix some table bugs such as inconsistency between issue count for modal/table and fix case where user can deselect all fields in the column picker
8
+
3
9
  ## 0.23.0
4
10
 
5
11
  ### Minor Changes
@@ -87,6 +87,13 @@ var ColumnPicker = function ColumnPicker(_ref) {
87
87
  onOpen && void onOpen();
88
88
  void sortSelectedColumnsTop();
89
89
  }, [onOpen, sortSelectedColumnsTop]);
90
+
91
+ // If only 1 option is selected, disable it since we don't want user to uncheck everything
92
+ var handleIsOptionDisabled = function handleIsOptionDisabled(option, selectValue) {
93
+ return selectValue.length === 1 && selectValue.some(function (selectedValue) {
94
+ return selectedValue.value === option.value;
95
+ });
96
+ };
90
97
  return (0, _react2.jsx)(_select.PopupSelect, {
91
98
  classNamePrefix: 'column-picker-popup',
92
99
  testId: 'column-picker-popup',
@@ -99,6 +106,7 @@ var ColumnPicker = function ColumnPicker(_ref) {
99
106
  closeMenuOnSelect: false,
100
107
  hideSelectedOptions: false,
101
108
  isMulti: true,
109
+ isOptionDisabled: handleIsOptionDisabled,
102
110
  placeholder: intl.formatMessage(_messages.columnPickerMessages.search),
103
111
  onKeyDown: stopEscapePropagationWhenOpen,
104
112
  "aria-label": "Search for fields",
@@ -299,8 +299,8 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
299
299
  }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
300
300
  value: totalCount
301
301
  }), ' ', (0, _react2.jsx)(_reactIntlNext.FormattedPlural, {
302
- one: "issue",
303
- other: "issues",
302
+ one: (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.singularIssue),
303
+ other: (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.pluralIssues),
304
304
  value: totalCount
305
305
  })), (0, _react2.jsx)(_standardButton.default, {
306
306
  appearance: "default",
@@ -37,9 +37,19 @@ var modalMessages = (0, _reactIntlNext.defineMessages)({
37
37
  defaultMessage: 'Count view'
38
38
  },
39
39
  issuesCountSmartCardPlaceholderText: {
40
- id: 'linkDataSource.jira-issues.configmodal.issues',
40
+ id: 'linkDataSource.jira-issues.configmodal.placeholder.issues',
41
41
  description: 'Placeholder text that will be placed next to a count of jira issues',
42
42
  defaultMessage: '### Issues'
43
+ },
44
+ singularIssue: {
45
+ id: 'linkDataSource.jira-issues.configmodal.singular.issue',
46
+ description: 'Text that appears after single issue count number.',
47
+ defaultMessage: 'issue'
48
+ },
49
+ pluralIssues: {
50
+ id: 'linkDataSource.jira-issues.configmodal.plural.issues',
51
+ description: 'Text that appears after plural issue count number.',
52
+ defaultMessage: 'issues'
43
53
  }
44
54
  });
45
55
  exports.modalMessages = modalMessages;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.TableFooter = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
10
  var _react = require("react");
@@ -46,12 +45,14 @@ var TableFooter = function TableFooter(_ref) {
46
45
  "data-testid": "table-footer"
47
46
  }, (0, _react2.jsx)(IssueCounterWrapper, null, showIssueCount && (0, _react2.jsx)(_heading.default, {
48
47
  testId: "issue-count",
49
- level: 'h400'
50
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.footerMessages.issueText, {
51
- values: {
52
- issueCount: issueCount
53
- }
54
- })))), (0, _react2.jsx)(SyncWrapper, null, onRefresh && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(SyncTextWrapper, {
48
+ level: "h400"
49
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedNumber, {
50
+ value: issueCount
51
+ }), ' ', (0, _react2.jsx)(_reactIntlNext.FormattedPlural, {
52
+ one: (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.footerMessages.singularIssue),
53
+ other: (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.footerMessages.pluralIssues),
54
+ value: issueCount
55
+ }))), (0, _react2.jsx)(SyncWrapper, null, onRefresh && (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)(SyncTextWrapper, {
55
56
  "data-testid": "sync-text"
56
57
  }, isLoading ? (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.footerMessages.loadingText) : (0, _react2.jsx)(_syncInfo.SyncInfo, {
57
58
  lastSyncTime: lastSyncTime
@@ -6,10 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.footerMessages = void 0;
7
7
  var _reactIntlNext = require("react-intl-next");
8
8
  var footerMessages = (0, _reactIntlNext.defineMessages)({
9
- issueText: {
9
+ singularIssue: {
10
10
  id: 'linkDataSource.table-footer.issue',
11
- description: 'Text that appears after issue count number if there is only 1 issue.',
12
- defaultMessage: '{issueCount} {issueCount, plural, one {issue} other {issues}}'
11
+ description: 'Text that appears after single issue count number.',
12
+ defaultMessage: 'issue'
13
+ },
14
+ pluralIssues: {
15
+ id: 'linkDataSource.table-footer.issues',
16
+ description: 'Text that appears after plural issue count number.',
17
+ defaultMessage: 'issues'
13
18
  },
14
19
  loadingText: {
15
20
  id: 'linkDataSource.table-footer.loading',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "sideEffects": false
5
5
  }
@@ -64,6 +64,11 @@ export const ColumnPicker = ({
64
64
  onOpen && void onOpen();
65
65
  void sortSelectedColumnsTop();
66
66
  }, [onOpen, sortSelectedColumnsTop]);
67
+
68
+ // If only 1 option is selected, disable it since we don't want user to uncheck everything
69
+ const handleIsOptionDisabled = (option, selectValue) => {
70
+ return selectValue.length === 1 && selectValue.some(selectedValue => selectedValue.value === option.value);
71
+ };
67
72
  return jsx(PopupSelect, {
68
73
  classNamePrefix: 'column-picker-popup',
69
74
  testId: 'column-picker-popup',
@@ -76,6 +81,7 @@ export const ColumnPicker = ({
76
81
  closeMenuOnSelect: false,
77
82
  hideSelectedOptions: false,
78
83
  isMulti: true,
84
+ isOptionDisabled: handleIsOptionDisabled,
79
85
  placeholder: intl.formatMessage(columnPickerMessages.search),
80
86
  onKeyDown: stopEscapePropagationWhenOpen,
81
87
  "aria-label": "Search for fields",
@@ -248,8 +248,8 @@ export const JiraIssuesConfigModal = props => {
248
248
  }, jsx(FormattedNumber, {
249
249
  value: totalCount
250
250
  }), ' ', jsx(FormattedPlural, {
251
- one: "issue",
252
- other: "issues",
251
+ one: jsx(FormattedMessage, modalMessages.singularIssue),
252
+ other: jsx(FormattedMessage, modalMessages.pluralIssues),
253
253
  value: totalCount
254
254
  })), jsx(Button, {
255
255
  appearance: "default",
@@ -31,8 +31,18 @@ export const modalMessages = defineMessages({
31
31
  defaultMessage: 'Count view'
32
32
  },
33
33
  issuesCountSmartCardPlaceholderText: {
34
- id: 'linkDataSource.jira-issues.configmodal.issues',
34
+ id: 'linkDataSource.jira-issues.configmodal.placeholder.issues',
35
35
  description: 'Placeholder text that will be placed next to a count of jira issues',
36
36
  defaultMessage: '### Issues'
37
+ },
38
+ singularIssue: {
39
+ id: 'linkDataSource.jira-issues.configmodal.singular.issue',
40
+ description: 'Text that appears after single issue count number.',
41
+ defaultMessage: 'issue'
42
+ },
43
+ pluralIssues: {
44
+ id: 'linkDataSource.jira-issues.configmodal.plural.issues',
45
+ description: 'Text that appears after plural issue count number.',
46
+ defaultMessage: 'issues'
37
47
  }
38
48
  });
@@ -1,9 +1,8 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  /** @jsx jsx */
3
2
  import { Fragment, useEffect, useState } from 'react';
4
3
  import { jsx } from '@emotion/react';
5
4
  import styled from '@emotion/styled';
6
- import { FormattedMessage, useIntl } from 'react-intl-next';
5
+ import { FormattedMessage, FormattedNumber, FormattedPlural, useIntl } from 'react-intl-next';
7
6
  import Button from '@atlaskit/button';
8
7
  import Heading from '@atlaskit/heading';
9
8
  import RefreshIcon from '@atlaskit/icon/glyph/refresh';
@@ -57,12 +56,14 @@ export const TableFooter = ({
57
56
  "data-testid": "table-footer"
58
57
  }, jsx(IssueCounterWrapper, null, showIssueCount && jsx(Heading, {
59
58
  testId: "issue-count",
60
- level: 'h400'
61
- }, jsx(FormattedMessage, _extends({}, footerMessages.issueText, {
62
- values: {
63
- issueCount
64
- }
65
- })))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
59
+ level: "h400"
60
+ }, jsx(FormattedNumber, {
61
+ value: issueCount
62
+ }), ' ', jsx(FormattedPlural, {
63
+ one: jsx(FormattedMessage, footerMessages.singularIssue),
64
+ other: jsx(FormattedMessage, footerMessages.pluralIssues),
65
+ value: issueCount
66
+ }))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
66
67
  "data-testid": "sync-text"
67
68
  }, isLoading ? jsx(FormattedMessage, footerMessages.loadingText) : jsx(SyncInfo, {
68
69
  lastSyncTime: lastSyncTime
@@ -1,9 +1,14 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export const footerMessages = defineMessages({
3
- issueText: {
3
+ singularIssue: {
4
4
  id: 'linkDataSource.table-footer.issue',
5
- description: 'Text that appears after issue count number if there is only 1 issue.',
6
- defaultMessage: '{issueCount} {issueCount, plural, one {issue} other {issues}}'
5
+ description: 'Text that appears after single issue count number.',
6
+ defaultMessage: 'issue'
7
+ },
8
+ pluralIssues: {
9
+ id: 'linkDataSource.table-footer.issues',
10
+ description: 'Text that appears after plural issue count number.',
11
+ defaultMessage: 'issues'
7
12
  },
8
13
  loadingText: {
9
14
  id: 'linkDataSource.table-footer.loading',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "sideEffects": false
5
5
  }
@@ -80,6 +80,13 @@ export var ColumnPicker = function ColumnPicker(_ref) {
80
80
  onOpen && void onOpen();
81
81
  void sortSelectedColumnsTop();
82
82
  }, [onOpen, sortSelectedColumnsTop]);
83
+
84
+ // If only 1 option is selected, disable it since we don't want user to uncheck everything
85
+ var handleIsOptionDisabled = function handleIsOptionDisabled(option, selectValue) {
86
+ return selectValue.length === 1 && selectValue.some(function (selectedValue) {
87
+ return selectedValue.value === option.value;
88
+ });
89
+ };
83
90
  return jsx(PopupSelect, {
84
91
  classNamePrefix: 'column-picker-popup',
85
92
  testId: 'column-picker-popup',
@@ -92,6 +99,7 @@ export var ColumnPicker = function ColumnPicker(_ref) {
92
99
  closeMenuOnSelect: false,
93
100
  hideSelectedOptions: false,
94
101
  isMulti: true,
102
+ isOptionDisabled: handleIsOptionDisabled,
95
103
  placeholder: intl.formatMessage(columnPickerMessages.search),
96
104
  onKeyDown: stopEscapePropagationWhenOpen,
97
105
  "aria-label": "Search for fields",
@@ -288,8 +288,8 @@ export var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
288
288
  }, jsx(FormattedNumber, {
289
289
  value: totalCount
290
290
  }), ' ', jsx(FormattedPlural, {
291
- one: "issue",
292
- other: "issues",
291
+ one: jsx(FormattedMessage, modalMessages.singularIssue),
292
+ other: jsx(FormattedMessage, modalMessages.pluralIssues),
293
293
  value: totalCount
294
294
  })), jsx(Button, {
295
295
  appearance: "default",
@@ -31,8 +31,18 @@ export var modalMessages = defineMessages({
31
31
  defaultMessage: 'Count view'
32
32
  },
33
33
  issuesCountSmartCardPlaceholderText: {
34
- id: 'linkDataSource.jira-issues.configmodal.issues',
34
+ id: 'linkDataSource.jira-issues.configmodal.placeholder.issues',
35
35
  description: 'Placeholder text that will be placed next to a count of jira issues',
36
36
  defaultMessage: '### Issues'
37
+ },
38
+ singularIssue: {
39
+ id: 'linkDataSource.jira-issues.configmodal.singular.issue',
40
+ description: 'Text that appears after single issue count number.',
41
+ defaultMessage: 'issue'
42
+ },
43
+ pluralIssues: {
44
+ id: 'linkDataSource.jira-issues.configmodal.plural.issues',
45
+ description: 'Text that appears after plural issue count number.',
46
+ defaultMessage: 'issues'
37
47
  }
38
48
  });
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
@@ -6,7 +5,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
6
5
  import { Fragment, useEffect, useState } from 'react';
7
6
  import { jsx } from '@emotion/react';
8
7
  import styled from '@emotion/styled';
9
- import { FormattedMessage, useIntl } from 'react-intl-next';
8
+ import { FormattedMessage, FormattedNumber, FormattedPlural, useIntl } from 'react-intl-next';
10
9
  import Button from '@atlaskit/button';
11
10
  import Heading from '@atlaskit/heading';
12
11
  import RefreshIcon from '@atlaskit/icon/glyph/refresh';
@@ -39,12 +38,14 @@ export var TableFooter = function TableFooter(_ref) {
39
38
  "data-testid": "table-footer"
40
39
  }, jsx(IssueCounterWrapper, null, showIssueCount && jsx(Heading, {
41
40
  testId: "issue-count",
42
- level: 'h400'
43
- }, jsx(FormattedMessage, _extends({}, footerMessages.issueText, {
44
- values: {
45
- issueCount: issueCount
46
- }
47
- })))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
41
+ level: "h400"
42
+ }, jsx(FormattedNumber, {
43
+ value: issueCount
44
+ }), ' ', jsx(FormattedPlural, {
45
+ one: jsx(FormattedMessage, footerMessages.singularIssue),
46
+ other: jsx(FormattedMessage, footerMessages.pluralIssues),
47
+ value: issueCount
48
+ }))), jsx(SyncWrapper, null, onRefresh && jsx(Fragment, null, jsx(SyncTextWrapper, {
48
49
  "data-testid": "sync-text"
49
50
  }, isLoading ? jsx(FormattedMessage, footerMessages.loadingText) : jsx(SyncInfo, {
50
51
  lastSyncTime: lastSyncTime
@@ -1,9 +1,14 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
2
  export var footerMessages = defineMessages({
3
- issueText: {
3
+ singularIssue: {
4
4
  id: 'linkDataSource.table-footer.issue',
5
- description: 'Text that appears after issue count number if there is only 1 issue.',
6
- defaultMessage: '{issueCount} {issueCount, plural, one {issue} other {issues}}'
5
+ description: 'Text that appears after single issue count number.',
6
+ defaultMessage: 'issue'
7
+ },
8
+ pluralIssues: {
9
+ id: 'linkDataSource.table-footer.issues',
10
+ description: 'Text that appears after plural issue count number.',
11
+ defaultMessage: 'issues'
7
12
  },
8
13
  loadingText: {
9
14
  id: 'linkDataSource.table-footer.loading',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "sideEffects": false
5
5
  }
@@ -34,4 +34,14 @@ export declare const modalMessages: {
34
34
  description: string;
35
35
  defaultMessage: string;
36
36
  };
37
+ singularIssue: {
38
+ id: string;
39
+ description: string;
40
+ defaultMessage: string;
41
+ };
42
+ pluralIssues: {
43
+ id: string;
44
+ description: string;
45
+ defaultMessage: string;
46
+ };
37
47
  };
@@ -1,5 +1,10 @@
1
1
  export declare const footerMessages: {
2
- issueText: {
2
+ singularIssue: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ pluralIssues: {
3
8
  id: string;
4
9
  description: string;
5
10
  defaultMessage: string;
@@ -34,4 +34,14 @@ export declare const modalMessages: {
34
34
  description: string;
35
35
  defaultMessage: string;
36
36
  };
37
+ singularIssue: {
38
+ id: string;
39
+ description: string;
40
+ defaultMessage: string;
41
+ };
42
+ pluralIssues: {
43
+ id: string;
44
+ description: string;
45
+ defaultMessage: string;
46
+ };
37
47
  };
@@ -1,5 +1,10 @@
1
1
  export declare const footerMessages: {
2
- issueText: {
2
+ singularIssue: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ pluralIssues: {
3
8
  id: string;
4
9
  description: string;
5
10
  defaultMessage: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"