@atlaskit/jql-editor 6.5.0 → 6.6.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,16 @@
1
1
  # @atlaskit/jql-editor
2
2
 
3
+ ## 6.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`506238c0247fd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/506238c0247fd) -
8
+ PTC-16709: Added changes to show autocomplete for membersOf function to fetch Teams
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 6.5.0
4
15
 
5
16
  ### Minor Changes
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useJqlEditorAnalytics = void 0;
7
7
  var _jqlEditorCommon = require("@atlaskit/jql-editor-common");
8
8
  var useJqlEditorAnalytics = exports.useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
9
- return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "6.4.7", _jqlEditorCommon.ANALYTICS_CHANNEL);
9
+ return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "6.5.0", _jqlEditorCommon.ANALYTICS_CHANNEL);
10
10
  };
@@ -30,6 +30,9 @@ var defaultAutocompleteProvider = exports.defaultAutocompleteProvider = {
30
30
  },
31
31
  onFunctions: function onFunctions() {
32
32
  return (0, _empty.empty)();
33
+ },
34
+ onFunctionArguments: function onFunctionArguments() {
35
+ return (0, _empty.empty)();
33
36
  }
34
37
  };
35
38
  var JQLAutocompletePluginKey = exports.JQLAutocompletePluginKey = new _state.PluginKey(AUTOCOMPLETE_PLUGIN_NAME);
@@ -19,6 +19,7 @@ var _view = require("@atlaskit/editor-prosemirror/view");
19
19
  var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
20
20
  var _jqlAst = require("@atlaskit/jql-ast");
21
21
  var _jqlAutocomplete = require("@atlaskit/jql-autocomplete");
22
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
23
  var _analytics = require("../analytics");
23
24
  var _selectErrorCommand = require("../commands/select-error-command");
24
25
  var _constants = require("../common/constants");
@@ -336,10 +337,26 @@ var actions = exports.actions = {
336
337
  onFields = _getState$autocomplet.onFields,
337
338
  onOperators = _getState$autocomplet.onOperators,
338
339
  onValues = _getState$autocomplet.onValues,
339
- onFunctions = _getState$autocomplet.onFunctions;
340
+ onFunctions = _getState$autocomplet.onFunctions,
341
+ onFunctionArguments = _getState$autocomplet.onFunctionArguments;
340
342
  var optionTypes = [];
341
343
  var observables = [];
342
- if (rules.value || rules.function ||
344
+ if (rules.functionArgument && onFunctionArguments && (0, _platformFeatureFlags.fg)('enable-jql-membersof-autocomplete')) {
345
+ var _context$field, _context$functionName;
346
+ // When the caret is inside a function argument (e.g. membersOf("...")), we call
347
+ // onFunctionArguments unconditionally in preference to the generic value/function
348
+ // providers. rules.functionArgument can co-exist with rules.function so we must check it
349
+ // first — before the outer rules.value/rules.function block — to avoid it being
350
+ // swallowed by the else-if chain.
351
+ var _rules$functionArgume = rules.functionArgument,
352
+ matchedText = _rules$functionArgume.matchedText,
353
+ context = _rules$functionArgume.context;
354
+ var fieldName = (_context$field = context === null || context === void 0 ? void 0 : context.field) !== null && _context$field !== void 0 ? _context$field : '';
355
+ var functionName = (_context$functionName = context === null || context === void 0 ? void 0 : context.functionName) !== null && _context$functionName !== void 0 ? _context$functionName : '';
356
+ var functionArguments$ = onFunctionArguments(fieldName, matchedText, functionName);
357
+ optionTypes.push('values');
358
+ observables.push(dispatch(actions.appendOptionsForObservable('values', functionArguments$, rules.functionArgument, 'value')));
359
+ } else if (rules.value || rules.function ||
343
360
  // If EMPTY is suggested as a token, we are also in "operand mode" and we don't want to call other providers
344
361
  // e.g. "assignee is " will return "EMPTY" token and "operator" rule as suggestions (because of "is not")
345
362
  tokens.values.includes('EMPTY')) {
@@ -357,16 +374,16 @@ var actions = exports.actions = {
357
374
  }
358
375
  } else if (rules.operator) {
359
376
  var _rules$operator = rules.operator,
360
- context = _rules$operator.context,
361
- matchedText = _rules$operator.matchedText;
362
- var operators$ = (0, _autocomplete.sortOperators)(onOperators(matchedText, context === null || context === void 0 ? void 0 : context.field));
377
+ _context = _rules$operator.context,
378
+ _matchedText = _rules$operator.matchedText;
379
+ var operators$ = (0, _autocomplete.sortOperators)(onOperators(_matchedText, _context === null || _context === void 0 ? void 0 : _context.field));
363
380
  optionTypes.push('operators');
364
381
  observables.push(dispatch(actions.appendOptionsForObservable('operators', operators$, rules.operator, 'operator')));
365
382
  } else if (rules.field) {
366
383
  var _rules$field = rules.field,
367
- _context = _rules$field.context,
368
- _matchedText = _rules$field.matchedText;
369
- var fields$ = onFields(_matchedText, _context === null || _context === void 0 ? void 0 : _context.clause);
384
+ _context2 = _rules$field.context,
385
+ _matchedText2 = _rules$field.matchedText;
386
+ var fields$ = onFields(_matchedText2, _context2 === null || _context2 === void 0 ? void 0 : _context2.clause);
370
387
  optionTypes.push('fields');
371
388
  observables.push(dispatch(actions.appendOptionsForObservable('fields', fields$, rules.field, 'field')));
372
389
  }
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export const useJqlEditorAnalytics = analyticsSource => {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.4.7", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.5.0", ANALYTICS_CHANNEL);
4
4
  };
@@ -16,6 +16,7 @@ export const defaultAutocompleteProvider = {
16
16
  onFields: () => empty(),
17
17
  onOperators: () => empty(),
18
18
  onValues: () => empty(),
19
- onFunctions: () => empty()
19
+ onFunctions: () => empty(),
20
+ onFunctionArguments: () => empty()
20
21
  };
21
22
  export const JQLAutocompletePluginKey = new PluginKey(AUTOCOMPLETE_PLUGIN_NAME);
@@ -10,6 +10,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
10
10
  import FeatureGates from '@atlaskit/feature-gate-js-client';
11
11
  import { computeJqlInsights, isListOperator, normaliseJqlString } from '@atlaskit/jql-ast';
12
12
  import { JQLAutocomplete } from '@atlaskit/jql-autocomplete';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
13
14
  import { ActionSubject, ActionSubjectId, Action as AnalyticsAction, EventType } from '../analytics';
14
15
  import { selectErrorCommand } from '../commands/select-error-command';
15
16
  import { JQL_EDITOR_MAIN_ID } from '../common/constants';
@@ -341,11 +342,28 @@ export const actions = {
341
342
  onFields,
342
343
  onOperators,
343
344
  onValues,
344
- onFunctions
345
+ onFunctions,
346
+ onFunctionArguments
345
347
  } = getState().autocompleteProvider;
346
348
  const optionTypes = [];
347
349
  const observables = [];
348
- if (rules.value || rules.function ||
350
+ if (rules.functionArgument && onFunctionArguments && fg('enable-jql-membersof-autocomplete')) {
351
+ var _context$field, _context$functionName;
352
+ // When the caret is inside a function argument (e.g. membersOf("...")), we call
353
+ // onFunctionArguments unconditionally in preference to the generic value/function
354
+ // providers. rules.functionArgument can co-exist with rules.function so we must check it
355
+ // first — before the outer rules.value/rules.function block — to avoid it being
356
+ // swallowed by the else-if chain.
357
+ const {
358
+ matchedText,
359
+ context
360
+ } = rules.functionArgument;
361
+ const fieldName = (_context$field = context === null || context === void 0 ? void 0 : context.field) !== null && _context$field !== void 0 ? _context$field : '';
362
+ const functionName = (_context$functionName = context === null || context === void 0 ? void 0 : context.functionName) !== null && _context$functionName !== void 0 ? _context$functionName : '';
363
+ const functionArguments$ = onFunctionArguments(fieldName, matchedText, functionName);
364
+ optionTypes.push('values');
365
+ observables.push(dispatch(actions.appendOptionsForObservable('values', functionArguments$, rules.functionArgument, 'value')));
366
+ } else if (rules.value || rules.function ||
349
367
  // If EMPTY is suggested as a token, we are also in "operand mode" and we don't want to call other providers
350
368
  // e.g. "assignee is " will return "EMPTY" token and "operator" rule as suggestions (because of "is not")
351
369
  tokens.values.includes('EMPTY')) {
@@ -1,4 +1,4 @@
1
1
  import { ANALYTICS_CHANNEL, useJqlPackageAnalytics } from '@atlaskit/jql-editor-common';
2
2
  export var useJqlEditorAnalytics = function useJqlEditorAnalytics(analyticsSource) {
3
- return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.4.7", ANALYTICS_CHANNEL);
3
+ return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.5.0", ANALYTICS_CHANNEL);
4
4
  };
@@ -24,6 +24,9 @@ export var defaultAutocompleteProvider = {
24
24
  },
25
25
  onFunctions: function onFunctions() {
26
26
  return empty();
27
+ },
28
+ onFunctionArguments: function onFunctionArguments() {
29
+ return empty();
27
30
  }
28
31
  };
29
32
  export var JQLAutocompletePluginKey = new PluginKey(AUTOCOMPLETE_PLUGIN_NAME);
@@ -15,6 +15,7 @@ import { EditorView } from '@atlaskit/editor-prosemirror/view';
15
15
  import FeatureGates from '@atlaskit/feature-gate-js-client';
16
16
  import { computeJqlInsights, isListOperator, normaliseJqlString } from '@atlaskit/jql-ast';
17
17
  import { JQLAutocomplete } from '@atlaskit/jql-autocomplete';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import { ActionSubject, ActionSubjectId, Action as AnalyticsAction, EventType } from '../analytics';
19
20
  import { selectErrorCommand } from '../commands/select-error-command';
20
21
  import { JQL_EDITOR_MAIN_ID } from '../common/constants';
@@ -330,10 +331,26 @@ export var actions = {
330
331
  onFields = _getState$autocomplet.onFields,
331
332
  onOperators = _getState$autocomplet.onOperators,
332
333
  onValues = _getState$autocomplet.onValues,
333
- onFunctions = _getState$autocomplet.onFunctions;
334
+ onFunctions = _getState$autocomplet.onFunctions,
335
+ onFunctionArguments = _getState$autocomplet.onFunctionArguments;
334
336
  var optionTypes = [];
335
337
  var observables = [];
336
- if (rules.value || rules.function ||
338
+ if (rules.functionArgument && onFunctionArguments && fg('enable-jql-membersof-autocomplete')) {
339
+ var _context$field, _context$functionName;
340
+ // When the caret is inside a function argument (e.g. membersOf("...")), we call
341
+ // onFunctionArguments unconditionally in preference to the generic value/function
342
+ // providers. rules.functionArgument can co-exist with rules.function so we must check it
343
+ // first — before the outer rules.value/rules.function block — to avoid it being
344
+ // swallowed by the else-if chain.
345
+ var _rules$functionArgume = rules.functionArgument,
346
+ matchedText = _rules$functionArgume.matchedText,
347
+ context = _rules$functionArgume.context;
348
+ var fieldName = (_context$field = context === null || context === void 0 ? void 0 : context.field) !== null && _context$field !== void 0 ? _context$field : '';
349
+ var functionName = (_context$functionName = context === null || context === void 0 ? void 0 : context.functionName) !== null && _context$functionName !== void 0 ? _context$functionName : '';
350
+ var functionArguments$ = onFunctionArguments(fieldName, matchedText, functionName);
351
+ optionTypes.push('values');
352
+ observables.push(dispatch(actions.appendOptionsForObservable('values', functionArguments$, rules.functionArgument, 'value')));
353
+ } else if (rules.value || rules.function ||
337
354
  // If EMPTY is suggested as a token, we are also in "operand mode" and we don't want to call other providers
338
355
  // e.g. "assignee is " will return "EMPTY" token and "operator" rule as suggestions (because of "is not")
339
356
  tokens.values.includes('EMPTY')) {
@@ -351,16 +368,16 @@ export var actions = {
351
368
  }
352
369
  } else if (rules.operator) {
353
370
  var _rules$operator = rules.operator,
354
- context = _rules$operator.context,
355
- matchedText = _rules$operator.matchedText;
356
- var operators$ = sortOperators(onOperators(matchedText, context === null || context === void 0 ? void 0 : context.field));
371
+ _context = _rules$operator.context,
372
+ _matchedText = _rules$operator.matchedText;
373
+ var operators$ = sortOperators(onOperators(_matchedText, _context === null || _context === void 0 ? void 0 : _context.field));
357
374
  optionTypes.push('operators');
358
375
  observables.push(dispatch(actions.appendOptionsForObservable('operators', operators$, rules.operator, 'operator')));
359
376
  } else if (rules.field) {
360
377
  var _rules$field = rules.field,
361
- _context = _rules$field.context,
362
- _matchedText = _rules$field.matchedText;
363
- var fields$ = onFields(_matchedText, _context === null || _context === void 0 ? void 0 : _context.clause);
378
+ _context2 = _rules$field.context,
379
+ _matchedText2 = _rules$field.matchedText;
380
+ var fields$ = onFields(_matchedText2, _context2 === null || _context2 === void 0 ? void 0 : _context2.clause);
364
381
  optionTypes.push('fields');
365
382
  observables.push(dispatch(actions.appendOptionsForObservable('fields', fields$, rules.field, 'field')));
366
383
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/jql-editor",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "This package allows consumers to render an advanced JQL editor component to enable autocomplete-assisted authoring and validation of JQL queries.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -47,13 +47,13 @@
47
47
  "@atlaskit/css": "^0.19.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
49
49
  "@atlaskit/emoji": "^70.17.0",
50
- "@atlaskit/feature-gate-js-client": "^5.7.0",
50
+ "@atlaskit/feature-gate-js-client": "^5.8.0",
51
51
  "@atlaskit/form": "^15.5.0",
52
52
  "@atlaskit/icon": "^35.4.0",
53
53
  "@atlaskit/icon-lab": "^6.13.0",
54
54
  "@atlaskit/jql-ast": "^3.5.0",
55
- "@atlaskit/jql-autocomplete": "^2.1.0",
56
- "@atlaskit/jql-editor-common": "^3.3.0",
55
+ "@atlaskit/jql-autocomplete": "^2.2.0",
56
+ "@atlaskit/jql-editor-common": "^3.4.0",
57
57
  "@atlaskit/jql-parser": "^2.1.0",
58
58
  "@atlaskit/link": "^3.4.0",
59
59
  "@atlaskit/platform-feature-flags": "^1.1.0",
@@ -63,7 +63,7 @@
63
63
  "@atlaskit/spinner": "^19.1.0",
64
64
  "@atlaskit/teams-avatar": "^2.7.0",
65
65
  "@atlaskit/theme": "^25.0.0",
66
- "@atlaskit/tokens": "^13.3.0",
66
+ "@atlaskit/tokens": "^13.4.0",
67
67
  "@atlaskit/tooltip": "^22.6.0",
68
68
  "@atlaskit/townsquare-emoji-provider": "^1.0.0",
69
69
  "@babel/runtime": "^7.0.0",
@@ -89,7 +89,7 @@
89
89
  "@af/integration-testing": "workspace:^",
90
90
  "@af/visual-regression": "workspace:^",
91
91
  "@atlaskit/docs": "^11.8.0",
92
- "@atlaskit/jql-editor-autocomplete-rest": "^3.3.0",
92
+ "@atlaskit/jql-editor-autocomplete-rest": "^3.4.0",
93
93
  "@atlassian/feature-flags-storybook-utils": "^0.4.0",
94
94
  "@atlassian/feature-flags-test-utils": "^1.1.0",
95
95
  "@atlassian/react-compiler-gating": "workspace:^",
@@ -155,6 +155,9 @@
155
155
  },
156
156
  "jql-function-arg-hydration": {
157
157
  "type": "boolean"
158
+ },
159
+ "enable-jql-membersof-autocomplete": {
160
+ "type": "boolean"
158
161
  }
159
162
  }
160
163
  }