@atlaskit/mention 19.8.1 → 19.9.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/mention
2
2
 
3
+ ## 19.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e65ada9dbbb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e65ada9dbbb) - Debounce MentionResource when debounceTime is passed in
8
+
3
9
  ## 19.8.1
4
10
 
5
11
  ### Patch Changes
@@ -31,6 +31,8 @@ var _logger = _interopRequireDefault(require("../util/logger"));
31
31
 
32
32
  var _analytics = require("../util/analytics");
33
33
 
34
+ var _debounce = _interopRequireDefault(require("lodash/debounce"));
35
+
34
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
35
37
 
36
38
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -221,6 +223,11 @@ var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
221
223
  _this.inviteExperimentCohort = config.inviteExperimentCohort;
222
224
  _this.onInviteItemClick = config.onInviteItemClick;
223
225
  _this.userRole = config.userRole || 'basic';
226
+
227
+ if (_this.config.debounceTime) {
228
+ _this.filter = (0, _debounce.default)(_this.filter, _this.config.debounceTime);
229
+ }
230
+
224
231
  return _this;
225
232
  }
226
233
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.8.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,6 +6,7 @@ const MAX_NOTIFIED_ITEMS = 20;
6
6
  // Re-exporting types to prevent breaking change
7
7
  // Re-exporting types to prevent breaking change
8
8
  import { SLI_EVENT_TYPE, Actions, SliNames } from '../util/analytics';
9
+ import debounce from 'lodash/debounce';
9
10
 
10
11
  const emptySecurityProvider = () => {
11
12
  return {
@@ -148,6 +149,10 @@ export class MentionResource extends AbstractMentionResource {
148
149
  this.inviteExperimentCohort = config.inviteExperimentCohort;
149
150
  this.onInviteItemClick = config.onInviteItemClick;
150
151
  this.userRole = config.userRole || 'basic';
152
+
153
+ if (this.config.debounceTime) {
154
+ this.filter = debounce(this.filter, this.config.debounceTime);
155
+ }
151
156
  }
152
157
 
153
158
  shouldHighlightMention(mention) {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.8.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -23,6 +23,7 @@ var MAX_NOTIFIED_ITEMS = 20;
23
23
  // Re-exporting types to prevent breaking change
24
24
  // Re-exporting types to prevent breaking change
25
25
  import { SLI_EVENT_TYPE, Actions, SliNames } from '../util/analytics';
26
+ import debounce from 'lodash/debounce';
26
27
 
27
28
  var emptySecurityProvider = function emptySecurityProvider() {
28
29
  return {
@@ -204,6 +205,11 @@ export var MentionResource = /*#__PURE__*/function (_AbstractMentionResou) {
204
205
  _this.inviteExperimentCohort = config.inviteExperimentCohort;
205
206
  _this.onInviteItemClick = config.onInviteItemClick;
206
207
  _this.userRole = config.userRole || 'basic';
208
+
209
+ if (_this.config.debounceTime) {
210
+ _this.filter = debounce(_this.filter, _this.config.debounceTime);
211
+ }
212
+
207
213
  return _this;
208
214
  }
209
215
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.8.1",
3
+ "version": "19.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -31,6 +31,7 @@ export interface MentionResourceConfig extends ServiceConfig {
31
31
  onInviteItemClick?: (flow: InviteFlow) => void;
32
32
  userRole?: UserRole;
33
33
  productName?: string;
34
+ debounceTime?: number;
34
35
  }
35
36
  export interface ResourceProvider<Result> {
36
37
  /**
@@ -9,10 +9,10 @@ import {
9
9
  import SectionMessage from '@atlaskit/section-message';
10
10
 
11
11
  const MentionProps = require('!!extract-react-types-loader!../src/api/extract-react-types/smart-config-props');
12
- import MentionWithEditorExample from '../examples/14-mention-with-editor';
13
- const MentionWithEditorExampleSource = require('!!raw-loader!../examples/14-mention-with-editor');
14
- import SmartMentionWithEditorExample from '../examples/15-smart-mention-resource';
15
- const SmartMentionWithEditorExampleSource = require('!!raw-loader!../examples/15-smart-mention-resource');
12
+ import MentionWithEditorExample from '../examples/14-mention-with-editor-extending-abstract-mention-resource';
13
+ const MentionWithEditorExampleSource = require('!!raw-loader!../examples/14-mention-with-editor-extending-abstract-mention-resource');
14
+ import SmartMentionWithEditorExample from '../examples/16-smart-mention-resource';
15
+ const SmartMentionWithEditorExampleSource = require('!!raw-loader!../examples/16-smart-mention-resource');
16
16
 
17
17
  export default md`
18
18
  ${(<AtlassianInternalWarning />)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/mention",
3
- "version": "19.8.1",
3
+ "version": "19.9.0",
4
4
  "description": "A React component used to display user profiles in a list for 'Mention' functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -36,6 +36,7 @@
36
36
  "@atlaskit/tooltip": "^17.5.0",
37
37
  "@atlaskit/util-service-support": "^6.0.0",
38
38
  "@babel/runtime": "^7.0.0",
39
+ "lodash": "^4.17.15",
39
40
  "uuid": "^3.1.0"
40
41
  },
41
42
  "peerDependencies": {