@atlaskit/jql-editor 5.12.8 → 5.13.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 +11 -0
- package/dist/cjs/analytics/util.js +1 -1
- package/dist/cjs/plugins/autocomplete/view.js +16 -1
- package/dist/cjs/plugins/rich-inline-nodes/nodes/base/index.compiled.css +3 -1
- package/dist/cjs/plugins/rich-inline-nodes/nodes/base/index.js +2 -2
- package/dist/cjs/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/cjs/plugins/rich-inline-nodes/nodes/project/index.js +9 -65
- package/dist/cjs/plugins/rich-inline-nodes/nodes/project/{index.compiled.css → project-node.compiled.css} +2 -2
- package/dist/cjs/plugins/rich-inline-nodes/nodes/project/project-node.js +78 -0
- package/dist/cjs/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +8 -1
- package/dist/cjs/state/index.js +40 -31
- package/dist/es2019/analytics/util.js +1 -1
- package/dist/es2019/plugins/autocomplete/view.js +16 -1
- package/dist/es2019/plugins/rich-inline-nodes/nodes/base/index.compiled.css +3 -1
- package/dist/es2019/plugins/rich-inline-nodes/nodes/base/index.js +2 -2
- package/dist/es2019/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/es2019/plugins/rich-inline-nodes/nodes/project/index.js +8 -56
- package/dist/es2019/plugins/rich-inline-nodes/nodes/project/{index.compiled.css → project-node.compiled.css} +2 -2
- package/dist/es2019/plugins/rich-inline-nodes/nodes/project/project-node.js +63 -0
- package/dist/es2019/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +9 -1
- package/dist/es2019/state/index.js +12 -2
- package/dist/esm/analytics/util.js +1 -1
- package/dist/esm/plugins/autocomplete/view.js +16 -1
- package/dist/esm/plugins/rich-inline-nodes/nodes/base/index.compiled.css +3 -1
- package/dist/esm/plugins/rich-inline-nodes/nodes/base/index.js +2 -2
- package/dist/esm/plugins/rich-inline-nodes/nodes/index.js +3 -1
- package/dist/esm/plugins/rich-inline-nodes/nodes/project/index.js +8 -59
- package/dist/esm/plugins/rich-inline-nodes/nodes/project/{index.compiled.css → project-node.compiled.css} +2 -2
- package/dist/esm/plugins/rich-inline-nodes/nodes/project/project-node.js +67 -0
- package/dist/esm/plugins/rich-inline-nodes/util/replace-nodes-transaction.js +8 -1
- package/dist/esm/state/index.js +39 -30
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/project/index.d.ts +3 -10
- package/dist/types/plugins/rich-inline-nodes/nodes/project/project-node.d.ts +10 -0
- package/dist/types/plugins/rich-inline-nodes/nodes/project/types.d.ts +6 -4
- package/dist/types/state/index.d.ts +36 -1
- package/dist/types/types.d.ts +1 -1
- package/dist/types/ui/jql-editor/types.d.ts +9 -2
- package/dist/types/ui/types.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/project/index.d.ts +3 -10
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/project/project-node.d.ts +10 -0
- package/dist/types-ts4.5/plugins/rich-inline-nodes/nodes/project/types.d.ts +6 -4
- package/dist/types-ts4.5/state/index.d.ts +36 -1
- package/dist/types-ts4.5/types.d.ts +1 -1
- package/dist/types-ts4.5/ui/jql-editor/types.d.ts +9 -2
- package/dist/types-ts4.5/ui/types.d.ts +1 -1
- package/package.json +6 -3
|
@@ -12,7 +12,7 @@ export const replaceRichInlineNodes = (editorState, hydratedValues) => {
|
|
|
12
12
|
transaction.setMeta('addToHistory', false);
|
|
13
13
|
Object.entries(hydratedValues).forEach(([fieldName, values]) => {
|
|
14
14
|
values.forEach(value => {
|
|
15
|
-
if (value.type === 'user' || value.type === 'team' && fg('jira_update_jql_teams')) {
|
|
15
|
+
if (value.type === 'user' || value.type === 'team' && fg('jira_update_jql_teams') || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
|
|
16
16
|
// First try to find as direct value operand (e.g., Team[Team] = uuid)
|
|
17
17
|
let astNodes = getValueNodes(ast, fieldName, value.id);
|
|
18
18
|
|
|
@@ -54,6 +54,14 @@ const getRichInlineNode = (fieldName, value, text) => {
|
|
|
54
54
|
fieldName
|
|
55
55
|
}, textContent);
|
|
56
56
|
}
|
|
57
|
+
case 'project':
|
|
58
|
+
{
|
|
59
|
+
const textContent = JQLEditorSchema.text(text);
|
|
60
|
+
return JQLEditorSchema.nodes.project.create({
|
|
61
|
+
...value,
|
|
62
|
+
fieldName
|
|
63
|
+
}, textContent);
|
|
64
|
+
}
|
|
57
65
|
default:
|
|
58
66
|
{
|
|
59
67
|
throw new Error(`Unsupported hydrated value type ${value.type}`);
|
|
@@ -893,14 +893,24 @@ export const useHydratedTeam = createHook(Store, {
|
|
|
893
893
|
return team && team.type === 'team' ? team : undefined;
|
|
894
894
|
}
|
|
895
895
|
});
|
|
896
|
+
export const useHydratedProject = createHook(Store, {
|
|
897
|
+
selector: (state, {
|
|
898
|
+
id,
|
|
899
|
+
fieldName
|
|
900
|
+
}) => {
|
|
901
|
+
var _state$hydratedValues4;
|
|
902
|
+
const project = (_state$hydratedValues4 = state.hydratedValues[fieldName]) === null || _state$hydratedValues4 === void 0 ? void 0 : _state$hydratedValues4.get(id);
|
|
903
|
+
return project && project.type === 'project' ? project : undefined;
|
|
904
|
+
}
|
|
905
|
+
});
|
|
896
906
|
export const useHydratedDeprecations = createHook(Store, {
|
|
897
907
|
selector: state => {
|
|
898
908
|
const ast = getJastFromState(state.editorState);
|
|
899
909
|
const fieldsInQuery = getFieldNodes(ast);
|
|
900
910
|
const toReturn = [];
|
|
901
911
|
Object.entries(state.hydratedValues).forEach(([fieldName]) => {
|
|
902
|
-
var _state$
|
|
903
|
-
(_state$
|
|
912
|
+
var _state$hydratedValues5;
|
|
913
|
+
(_state$hydratedValues5 = state.hydratedValues[fieldName]) === null || _state$hydratedValues5 === void 0 ? void 0 : _state$hydratedValues5.forEach(value => {
|
|
904
914
|
if (value.type === 'deprecated-field') {
|
|
905
915
|
if (fieldsInQuery.has(value.id.toLowerCase())) {
|
|
906
916
|
toReturn.push(value);
|
|
@@ -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", "
|
|
3
|
+
return useJqlPackageAnalytics(analyticsSource, "@atlaskit/jql-editor", "5.12.8", ANALYTICS_CHANNEL);
|
|
4
4
|
};
|
|
@@ -56,7 +56,7 @@ var AutocompletePluginView = /*#__PURE__*/function (_ReactPluginView) {
|
|
|
56
56
|
if (_this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'user') {
|
|
57
57
|
transaction.setMeta('hydrate', true);
|
|
58
58
|
}
|
|
59
|
-
if (_this.enableRichInlineNodes && option.type === 'value' && option.valueType === 'team' && fg('jira_update_jql_teams')) {
|
|
59
|
+
if (_this.enableRichInlineNodes && option.type === 'value' && (option.valueType === 'team' && fg('jira_update_jql_teams') || option.valueType === 'project' && fg('projects_in_jira_eap_drop2'))) {
|
|
60
60
|
transaction.setMeta('hydrate', true);
|
|
61
61
|
}
|
|
62
62
|
var documentFrom = getDocumentPosition(transaction.doc, from);
|
|
@@ -111,6 +111,21 @@ var AutocompletePluginView = /*#__PURE__*/function (_ReactPluginView) {
|
|
|
111
111
|
}
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
114
|
+
case 'project':
|
|
115
|
+
{
|
|
116
|
+
if (fg('projects_in_jira_eap_drop2')) {
|
|
117
|
+
var _attributes2 = {
|
|
118
|
+
type: 'project',
|
|
119
|
+
id: value,
|
|
120
|
+
name: nameOnRichInlineNode !== null && nameOnRichInlineNode !== void 0 ? nameOnRichInlineNode : name,
|
|
121
|
+
fieldName: context === null || context === void 0 ? void 0 : context.field
|
|
122
|
+
};
|
|
123
|
+
nodes.push(_this.view.state.schema.nodes.project.create(_attributes2, textContent));
|
|
124
|
+
} else {
|
|
125
|
+
nodes.push(textContent);
|
|
126
|
+
}
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
114
129
|
default:
|
|
115
130
|
{
|
|
116
131
|
nodes.push(textContent);
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
3
|
._1h6dq98m{border-color:var(--ds-border-selected,#1868db)}
|
|
4
4
|
._1rjcidpf{padding-block:0}
|
|
5
|
+
._1e0c116y{display:inline-flex}
|
|
5
6
|
._1e0c1txw{display:flex}
|
|
6
7
|
._1hms8stv{text-decoration-line:underline}
|
|
7
8
|
._1kegt94y{text-decoration-thickness:1px}
|
|
8
|
-
.
|
|
9
|
+
._1wpz1q9y{align-self:baseline}
|
|
9
10
|
._4bfu1r31{text-decoration-color:currentColor}
|
|
10
11
|
._4bfu1tmw{text-decoration-color:var(--ds-text-danger,#ae2e24)}
|
|
11
12
|
._4cvr1h6o{align-items:center}
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
._bfhki8nm{background-color:var(--ds-background-neutral,#0515240f)}
|
|
18
19
|
._bozgv77o{padding-inline-start:var(--ds-space-025,2px)}
|
|
19
20
|
._ect4zzfg{font-family:var(--ds-font-family-code,"Atlassian Mono",ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
|
|
21
|
+
._s7n4z0dk{vertical-align:text-top}
|
|
20
22
|
._tdi7glyw{-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}
|
|
21
23
|
._y4ti1b66{padding-inline-end:var(--ds-space-050,4px)}
|
|
22
24
|
._irr31yvi:hover{background-color:var(--ds-background-danger-hovered,#ffd5d2)}
|
|
@@ -6,12 +6,12 @@ import { cx } from '@atlaskit/css';
|
|
|
6
6
|
import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
|
|
7
7
|
import { Box, Inline, Pressable } from '@atlaskit/primitives/compiled';
|
|
8
8
|
var styles = {
|
|
9
|
-
nodeWrapper: "_19it145i _2rko12b0 _1rjcidpf
|
|
9
|
+
nodeWrapper: "_19it145i _2rko12b0 _1rjcidpf _1e0c116y _s7n4z0dk _4cvr1h6o _1wpz1q9y _bfhki8nm _4t3igktf _bozgv77o _y4ti1b66 _irr3plhp",
|
|
10
10
|
nodeWrapperSelected: "_1h6dq98m _bfhk15s3 _irr3ufnl",
|
|
11
11
|
nodeWrapperError: "_4bfu1r31 _1hms8stv _ajmm1khm _1kegt94y _tdi7glyw _4bfu1tmw",
|
|
12
12
|
nodeWrapperErrorSelected: "_bfhk1gly _irr31yvi",
|
|
13
13
|
textWrapper: "_ect4zzfg",
|
|
14
|
-
iconBeforeWrapper: "_1e0c1txw _4t3i7vkz _4cvr1h6o
|
|
14
|
+
iconBeforeWrapper: "_1e0c1txw _4t3i7vkz _4cvr1h6o",
|
|
15
15
|
iconAfterWrapper: ""
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1,60 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
10
|
-
import ProjectIcon from '@atlaskit/icon/core/project';
|
|
11
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
12
|
-
import { useIntl } from '../../../../state';
|
|
13
|
-
import { NodeBase } from '../base';
|
|
14
|
-
import { messages } from './messages';
|
|
15
|
-
var styles = {
|
|
16
|
-
emojiWrapper: "_1e0c1txw _4t3i7vkz _4cvr1h6o _1pfh1i6y",
|
|
17
|
-
projectIconWrapper: "_ca0qv77o _u5f3v77o _n3tdv77o _19bvv77o"
|
|
18
|
-
};
|
|
19
|
-
var getTownsquareEmojiProvider = function getTownsquareEmojiProvider() {
|
|
20
|
-
// Dynamically import the emoji provider to prevent an unnecessary network call from being made on module import
|
|
21
|
-
return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/jql-editor/plugins/rich-inline-nodes/nodes/base" */'@atlaskit/townsquare-emoji-provider').then(function (mod) {
|
|
22
|
-
return mod.emojiProvider;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* ProjectNode Component
|
|
28
|
-
*
|
|
29
|
-
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
30
|
-
* in the JQL editor
|
|
31
|
-
*/
|
|
32
|
-
export var ProjectNode = function ProjectNode(props) {
|
|
33
|
-
var emojiName = props.emojiName,
|
|
34
|
-
isRestricted = props.isRestricted,
|
|
35
|
-
text = props.text,
|
|
36
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
37
|
-
var _useIntl = useIntl(),
|
|
38
|
-
_useIntl2 = _slicedToArray(_useIntl, 1),
|
|
39
|
-
formatMessage = _useIntl2[0].formatMessage;
|
|
40
|
-
var townsquareEmojiProvider = getTownsquareEmojiProvider();
|
|
41
|
-
return /*#__PURE__*/React.createElement(NodeBase, _extends({
|
|
42
|
-
iconBefore: emojiName ? /*#__PURE__*/React.createElement(Box, {
|
|
43
|
-
xcss: styles.emojiWrapper
|
|
44
|
-
}, /*#__PURE__*/React.createElement(ResourcedEmoji, {
|
|
45
|
-
emojiProvider: townsquareEmojiProvider,
|
|
46
|
-
emojiId: {
|
|
47
|
-
shortName: emojiName
|
|
48
|
-
},
|
|
49
|
-
fitToHeight: 16
|
|
50
|
-
})) : /*#__PURE__*/React.createElement(Box, {
|
|
51
|
-
xcss: styles.projectIconWrapper
|
|
52
|
-
}, /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
53
|
-
size: "small",
|
|
54
|
-
label: ""
|
|
55
|
-
})),
|
|
56
|
-
text: isRestricted ? formatMessage(messages.restrictedProject) : text
|
|
57
|
-
}, rest, {
|
|
58
|
-
isLocked: isRestricted
|
|
59
|
-
}));
|
|
1
|
+
import { ProjectNode } from './project-node';
|
|
2
|
+
export var project = {
|
|
3
|
+
component: ProjectNode,
|
|
4
|
+
attrs: {
|
|
5
|
+
id: {},
|
|
6
|
+
name: {},
|
|
7
|
+
fieldName: {}
|
|
8
|
+
}
|
|
60
9
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
._154i1i6y{top:var(--ds-space-negative-025,-2px)}
|
|
1
2
|
._19bvv77o{padding-left:var(--ds-space-025,2px)}
|
|
2
3
|
._1e0c1txw{display:flex}
|
|
3
|
-
._1pfh1i6y{margin-block-start:var(--ds-space-negative-025,-2px)}
|
|
4
|
-
._4cvr1h6o{align-items:center}
|
|
5
4
|
._4t3i7vkz{height:1pc}
|
|
6
5
|
._ca0qv77o{padding-top:var(--ds-space-025,2px)}
|
|
6
|
+
._kqswh2mm{position:relative}
|
|
7
7
|
._n3tdv77o{padding-bottom:var(--ds-space-025,2px)}
|
|
8
8
|
._u5f3v77o{padding-right:var(--ds-space-025,2px)}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/* project-node.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["id", "fieldName", "name", "privateProject"];
|
|
6
|
+
import "./project-node.compiled.css";
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { useIntl } from 'react-intl-next';
|
|
10
|
+
import { ResourcedEmoji } from '@atlaskit/emoji';
|
|
11
|
+
import ProjectIcon from '@atlaskit/icon/core/project';
|
|
12
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
13
|
+
import { useHydratedProject } from '../../../../state';
|
|
14
|
+
import { NodeBase } from '../base';
|
|
15
|
+
import { messages } from './messages';
|
|
16
|
+
var styles = {
|
|
17
|
+
emojiWrapper: "_1e0c1txw _4t3i7vkz _kqswh2mm _154i1i6y",
|
|
18
|
+
projectIconWrapper: "_ca0qv77o _u5f3v77o _n3tdv77o _19bvv77o"
|
|
19
|
+
};
|
|
20
|
+
var getTownsquareEmojiProvider = function getTownsquareEmojiProvider() {
|
|
21
|
+
// Dynamically import the emoji provider to prevent an unnecessary network call from being made on module import
|
|
22
|
+
return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/jql-editor/plugins/rich-inline-nodes/nodes/base" */'@atlaskit/townsquare-emoji-provider').then(function (mod) {
|
|
23
|
+
return mod.emojiProvider;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* ProjectNode Component
|
|
29
|
+
*
|
|
30
|
+
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
31
|
+
* in the JQL editor
|
|
32
|
+
*/
|
|
33
|
+
export var ProjectNode = function ProjectNode(props) {
|
|
34
|
+
var id = props.id,
|
|
35
|
+
fieldName = props.fieldName,
|
|
36
|
+
name = props.name,
|
|
37
|
+
privateProject = props.privateProject,
|
|
38
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
39
|
+
var _useIntl = useIntl(),
|
|
40
|
+
formatMessage = _useIntl.formatMessage;
|
|
41
|
+
var _useHydratedProject = useHydratedProject({
|
|
42
|
+
id: id,
|
|
43
|
+
fieldName: fieldName
|
|
44
|
+
}),
|
|
45
|
+
_useHydratedProject2 = _slicedToArray(_useHydratedProject, 1),
|
|
46
|
+
project = _useHydratedProject2[0];
|
|
47
|
+
var townsquareEmojiProvider = getTownsquareEmojiProvider();
|
|
48
|
+
return /*#__PURE__*/React.createElement(NodeBase, _extends({
|
|
49
|
+
iconBefore: project !== null && project !== void 0 && project.iconName ? /*#__PURE__*/React.createElement(Box, {
|
|
50
|
+
xcss: styles.emojiWrapper
|
|
51
|
+
}, /*#__PURE__*/React.createElement(ResourcedEmoji, {
|
|
52
|
+
emojiProvider: townsquareEmojiProvider,
|
|
53
|
+
emojiId: {
|
|
54
|
+
shortName: project.iconName
|
|
55
|
+
},
|
|
56
|
+
fitToHeight: 16
|
|
57
|
+
})) : /*#__PURE__*/React.createElement(Box, {
|
|
58
|
+
xcss: styles.projectIconWrapper
|
|
59
|
+
}, /*#__PURE__*/React.createElement(ProjectIcon, {
|
|
60
|
+
size: "small",
|
|
61
|
+
label: ""
|
|
62
|
+
})),
|
|
63
|
+
text: privateProject || project !== null && project !== void 0 && project.privateProject ? formatMessage(messages.restrictedProject) : name
|
|
64
|
+
}, rest, {
|
|
65
|
+
isLocked: project === null || project === void 0 ? void 0 : project.privateProject
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
@@ -26,7 +26,7 @@ export var replaceRichInlineNodes = function replaceRichInlineNodes(editorState,
|
|
|
26
26
|
fieldName = _ref2[0],
|
|
27
27
|
values = _ref2[1];
|
|
28
28
|
values.forEach(function (value) {
|
|
29
|
-
if (value.type === 'user' || value.type === 'team' && fg('jira_update_jql_teams')) {
|
|
29
|
+
if (value.type === 'user' || value.type === 'team' && fg('jira_update_jql_teams') || value.type === 'project' && fg('projects_in_jira_eap_drop2')) {
|
|
30
30
|
// First try to find as direct value operand (e.g., Team[Team] = uuid)
|
|
31
31
|
var astNodes = getValueNodes(ast, fieldName, value.id);
|
|
32
32
|
|
|
@@ -68,6 +68,13 @@ var getRichInlineNode = function getRichInlineNode(fieldName, value, text) {
|
|
|
68
68
|
fieldName: fieldName
|
|
69
69
|
}), _textContent);
|
|
70
70
|
}
|
|
71
|
+
case 'project':
|
|
72
|
+
{
|
|
73
|
+
var _textContent2 = JQLEditorSchema.text(text);
|
|
74
|
+
return JQLEditorSchema.nodes.project.create(_objectSpread(_objectSpread({}, value), {}, {
|
|
75
|
+
fieldName: fieldName
|
|
76
|
+
}), _textContent2);
|
|
77
|
+
}
|
|
71
78
|
default:
|
|
72
79
|
{
|
|
73
80
|
throw new Error("Unsupported hydrated value type ".concat(value.type));
|
package/dist/esm/state/index.js
CHANGED
|
@@ -912,16 +912,25 @@ export var useHydratedTeam = createHook(Store, {
|
|
|
912
912
|
return team && team.type === 'team' ? team : undefined;
|
|
913
913
|
}
|
|
914
914
|
});
|
|
915
|
+
export var useHydratedProject = createHook(Store, {
|
|
916
|
+
selector: function selector(state, _ref41) {
|
|
917
|
+
var _state$hydratedValues4;
|
|
918
|
+
var id = _ref41.id,
|
|
919
|
+
fieldName = _ref41.fieldName;
|
|
920
|
+
var project = (_state$hydratedValues4 = state.hydratedValues[fieldName]) === null || _state$hydratedValues4 === void 0 ? void 0 : _state$hydratedValues4.get(id);
|
|
921
|
+
return project && project.type === 'project' ? project : undefined;
|
|
922
|
+
}
|
|
923
|
+
});
|
|
915
924
|
export var useHydratedDeprecations = createHook(Store, {
|
|
916
925
|
selector: function selector(state) {
|
|
917
926
|
var ast = getJastFromState(state.editorState);
|
|
918
927
|
var fieldsInQuery = getFieldNodes(ast);
|
|
919
928
|
var toReturn = [];
|
|
920
|
-
Object.entries(state.hydratedValues).forEach(function (
|
|
921
|
-
var _state$
|
|
922
|
-
var
|
|
923
|
-
fieldName =
|
|
924
|
-
(_state$
|
|
929
|
+
Object.entries(state.hydratedValues).forEach(function (_ref42) {
|
|
930
|
+
var _state$hydratedValues5;
|
|
931
|
+
var _ref43 = _slicedToArray(_ref42, 1),
|
|
932
|
+
fieldName = _ref43[0];
|
|
933
|
+
(_state$hydratedValues5 = state.hydratedValues[fieldName]) === null || _state$hydratedValues5 === void 0 || _state$hydratedValues5.forEach(function (value) {
|
|
925
934
|
if (value.type === 'deprecated-field') {
|
|
926
935
|
if (fieldsInQuery.has(value.id.toLowerCase())) {
|
|
927
936
|
toReturn.push(value);
|
|
@@ -944,19 +953,19 @@ export var useOnSyntaxHelp = createHook(Store, {
|
|
|
944
953
|
});
|
|
945
954
|
export var EditorStateContainer = createContainer(Store, {
|
|
946
955
|
onInit: function onInit() {
|
|
947
|
-
return function (
|
|
948
|
-
var getState =
|
|
949
|
-
setState =
|
|
950
|
-
dispatch =
|
|
951
|
-
var intlRef =
|
|
952
|
-
query =
|
|
953
|
-
isSearching =
|
|
954
|
-
autocompleteProvider =
|
|
955
|
-
externalMessages =
|
|
956
|
-
enableRichInlineNodes =
|
|
957
|
-
onDebugUnsafeMessage =
|
|
958
|
-
onSyntaxHelp =
|
|
959
|
-
customComponents =
|
|
956
|
+
return function (_ref44, _ref45) {
|
|
957
|
+
var getState = _ref44.getState,
|
|
958
|
+
setState = _ref44.setState,
|
|
959
|
+
dispatch = _ref44.dispatch;
|
|
960
|
+
var intlRef = _ref45.intlRef,
|
|
961
|
+
query = _ref45.query,
|
|
962
|
+
isSearching = _ref45.isSearching,
|
|
963
|
+
autocompleteProvider = _ref45.autocompleteProvider,
|
|
964
|
+
externalMessages = _ref45.externalMessages,
|
|
965
|
+
enableRichInlineNodes = _ref45.enableRichInlineNodes,
|
|
966
|
+
onDebugUnsafeMessage = _ref45.onDebugUnsafeMessage,
|
|
967
|
+
onSyntaxHelp = _ref45.onSyntaxHelp,
|
|
968
|
+
customComponents = _ref45.customComponents;
|
|
960
969
|
setState({
|
|
961
970
|
controlledQuery: query,
|
|
962
971
|
query: query,
|
|
@@ -985,18 +994,18 @@ export var EditorStateContainer = createContainer(Store, {
|
|
|
985
994
|
};
|
|
986
995
|
},
|
|
987
996
|
onUpdate: function onUpdate() {
|
|
988
|
-
return function (
|
|
989
|
-
var getState =
|
|
990
|
-
setState =
|
|
991
|
-
dispatch =
|
|
992
|
-
var controlledQueryProp =
|
|
993
|
-
isSearching =
|
|
994
|
-
autocompleteProvider =
|
|
995
|
-
externalMessages =
|
|
996
|
-
enableRichInlineNodes =
|
|
997
|
-
onDebugUnsafeMessage =
|
|
998
|
-
onSyntaxHelp =
|
|
999
|
-
customComponents =
|
|
997
|
+
return function (_ref46, _ref47) {
|
|
998
|
+
var getState = _ref46.getState,
|
|
999
|
+
setState = _ref46.setState,
|
|
1000
|
+
dispatch = _ref46.dispatch;
|
|
1001
|
+
var controlledQueryProp = _ref47.query,
|
|
1002
|
+
isSearching = _ref47.isSearching,
|
|
1003
|
+
autocompleteProvider = _ref47.autocompleteProvider,
|
|
1004
|
+
externalMessages = _ref47.externalMessages,
|
|
1005
|
+
enableRichInlineNodes = _ref47.enableRichInlineNodes,
|
|
1006
|
+
onDebugUnsafeMessage = _ref47.onDebugUnsafeMessage,
|
|
1007
|
+
onSyntaxHelp = _ref47.onSyntaxHelp,
|
|
1008
|
+
customComponents = _ref47.customComponents;
|
|
1000
1009
|
var _getState12 = getState(),
|
|
1001
1010
|
controlledQuery = _getState12.controlledQuery,
|
|
1002
1011
|
query = _getState12.query;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { default as JQLEditor } from './ui';
|
|
|
2
2
|
export { JQLEditorAsync, preloadJQLEditor } from './async';
|
|
3
3
|
export { JQLEditorReadOnly } from './ui/jql-editor-layout';
|
|
4
4
|
export { JQLEditorAnalyticsListener, ANALYTICS_CHANNEL, useJqlPackageAnalytics, EventType, } from './analytics';
|
|
5
|
-
export type { ListenerProps, JqlAnalyticsEvent, JQLEditorUIProps, JQLEditorProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, AutocompleteOption, AutocompleteValueType, AutocompleteOptions, AutocompleteProvider, JQLClause, ExternalMessage, ExternalError, ExternalWarning, ExternalInfo, CustomComponents, } from './types';
|
|
5
|
+
export type { ListenerProps, JqlAnalyticsEvent, JQLEditorUIProps, JQLEditorProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, HydratedProject, AutocompleteOption, AutocompleteValueType, AutocompleteOptions, AutocompleteProvider, JQLClause, ExternalMessage, ExternalError, ExternalWarning, ExternalInfo, CustomComponents, } from './types';
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ProjectNode Component
|
|
6
|
-
*
|
|
7
|
-
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
8
|
-
* in the JQL editor
|
|
9
|
-
*/
|
|
10
|
-
export declare const ProjectNode: (props: NodeViewProps<ProjectNodeProps>) => React.JSX.Element;
|
|
1
|
+
import type { JQLNodeSpec } from '../types';
|
|
2
|
+
import type { Props } from './types';
|
|
3
|
+
export declare const project: JQLNodeSpec<Props>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { NodeViewProps } from '../../util/react-node-view';
|
|
3
|
+
import type { Props } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* ProjectNode Component
|
|
6
|
+
*
|
|
7
|
+
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
8
|
+
* in the JQL editor
|
|
9
|
+
*/
|
|
10
|
+
export declare const ProjectNode: (props: NodeViewProps<Props>) => React.JSX.Element;
|
|
@@ -10,7 +10,7 @@ import { type JqlEditorAnalyticsEvent } from '../analytics';
|
|
|
10
10
|
import { type AutocompleteOptionGroup, type AutocompleteOptions, type AutocompleteOptionType, type SelectableAutocompleteOption } from '../plugins/autocomplete/components/types';
|
|
11
11
|
import { type AutocompleteProvider } from '../plugins/types';
|
|
12
12
|
import { type PortalActions } from '../ui/jql-editor-portal-provider/types';
|
|
13
|
-
import { type HydratedDeprecatedField, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
|
|
13
|
+
import { type HydratedDeprecatedField, type HydratedProject, type HydratedTeam, type HydratedUser, type HydratedValue } from '../ui/jql-editor/types';
|
|
14
14
|
import { type AutocompletePosition, type AutocompleteState, type ContextAwareJQLSuggestions, type CustomErrorComponent, type ExternalMessagesNormalized, type OptionsKey, type Props, type State } from './types';
|
|
15
15
|
export declare const initialState: State;
|
|
16
16
|
export declare const actions: {
|
|
@@ -764,6 +764,41 @@ export declare const useHydratedTeam: import("react-sweet-state").HookFunction<H
|
|
|
764
764
|
fieldName: string;
|
|
765
765
|
id: string;
|
|
766
766
|
}>;
|
|
767
|
+
export declare const useHydratedProject: import("react-sweet-state").HookFunction<HydratedProject | undefined, import("react-sweet-state").BoundActions<State, {
|
|
768
|
+
onEditorViewBlur: () => Action<State>;
|
|
769
|
+
onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
|
|
770
|
+
openAutocompleteOnNextUpdate: () => Action<State>;
|
|
771
|
+
closeAutocomplete: () => Action<State>;
|
|
772
|
+
setSelectedAutocompleteOptionId: (selectedOptionId: string | undefined) => Action<State>;
|
|
773
|
+
getAutocompleteSuggestions: (editorState: EditorState) => Action<State>;
|
|
774
|
+
getAutocompleteOptions: (suggestions: ContextAwareJQLSuggestions) => Action<State>;
|
|
775
|
+
appendOptionsForObservable: (key: OptionsKey, observable: Observable<AutocompleteOptions>, rule: JQLRuleSuggestion, type: AutocompleteOptionType) => Action<State, void, Observable<AutocompleteOptions>>;
|
|
776
|
+
cancelSubscription: () => Action<State>;
|
|
777
|
+
setLoading: (loading: boolean) => Action<State>;
|
|
778
|
+
setAutocompleteOptions: (options: AutocompleteOptionGroup) => Action<State>;
|
|
779
|
+
setAutocompleteContainer: (container: HTMLElement | null) => Action<State>;
|
|
780
|
+
callAutocompleteProviders: ({ rules, tokens }: ContextAwareJQLSuggestions) => Action<State>;
|
|
781
|
+
updateValidationState: () => Action<State>;
|
|
782
|
+
initialiseEditorState: () => Action<State, Props>;
|
|
783
|
+
configurePlugins: (portalActions: PortalActions | void) => Action<State, Props>;
|
|
784
|
+
onApplyEditorTransaction: (transaction: Transaction) => Action<State, Props>;
|
|
785
|
+
resetEditorState: (query: string, addToHistory?: boolean) => Action<State>;
|
|
786
|
+
initialiseEditorView: (editorViewNode: HTMLElement, attributes: {
|
|
787
|
+
[key: string]: string;
|
|
788
|
+
}, portalActions: PortalActions) => Action<State, Props>;
|
|
789
|
+
updateEditorView: (attributes: {
|
|
790
|
+
[key: string]: string;
|
|
791
|
+
}) => Action<State, Props>;
|
|
792
|
+
setEditorViewContainer: (editorViewContainer: HTMLElement) => Action<State>;
|
|
793
|
+
setEditorViewContainerScroll: (scroll: number) => Action<State>;
|
|
794
|
+
onSearch: () => Action<State>;
|
|
795
|
+
onSearchCommand: (pmState: EditorState, pmDispatch: ((tr: Transaction) => void) | undefined, pmView: EditorView | undefined, keyboardShortcut: boolean) => Action<State, Props, boolean>;
|
|
796
|
+
externalErrorMessageViewed: () => Action<State, Props>;
|
|
797
|
+
createAndFireAnalyticsEvent: (payload: JqlEditorAnalyticsEvent) => Action<State, Props>;
|
|
798
|
+
}>, {
|
|
799
|
+
fieldName: string;
|
|
800
|
+
id: string;
|
|
801
|
+
}>;
|
|
767
802
|
export declare const useHydratedDeprecations: import("react-sweet-state").HookFunction<HydratedDeprecatedField[], import("react-sweet-state").BoundActions<State, {
|
|
768
803
|
onEditorViewBlur: () => Action<State>;
|
|
769
804
|
onEditorViewFocus: (event: FocusEvent<HTMLElement>) => Action<State, Props>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { JQLClause } from '@atlaskit/jql-autocomplete';
|
|
2
|
-
export type { JQLEditorUIProps, JQLEditorProps, HydratedValues, HydratedValue, HydratedUser, HydratedTeam, } from './ui/types';
|
|
2
|
+
export type { JQLEditorUIProps, JQLEditorProps, HydratedValues, HydratedValue, HydratedUser, HydratedTeam, HydratedProject, } from './ui/types';
|
|
3
3
|
export type { ExternalMessage, ExternalError, ExternalWarning, ExternalInfo, CustomComponents, } from './state/types';
|
|
4
4
|
export type { AutocompleteProvider, AutocompleteOptions, AutocompleteOption, AutocompleteValueType, } from './plugins/types';
|
|
5
5
|
export type { ListenerProps, JqlAnalyticsEvent } from './analytics';
|
|
@@ -3,11 +3,11 @@ import { type Jast } from '@atlaskit/jql-ast';
|
|
|
3
3
|
import { type AutocompleteProvider } from '../../plugins/autocomplete/types';
|
|
4
4
|
import { type CustomComponents, type ExternalMessage } from '../../state/types';
|
|
5
5
|
export type HydratedUser = {
|
|
6
|
+
appType?: string | null;
|
|
6
7
|
avatarUrl: string;
|
|
7
8
|
id: string;
|
|
8
9
|
name: string;
|
|
9
10
|
type: 'user';
|
|
10
|
-
appType?: string | null;
|
|
11
11
|
};
|
|
12
12
|
export type HydratedTeam = {
|
|
13
13
|
avatarUrl: string;
|
|
@@ -15,6 +15,13 @@ export type HydratedTeam = {
|
|
|
15
15
|
name: string;
|
|
16
16
|
type: 'team';
|
|
17
17
|
};
|
|
18
|
+
export type HydratedProject = {
|
|
19
|
+
iconName?: string;
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
privateProject?: boolean;
|
|
23
|
+
type: 'project';
|
|
24
|
+
};
|
|
18
25
|
export type HydratedDeprecatedField = {
|
|
19
26
|
deprecatedSearcherKey: string;
|
|
20
27
|
/**
|
|
@@ -23,7 +30,7 @@ export type HydratedDeprecatedField = {
|
|
|
23
30
|
id: string;
|
|
24
31
|
type: 'deprecated-field';
|
|
25
32
|
};
|
|
26
|
-
export type HydratedValue = HydratedUser | HydratedTeam | HydratedDeprecatedField;
|
|
33
|
+
export type HydratedValue = HydratedUser | HydratedTeam | HydratedProject | HydratedDeprecatedField;
|
|
27
34
|
export type HydratedValues = {
|
|
28
35
|
[fieldName: string]: HydratedValue[];
|
|
29
36
|
};
|
package/dist/types/ui/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JQLEditorUIProps } from './jql-editor/types';
|
|
2
|
-
export type { JQLEditorUIProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, } from './jql-editor/types';
|
|
2
|
+
export type { JQLEditorUIProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, HydratedProject, } from './jql-editor/types';
|
|
3
3
|
export type JQLEditorProps = JQLEditorUIProps & {
|
|
4
4
|
/**
|
|
5
5
|
* React-intl locale. This should be set to "en" if alternate message sets are not being loaded higher in the React
|
|
@@ -2,4 +2,4 @@ export { default as JQLEditor } from './ui';
|
|
|
2
2
|
export { JQLEditorAsync, preloadJQLEditor } from './async';
|
|
3
3
|
export { JQLEditorReadOnly } from './ui/jql-editor-layout';
|
|
4
4
|
export { JQLEditorAnalyticsListener, ANALYTICS_CHANNEL, useJqlPackageAnalytics, EventType, } from './analytics';
|
|
5
|
-
export type { ListenerProps, JqlAnalyticsEvent, JQLEditorUIProps, JQLEditorProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, AutocompleteOption, AutocompleteValueType, AutocompleteOptions, AutocompleteProvider, JQLClause, ExternalMessage, ExternalError, ExternalWarning, ExternalInfo, CustomComponents, } from './types';
|
|
5
|
+
export type { ListenerProps, JqlAnalyticsEvent, JQLEditorUIProps, JQLEditorProps, HydratedValue, HydratedValues, HydratedUser, HydratedTeam, HydratedProject, AutocompleteOption, AutocompleteValueType, AutocompleteOptions, AutocompleteProvider, JQLClause, ExternalMessage, ExternalError, ExternalWarning, ExternalInfo, CustomComponents, } from './types';
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ProjectNode Component
|
|
6
|
-
*
|
|
7
|
-
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
8
|
-
* in the JQL editor
|
|
9
|
-
*/
|
|
10
|
-
export declare const ProjectNode: (props: NodeViewProps<ProjectNodeProps>) => React.JSX.Element;
|
|
1
|
+
import type { JQLNodeSpec } from '../types';
|
|
2
|
+
import type { Props } from './types';
|
|
3
|
+
export declare const project: JQLNodeSpec<Props>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { NodeViewProps } from '../../util/react-node-view';
|
|
3
|
+
import type { Props } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* ProjectNode Component
|
|
6
|
+
*
|
|
7
|
+
* This component is a component for rendering a pill-like view for Project (Atlas) node type
|
|
8
|
+
* in the JQL editor
|
|
9
|
+
*/
|
|
10
|
+
export declare const ProjectNode: (props: NodeViewProps<Props>) => React.JSX.Element;
|