@atlaskit/jql-editor 6.1.1 → 6.2.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 +19 -0
- package/dist/cjs/analytics/util.js +1 -1
- package/dist/cjs/plugins/autocomplete/view.js +17 -1
- package/dist/cjs/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
- package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +46 -0
- package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
- package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/goal-node.js +56 -0
- package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/index.js +15 -0
- package/dist/cjs/plugins/rich-inline-nodes/nodes/goal/types.js +1 -0
- package/dist/cjs/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/cjs/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +9 -1
- package/dist/cjs/state/index.js +40 -31
- package/dist/cjs/ui/jql-editor-footer-content/jql-messages/warnings/messages.js +1 -1
- package/dist/es2019/analytics/util.js +1 -1
- package/dist/es2019/plugins/autocomplete/view.js +17 -1
- package/dist/es2019/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
- package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +35 -0
- package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
- package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/goal-node.js +46 -0
- package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/index.js +9 -0
- package/dist/es2019/plugins/rich-inline-nodes/nodes/goal/types.js +0 -0
- package/dist/es2019/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/es2019/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +10 -1
- package/dist/es2019/state/index.js +12 -2
- package/dist/es2019/ui/jql-editor-footer-content/jql-messages/warnings/messages.js +1 -1
- package/dist/esm/analytics/util.js +1 -1
- package/dist/esm/plugins/autocomplete/view.js +17 -1
- package/dist/esm/plugins/rich-inline-nodes/nodes/base/index.js +3 -2
- package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-icon.js +39 -0
- package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-node.compiled.css +3 -0
- package/dist/esm/plugins/rich-inline-nodes/nodes/goal/goal-node.js +49 -0
- package/dist/esm/plugins/rich-inline-nodes/nodes/goal/index.js +9 -0
- package/dist/esm/plugins/rich-inline-nodes/nodes/goal/types.js +0 -0
- package/dist/esm/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/esm/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +9 -1
- package/dist/esm/state/index.js +39 -30
- package/dist/esm/ui/jql-editor-footer-content/jql-messages/warnings/messages.js +1 -1
- package/dist/types/plugins/rich-inline-nodes/nodes/base/types.d.ts +1 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/goal/goal-icon.d.ts +12 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/goal/goal-node.d.ts +10 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/goal/index.d.ts +3 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/goal/types.d.ts +5 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
- package/dist/types/state/index.d.ts +36 -1
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/base/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/goal-icon.d.ts +16 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/goal-node.d.ts +10 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/goal/types.d.ts +5 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
- package/dist/types-ts4.5/state/index.d.ts +36 -1
- package/package.json +16 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/jql-editor
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`2f2e1ff7d48a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f2e1ff7d48a0) -
|
|
8
|
+
[ux] Add goal lozenge and use it on JQL editor
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 6.1.2
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`85a5e662048f6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85a5e662048f6) -
|
|
19
|
+
Enrol jql packages into the React Compiler with platform gating via isReactCompilerActivePlatform
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 6.1.1
|
|
4
23
|
|
|
5
24
|
### Patch 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.1.
|
|
9
|
+
return (0, _jqlEditorCommon.useJqlPackageAnalytics)(analyticsSource, "@atlaskit/jql-editor", "6.1.2", _jqlEditorCommon.ANALYTICS_CHANNEL);
|
|
10
10
|
};
|
|
@@ -14,6 +14,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
|
+
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
17
18
|
var _jqlAst = require("@atlaskit/jql-ast");
|
|
18
19
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
20
|
var _getDocumentPosition = _interopRequireDefault(require("../common/get-document-position"));
|
|
@@ -62,7 +63,7 @@ var AutocompletePluginView = exports.default = /*#__PURE__*/function (_ReactPlug
|
|
|
62
63
|
if (_this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
|
|
63
64
|
transaction.setMeta('hydrate', true);
|
|
64
65
|
}
|
|
65
|
-
if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2'))) {
|
|
66
|
+
if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'goal' && _featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || option.valueType === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2'))) {
|
|
66
67
|
transaction.setMeta('hydrate', true);
|
|
67
68
|
}
|
|
68
69
|
var documentFrom = (0, _getDocumentPosition.default)(transaction.doc, from);
|
|
@@ -128,6 +129,21 @@ var AutocompletePluginView = exports.default = /*#__PURE__*/function (_ReactPlug
|
|
|
128
129
|
}
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
132
|
+
case 'goal':
|
|
133
|
+
{
|
|
134
|
+
if (_featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false)) {
|
|
135
|
+
var _attributes3 = {
|
|
136
|
+
type: 'goal',
|
|
137
|
+
id: value,
|
|
138
|
+
name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
|
|
139
|
+
fieldName: context === null || context === void 0 ? void 0 : context.field
|
|
140
|
+
};
|
|
141
|
+
nodes.push(_this.view.state.schema.nodes.goal.create(_attributes3, textContent));
|
|
142
|
+
} else {
|
|
143
|
+
nodes.push(textContent);
|
|
144
|
+
}
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
131
147
|
default:
|
|
132
148
|
{
|
|
133
149
|
nodes.push(textContent);
|
|
@@ -43,8 +43,9 @@ var NodeBase = exports.NodeBase = function NodeBase(props) {
|
|
|
43
43
|
text = props.text,
|
|
44
44
|
isLocked = props.isLocked,
|
|
45
45
|
selected = props.selected,
|
|
46
|
-
error = props.error
|
|
47
|
-
|
|
46
|
+
error = props.error,
|
|
47
|
+
isRichNodeDisplay = props.isRichNodeDisplay;
|
|
48
|
+
var isNewExperienceEnabled = _featureGateJsClient.default.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false) || isRichNodeDisplay;
|
|
48
49
|
return /*#__PURE__*/_react.default.createElement(_compiled.Pressable, (0, _extends2.default)({
|
|
49
50
|
xcss: (0, _css.cx)(styles.nodeWrapper, !isNewExperienceEnabled && styles.nodeWrapperWithHeight, error && styles.nodeWrapperError, selected && (error ? styles.nodeWrapperErrorSelected : styles.nodeWrapperSelected))
|
|
50
51
|
}, isNewExperienceEnabled ? {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isGoalIconKey = exports.GoalIcon = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _icon = require("@atlaskit/icon");
|
|
10
|
+
var _keyResult = _interopRequireDefault(require("@atlaskit/icon/core/key-result"));
|
|
11
|
+
var _objective = _interopRequireDefault(require("@atlaskit/icon/core/objective"));
|
|
12
|
+
var goalAppearances = ['DEFAULT', 'ON_TRACK', 'AT_RISK', 'OFF_TRACK', 'MENU'];
|
|
13
|
+
var GOAL_ICON_KEYS = ['GOAL', 'OBJECTIVE', 'KEY_RESULT'];
|
|
14
|
+
var isGoalAppearance = function isGoalAppearance(value) {
|
|
15
|
+
return goalAppearances.includes(value.toLocaleUpperCase());
|
|
16
|
+
};
|
|
17
|
+
var isGoalIconKey = exports.isGoalIconKey = function isGoalIconKey(value) {
|
|
18
|
+
return GOAL_ICON_KEYS.includes(value);
|
|
19
|
+
};
|
|
20
|
+
var appearanceToColorMap = {
|
|
21
|
+
DEFAULT: 'gray',
|
|
22
|
+
MENU: 'gray',
|
|
23
|
+
OFF_TRACK: 'red',
|
|
24
|
+
AT_RISK: 'yellow',
|
|
25
|
+
ON_TRACK: 'green'
|
|
26
|
+
};
|
|
27
|
+
var keyToIconMap = {
|
|
28
|
+
GOAL: _objective.default,
|
|
29
|
+
OBJECTIVE: _objective.default,
|
|
30
|
+
KEY_RESULT: _keyResult.default
|
|
31
|
+
};
|
|
32
|
+
var GoalIcon = exports.GoalIcon = function GoalIcon(_ref) {
|
|
33
|
+
var _keyToIconMap;
|
|
34
|
+
var status = _ref.status,
|
|
35
|
+
size = _ref.size,
|
|
36
|
+
_ref$iconKey = _ref.iconKey,
|
|
37
|
+
iconKey = _ref$iconKey === void 0 ? 'GOAL' : _ref$iconKey;
|
|
38
|
+
var Icon = (_keyToIconMap = keyToIconMap[iconKey]) !== null && _keyToIconMap !== void 0 ? _keyToIconMap : keyToIconMap.GOAL;
|
|
39
|
+
var appearance = isGoalAppearance(status) ? status : 'DEFAULT';
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_icon.IconTile, {
|
|
41
|
+
size: size,
|
|
42
|
+
icon: Icon,
|
|
43
|
+
label: "",
|
|
44
|
+
appearance: appearanceToColorMap[appearance]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* goal-node.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GoalNode = void 0;
|
|
9
|
+
require("./goal-node.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
|
+
var _state = require("../../../../state");
|
|
17
|
+
var _base = require("../base");
|
|
18
|
+
var _goalIcon = require("./goal-icon");
|
|
19
|
+
var _excluded = ["id", "fieldName", "name"];
|
|
20
|
+
var styles = {
|
|
21
|
+
iconWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm"
|
|
22
|
+
};
|
|
23
|
+
function toGoalIconKey(iconKey) {
|
|
24
|
+
return iconKey && (0, _goalIcon.isGoalIconKey)(iconKey) ? iconKey : 'GOAL';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* GoalNode Component
|
|
29
|
+
*
|
|
30
|
+
* This component is a component for rendering a pill-like view for Goal node type
|
|
31
|
+
* in the JQL editor
|
|
32
|
+
*/
|
|
33
|
+
var GoalNode = exports.GoalNode = function GoalNode(props) {
|
|
34
|
+
var _goal$status;
|
|
35
|
+
var id = props.id,
|
|
36
|
+
fieldName = props.fieldName,
|
|
37
|
+
name = props.name,
|
|
38
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
39
|
+
var _useHydratedGoal = (0, _state.useHydratedGoal)({
|
|
40
|
+
id: id,
|
|
41
|
+
fieldName: fieldName
|
|
42
|
+
}),
|
|
43
|
+
_useHydratedGoal2 = (0, _slicedToArray2.default)(_useHydratedGoal, 1),
|
|
44
|
+
goal = _useHydratedGoal2[0];
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_base.NodeBase, (0, _extends2.default)({
|
|
46
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
47
|
+
xcss: styles.iconWrapper
|
|
48
|
+
}, /*#__PURE__*/_react.default.createElement(_goalIcon.GoalIcon, {
|
|
49
|
+
size: "16",
|
|
50
|
+
status: (_goal$status = goal === null || goal === void 0 ? void 0 : goal.status) !== null && _goal$status !== void 0 ? _goal$status : "DEFAULT",
|
|
51
|
+
iconKey: toGoalIconKey("GOAL")
|
|
52
|
+
})),
|
|
53
|
+
text: name,
|
|
54
|
+
isRichNodeDisplay: true
|
|
55
|
+
}, rest));
|
|
56
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.goal = void 0;
|
|
7
|
+
var _goalNode = require("./goal-node");
|
|
8
|
+
var goal = exports.goal = {
|
|
9
|
+
component: _goalNode.GoalNode,
|
|
10
|
+
attrs: {
|
|
11
|
+
id: {},
|
|
12
|
+
name: {},
|
|
13
|
+
fieldName: {}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.richInlineNodes = void 0;
|
|
7
|
+
var _goal = require("./goal");
|
|
7
8
|
var _project = require("./project");
|
|
8
9
|
var _team = require("./team");
|
|
9
10
|
var _user = require("./user");
|
|
10
11
|
var richInlineNodes = exports.richInlineNodes = {
|
|
11
12
|
user: _user.user,
|
|
12
13
|
team: _team.team,
|
|
13
|
-
project: _project.project
|
|
14
|
+
project: _project.project,
|
|
15
|
+
goal: _goal.goal
|
|
14
16
|
};
|
|
@@ -13,6 +13,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
|
|
16
17
|
var _jqlAst = require("@atlaskit/jql-ast");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _schema = require("../../../schema");
|
|
@@ -33,7 +34,7 @@ var replaceRichInlineNodes = exports.replaceRichInlineNodes = function replaceRi
|
|
|
33
34
|
fieldName = _ref2[0],
|
|
34
35
|
values = _ref2[1];
|
|
35
36
|
values.forEach(function (value) {
|
|
36
|
-
if (value.type === 'user' || value.type === 'team' || value.type === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2')) {
|
|
37
|
+
if (value.type === 'user' || value.type === 'team' || value.type === 'goal' && _featureGateJsClient.default.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || value.type === 'project' && (0, _platformFeatureFlags.fg)('projects_in_jira_eap_drop2')) {
|
|
37
38
|
// First try to find as direct value operand (e.g., Team[Team] = uuid)
|
|
38
39
|
var astNodes = getValueNodes(ast, fieldName, value.id);
|
|
39
40
|
|
|
@@ -82,6 +83,13 @@ var getRichInlineNode = function getRichInlineNode(fieldName, value, text) {
|
|
|
82
83
|
fieldName: fieldName
|
|
83
84
|
}), _textContent2);
|
|
84
85
|
}
|
|
86
|
+
case 'goal':
|
|
87
|
+
{
|
|
88
|
+
var _textContent3 = _schema.JQLEditorSchema.text(text);
|
|
89
|
+
return _schema.JQLEditorSchema.nodes.goal.create(_objectSpread(_objectSpread({}, value), {}, {
|
|
90
|
+
fieldName: fieldName
|
|
91
|
+
}), _textContent3);
|
|
92
|
+
}
|
|
85
93
|
default:
|
|
86
94
|
{
|
|
87
95
|
throw new Error("Unsupported hydrated value type ".concat(value.type));
|
package/dist/cjs/state/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useStoreActions = exports.useScopedId = exports.useRichInlineNodesEnabled = exports.useOnSyntaxHelp = exports.useLineNumbersVisible = exports.useJqlError = exports.useIsSearching = exports.useIntl = exports.useIdPrefix = exports.useHydratedValue = exports.useHydratedUser = exports.useHydratedTeam = exports.useHydratedProject = exports.useHydratedDeprecations = exports.useExternalMessages = exports.useEditorViewHasFocus = exports.useEditorView = exports.useEditorStateHasJqlError = exports.useEditorState = exports.useCustomErrorComponent = exports.useAutocompleteProvider = exports.useAutocompletePosition = exports.useAutocompleteOptions = exports.useAutocompleteLoading = exports.useAutocompleteIsOpen = exports.useAutocomplete = exports.initialState = exports.actions = exports.EditorStateContainer = void 0;
|
|
7
|
+
exports.useStoreActions = exports.useScopedId = exports.useRichInlineNodesEnabled = exports.useOnSyntaxHelp = exports.useLineNumbersVisible = exports.useJqlError = exports.useIsSearching = exports.useIntl = exports.useIdPrefix = exports.useHydratedValue = exports.useHydratedUser = exports.useHydratedTeam = exports.useHydratedProject = exports.useHydratedGoal = exports.useHydratedDeprecations = exports.useExternalMessages = exports.useEditorViewHasFocus = exports.useEditorView = exports.useEditorStateHasJqlError = exports.useEditorState = exports.useCustomErrorComponent = exports.useAutocompleteProvider = exports.useAutocompletePosition = exports.useAutocompleteOptions = exports.useAutocompleteLoading = exports.useAutocompleteIsOpen = exports.useAutocomplete = exports.initialState = exports.actions = exports.EditorStateContainer = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -938,16 +938,25 @@ var useHydratedProject = exports.useHydratedProject = (0, _reactSweetState.creat
|
|
|
938
938
|
return project && project.type === 'project' ? project : undefined;
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
|
+
var useHydratedGoal = exports.useHydratedGoal = (0, _reactSweetState.createHook)(Store, {
|
|
942
|
+
selector: function selector(state, _ref42) {
|
|
943
|
+
var _state$hydratedValues9;
|
|
944
|
+
var id = _ref42.id,
|
|
945
|
+
fieldName = _ref42.fieldName;
|
|
946
|
+
var goal = (_state$hydratedValues9 = state.hydratedValues[(0, _util.normaliseHydrationKey)(fieldName)]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.get((0, _jqlAst.normaliseJqlString)(id));
|
|
947
|
+
return goal && goal.type === 'goal' ? goal : undefined;
|
|
948
|
+
}
|
|
949
|
+
});
|
|
941
950
|
var useHydratedDeprecations = exports.useHydratedDeprecations = (0, _reactSweetState.createHook)(Store, {
|
|
942
951
|
selector: function selector(state) {
|
|
943
952
|
var ast = (0, _jqlAst2.getJastFromState)(state.editorState);
|
|
944
953
|
var fieldsInQuery = (0, _util2.getFieldNodes)(ast);
|
|
945
954
|
var toReturn = [];
|
|
946
|
-
Object.entries(state.hydratedValues).forEach(function (
|
|
947
|
-
var _state$
|
|
948
|
-
var
|
|
949
|
-
fieldName =
|
|
950
|
-
(_state$
|
|
955
|
+
Object.entries(state.hydratedValues).forEach(function (_ref43) {
|
|
956
|
+
var _state$hydratedValues0;
|
|
957
|
+
var _ref44 = (0, _slicedToArray2.default)(_ref43, 1),
|
|
958
|
+
fieldName = _ref44[0];
|
|
959
|
+
(_state$hydratedValues0 = state.hydratedValues[fieldName]) === null || _state$hydratedValues0 === void 0 || _state$hydratedValues0.forEach(function (value) {
|
|
951
960
|
if (value.type === 'deprecated-field') {
|
|
952
961
|
if (fieldsInQuery.has(value.id.toLowerCase())) {
|
|
953
962
|
toReturn.push(value);
|
|
@@ -970,19 +979,19 @@ var useOnSyntaxHelp = exports.useOnSyntaxHelp = (0, _reactSweetState.createHook)
|
|
|
970
979
|
});
|
|
971
980
|
var EditorStateContainer = exports.EditorStateContainer = (0, _reactSweetState.createContainer)(Store, {
|
|
972
981
|
onInit: function onInit() {
|
|
973
|
-
return function (
|
|
974
|
-
var getState =
|
|
975
|
-
setState =
|
|
976
|
-
dispatch =
|
|
977
|
-
var intlRef =
|
|
978
|
-
query =
|
|
979
|
-
isSearching =
|
|
980
|
-
autocompleteProvider =
|
|
981
|
-
externalMessages =
|
|
982
|
-
enableRichInlineNodes =
|
|
983
|
-
onDebugUnsafeMessage =
|
|
984
|
-
onSyntaxHelp =
|
|
985
|
-
customComponents =
|
|
982
|
+
return function (_ref45, _ref46) {
|
|
983
|
+
var getState = _ref45.getState,
|
|
984
|
+
setState = _ref45.setState,
|
|
985
|
+
dispatch = _ref45.dispatch;
|
|
986
|
+
var intlRef = _ref46.intlRef,
|
|
987
|
+
query = _ref46.query,
|
|
988
|
+
isSearching = _ref46.isSearching,
|
|
989
|
+
autocompleteProvider = _ref46.autocompleteProvider,
|
|
990
|
+
externalMessages = _ref46.externalMessages,
|
|
991
|
+
enableRichInlineNodes = _ref46.enableRichInlineNodes,
|
|
992
|
+
onDebugUnsafeMessage = _ref46.onDebugUnsafeMessage,
|
|
993
|
+
onSyntaxHelp = _ref46.onSyntaxHelp,
|
|
994
|
+
customComponents = _ref46.customComponents;
|
|
986
995
|
setState({
|
|
987
996
|
controlledQuery: query,
|
|
988
997
|
query: query,
|
|
@@ -1011,18 +1020,18 @@ var EditorStateContainer = exports.EditorStateContainer = (0, _reactSweetState.c
|
|
|
1011
1020
|
};
|
|
1012
1021
|
},
|
|
1013
1022
|
onUpdate: function onUpdate() {
|
|
1014
|
-
return function (
|
|
1015
|
-
var getState =
|
|
1016
|
-
setState =
|
|
1017
|
-
dispatch =
|
|
1018
|
-
var controlledQueryProp =
|
|
1019
|
-
isSearching =
|
|
1020
|
-
autocompleteProvider =
|
|
1021
|
-
externalMessages =
|
|
1022
|
-
enableRichInlineNodes =
|
|
1023
|
-
onDebugUnsafeMessage =
|
|
1024
|
-
onSyntaxHelp =
|
|
1025
|
-
customComponents =
|
|
1023
|
+
return function (_ref47, _ref48) {
|
|
1024
|
+
var getState = _ref47.getState,
|
|
1025
|
+
setState = _ref47.setState,
|
|
1026
|
+
dispatch = _ref47.dispatch;
|
|
1027
|
+
var controlledQueryProp = _ref48.query,
|
|
1028
|
+
isSearching = _ref48.isSearching,
|
|
1029
|
+
autocompleteProvider = _ref48.autocompleteProvider,
|
|
1030
|
+
externalMessages = _ref48.externalMessages,
|
|
1031
|
+
enableRichInlineNodes = _ref48.enableRichInlineNodes,
|
|
1032
|
+
onDebugUnsafeMessage = _ref48.onDebugUnsafeMessage,
|
|
1033
|
+
onSyntaxHelp = _ref48.onSyntaxHelp,
|
|
1034
|
+
customComponents = _ref48.customComponents;
|
|
1026
1035
|
var _getState12 = getState(),
|
|
1027
1036
|
controlledQuery = _getState12.controlledQuery,
|
|
1028
1037
|
query = _getState12.query;
|
|
@@ -19,6 +19,6 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
19
19
|
defaultWarning: {
|
|
20
20
|
id: 'jql-editor.ui.jql-warning-message.default',
|
|
21
21
|
defaultMessage: '{deprecatedField} has been deprecated and may stop working in the future.',
|
|
22
|
-
description: '
|
|
22
|
+
description: 'The text is shown as a warning message in the JQL editor footer when a deprecated field is used in the query. The placeholder {deprecatedField} will be substituted with the name of the deprecated JQL field.'
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -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.1.
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.1.2", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
4
5
|
import { isListOperator } from '@atlaskit/jql-ast';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import getDocumentPosition from '../common/get-document-position';
|
|
@@ -45,7 +46,7 @@ export default class AutocompletePluginView extends ReactPluginView {
|
|
|
45
46
|
if (this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
|
|
46
47
|
transaction.setMeta('hydrate', true);
|
|
47
48
|
}
|
|
48
|
-
if (this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
|
|
49
|
+
if (this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' || option.valueType === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
|
|
49
50
|
transaction.setMeta('hydrate', true);
|
|
50
51
|
}
|
|
51
52
|
const documentFrom = getDocumentPosition(transaction.doc, from);
|
|
@@ -113,6 +114,21 @@ export default class AutocompletePluginView extends ReactPluginView {
|
|
|
113
114
|
}
|
|
114
115
|
break;
|
|
115
116
|
}
|
|
117
|
+
case 'goal':
|
|
118
|
+
{
|
|
119
|
+
if (FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false)) {
|
|
120
|
+
const attributes = {
|
|
121
|
+
type: 'goal',
|
|
122
|
+
id: value,
|
|
123
|
+
name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
|
|
124
|
+
fieldName: context === null || context === void 0 ? void 0 : context.field
|
|
125
|
+
};
|
|
126
|
+
nodes.push(this.view.state.schema.nodes.goal.create(attributes, textContent));
|
|
127
|
+
} else {
|
|
128
|
+
nodes.push(textContent);
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
116
132
|
default:
|
|
117
133
|
{
|
|
118
134
|
nodes.push(textContent);
|
|
@@ -37,9 +37,10 @@ export const NodeBase = props => {
|
|
|
37
37
|
text,
|
|
38
38
|
isLocked,
|
|
39
39
|
selected,
|
|
40
|
-
error
|
|
40
|
+
error,
|
|
41
|
+
isRichNodeDisplay
|
|
41
42
|
} = props;
|
|
42
|
-
const isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false);
|
|
43
|
+
const isNewExperienceEnabled = FeatureGates.getExperimentValue('projects_in_jira_eap_drop2_fast_follow_filters', 'isEnabled', false) || isRichNodeDisplay;
|
|
43
44
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
44
45
|
xcss: cx(styles.nodeWrapper, !isNewExperienceEnabled && styles.nodeWrapperWithHeight, error && styles.nodeWrapperError, selected && (error ? styles.nodeWrapperErrorSelected : styles.nodeWrapperSelected))
|
|
45
46
|
}, isNewExperienceEnabled ? {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconTile } from '@atlaskit/icon';
|
|
3
|
+
import KeyResultIcon from '@atlaskit/icon/core/key-result';
|
|
4
|
+
import ObjectiveIcon from '@atlaskit/icon/core/objective';
|
|
5
|
+
const goalAppearances = ['DEFAULT', 'ON_TRACK', 'AT_RISK', 'OFF_TRACK', 'MENU'];
|
|
6
|
+
const GOAL_ICON_KEYS = ['GOAL', 'OBJECTIVE', 'KEY_RESULT'];
|
|
7
|
+
const isGoalAppearance = value => goalAppearances.includes(value.toLocaleUpperCase());
|
|
8
|
+
export const isGoalIconKey = value => GOAL_ICON_KEYS.includes(value);
|
|
9
|
+
const appearanceToColorMap = {
|
|
10
|
+
DEFAULT: 'gray',
|
|
11
|
+
MENU: 'gray',
|
|
12
|
+
OFF_TRACK: 'red',
|
|
13
|
+
AT_RISK: 'yellow',
|
|
14
|
+
ON_TRACK: 'green'
|
|
15
|
+
};
|
|
16
|
+
const keyToIconMap = {
|
|
17
|
+
GOAL: ObjectiveIcon,
|
|
18
|
+
OBJECTIVE: ObjectiveIcon,
|
|
19
|
+
KEY_RESULT: KeyResultIcon
|
|
20
|
+
};
|
|
21
|
+
export const GoalIcon = ({
|
|
22
|
+
status,
|
|
23
|
+
size,
|
|
24
|
+
iconKey = 'GOAL'
|
|
25
|
+
}) => {
|
|
26
|
+
var _keyToIconMap;
|
|
27
|
+
const Icon = (_keyToIconMap = keyToIconMap[iconKey]) !== null && _keyToIconMap !== void 0 ? _keyToIconMap : keyToIconMap.GOAL;
|
|
28
|
+
const appearance = isGoalAppearance(status) ? status : 'DEFAULT';
|
|
29
|
+
return /*#__PURE__*/React.createElement(IconTile, {
|
|
30
|
+
size: size,
|
|
31
|
+
icon: Icon,
|
|
32
|
+
label: "",
|
|
33
|
+
appearance: appearanceToColorMap[appearance]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* goal-node.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./goal-node.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
7
|
+
import { useHydratedGoal } from '../../../../state';
|
|
8
|
+
import { NodeBase } from '../base';
|
|
9
|
+
import { GoalIcon, isGoalIconKey } from './goal-icon';
|
|
10
|
+
const styles = {
|
|
11
|
+
iconWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm"
|
|
12
|
+
};
|
|
13
|
+
function toGoalIconKey(iconKey) {
|
|
14
|
+
return iconKey && isGoalIconKey(iconKey) ? iconKey : 'GOAL';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* GoalNode Component
|
|
19
|
+
*
|
|
20
|
+
* This component is a component for rendering a pill-like view for Goal node type
|
|
21
|
+
* in the JQL editor
|
|
22
|
+
*/
|
|
23
|
+
export const GoalNode = props => {
|
|
24
|
+
var _goal$status;
|
|
25
|
+
const {
|
|
26
|
+
id,
|
|
27
|
+
fieldName,
|
|
28
|
+
name,
|
|
29
|
+
...rest
|
|
30
|
+
} = props;
|
|
31
|
+
const [goal] = useHydratedGoal({
|
|
32
|
+
id,
|
|
33
|
+
fieldName
|
|
34
|
+
});
|
|
35
|
+
return /*#__PURE__*/React.createElement(NodeBase, _extends({
|
|
36
|
+
iconBefore: /*#__PURE__*/React.createElement(Box, {
|
|
37
|
+
xcss: styles.iconWrapper
|
|
38
|
+
}, /*#__PURE__*/React.createElement(GoalIcon, {
|
|
39
|
+
size: "16",
|
|
40
|
+
status: (_goal$status = goal === null || goal === void 0 ? void 0 : goal.status) !== null && _goal$status !== void 0 ? _goal$status : "DEFAULT",
|
|
41
|
+
iconKey: toGoalIconKey("GOAL")
|
|
42
|
+
})),
|
|
43
|
+
text: name,
|
|
44
|
+
isRichNodeDisplay: true
|
|
45
|
+
}, rest));
|
|
46
|
+
};
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import FeatureGates from '@atlaskit/feature-gate-js-client';
|
|
2
3
|
import { AbstractJastVisitor } from '@atlaskit/jql-ast';
|
|
3
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { JQLEditorSchema } from '../../../schema';
|
|
@@ -12,7 +13,7 @@ export const replaceRichInlineNodes = (editorState, hydratedValues) => {
|
|
|
12
13
|
transaction.setMeta('addToHistory', false);
|
|
13
14
|
Object.entries(hydratedValues).forEach(([fieldName, values]) => {
|
|
14
15
|
values.forEach(value => {
|
|
15
|
-
if (value.type === 'user' || value.type === 'team' || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
|
|
16
|
+
if (value.type === 'user' || value.type === 'team' || value.type === 'goal' && FeatureGates.getExperimentValue('anip-1095-goals-in-harmonised-filter', 'isEnabled', false) || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
|
|
16
17
|
// First try to find as direct value operand (e.g., Team[Team] = uuid)
|
|
17
18
|
let astNodes = getValueNodes(ast, fieldName, value.id);
|
|
18
19
|
|
|
@@ -62,6 +63,14 @@ const getRichInlineNode = (fieldName, value, text) => {
|
|
|
62
63
|
fieldName
|
|
63
64
|
}, textContent);
|
|
64
65
|
}
|
|
66
|
+
case 'goal':
|
|
67
|
+
{
|
|
68
|
+
const textContent = JQLEditorSchema.text(text);
|
|
69
|
+
return JQLEditorSchema.nodes.goal.create({
|
|
70
|
+
...value,
|
|
71
|
+
fieldName
|
|
72
|
+
}, textContent);
|
|
73
|
+
}
|
|
65
74
|
default:
|
|
66
75
|
{
|
|
67
76
|
throw new Error(`Unsupported hydrated value type ${value.type}`);
|
|
@@ -914,14 +914,24 @@ export const useHydratedProject = createHook(Store, {
|
|
|
914
914
|
return project && project.type === 'project' ? project : undefined;
|
|
915
915
|
}
|
|
916
916
|
});
|
|
917
|
+
export const useHydratedGoal = createHook(Store, {
|
|
918
|
+
selector: (state, {
|
|
919
|
+
id,
|
|
920
|
+
fieldName
|
|
921
|
+
}) => {
|
|
922
|
+
var _state$hydratedValues9;
|
|
923
|
+
const goal = (_state$hydratedValues9 = state.hydratedValues[normaliseHydrationKey(fieldName)]) === null || _state$hydratedValues9 === void 0 ? void 0 : _state$hydratedValues9.get(normaliseJqlString(id));
|
|
924
|
+
return goal && goal.type === 'goal' ? goal : undefined;
|
|
925
|
+
}
|
|
926
|
+
});
|
|
917
927
|
export const useHydratedDeprecations = createHook(Store, {
|
|
918
928
|
selector: state => {
|
|
919
929
|
const ast = getJastFromState(state.editorState);
|
|
920
930
|
const fieldsInQuery = getFieldNodes(ast);
|
|
921
931
|
const toReturn = [];
|
|
922
932
|
Object.entries(state.hydratedValues).forEach(([fieldName]) => {
|
|
923
|
-
var _state$
|
|
924
|
-
(_state$
|
|
933
|
+
var _state$hydratedValues0;
|
|
934
|
+
(_state$hydratedValues0 = state.hydratedValues[fieldName]) === null || _state$hydratedValues0 === void 0 ? void 0 : _state$hydratedValues0.forEach(value => {
|
|
925
935
|
if (value.type === 'deprecated-field') {
|
|
926
936
|
if (fieldsInQuery.has(value.id.toLowerCase())) {
|
|
927
937
|
toReturn.push(value);
|
|
@@ -13,6 +13,6 @@ export const messages = defineMessages({
|
|
|
13
13
|
defaultWarning: {
|
|
14
14
|
id: 'jql-editor.ui.jql-warning-message.default',
|
|
15
15
|
defaultMessage: '{deprecatedField} has been deprecated and may stop working in the future.',
|
|
16
|
-
description: '
|
|
16
|
+
description: 'The text is shown as a warning message in the JQL editor footer when a deprecated field is used in the query. The placeholder {deprecatedField} will be substituted with the name of the deprecated JQL field.'
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -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.1.
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "6.1.2", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|