@pega/cosmos-react-build 3.0.0-dev.3.0 → 3.0.0-dev.30.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/lib/components/AppHeader/AppHeader.d.ts +4 -2
- package/lib/components/AppHeader/AppHeader.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.js +12 -10
- package/lib/components/AppHeader/AppHeader.js.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.d.ts +1 -3
- package/lib/components/AppHeader/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppHeader/AppHeader.styles.js +5 -22
- package/lib/components/AppHeader/AppHeader.styles.js.map +1 -1
- package/lib/components/AppHeader/BranchButton.d.ts.map +1 -1
- package/lib/components/AppHeader/BranchButton.js +22 -18
- package/lib/components/AppHeader/BranchButton.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +21 -20
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +17 -2
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +6 -9
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +3 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js +173 -42
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts +6 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.types.js.map +1 -1
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts +307 -3
- package/lib/components/DynamicContentEditor/PegaCustomElement.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/PegaCustomElement.js +21 -21
- package/lib/components/DynamicContentEditor/PegaCustomElement.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +8 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +124 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +8 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +517 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +35 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js +2 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts +13 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +46 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js +51 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +14 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +81 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +74 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js +2 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts +7 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js +6 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilderContext.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.js +12 -0
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.js +43 -0
- package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +6 -0
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionList.js +32 -0
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -0
- package/lib/components/ExpressionBuilder/index.d.ts +8 -0
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/index.js +6 -0
- package/lib/components/ExpressionBuilder/index.js.map +1 -0
- package/lib/components/FlowModeller/AddNode.d.ts +11 -9
- package/lib/components/FlowModeller/AddNode.d.ts.map +1 -1
- package/lib/components/FlowModeller/AddNode.js +9 -3
- package/lib/components/FlowModeller/AddNode.js.map +1 -1
- package/lib/components/FlowModeller/Connector.d.ts +7 -0
- package/lib/components/FlowModeller/Connector.d.ts.map +1 -0
- package/lib/components/FlowModeller/Connector.js +71 -0
- package/lib/components/FlowModeller/Connector.js.map +1 -0
- package/lib/components/FlowModeller/DeletePopover.d.ts +19 -0
- package/lib/components/FlowModeller/DeletePopover.d.ts.map +1 -0
- package/lib/components/FlowModeller/DeletePopover.js +136 -0
- package/lib/components/FlowModeller/DeletePopover.js.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.d.ts +3 -19
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.js +187 -63
- package/lib/components/FlowModeller/FlowModeller.js.map +1 -1
- package/lib/components/FlowModeller/FlowModeller.types.d.ts +25 -0
- package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModeller.types.js +2 -0
- package/lib/components/FlowModeller/FlowModeller.types.js.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts +6 -0
- package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +1 -0
- package/lib/components/FlowModeller/FlowModellerContext.js +7 -0
- package/lib/components/FlowModeller/FlowModellerContext.js.map +1 -0
- package/lib/components/FlowModeller/Node/Node.types.d.ts +22 -9
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/Node.types.js +2 -3
- package/lib/components/FlowModeller/Node/Node.types.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +6 -4
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +21 -11
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +43 -19
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
- package/lib/components/FlowModeller/Node.d.ts +5 -0
- package/lib/components/FlowModeller/Node.d.ts.map +1 -0
- package/lib/components/FlowModeller/Node.js +22 -0
- package/lib/components/FlowModeller/Node.js.map +1 -0
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +37 -6
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +9 -9
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +8 -3
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +7 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +2 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +19 -6
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +9 -6
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +1 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +23 -3
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +1 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +17 -0
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/{AddNodeUtils.js → addNodeUtils.js} +58 -35
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +30 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +1 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +81 -0
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +1 -0
- package/lib/components/FlowModeller/helper.d.ts +18 -8
- package/lib/components/FlowModeller/helper.d.ts.map +1 -1
- package/lib/components/FlowModeller/helper.js +114 -55
- package/lib/components/FlowModeller/helper.js.map +1 -1
- package/lib/components/FlowModeller/index.d.ts +8 -3
- package/lib/components/FlowModeller/index.d.ts.map +1 -1
- package/lib/components/FlowModeller/index.js +5 -1
- package/lib/components/FlowModeller/index.js.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts +8 -6
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +6 -8
- package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/Category.js +17 -13
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.js +2 -3
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +2 -4
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.d.ts +1 -1
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js +3 -2
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts +1 -1
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +8 -17
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +5 -8
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +10 -32
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +5 -3
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +17 -10
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/LifeCycle/index.d.ts +1 -2
- package/lib/components/LifeCycle/index.d.ts.map +1 -1
- package/lib/components/LifeCycle/index.js.map +1 -1
- package/lib/components/ObjectPreview/ObjectPreview.d.ts +16 -0
- package/lib/components/ObjectPreview/ObjectPreview.d.ts.map +1 -0
- package/lib/components/ObjectPreview/ObjectPreview.js +25 -0
- package/lib/components/ObjectPreview/ObjectPreview.js.map +1 -0
- package/lib/components/ObjectPreview/index.d.ts +3 -0
- package/lib/components/ObjectPreview/index.d.ts.map +1 -0
- package/lib/components/ObjectPreview/index.js +3 -0
- package/lib/components/ObjectPreview/index.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts +15 -0
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectPicker.js +40 -0
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts +32 -0
- package/lib/components/ObjectSelect/ObjectSelect.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSelect.js +41 -0
- package/lib/components/ObjectSelect/ObjectSelect.js.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts +24 -0
- package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -0
- package/lib/components/ObjectSelect/ObjectSummary.js +45 -0
- package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -0
- package/lib/components/ObjectSelect/index.d.ts +3 -0
- package/lib/components/ObjectSelect/index.d.ts.map +1 -0
- package/lib/components/ObjectSelect/index.js +2 -0
- package/lib/components/ObjectSelect/index.js.map +1 -0
- package/lib/components/ObjectSelect/useCreateModal.d.ts +34 -0
- package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -0
- package/lib/components/ObjectSelect/useCreateModal.js +61 -0
- package/lib/components/ObjectSelect/useCreateModal.js.map +1 -0
- package/lib/components/PageTemplates/GalleryPage.js +4 -4
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +3 -3
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +45 -37
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.d.ts +2 -3
- package/lib/components/SummaryCard/SummaryCard.d.ts.map +1 -1
- package/lib/components/SummaryCard/SummaryCard.js +3 -4
- package/lib/components/SummaryCard/SummaryCard.js.map +1 -1
- package/lib/components/Workbench/ConfigurationPanel.d.ts.map +1 -1
- package/lib/components/Workbench/ConfigurationPanel.js +4 -15
- package/lib/components/Workbench/ConfigurationPanel.js.map +1 -1
- package/lib/components/Workbench/Toolbar.d.ts +1 -5
- package/lib/components/Workbench/Toolbar.d.ts.map +1 -1
- package/lib/components/Workbench/Toolbar.js +8 -8
- package/lib/components/Workbench/Toolbar.js.map +1 -1
- package/lib/components/Workbench/UtilityPanel.js +1 -1
- package/lib/components/Workbench/UtilityPanel.js.map +1 -1
- package/lib/components/Workbench/Workbench.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.js +3 -4
- package/lib/components/Workbench/Workbench.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.styles.js +15 -16
- package/lib/components/Workbench/Workbench.styles.js.map +1 -1
- package/lib/components/Workbench/Workbench.types.d.ts +2 -4
- package/lib/components/Workbench/Workbench.types.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.types.js.map +1 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -1
- package/lib/index.js.map +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/utils.d.ts +14 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/utils/utils.js +13 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +23 -14
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts +0 -13
- package/lib/components/FlowModeller/Renderer/Connectors.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Connectors.js +0 -47
- package/lib/components/FlowModeller/Renderer/Connectors.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts +0 -9
- package/lib/components/FlowModeller/Renderer/Nodes.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Nodes.js +0 -25
- package/lib/components/FlowModeller/Renderer/Nodes.js.map +0 -1
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts +0 -16
- package/lib/components/FlowModeller/Utils/AddNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/AddNodeUtils.js.map +0 -1
- package/lib/components/Visual/Visual.d.ts +0 -17
- package/lib/components/Visual/Visual.d.ts.map +0 -1
- package/lib/components/Visual/Visual.js +0 -28
- package/lib/components/Visual/Visual.js.map +0 -1
- package/lib/components/Visual/index.d.ts +0 -3
- package/lib/components/Visual/index.d.ts.map +0 -1
- package/lib/components/Visual/index.js +0 -3
- package/lib/components/Visual/index.js.map +0 -1
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
// cSpell:words vscrollbar hscrollbar
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { mix } from 'polished';
|
|
4
|
+
import { defaultThemeProp, calculateFontSize, Flex } from '@pega/cosmos-react-core';
|
|
5
|
+
import { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';
|
|
6
|
+
export const StyledLoading = styled.div `
|
|
7
|
+
font-size: 1.5rem;
|
|
8
|
+
`;
|
|
9
|
+
export const StyledCodeEditor = styled(Flex)(({ theme: { base, components: { 'form-control': { ':read-only': { 'background-color': readOnlyBackgroundColor } }, 'form-field': { error: { 'status-color': errorBackground } } } }, errors, isLoading, readOnly }) => {
|
|
10
|
+
const activeColor = mix(0.85, base.palette['primary-background'], base.palette.interactive);
|
|
11
|
+
const hoverColor = mix(0.95, base.palette['primary-background'], base.palette.interactive);
|
|
12
|
+
const fontSizes = calculateFontSize(base['font-size'], base['font-scale']);
|
|
13
|
+
return css `
|
|
14
|
+
position: relative;
|
|
15
|
+
max-height: 100%;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
${StyledFormField} {
|
|
18
|
+
flex-grow: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* PADDING */
|
|
22
|
+
.react-codemirror2 {
|
|
23
|
+
flex-grow: 1;
|
|
24
|
+
min-height: 3.75rem;
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
${readOnly &&
|
|
27
|
+
css `
|
|
28
|
+
max-height: 5.625rem;
|
|
29
|
+
`}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.CodeMirror-lines {
|
|
33
|
+
cursor: text;
|
|
34
|
+
min-height: 0.063rem; /* prevents collapsing before first draw */
|
|
35
|
+
padding: ${base.spacing};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.CodeMirror-scrollbar-filler,
|
|
39
|
+
.CodeMirror-gutter-filler {
|
|
40
|
+
background-color: white; /* The little square between H and V scrollbars */
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* GUTTER */
|
|
44
|
+
|
|
45
|
+
.CodeMirror-gutters {
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 0;
|
|
49
|
+
min-height: 100%;
|
|
50
|
+
z-index: 3;
|
|
51
|
+
border-right: 0.063rem solid #dddddd;
|
|
52
|
+
background-color: #f7f7f7;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
.CodeMirror-linenumber {
|
|
56
|
+
padding: 0 0.125rem 0 0.313rem;
|
|
57
|
+
min-width: 1.25rem;
|
|
58
|
+
text-align: right;
|
|
59
|
+
color: #999999;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.CodeMirror-guttermarker {
|
|
64
|
+
color: black;
|
|
65
|
+
}
|
|
66
|
+
.CodeMirror-guttermarker-subtle {
|
|
67
|
+
color: #999999;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* CURSOR */
|
|
71
|
+
|
|
72
|
+
.CodeMirror-cursor {
|
|
73
|
+
position: absolute;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
border-left: 0.0625rem solid ${base.palette.dark};
|
|
76
|
+
border-right: none;
|
|
77
|
+
width: 0;
|
|
78
|
+
${readOnly &&
|
|
79
|
+
css `
|
|
80
|
+
display: none;
|
|
81
|
+
`}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Shown when moving in bi-directional text */
|
|
85
|
+
.CodeMirror div.CodeMirror-secondarycursor {
|
|
86
|
+
border-left: 0.063rem solid silver;
|
|
87
|
+
}
|
|
88
|
+
.cm-fat-cursor-mark {
|
|
89
|
+
background-color: rgba(20, 255, 20, 0.5);
|
|
90
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
91
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
92
|
+
animation: blink 1.06s steps(1) infinite;
|
|
93
|
+
}
|
|
94
|
+
.cm-animate-fat-cursor {
|
|
95
|
+
width: auto;
|
|
96
|
+
border: 0;
|
|
97
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
98
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
99
|
+
animation: blink 1.06s steps(1) infinite;
|
|
100
|
+
background-color: #77ee77;
|
|
101
|
+
}
|
|
102
|
+
@-moz-keyframes blink {
|
|
103
|
+
50% {
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
@-webkit-keyframes blink {
|
|
108
|
+
50% {
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
@keyframes blink {
|
|
113
|
+
50% {
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.cm-tab {
|
|
119
|
+
display: inline-block;
|
|
120
|
+
text-decoration: inherit;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.CodeMirror-rulers {
|
|
124
|
+
position: absolute;
|
|
125
|
+
left: 0;
|
|
126
|
+
right: 0;
|
|
127
|
+
top: -3.125rem;
|
|
128
|
+
bottom: 0;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
}
|
|
131
|
+
.CodeMirror-ruler {
|
|
132
|
+
border-left: 0.063rem solid #cccccc;
|
|
133
|
+
top: 0;
|
|
134
|
+
bottom: 0;
|
|
135
|
+
position: absolute;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* DEFAULT THEME */
|
|
139
|
+
|
|
140
|
+
.cm-s-default .cm-header {
|
|
141
|
+
color: blue;
|
|
142
|
+
}
|
|
143
|
+
.cm-negative {
|
|
144
|
+
color: #dd4444;
|
|
145
|
+
}
|
|
146
|
+
.cm-positive {
|
|
147
|
+
color: #229922;
|
|
148
|
+
}
|
|
149
|
+
.cm-strong {
|
|
150
|
+
font-weight: bold;
|
|
151
|
+
}
|
|
152
|
+
.cm-s-default .cm-quote {
|
|
153
|
+
color: #009900;
|
|
154
|
+
}
|
|
155
|
+
.cm-em {
|
|
156
|
+
font-style: italic;
|
|
157
|
+
}
|
|
158
|
+
.cm-link {
|
|
159
|
+
text-decoration: underline;
|
|
160
|
+
}
|
|
161
|
+
.cm-strikethrough {
|
|
162
|
+
text-decoration: line-through;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.cm-s-default .cm-keyword {
|
|
166
|
+
color: #770088;
|
|
167
|
+
}
|
|
168
|
+
.cm-s-default .cm-atom {
|
|
169
|
+
color: #221199;
|
|
170
|
+
}
|
|
171
|
+
.cm-s-default .cm-number {
|
|
172
|
+
color: #116644;
|
|
173
|
+
}
|
|
174
|
+
.cm-s-default .cm-def {
|
|
175
|
+
color: #0000ff;
|
|
176
|
+
}
|
|
177
|
+
.cm-s-default .cm-variable-2 {
|
|
178
|
+
color: #0055aa;
|
|
179
|
+
}
|
|
180
|
+
.cm-s-default .cm-variable-3,
|
|
181
|
+
.cm-s-default .cm-type {
|
|
182
|
+
color: #008855;
|
|
183
|
+
}
|
|
184
|
+
.cm-s-default .cm-comment {
|
|
185
|
+
color: #aa5500;
|
|
186
|
+
}
|
|
187
|
+
.cm-s-default .cm-string {
|
|
188
|
+
color: #aa1111;
|
|
189
|
+
}
|
|
190
|
+
.cm-s-default .cm-string-2 {
|
|
191
|
+
color: #ff5500;
|
|
192
|
+
}
|
|
193
|
+
.cm-s-default .cm-meta {
|
|
194
|
+
color: #555555;
|
|
195
|
+
}
|
|
196
|
+
.cm-s-default .cm-qualifier {
|
|
197
|
+
color: #555555;
|
|
198
|
+
}
|
|
199
|
+
.cm-s-default .cm-builtin {
|
|
200
|
+
color: #3300aa;
|
|
201
|
+
}
|
|
202
|
+
.cm-s-default .cm-bracket {
|
|
203
|
+
color: #999977;
|
|
204
|
+
}
|
|
205
|
+
.cm-s-default .cm-tag {
|
|
206
|
+
color: #117700;
|
|
207
|
+
}
|
|
208
|
+
.cm-s-default .cm-attribute {
|
|
209
|
+
color: #0000cc;
|
|
210
|
+
}
|
|
211
|
+
.cm-s-default .cm-hr {
|
|
212
|
+
color: #999999;
|
|
213
|
+
}
|
|
214
|
+
.cm-s-default .cm-link {
|
|
215
|
+
color: #0000cc;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.cm-s-default .cm-error {
|
|
219
|
+
color: #ff0000;
|
|
220
|
+
}
|
|
221
|
+
.cm-invalidchar {
|
|
222
|
+
color: #ff0000;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.CodeMirror-composing {
|
|
226
|
+
border-bottom: 0.125rem solid;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Default styles for common addons */
|
|
230
|
+
|
|
231
|
+
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
232
|
+
color: #00bb00;
|
|
233
|
+
}
|
|
234
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
235
|
+
color: #aa2222;
|
|
236
|
+
}
|
|
237
|
+
.CodeMirror-matchingtag {
|
|
238
|
+
background: rgba(255, 150, 0, 0.3);
|
|
239
|
+
}
|
|
240
|
+
.CodeMirror-activeline-background {
|
|
241
|
+
background: #e8f2ff;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* STOP */
|
|
245
|
+
|
|
246
|
+
/* The rest of this file contains styles related to the mechanics of
|
|
247
|
+
the editor. You probably shouldn't touch them. */
|
|
248
|
+
|
|
249
|
+
.CodeMirror-scroll {
|
|
250
|
+
overflow: scroll !important;
|
|
251
|
+
margin-bottom: -3.125rem;
|
|
252
|
+
margin-right: -3.125rem;
|
|
253
|
+
padding-bottom: 3.125rem;
|
|
254
|
+
height: 100%;
|
|
255
|
+
outline: none; /* Prevent dragging from highlighting the element */
|
|
256
|
+
position: relative;
|
|
257
|
+
}
|
|
258
|
+
.CodeMirror-sizer {
|
|
259
|
+
position: relative;
|
|
260
|
+
border-right: 3.125rem solid transparent;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
264
|
+
before actual scrolling happens, thus preventing shaking and
|
|
265
|
+
flickering artifacts. */
|
|
266
|
+
.CodeMirror-vscrollbar,
|
|
267
|
+
.CodeMirror-hscrollbar,
|
|
268
|
+
.CodeMirror-scrollbar-filler,
|
|
269
|
+
.CodeMirror-gutter-filler {
|
|
270
|
+
position: absolute;
|
|
271
|
+
z-index: 6;
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
.CodeMirror-vscrollbar {
|
|
275
|
+
right: 0;
|
|
276
|
+
top: 0;
|
|
277
|
+
overflow-x: hidden;
|
|
278
|
+
overflow-y: scroll;
|
|
279
|
+
}
|
|
280
|
+
.CodeMirror-hscrollbar {
|
|
281
|
+
bottom: 0;
|
|
282
|
+
left: 0;
|
|
283
|
+
overflow-y: hidden;
|
|
284
|
+
overflow-x: scroll;
|
|
285
|
+
}
|
|
286
|
+
.CodeMirror-scrollbar-filler {
|
|
287
|
+
right: 0;
|
|
288
|
+
bottom: 0;
|
|
289
|
+
}
|
|
290
|
+
.CodeMirror-gutter-filler {
|
|
291
|
+
left: 0;
|
|
292
|
+
bottom: 0;
|
|
293
|
+
}
|
|
294
|
+
.CodeMirror-gutter {
|
|
295
|
+
white-space: normal;
|
|
296
|
+
height: 100%;
|
|
297
|
+
display: inline-block;
|
|
298
|
+
vertical-align: top;
|
|
299
|
+
margin-bottom: -3.125rem;
|
|
300
|
+
}
|
|
301
|
+
.CodeMirror-gutter-wrapper {
|
|
302
|
+
position: absolute;
|
|
303
|
+
z-index: 4;
|
|
304
|
+
background: none !important;
|
|
305
|
+
border: none !important;
|
|
306
|
+
}
|
|
307
|
+
.CodeMirror-gutter-background {
|
|
308
|
+
position: absolute;
|
|
309
|
+
top: 0;
|
|
310
|
+
bottom: 0;
|
|
311
|
+
z-index: 4;
|
|
312
|
+
}
|
|
313
|
+
.CodeMirror-gutter-elt {
|
|
314
|
+
position: absolute;
|
|
315
|
+
cursor: default;
|
|
316
|
+
z-index: 4;
|
|
317
|
+
}
|
|
318
|
+
.CodeMirror-gutter-wrapper ::selection {
|
|
319
|
+
background-color: transparent;
|
|
320
|
+
}
|
|
321
|
+
.CodeMirror-gutter-wrapper ::-moz-selection {
|
|
322
|
+
background-color: transparent;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.CodeMirror pre.CodeMirror-line,
|
|
326
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
327
|
+
/* Reset some styles that the rest of the page might have set */
|
|
328
|
+
-moz-border-radius: 0;
|
|
329
|
+
-webkit-border-radius: 0;
|
|
330
|
+
border-radius: 0;
|
|
331
|
+
border-width: 0;
|
|
332
|
+
background: transparent;
|
|
333
|
+
font-family: inherit;
|
|
334
|
+
font-size: inherit;
|
|
335
|
+
margin: 0;
|
|
336
|
+
white-space: pre;
|
|
337
|
+
word-wrap: normal;
|
|
338
|
+
line-height: inherit;
|
|
339
|
+
color: inherit;
|
|
340
|
+
z-index: 2;
|
|
341
|
+
position: relative;
|
|
342
|
+
overflow: visible;
|
|
343
|
+
-webkit-tap-highlight-color: transparent;
|
|
344
|
+
-webkit-font-variant-ligatures: contextual;
|
|
345
|
+
font-variant-ligatures: contextual;
|
|
346
|
+
}
|
|
347
|
+
.CodeMirror-wrap pre.CodeMirror-line,
|
|
348
|
+
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
349
|
+
word-wrap: break-word;
|
|
350
|
+
white-space: pre-wrap;
|
|
351
|
+
word-break: normal;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.CodeMirror-linebackground {
|
|
355
|
+
position: absolute;
|
|
356
|
+
left: 0;
|
|
357
|
+
right: 0;
|
|
358
|
+
top: 0;
|
|
359
|
+
bottom: 0;
|
|
360
|
+
z-index: 0;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.CodeMirror-linewidget {
|
|
364
|
+
position: relative;
|
|
365
|
+
z-index: 2;
|
|
366
|
+
padding: 0.006rem; /* Force widget margins to stay inside of the container */
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.CodeMirror-rtl pre {
|
|
370
|
+
direction: rtl;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.CodeMirror-code {
|
|
374
|
+
outline: none;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* Force content-box sizing for the elements where we expect it */
|
|
378
|
+
.CodeMirror-scroll,
|
|
379
|
+
.CodeMirror-sizer,
|
|
380
|
+
.CodeMirror-gutter,
|
|
381
|
+
.CodeMirror-linenumber {
|
|
382
|
+
-moz-box-sizing: content-box;
|
|
383
|
+
box-sizing: content-box;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.CodeMirror-measure {
|
|
387
|
+
position: absolute;
|
|
388
|
+
width: 100%;
|
|
389
|
+
height: 0;
|
|
390
|
+
overflow: hidden;
|
|
391
|
+
visibility: hidden;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.CodeMirror-measure pre {
|
|
395
|
+
position: static;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
div.CodeMirror-dragcursors {
|
|
399
|
+
visibility: visible;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.CodeMirror-selected {
|
|
403
|
+
background: #d9d9d9;
|
|
404
|
+
}
|
|
405
|
+
.CodeMirror-focused .CodeMirror-selected {
|
|
406
|
+
background: #d7d4f0;
|
|
407
|
+
}
|
|
408
|
+
.CodeMirror-focused {
|
|
409
|
+
border-color: ${base.palette.interactive} !important;
|
|
410
|
+
}
|
|
411
|
+
.CodeMirror:not(.CodeMirror-focused) .CodeMirror-cursors {
|
|
412
|
+
visibility: hidden;
|
|
413
|
+
}
|
|
414
|
+
.CodeMirror-crosshair {
|
|
415
|
+
cursor: crosshair;
|
|
416
|
+
}
|
|
417
|
+
.CodeMirror-line::selection,
|
|
418
|
+
.CodeMirror-line > span::selection,
|
|
419
|
+
.CodeMirror-line > span > span::selection {
|
|
420
|
+
background: #d7d4f0;
|
|
421
|
+
}
|
|
422
|
+
.CodeMirror-line::-moz-selection,
|
|
423
|
+
.CodeMirror-line > span::-moz-selection,
|
|
424
|
+
.CodeMirror-line > span > span::-moz-selection {
|
|
425
|
+
background: #d7d4f0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.cm-searching {
|
|
429
|
+
background-color: rgba(255, 255, 0, 0.4);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/* Used to force a border model for a node */
|
|
433
|
+
.cm-force-border {
|
|
434
|
+
padding-right: 0.006rem;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/* See issue #2901 */
|
|
438
|
+
.cm-tab-wrap-hack::after {
|
|
439
|
+
content: '';
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/* Help users use markselection to safely style text background */
|
|
443
|
+
span.CodeMirror-selectedtext {
|
|
444
|
+
background: none;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.CodeMirror {
|
|
448
|
+
overflow: hidden;
|
|
449
|
+
font-family: monospace;
|
|
450
|
+
direction: ltr;
|
|
451
|
+
position: relative;
|
|
452
|
+
background-color: ${base.palette['background-color']};
|
|
453
|
+
color: ${base.palette['foreground-color']};
|
|
454
|
+
border: 0.0625rem solid ${base.palette['border-line']};
|
|
455
|
+
border-radius: calc(0.5 * ${base['border-radius']});
|
|
456
|
+
${errors &&
|
|
457
|
+
css `
|
|
458
|
+
border-color: ${errorBackground};
|
|
459
|
+
`}
|
|
460
|
+
${readOnly &&
|
|
461
|
+
css `
|
|
462
|
+
background-color: ${readOnlyBackgroundColor};
|
|
463
|
+
`}
|
|
464
|
+
}
|
|
465
|
+
.cm-ex-properties {
|
|
466
|
+
color: ${base.palette.success};
|
|
467
|
+
}
|
|
468
|
+
.cm-ex-functions {
|
|
469
|
+
color: ${base.palette.warn};
|
|
470
|
+
}
|
|
471
|
+
.CodeMirror-hints {
|
|
472
|
+
position: absolute;
|
|
473
|
+
z-index: 10;
|
|
474
|
+
transition: height ${base.animation.speed} ${base.animation.timing.ease};
|
|
475
|
+
padding: 0;
|
|
476
|
+
border-radius: calc(0.5 * ${base['border-radius']});
|
|
477
|
+
box-shadow: ${base.shadow.low};
|
|
478
|
+
border: 0.0625rem solid ${base.palette['border-line']};
|
|
479
|
+
background-color: ${base.palette['primary-background']};
|
|
480
|
+
font-size: ${fontSizes.s};
|
|
481
|
+
font-family: monospace;
|
|
482
|
+
max-height: 10em;
|
|
483
|
+
overflow-y: auto;
|
|
484
|
+
min-width: 8rem;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.CodeMirror-hint {
|
|
488
|
+
${isLoading &&
|
|
489
|
+
css `
|
|
490
|
+
pointer-events: none;
|
|
491
|
+
`}
|
|
492
|
+
min-height: ${base['hit-area']['compact-min']};
|
|
493
|
+
cursor: pointer;
|
|
494
|
+
@media (pointer: coarse) {
|
|
495
|
+
min-height: ${base['hit-area']['compact-min']};
|
|
496
|
+
}
|
|
497
|
+
line-height: ${base['hit-area']['compact-min']};
|
|
498
|
+
&:focus-within {
|
|
499
|
+
background-color: ${activeColor};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
&:hover:not([aria-disabled='true']) {
|
|
503
|
+
background-color: ${hoverColor};
|
|
504
|
+
}
|
|
505
|
+
padding-inline: ${base.spacing};
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
li.CodeMirror-hint-active {
|
|
509
|
+
${!isLoading &&
|
|
510
|
+
css `
|
|
511
|
+
background-color: ${activeColor};
|
|
512
|
+
`}
|
|
513
|
+
}
|
|
514
|
+
`;
|
|
515
|
+
});
|
|
516
|
+
StyledCodeEditor.defaultProps = defaultThemeProp;
|
|
517
|
+
//# sourceMappingURL=CodeEditor.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeEditor.styles.js","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAC;AAE7F,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA;;CAEtC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAK1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EACJ,UAAU,EAAE,EACV,cAAc,EAAE,EACd,YAAY,EAAE,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAC9D,EACD,YAAY,EAAE,EACZ,KAAK,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,EAC3C,EACF,EACF,EACD,MAAM,EACN,SAAS,EACT,QAAQ,EACT,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5F,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3F,MAAM,SAAS,GAAG,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3E,OAAO,GAAG,CAAA;;;;QAIN,eAAe;;;;;;;;;UASb,QAAQ;QACV,GAAG,CAAA;;SAEF;;;;;;mBAMU,IAAI,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAwCQ,IAAI,CAAC,OAAO,CAAC,IAAI;;;UAG9C,QAAQ;QACV,GAAG,CAAA;;SAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAwUe,IAAI,CAAC,OAAO,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA2CpB,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;iBAC3C,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC;kCACf,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;oCACzB,IAAI,CAAC,eAAe,CAAC;UAC/C,MAAM;QACR,GAAG,CAAA;0BACe,eAAe;SAChC;UACC,QAAQ;QACV,GAAG,CAAA;8BACmB,uBAAuB;SAC5C;;;iBAGQ,IAAI,CAAC,OAAO,CAAC,OAAO;;;iBAGpB,IAAI,CAAC,OAAO,CAAC,IAAI;;;;;6BAKL,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;;oCAE3C,IAAI,CAAC,eAAe,CAAC;sBACnC,IAAI,CAAC,MAAM,CAAC,GAAG;kCACH,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;4BACjC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;qBACzC,SAAS,CAAC,CAAC;;;;;;;;UAQtB,SAAS;QACX,GAAG,CAAA;;SAEF;sBACa,IAAI,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC;;;wBAG7B,IAAI,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC;;uBAEhC,IAAI,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC;;8BAExB,WAAW;;;;8BAIX,UAAU;;0BAEd,IAAI,CAAC,OAAO;;;;UAI5B,CAAC,SAAS;QACZ,GAAG,CAAA;8BACmB,WAAW;SAChC;;KAEJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["// cSpell:words vscrollbar hscrollbar\nimport styled, { css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp, calculateFontSize, Flex } from '@pega/cosmos-react-core';\nimport { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\n\nexport const StyledLoading = styled.div`\n font-size: 1.5rem;\n`;\n\nexport const StyledCodeEditor = styled(Flex)<{\n isLoading?: boolean;\n errors?: string;\n readOnly?: boolean;\n}>(\n ({\n theme: {\n base,\n components: {\n 'form-control': {\n ':read-only': { 'background-color': readOnlyBackgroundColor }\n },\n 'form-field': {\n error: { 'status-color': errorBackground }\n }\n }\n },\n errors,\n isLoading,\n readOnly\n }) => {\n const activeColor = mix(0.85, base.palette['primary-background'], base.palette.interactive);\n\n const hoverColor = mix(0.95, base.palette['primary-background'], base.palette.interactive);\n\n const fontSizes = calculateFontSize(base['font-size'], base['font-scale']);\n return css`\n position: relative;\n max-height: 100%;\n overflow-y: auto;\n ${StyledFormField} {\n flex-grow: 1;\n }\n\n /* PADDING */\n .react-codemirror2 {\n flex-grow: 1;\n min-height: 3.75rem;\n overflow-y: auto;\n ${readOnly &&\n css`\n max-height: 5.625rem;\n `}\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 0.063rem; /* prevents collapsing before first draw */\n padding: ${base.spacing};\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n background-color: white; /* The little square between H and V scrollbars */\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n position: absolute;\n left: 0;\n top: 0;\n min-height: 100%;\n z-index: 3;\n border-right: 0.063rem solid #dddddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumber {\n padding: 0 0.125rem 0 0.313rem;\n min-width: 1.25rem;\n text-align: right;\n color: #999999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-left: 0.0625rem solid ${base.palette.dark};\n border-right: none;\n width: 0;\n ${readOnly &&\n css`\n display: none;\n `}\n }\n\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 0.063rem solid silver;\n }\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #77ee77;\n }\n @-moz-keyframes blink {\n 50% {\n background-color: transparent;\n }\n }\n @-webkit-keyframes blink {\n 50% {\n background-color: transparent;\n }\n }\n @keyframes blink {\n 50% {\n background-color: transparent;\n }\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -3.125rem;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 0.063rem solid #cccccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-s-default .cm-header {\n color: blue;\n }\n .cm-negative {\n color: #dd4444;\n }\n .cm-positive {\n color: #229922;\n }\n .cm-strong {\n font-weight: bold;\n }\n .cm-s-default .cm-quote {\n color: #009900;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .cm-s-default .cm-keyword {\n color: #770088;\n }\n .cm-s-default .cm-atom {\n color: #221199;\n }\n .cm-s-default .cm-number {\n color: #116644;\n }\n .cm-s-default .cm-def {\n color: #0000ff;\n }\n .cm-s-default .cm-variable-2 {\n color: #0055aa;\n }\n .cm-s-default .cm-variable-3,\n .cm-s-default .cm-type {\n color: #008855;\n }\n .cm-s-default .cm-comment {\n color: #aa5500;\n }\n .cm-s-default .cm-string {\n color: #aa1111;\n }\n .cm-s-default .cm-string-2 {\n color: #ff5500;\n }\n .cm-s-default .cm-meta {\n color: #555555;\n }\n .cm-s-default .cm-qualifier {\n color: #555555;\n }\n .cm-s-default .cm-builtin {\n color: #3300aa;\n }\n .cm-s-default .cm-bracket {\n color: #999977;\n }\n .cm-s-default .cm-tag {\n color: #117700;\n }\n .cm-s-default .cm-attribute {\n color: #0000cc;\n }\n .cm-s-default .cm-hr {\n color: #999999;\n }\n .cm-s-default .cm-link {\n color: #0000cc;\n }\n\n .cm-s-default .cm-error {\n color: #ff0000;\n }\n .cm-invalidchar {\n color: #ff0000;\n }\n\n .CodeMirror-composing {\n border-bottom: 0.125rem solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #00bb00;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #aa2222;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror-scroll {\n overflow: scroll !important;\n margin-bottom: -3.125rem;\n margin-right: -3.125rem;\n padding-bottom: 3.125rem;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 3.125rem solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 6;\n display: none;\n }\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n .CodeMirror-gutter-filler {\n left: 0;\n bottom: 0;\n }\n .CodeMirror-gutter {\n white-space: normal;\n height: 100%;\n display: inline-block;\n vertical-align: top;\n margin-bottom: -3.125rem;\n }\n .CodeMirror-gutter-wrapper {\n position: absolute;\n z-index: 4;\n background: none !important;\n border: none !important;\n }\n .CodeMirror-gutter-background {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: 4;\n }\n .CodeMirror-gutter-elt {\n position: absolute;\n cursor: default;\n z-index: 4;\n }\n .CodeMirror-gutter-wrapper ::selection {\n background-color: transparent;\n }\n .CodeMirror-gutter-wrapper ::-moz-selection {\n background-color: transparent;\n }\n\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n /* Reset some styles that the rest of the page might have set */\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: inherit;\n color: inherit;\n z-index: 2;\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: normal;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n z-index: 2;\n padding: 0.006rem; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: #d9d9d9;\n }\n .CodeMirror-focused .CodeMirror-selected {\n background: #d7d4f0;\n }\n .CodeMirror-focused {\n border-color: ${base.palette.interactive} !important;\n }\n .CodeMirror:not(.CodeMirror-focused) .CodeMirror-cursors {\n visibility: hidden;\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n .CodeMirror-line::selection,\n .CodeMirror-line > span::selection,\n .CodeMirror-line > span > span::selection {\n background: #d7d4f0;\n }\n .CodeMirror-line::-moz-selection,\n .CodeMirror-line > span::-moz-selection,\n .CodeMirror-line > span > span::-moz-selection {\n background: #d7d4f0;\n }\n\n .cm-searching {\n background-color: rgba(255, 255, 0, 0.4);\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.006rem;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack::after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n .CodeMirror {\n overflow: hidden;\n font-family: monospace;\n direction: ltr;\n position: relative;\n background-color: ${base.palette['background-color']};\n color: ${base.palette['foreground-color']};\n border: 0.0625rem solid ${base.palette['border-line']};\n border-radius: calc(0.5 * ${base['border-radius']});\n ${errors &&\n css`\n border-color: ${errorBackground};\n `}\n ${readOnly &&\n css`\n background-color: ${readOnlyBackgroundColor};\n `}\n }\n .cm-ex-properties {\n color: ${base.palette.success};\n }\n .cm-ex-functions {\n color: ${base.palette.warn};\n }\n .CodeMirror-hints {\n position: absolute;\n z-index: 10;\n transition: height ${base.animation.speed} ${base.animation.timing.ease};\n padding: 0;\n border-radius: calc(0.5 * ${base['border-radius']});\n box-shadow: ${base.shadow.low};\n border: 0.0625rem solid ${base.palette['border-line']};\n background-color: ${base.palette['primary-background']};\n font-size: ${fontSizes.s};\n font-family: monospace;\n max-height: 10em;\n overflow-y: auto;\n min-width: 8rem;\n }\n\n .CodeMirror-hint {\n ${isLoading &&\n css`\n pointer-events: none;\n `}\n min-height: ${base['hit-area']['compact-min']};\n cursor: pointer;\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['compact-min']};\n }\n line-height: ${base['hit-area']['compact-min']};\n &:focus-within {\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']) {\n background-color: ${hoverColor};\n }\n padding-inline: ${base.spacing};\n }\n\n li.CodeMirror-hint-active {\n ${!isLoading &&\n css`\n background-color: ${activeColor};\n `}\n }\n `;\n }\n);\n\nStyledCodeEditor.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { ShowHintOptions, EditorConfiguration } from 'codemirror';
|
|
3
|
+
export declare type AutoCompleteTriggerType = '@' | '.';
|
|
4
|
+
export declare type SuggestionsType = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
export interface EditorState {
|
|
9
|
+
getValue: () => string | undefined;
|
|
10
|
+
insertText: (text: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export interface CodeEditorProps {
|
|
13
|
+
/** Default expression to set in the code editor */
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/** Compiled error message */
|
|
16
|
+
errors?: string;
|
|
17
|
+
/** Enable read only mode */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
/** Fetches suggestion list for suggestions popover */
|
|
20
|
+
fetchSuggestions?: (autoCompleteTrigger: AutoCompleteTriggerType, queryString: string) => Promise<SuggestionsType[]>;
|
|
21
|
+
/** characters which triggers suggestions */
|
|
22
|
+
autoCompleteTriggers?: AutoCompleteTriggerType[];
|
|
23
|
+
/** Code editor configuration props */
|
|
24
|
+
editorConfigProps?: EditorConfiguration;
|
|
25
|
+
/** To show loader for intellisense popover */
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
ref?: Ref<HTMLDivElement>;
|
|
28
|
+
codeEditorHandle: Ref<EditorState>;
|
|
29
|
+
}
|
|
30
|
+
export interface EditorHintOptions extends ShowHintOptions {
|
|
31
|
+
suggestions?: SuggestionsType[];
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
autoCompleteTrigger?: AutoCompleteTriggerType;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=CodeEditor.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeEditor.types.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAElE,oBAAY,uBAAuB,GAAG,GAAG,GAAG,GAAG,CAAC;AAEhD,oBAAY,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,CACjB,mBAAmB,EAAE,uBAAuB,EAC5C,WAAW,EAAE,MAAM,KAChB,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAChC,4CAA4C;IAC5C,oBAAoB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IACjD,sCAAsC;IACtC,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,gBAAgB,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,uBAAuB,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeEditor.types.js","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Ref } from 'react';\nimport { ShowHintOptions, EditorConfiguration } from 'codemirror';\n\nexport type AutoCompleteTriggerType = '@' | '.';\n\nexport type SuggestionsType = { label: string; value: string };\n\nexport interface EditorState {\n getValue: () => string | undefined;\n insertText: (text: string) => void;\n}\n\nexport interface CodeEditorProps {\n /** Default expression to set in the code editor */\n defaultValue?: string;\n /** Compiled error message */\n errors?: string;\n /** Enable read only mode */\n readOnly?: boolean;\n /** Fetches suggestion list for suggestions popover */\n fetchSuggestions?: (\n autoCompleteTrigger: AutoCompleteTriggerType,\n queryString: string\n ) => Promise<SuggestionsType[]>;\n /** characters which triggers suggestions */\n autoCompleteTriggers?: AutoCompleteTriggerType[];\n /** Code editor configuration props */\n editorConfigProps?: EditorConfiguration;\n /** To show loader for intellisense popover */\n loading?: boolean;\n ref?: Ref<HTMLDivElement>;\n codeEditorHandle: Ref<EditorState>;\n}\n\nexport interface EditorHintOptions extends ShowHintOptions {\n suggestions?: SuggestionsType[];\n loading?: boolean;\n autoCompleteTrigger?: AutoCompleteTriggerType;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Editor, Hint, Hints } from 'codemirror';
|
|
2
|
+
import { EditorHintOptions } from './CodeEditor.types';
|
|
3
|
+
declare const getCodeSuggestions: (codeMirror: Editor, { suggestions, loading, autoCompleteTrigger }: EditorHintOptions) => {
|
|
4
|
+
list: {
|
|
5
|
+
text: string;
|
|
6
|
+
displayText: string;
|
|
7
|
+
render: (element: HTMLLIElement, _: Hints, listItem: Hint) => void;
|
|
8
|
+
}[];
|
|
9
|
+
from: import("codemirror").Position;
|
|
10
|
+
to: import("codemirror").Position;
|
|
11
|
+
};
|
|
12
|
+
export default getCodeSuggestions;
|
|
13
|
+
//# sourceMappingURL=getCodeSuggestions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCodeSuggestions.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAO,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAItD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,QAAA,MAAM,kBAAkB,eACV,MAAM,iDAC0C,iBAAiB;;;;0BA+BjD,aAAa,KAAK,KAAK,YAAY,IAAI;;;;CAkBpE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { Pos } from 'codemirror';
|
|
4
|
+
import { Progress, Flex } from '@pega/cosmos-react-core';
|
|
5
|
+
import { StyledLoading } from './CodeEditor.styles';
|
|
6
|
+
const getCodeSuggestions = (codeMirror, { suggestions = [], loading = false, autoCompleteTrigger }) => {
|
|
7
|
+
const currentPosition = codeMirror.getCursor();
|
|
8
|
+
const word = codeMirror.getTokenAt(currentPosition);
|
|
9
|
+
const tokens = word.string.split(autoCompleteTrigger);
|
|
10
|
+
const prefixToken = tokens.slice(0, tokens.length - 1).join();
|
|
11
|
+
const filteredList = loading
|
|
12
|
+
? [
|
|
13
|
+
{
|
|
14
|
+
text: '',
|
|
15
|
+
displayText: '',
|
|
16
|
+
render: (element) => {
|
|
17
|
+
ReactDOM.render(_jsx(Flex, { container: {
|
|
18
|
+
justify: 'center',
|
|
19
|
+
pad: 1
|
|
20
|
+
}, children: _jsx(Progress, { variant: 'ring', placement: 'inline', visible: loading, as: StyledLoading }) }), element);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
: suggestions
|
|
25
|
+
.map(hint => {
|
|
26
|
+
return {
|
|
27
|
+
text: prefixToken.concat(hint.value),
|
|
28
|
+
displayText: hint.label,
|
|
29
|
+
render: (element, _, listItem) => {
|
|
30
|
+
const itemDiv = document.createElement('div');
|
|
31
|
+
const labelSpan = document.createElement('span');
|
|
32
|
+
labelSpan.textContent = listItem.displayText;
|
|
33
|
+
itemDiv.appendChild(labelSpan);
|
|
34
|
+
element.appendChild(itemDiv);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
})
|
|
38
|
+
.filter(item => item.displayText.toLowerCase().startsWith(tokens[tokens.length - 1].toLowerCase()));
|
|
39
|
+
return {
|
|
40
|
+
list: filteredList,
|
|
41
|
+
from: Pos(currentPosition.line, word.start + prefixToken.length),
|
|
42
|
+
to: Pos(currentPosition.line, word.end)
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default getCodeSuggestions;
|
|
46
|
+
//# sourceMappingURL=getCodeSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCodeSuggestions.js","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.tsx"],"names":[],"mappings":";AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAU,GAAG,EAAe,MAAM,YAAY,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,kBAAkB,GAAG,CACzB,UAAkB,EAClB,EAAE,WAAW,GAAG,EAAE,EAAE,OAAO,GAAG,KAAK,EAAE,mBAAmB,EAAqB,EAC7E,EAAE;IACF,MAAM,eAAe,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAoB,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,MAAM,YAAY,GAAG,OAAO;QAC1B,CAAC,CAAC;YACE;gBACE,IAAI,EAAE,EAAE;gBACR,WAAW,EAAE,EAAE;gBACf,MAAM,EAAE,CAAC,OAAsB,EAAE,EAAE;oBACjC,QAAQ,CAAC,MAAM,CACb,KAAC,IAAI,IACH,SAAS,EAAE;4BACT,OAAO,EAAE,QAAQ;4BACjB,GAAG,EAAE,CAAC;yBACP,YAED,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,aAAa,GAAI,GAC9E,EACP,OAAO,CACR,CAAC;gBACJ,CAAC;aACF;SACF;QACH,CAAC,CAAC,WAAW;aACR,GAAG,CAAC,IAAI,CAAC,EAAE;YACV,OAAO;gBACL,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;gBACpC,WAAW,EAAE,IAAI,CAAC,KAAK;gBACvB,MAAM,EAAE,CAAC,OAAsB,EAAE,CAAQ,EAAE,QAAc,EAAE,EAAE;oBAC3D,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;oBAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;oBACjD,SAAS,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAY,CAAC;oBAC9C,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;oBAC/B,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC/B,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;aACD,MAAM,CAAC,IAAI,CAAC,EAAE,CACb,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CACnF,CAAC;IAER,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC;QAChE,EAAE,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import ReactDOM from 'react-dom';\nimport { Editor, Pos, Hint, Hints } from 'codemirror';\n\nimport { Progress, Flex } from '@pega/cosmos-react-core';\n\nimport { EditorHintOptions } from './CodeEditor.types';\nimport { StyledLoading } from './CodeEditor.styles';\n\nconst getCodeSuggestions = (\n codeMirror: Editor,\n { suggestions = [], loading = false, autoCompleteTrigger }: EditorHintOptions\n) => {\n const currentPosition = codeMirror.getCursor();\n const word = codeMirror.getTokenAt(currentPosition);\n const tokens = word.string.split(autoCompleteTrigger!);\n const prefixToken = tokens.slice(0, tokens.length - 1).join();\n const filteredList = loading\n ? [\n {\n text: '',\n displayText: '',\n render: (element: HTMLLIElement) => {\n ReactDOM.render(\n <Flex\n container={{\n justify: 'center',\n pad: 1\n }}\n >\n <Progress variant='ring' placement='inline' visible={loading} as={StyledLoading} />\n </Flex>,\n element\n );\n }\n }\n ]\n : suggestions\n .map(hint => {\n return {\n text: prefixToken.concat(hint.value),\n displayText: hint.label,\n render: (element: HTMLLIElement, _: Hints, listItem: Hint) => {\n const itemDiv = document.createElement('div');\n const labelSpan = document.createElement('span');\n labelSpan.textContent = listItem.displayText!;\n itemDiv.appendChild(labelSpan);\n element.appendChild(itemDiv);\n }\n };\n })\n .filter(item =>\n item.displayText.toLowerCase().startsWith(tokens[tokens.length - 1].toLowerCase())\n );\n\n return {\n list: filteredList,\n from: Pos(currentPosition.line, word.start + prefixToken.length),\n to: Pos(currentPosition.line, word.end)\n };\n};\n\nexport default getCodeSuggestions;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import { ExpressionBuilderProps } from './ExpressionBuilder.types';
|
|
4
|
+
declare const ExpressionBuilder: FunctionComponent<ExpressionBuilderProps & ForwardProps>;
|
|
5
|
+
export default ExpressionBuilder;
|
|
6
|
+
//# sourceMappingURL=ExpressionBuilder.d.ts.map
|