@pega/cosmos-react-build 9.0.0-build.3.0 → 9.0.0-build.3.2
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/Expression/Expression.test-ids.d.ts +1 -0
- package/lib/components/Expression/Expression.test-ids.d.ts.map +1 -1
- package/lib/components/Expression/Expression.test-ids.js +6 -0
- package/lib/components/Expression/Expression.test-ids.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js +66 -25
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +18 -2
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js +80 -13
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts +5 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js +22 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.test-ids.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +33 -5
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.js +6 -4
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionItem.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionItem.js +8 -6
- package/lib/components/ExpressionBuilder/ExpressionItem.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +4 -2
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.js +17 -5
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -0
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js +1 -0
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const getExpressionTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expression-input", "expression-menu-popover", "expression-builder-error-banner", "progress-builder"]>;
|
|
2
|
+
export declare const getExpressionBuilderGearTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["expression-builder-modal", "open-expression-builder", "expression-modal-cancel", "expression-modal-submit"]>;
|
|
2
3
|
//# sourceMappingURL=Expression.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expression.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Expression/Expression.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,2OAKtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Expression.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/Expression/Expression.test-ids.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,2OAKtB,CAAC;AAEZ,eAAO,MAAM,+BAA+B,kPAKjC,CAAC"}
|
|
@@ -5,4 +5,10 @@ export const getExpressionTestIds = createTestIds('expression', [
|
|
|
5
5
|
'expression-builder-error-banner',
|
|
6
6
|
'progress-builder'
|
|
7
7
|
]);
|
|
8
|
+
export const getExpressionBuilderGearTestIds = createTestIds('expression-builder-gear', [
|
|
9
|
+
'expression-builder-modal',
|
|
10
|
+
'open-expression-builder',
|
|
11
|
+
'expression-modal-cancel',
|
|
12
|
+
'expression-modal-submit'
|
|
13
|
+
]);
|
|
8
14
|
//# sourceMappingURL=Expression.test-ids.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expression.test-ids.js","sourceRoot":"","sources":["../../../src/components/Expression/Expression.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,YAAY,EAAE;IAC9D,kBAAkB;IAClB,yBAAyB;IACzB,iCAAiC;IACjC,kBAAkB;CACV,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getExpressionTestIds = createTestIds('expression', [\n 'expression-input',\n 'expression-menu-popover',\n 'expression-builder-error-banner',\n 'progress-builder'\n] as const);\n"]}
|
|
1
|
+
{"version":3,"file":"Expression.test-ids.js","sourceRoot":"","sources":["../../../src/components/Expression/Expression.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,YAAY,EAAE;IAC9D,kBAAkB;IAClB,yBAAyB;IACzB,iCAAiC;IACjC,kBAAkB;CACV,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,+BAA+B,GAAG,aAAa,CAAC,yBAAyB,EAAE;IACtF,0BAA0B;IAC1B,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;CACjB,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\n\nexport const getExpressionTestIds = createTestIds('expression', [\n 'expression-input',\n 'expression-menu-popover',\n 'expression-builder-error-banner',\n 'progress-builder'\n] as const);\n\nexport const getExpressionBuilderGearTestIds = createTestIds('expression-builder-gear', [\n 'expression-builder-modal',\n 'open-expression-builder',\n 'expression-modal-cancel',\n 'expression-modal-submit'\n] as const);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAsB7C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,oBAAoB,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAIA,OAAO,oCAAoC,CAAC;AAC5C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAsB7C,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,oBAAoB,CAAC;;;;AAkoB5B,wBAA0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["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AE,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,aAAa,GAAI,CACpE,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,cAAE,WAAW,CAAC,aAAa,GAAQ,CACzC,IACI,GACC,CACX,EACA,MAAM,IAAI,CACT,KAAC,mBAAmB,IAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAC,OAAO,iBAAc,OAAO,CAAC,YAAY,YACnF,MAAM,GACa,CACvB,IACgB,IAClB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// cspell:words unfocus\nimport { forwardRef, useRef, useState, useEffect, useImperativeHandle, useMemo } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport { Controlled as ReactCodeMirror } from 'react-codemirror2';\nimport 'codemirror/addon/hint/show-hint.js';\nimport 'codemirror/addon/edit/closebrackets';\nimport 'codemirror/addon/edit/matchbrackets';\nimport { Pass, showHint, defineMode, registerHelper } from 'codemirror';\nimport type {\n Editor,\n Position,\n EditorChange,\n EditorConfiguration,\n MarkerRange,\n TextMarker\n} from 'codemirror';\n\nimport {\n Popover,\n Text,\n UnorderedList,\n Flex,\n useI18n,\n useTestIds,\n withTestIds,\n useUID,\n debounce\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { StyledFormFieldInfo } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\n\nimport type {\n AutoCompleteTriggerChar,\n CodeEditorProps,\n SuggestionType,\n CustomPositionProps\n} from './CodeEditor.types';\nimport {\n StyledSuggestions,\n StyledCodeEditor,\n StyledPopover,\n StyledList,\n StyledWarnIcon\n} from './CodeEditor.styles';\nimport getCodeSuggestions from './getCodeSuggestions';\nimport { getEditorsTestIds } from './CodeEditor.test-ids';\nimport { lint as jsonLint } from './mode/jsonLinter';\n\nconst contextText = 'ex-context';\nconst commentText = 'ex-comment';\nconst languages = ['json', 'javascript'];\n\nconst additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];\n\ndefineMode('expression', (config, parserConfig) => {\n const isSingleLine = parserConfig.isSingleLine;\n\n const tokens = [\n // Below regex is used to identify the context\n { token: /\\w+@/, style: contextText },\n // Below regex is used to identify the RuleType\n { token: /\\w+:/, style: contextText },\n // Below regex is used to identify the RuleName\n { token: /\\w+[(]/, style: 'ex-ruleName' },\n // Below regex is used to identify the delimeters\n { token: /[:.(),[\\]]/, style: 'ex-delimeter' },\n // Below regex is used to identify the operators\n { token: /[-+\\\\/*=<>@#]+/, style: 'ex-operator' },\n // Below regex is used to identify the spaces\n { token: / /, style: 'ex-space' }\n ];\n\n return {\n startState() {\n return { inString: false, inMultiLineComment: false };\n },\n token(stream, state) {\n /** Additional operator highlighting */\n for (let i = 0; i < additionalOperators.length; i += 1) {\n const keyword = additionalOperators[i];\n const len = keyword.length;\n const currentPos = stream.pos;\n\n if (stream.match(keyword, true)) {\n const before = currentPos === 0 ? null : stream.string.charAt(currentPos - 1);\n const after = stream.eol() ? null : stream.peek();\n\n const isWordChar = (char: string) => char.includes(' ');\n\n if ((!before || isWordChar(before)) && (!after || isWordChar(after))) {\n return 'ex-additional-operators';\n }\n stream.backUp(len);\n }\n }\n /* Highlights single and multi line comments */\n if (state.inMultiLineComment && !isSingleLine) {\n if (stream.match(/.*?\\*\\//)) {\n state.inMultiLineComment = false;\n } else {\n stream.skipToEnd();\n }\n return commentText;\n }\n\n if (stream.match(/\\/\\*/) && !isSingleLine) {\n state.inMultiLineComment = true;\n return commentText;\n }\n\n if (stream.match(/\\/\\//) && !isSingleLine) {\n stream.skipToEnd();\n return commentText;\n }\n // Used to identify the constants in the expression\n if (!state.inMultiLineComment) {\n const nextChar = stream.peek();\n if (!state.inString && (nextChar === \"'\" || nextChar === '\"')) {\n stream.next(); // Skip quote\n state.inString = true; // Update state\n }\n\n if (state.inString) {\n if (nextChar && stream.skipTo(nextChar)) {\n // Quote found on this line\n stream.next(); // Skip quote\n state.inString = false; // Clear flag\n } else {\n stream.skipToEnd(); // Rest of line is string\n }\n return nextChar === '\"' ? 'ex-constant' : contextText; // Token style\n }\n\n // Used to match the regex in the expression\n for (const element of tokens) {\n const match = stream.match(element.token, false);\n if (match) {\n if (stream.pos === stream.start) {\n stream.next();\n }\n return element.style;\n }\n }\n }\n stream.next();\n return null;\n }\n };\n});\n\nconst CodeEditor: ForwardRefForwardPropsComponent<CodeEditorProps> = forwardRef(\n (\n {\n testId,\n fetchSuggestions,\n autoCompleteTriggers,\n editorConfigProps,\n codeEditorHandle,\n defaultValue = '',\n loading = false,\n readOnly,\n isSingleLine = false,\n errors,\n onChange,\n onBlur,\n inLineErrors,\n 'aria-describedby': ariaDescribedBy,\n ...restProps\n }: PropsWithoutRef<CodeEditorProps>,\n ref: CodeEditorProps['ref']\n ) => {\n const t = useI18n();\n const [value, setCode] = useState<string>(defaultValue);\n const [showEditor, setShowEditor] = useState(false);\n const [isFocused, setIsFocused] = useState(false);\n const [suggestions, setSuggestions] = useState<SuggestionType[]>([]);\n const [codeMirror, setCodeMirror] = useState<Editor | null>(null);\n const [suggestionTrigger, setSuggestionTrigger] = useState<{\n character: AutoCompleteTriggerChar;\n cursorPosition: Position;\n } | null>(null);\n const [popover, showPopover] = useState(false);\n const mounted = useRef(false);\n const testIds = useTestIds(testId, getEditorsTestIds);\n const editorRef = useRef<Editor | null>(null);\n const uId = useUID();\n const errorDescId = `${uId}-description`;\n const onBlurRef = useRef(onBlur);\n const hasSuggestionRef = useRef(true);\n\n useImperativeHandle(\n codeEditorHandle,\n () => ({\n insertText: (\n text: string,\n resetContent?: boolean,\n customPosition?: CustomPositionProps\n ) => {\n if (editorRef.current) {\n if (editorRef.current.getSelection()) {\n editorRef.current.replaceSelection(text);\n } else if (customPosition?.start && customPosition?.end) {\n editorRef.current.replaceRange(\n text,\n { ...customPosition.start },\n { ...customPosition.end }\n );\n } else {\n const cur: Position = editorRef.current.getCursor();\n const doc = editorRef.current.getDoc();\n const lastLine = doc.lastLine(); // Get the index of the last line\n const lastCharIndex = doc.getLine(lastLine).length;\n editorRef.current.replaceRange(\n text,\n resetContent ? { ch: lastCharIndex, line: lastLine } : cur,\n resetContent ? { ch: 0, line: 0 } : undefined\n );\n }\n }\n },\n getValue: () => {\n return editorRef.current?.getValue();\n }\n }),\n []\n );\n\n const autoComplete = (codeEditor: Editor) => {\n const hintOptions = {\n completeSingle: false,\n completeOnSingleClick: true,\n closeOnUnfocus: true,\n suggestions,\n loading,\n triggerCharacterCursorPos: suggestionTrigger?.cursorPosition\n };\n\n debounce(() => showHint(codeEditor, getCodeSuggestions, hintOptions), 100)();\n };\n\n const errorHandler = (val: string) => {\n if (!editorConfigProps?.lint) return;\n const mode = editorConfigProps?.mode;\n switch (mode) {\n case 'json':\n return jsonLint(val);\n case 'expression':\n default:\n return undefined;\n }\n };\n\n useEffect(() => {\n onBlurRef.current = onBlur;\n }, [onBlur]);\n\n const onBlurHandler = (editor: Editor) => {\n if (onBlurRef.current) {\n onBlurRef.current(editor.getDoc().getValue());\n }\n };\n\n const onBeforeChange = async (editor: Editor, _data: EditorChange, textvalue: string) => {\n const updatedTextValue = isSingleLine ? textvalue.replaceAll(/\\n/g, '') : textvalue;\n setCode(updatedTextValue);\n /** _data.origin is a flag from codemirror that tells from where the change was made in the code editor input */\n onChange?.(updatedTextValue, errorHandler(updatedTextValue), _data.origin);\n const currentCursor = editor.getCursor();\n const currentCharacter = editor\n .getTokenAt(currentCursor)\n .string.trim() as AutoCompleteTriggerChar;\n let newSuggestions: SuggestionType[] = [];\n\n if (autoCompleteTriggers?.includes(currentCharacter) && fetchSuggestions) {\n const suggestionData = await fetchSuggestions(currentCharacter, {\n line: currentCursor.line,\n ch: currentCursor.ch\n });\n\n if (suggestionData === undefined) {\n hasSuggestionRef.current = false;\n return;\n }\n\n setSuggestionTrigger({\n character: currentCharacter,\n cursorPosition: currentCursor\n });\n\n hasSuggestionRef.current = true;\n newSuggestions = [...suggestionData];\n if (mounted.current) {\n setSuggestions(newSuggestions);\n }\n }\n };\n\n useEffect(() => {\n if (!popover) {\n return;\n }\n const isSuggestionTriggerPresent =\n suggestionTrigger &&\n codeMirror\n ?.getTokenAt(suggestionTrigger.cursorPosition)\n .string.includes(suggestionTrigger.character);\n\n if (!isSuggestionTriggerPresent) {\n codeMirror?.closeHint();\n showPopover(false);\n setSuggestionTrigger(null);\n }\n }, [onBeforeChange]);\n\n useEffect(() => {\n if (codeMirror && isFocused && hasSuggestionRef.current && (suggestionTrigger || loading)) {\n autoComplete(codeMirror);\n showPopover(true);\n } else {\n codeMirror?.closeHint();\n showPopover(false);\n }\n }, [suggestions, loading, suggestionTrigger, codeMirror]);\n\n const [popoverInfo, setPopoverInfo] = useState<{\n targetElement: Element | null;\n errorMessages: string[];\n }>({ targetElement: null, errorMessages: [] });\n\n const [show, setShow] = useState(false);\n const [errorMapping, setErrorMapping] = useState<string[][]>([]);\n const [textMarkerList, setTextMarkerList] = useState<TextMarker<MarkerRange>[]>([]);\n\n const removeInLineErrors = () => {\n if (textMarkerList.length) {\n textMarkerList.forEach(item => item.clear());\n }\n };\n\n useEffect(() => {\n removeInLineErrors();\n if (inLineErrors?.length && codeMirror) {\n const markerList: TextMarker<MarkerRange>[] = [];\n const errorMessageMap = inLineErrors?.map(({ start, end, messages }, index) => {\n if (messages.length) {\n markerList.push(\n codeMirror.markText(start, end, {\n className: `cm-ex-underline-error error-${index}`\n })\n );\n return messages;\n }\n return [];\n });\n setTextMarkerList(markerList);\n setErrorMapping(errorMessageMap);\n } else {\n setErrorMapping([]);\n }\n }, [inLineErrors, codeMirror]);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const getErrors = (target: Element) => {\n const errorMessages: string[] = [];\n if (target) {\n errorMapping.forEach((item, index) => {\n if (target.classList.contains(`error-${index}`)) {\n errorMessages.push(...item);\n }\n });\n }\n\n return errorMessages;\n };\n\n const onMouseMove = (event: Event | null, type?: string) => {\n if (codeMirror && errorMapping.length) {\n let target: Element | null;\n\n if (type === 'cursor') {\n const coords = codeMirror.getCursor();\n const charCoords = codeMirror.charCoords(coords, 'window');\n target = document.elementFromPoint(charCoords.left, charCoords.top);\n } else {\n target = event?.target instanceof Element ? event.target : null;\n }\n\n if (target) {\n const errorMessages = getErrors(target);\n if (errorMessages.length) {\n setPopoverInfo(() => {\n return {\n targetElement: target,\n errorMessages\n };\n });\n setShow(true);\n } else {\n setShow(false);\n }\n }\n }\n };\n\n const onMouseLeave = () => {\n setShow(false);\n };\n\n const hidePopover = (e: KeyboardEvent) => {\n if (e.shiftKey && (e.metaKey || e.ctrlKey) && e.key === ' ') {\n onMouseMove(null, 'cursor');\n } else {\n setShow(false);\n }\n };\n\n useEffect(() => {\n if (codeMirror && inLineErrors?.length && errorMapping.length) {\n const codeMirrorWrapper = codeMirror.getWrapperElement();\n\n codeMirrorWrapper.addEventListener('keydown', hidePopover);\n codeMirrorWrapper.addEventListener('mousedown', onMouseLeave);\n\n const elementsWithClassName = Array.from(\n codeMirrorWrapper.getElementsByClassName('cm-ex-underline-error')\n );\n\n elementsWithClassName.forEach(element => {\n element.addEventListener('mouseenter', onMouseMove);\n element.addEventListener('mouseleave', onMouseLeave);\n });\n\n return () => {\n codeMirrorWrapper.removeEventListener('keydown', hidePopover);\n codeMirrorWrapper.removeEventListener('mousedown', onMouseLeave);\n\n elementsWithClassName.forEach(element => {\n element.removeEventListener('mouseenter', onMouseMove);\n element.removeEventListener('mouseleave', onMouseLeave);\n });\n };\n }\n return undefined;\n }, [value, inLineErrors, errorMapping, codeMirror]);\n\n const extendModeWithSingleLine = (\n mode: EditorConfiguration['mode'],\n singleLineEditor: boolean\n ) => {\n if (typeof mode === 'string' || (mode && typeof mode.name === 'string')) {\n return {\n name: typeof mode === 'string' ? mode : mode.name,\n isSingleLine: singleLineEditor\n };\n }\n return mode;\n };\n\n useEffect(() => {\n (async () => {\n if (editorConfigProps?.placeholder) {\n await import('codemirror/addon/display/placeholder');\n }\n\n if (languages.includes(editorConfigProps?.mode as string)) {\n await import('codemirror/mode/javascript/javascript');\n await import('codemirror/theme/eclipse.css');\n }\n\n if (editorConfigProps?.foldGutter && !isSingleLine) {\n await import('codemirror/addon/fold/foldcode');\n await import('codemirror/addon/fold/foldgutter');\n await import('codemirror/addon/fold/brace-fold');\n await import('codemirror/addon/fold/comment-fold');\n await import('codemirror/addon/fold/foldgutter.css');\n }\n\n if (editorConfigProps?.lint) {\n await import('codemirror/addon/lint/lint.css');\n await import('codemirror/addon/lint/lint');\n\n if (editorConfigProps.mode === 'json') {\n await import('codemirror/addon/lint/json-lint');\n registerHelper('lint', 'json', jsonLint);\n }\n }\n setShowEditor(true);\n })();\n }, [editorConfigProps]);\n\n const updatedEditorConfig: EditorConfiguration = useMemo(() => {\n const mode = extendModeWithSingleLine(editorConfigProps?.mode || 'expression', isSingleLine);\n return {\n ...editorConfigProps,\n lineWrapping: !isSingleLine,\n smartIndent: true,\n autoCloseBrackets: true,\n matchBrackets: true,\n lineNumbers: !isSingleLine && editorConfigProps?.lineNumbers,\n placeholder: editorConfigProps?.placeholder,\n extraKeys: {\n /** default tab and shift tab behavior\n * https://codemirror.net/5/\n * https://discuss.codemirror.net/t/does-tab-key-work-in-codemirror-6/2705\n */\n Tab: isSingleLine ? false : () => Pass,\n 'Shift-Tab': isSingleLine ? false : () => Pass,\n ...(isSingleLine ? { Enter: () => {} } : {})\n },\n mode,\n ...(languages.includes(editorConfigProps?.mode as string) ? { theme: 'eclipse' } : {}),\n ...(editorConfigProps?.foldGutter && !isSingleLine\n ? {\n foldGutter: true,\n gutters: (() => {\n const guttersArr: string[] = [];\n if (editorConfigProps?.lint) guttersArr.push('CodeMirror-lint-markers');\n if (editorConfigProps?.lineNumbers) guttersArr.push('CodeMirror-linenumbers');\n return [...guttersArr, 'CodeMirror-foldgutter'];\n })()\n }\n : {}),\n ...(editorConfigProps?.mode === 'json'\n ? {\n mode: 'application/json',\n lint: editorConfigProps.lint\n }\n : {})\n };\n }, [isSingleLine, editorConfigProps]);\n\n const handlePaste = (editor: Editor, event: ClipboardEvent) => {\n if (isSingleLine) {\n const doc = editor.getDoc();\n const pastedContent = event.clipboardData?.getData('text/plain').trim();\n const singleLineContent = pastedContent?.replace(/\\r?\\n|\\r/g, ' ') || '';\n\n if (doc && doc.getSelection()) {\n doc.replaceSelection(singleLineContent);\n } else {\n const cursor: Position = doc.getCursor();\n doc.replaceRange(singleLineContent, cursor);\n }\n const cursor: Position = doc.getCursor();\n doc.setCursor(cursor);\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n const editor = editorRef.current;\n if (editor && isSingleLine) {\n editor.on('paste', handlePaste);\n }\n return () => {\n if (editor) {\n editor.off('paste', handlePaste);\n }\n };\n }, [isSingleLine]);\n\n useEffect(() => {\n const textArea = codeMirror?.getInputField();\n if (!textArea) return;\n\n let describedBy = textArea.getAttribute('aria-describedby') || '';\n const ids = new Set(describedBy.split(' ').filter(item => item));\n\n if (ariaDescribedBy && !ids.has(ariaDescribedBy)) {\n ids.add(ariaDescribedBy);\n }\n\n if (errors && !ids.has(errorDescId)) {\n ids.add(errorDescId);\n } else if (!errors && ids.has(errorDescId)) {\n ids.delete(errorDescId);\n }\n\n if (!ariaDescribedBy) {\n describedBy = ids.has(errorDescId) ? errorDescId : '';\n } else describedBy = Array.from(ids).join(' ').trim();\n\n if (describedBy) {\n textArea.setAttribute('aria-describedby', describedBy);\n } else {\n textArea.removeAttribute('aria-describedby');\n }\n }, [codeMirror, errors, ariaDescribedBy]);\n\n return (\n <>\n <StyledSuggestions isLoading={loading} suggestions={suggestions} />\n <StyledCodeEditor\n {...restProps}\n data-testid={testIds.root}\n container={{\n direction: 'column',\n justify: 'between'\n }}\n item={{\n grow: 1\n }}\n ref={ref}\n errors={errors}\n readOnly={readOnly}\n isLoading={loading}\n suggestions={suggestions}\n isSingleLine={isSingleLine}\n editorConfigProps={updatedEditorConfig}\n >\n {showEditor && (\n <ReactCodeMirror\n value={value}\n onBeforeChange={onBeforeChange}\n options={updatedEditorConfig}\n editorDidMount={editor => {\n editor.setSize('100%', '100%');\n setCodeMirror(editor);\n editorRef.current = editor;\n }}\n onBlur={editor => {\n setIsFocused(false);\n if (onBlur) {\n onBlurHandler(editor);\n }\n }}\n onFocus={() => {\n setIsFocused(true);\n }}\n />\n )}\n {popoverInfo.errorMessages.length > 0 && popoverInfo.targetElement !== null && (\n <Popover\n as={StyledPopover}\n show={show}\n target={popoverInfo.targetElement}\n placement='bottom-start'\n data-testid={testIds.errorPopover}\n >\n <Flex container={{ direction: 'column', gap: 1 }}>\n <Flex container={{ gap: 1 }}>\n <StyledWarnIcon name='warn-solid' />\n <Text variant='h4'>\n {t('errors', [], {\n count:\n popoverInfo.errorMessages.length === 1\n ? 1\n : // Using NaN to always select \"other\" pluralization form\n NaN\n })}\n </Text>\n </Flex>\n {popoverInfo.errorMessages.length > 1 ? (\n <UnorderedList as={StyledList} items={popoverInfo.errorMessages} />\n ) : (\n <Text>{popoverInfo.errorMessages}</Text>\n )}\n </Flex>\n </Popover>\n )}\n {errors && (\n <StyledFormFieldInfo id={errorDescId} status='error' data-testid={testIds.errorMessage}>\n {errors}\n </StyledFormFieldInfo>\n )}\n </StyledCodeEditor>\n </>\n );\n }\n);\n\nexport default withTestIds(CodeEditor, getEditorsTestIds);\n"]}
|
|
1
|
+
{"version":3,"file":"CodeEditor.js","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.tsx"],"names":[],"mappings":";AAAA,uBAAuB;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9F,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,oCAAoC,CAAC;AAC5C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qCAAqC,CAAC;AAC7C,OAAO,EAAE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AAEF,eAAe,WAAW,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["// cspell:words unfocus\nimport { forwardRef, useRef, useState, useEffect, useImperativeHandle, useMemo } from 'react';\nimport type { PropsWithoutRef } from 'react';\nimport { Controlled as ReactCodeMirror } from 'react-codemirror2';\nimport 'codemirror/addon/hint/show-hint.js';\nimport 'codemirror/addon/edit/closebrackets';\nimport 'codemirror/addon/edit/matchbrackets';\nimport { Pass, showHint, defineMode, registerHelper } from 'codemirror';\nimport type {\n Editor,\n Position,\n EditorChange,\n EditorConfiguration,\n MarkerRange,\n TextMarker\n} from 'codemirror';\n\nimport {\n Popover,\n Text,\n UnorderedList,\n Flex,\n useI18n,\n useTestIds,\n withTestIds,\n useUID,\n debounce\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\nimport { StyledFormFieldInfo } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\n\nimport type {\n AutoCompleteTriggerChar,\n CodeEditorProps,\n SuggestionType,\n CustomPositionProps\n} from './CodeEditor.types';\nimport {\n StyledSuggestions,\n StyledCodeEditor,\n StyledPopover,\n StyledList,\n StyledWarnIcon\n} from './CodeEditor.styles';\nimport getCodeSuggestions from './getCodeSuggestions';\nimport { getEditorsTestIds } from './CodeEditor.test-ids';\nimport { lint as jsonLint } from './mode/jsonLinter';\n\nconst contextText = 'ex-context';\nconst commentText = 'ex-comment';\nconst languages = ['json', 'javascript'];\n\nconst additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];\n\ndefineMode('expression', (config, parserConfig) => {\n const isSingleLine = parserConfig.isSingleLine;\n\n const tokens = [\n // Below regex is used to identify the context\n { token: /\\w+@/, style: contextText },\n // Below regex is used to identify the RuleType\n { token: /\\w+:/, style: contextText },\n // Below regex is used to identify the RuleName\n { token: /\\w+[(]/, style: 'ex-ruleName' },\n // Below regex is used to identify the delimeters\n { token: /[:.(),[\\]]/, style: 'ex-delimeter' },\n // Below regex is used to identify the operators\n { token: /[-+\\\\/*=<>@#]+/, style: 'ex-operator' },\n // Below regex is used to identify the spaces\n { token: / /, style: 'ex-space' }\n ];\n\n return {\n startState() {\n return { inString: false, inMultiLineComment: false };\n },\n token(stream, state) {\n /** Additional operator highlighting */\n for (let i = 0; i < additionalOperators.length; i += 1) {\n const keyword = additionalOperators[i];\n const len = keyword.length;\n const currentPos = stream.pos;\n\n if (stream.match(keyword, true)) {\n const before = currentPos === 0 ? null : stream.string.charAt(currentPos - 1);\n const after = stream.eol() ? null : stream.peek();\n\n const isWordChar = (char: string) => char.includes(' ');\n\n if ((!before || isWordChar(before)) && (!after || isWordChar(after))) {\n return 'ex-additional-operators';\n }\n stream.backUp(len);\n }\n }\n /* Highlights single and multi line comments */\n if (state.inMultiLineComment && !isSingleLine) {\n if (stream.match(/.*?\\*\\//)) {\n state.inMultiLineComment = false;\n } else {\n stream.skipToEnd();\n }\n return commentText;\n }\n\n if (stream.match(/\\/\\*/) && !isSingleLine) {\n state.inMultiLineComment = true;\n return commentText;\n }\n\n if (stream.match(/\\/\\//) && !isSingleLine) {\n stream.skipToEnd();\n return commentText;\n }\n // Used to identify the constants in the expression\n if (!state.inMultiLineComment) {\n const nextChar = stream.peek();\n if (!state.inString && (nextChar === \"'\" || nextChar === '\"')) {\n stream.next(); // Skip quote\n state.inString = true; // Update state\n }\n\n if (state.inString) {\n if (nextChar && stream.skipTo(nextChar)) {\n // Quote found on this line\n stream.next(); // Skip quote\n state.inString = false; // Clear flag\n } else {\n stream.skipToEnd(); // Rest of line is string\n }\n return nextChar === '\"' ? 'ex-constant' : contextText; // Token style\n }\n\n // Used to match the regex in the expression\n for (const element of tokens) {\n const match = stream.match(element.token, false);\n if (match) {\n if (stream.pos === stream.start) {\n stream.next();\n }\n return element.style;\n }\n }\n }\n stream.next();\n return null;\n }\n };\n});\n\nconst CodeEditor: ForwardRefForwardPropsComponent<CodeEditorProps> = forwardRef(\n (\n {\n testId,\n fetchSuggestions,\n autoCompleteTriggers,\n editorConfigProps,\n codeEditorHandle,\n defaultValue = '',\n loading = false,\n readOnly,\n isSingleLine = false,\n errors,\n onChange,\n onBlur,\n inLineErrors,\n 'aria-describedby': ariaDescribedBy,\n ...restProps\n }: PropsWithoutRef<CodeEditorProps>,\n ref: CodeEditorProps['ref']\n ) => {\n const t = useI18n();\n const [value, setCode] = useState<string>(defaultValue);\n const [showEditor, setShowEditor] = useState(false);\n const [isFocused, setIsFocused] = useState(false);\n const [suggestions, setSuggestions] = useState<SuggestionType[]>([]);\n const [codeMirror, setCodeMirror] = useState<Editor | null>(null);\n const [suggestionTrigger, setSuggestionTrigger] = useState<{\n character: AutoCompleteTriggerChar;\n cursorPosition: Position;\n } | null>(null);\n const [popover, showPopover] = useState(false);\n const mounted = useRef(false);\n const testIds = useTestIds(testId, getEditorsTestIds);\n const editorRef = useRef<Editor | null>(null);\n const uId = useUID();\n const errorDescId = `${uId}-description`;\n const onBlurRef = useRef(onBlur);\n const hasSuggestionRef = useRef(true);\n\n useImperativeHandle(\n codeEditorHandle,\n () => ({\n insertText: (\n text: string,\n resetContent?: boolean,\n customPosition?: CustomPositionProps\n ) => {\n if (editorRef.current) {\n if (editorRef.current.getSelection()) {\n editorRef.current.replaceSelection(text);\n } else if (customPosition?.start && customPosition?.end) {\n editorRef.current.replaceRange(\n text,\n { ...customPosition.start },\n { ...customPosition.end }\n );\n } else {\n const cur: Position = editorRef.current.getCursor();\n const doc = editorRef.current.getDoc();\n const lastLine = doc.lastLine(); // Get the index of the last line\n const lastCharIndex = doc.getLine(lastLine).length;\n editorRef.current.replaceRange(\n text,\n resetContent ? { ch: lastCharIndex, line: lastLine } : cur,\n resetContent ? { ch: 0, line: 0 } : undefined\n );\n }\n }\n },\n getValue: () => {\n return editorRef.current?.getValue();\n }\n }),\n []\n );\n\n const autoComplete = (codeEditor: Editor) => {\n const hintOptions = {\n completeSingle: false,\n completeOnSingleClick: true,\n closeCharacters: /./s,\n closeOnUnfocus: true,\n suggestions,\n loading,\n triggerCharacterCursorPos: suggestionTrigger?.cursorPosition\n };\n\n debounce(() => showHint(codeEditor, getCodeSuggestions, hintOptions), 100)();\n };\n\n const errorHandler = (val: string) => {\n if (!editorConfigProps?.lint) return;\n const mode = editorConfigProps?.mode;\n switch (mode) {\n case 'json':\n return jsonLint(val);\n case 'expression':\n default:\n return undefined;\n }\n };\n\n useEffect(() => {\n onBlurRef.current = onBlur;\n }, [onBlur]);\n\n const onBlurHandler = (editor: Editor) => {\n if (onBlurRef.current) {\n onBlurRef.current(editor.getDoc().getValue());\n }\n };\n\n const onBeforeChange = async (editor: Editor, _data: EditorChange, textvalue: string) => {\n const updatedTextValue = isSingleLine ? textvalue.replaceAll(/\\n/g, '') : textvalue;\n setCode(updatedTextValue);\n /** _data.origin is a flag from codemirror that tells from where the change was made in the code editor input */\n onChange?.(updatedTextValue, errorHandler(updatedTextValue), _data.origin);\n const currentCursor = editor.getCursor();\n const currentCharacter = editor\n .getTokenAt(currentCursor)\n .string.trim() as AutoCompleteTriggerChar;\n let newSuggestions: SuggestionType[] = [];\n\n if (autoCompleteTriggers?.includes(currentCharacter) && fetchSuggestions) {\n const suggestionData = await fetchSuggestions(currentCharacter, {\n line: currentCursor.line,\n ch: currentCursor.ch\n });\n\n if (suggestionData === undefined) {\n hasSuggestionRef.current = false;\n return;\n }\n\n setSuggestionTrigger({\n character: currentCharacter,\n cursorPosition: currentCursor\n });\n\n hasSuggestionRef.current = true;\n newSuggestions = [...suggestionData];\n if (mounted.current) {\n setSuggestions(newSuggestions);\n }\n }\n };\n\n useEffect(() => {\n if (!popover) {\n return;\n }\n const isSuggestionTriggerPresent =\n suggestionTrigger &&\n codeMirror\n ?.getTokenAt(suggestionTrigger.cursorPosition)\n .string.includes(suggestionTrigger.character);\n\n if (!isSuggestionTriggerPresent) {\n codeMirror?.closeHint();\n showPopover(false);\n setSuggestionTrigger(null);\n }\n }, [onBeforeChange]);\n\n useEffect(() => {\n if (codeMirror && isFocused && hasSuggestionRef.current && (suggestionTrigger || loading)) {\n autoComplete(codeMirror);\n showPopover(true);\n } else {\n codeMirror?.closeHint();\n showPopover(false);\n }\n }, [suggestions, loading, suggestionTrigger, codeMirror]);\n\n const [popoverInfo, setPopoverInfo] = useState<{\n targetElement: Element | null;\n errorMessages: string[];\n }>({ targetElement: null, errorMessages: [] });\n\n const [show, setShow] = useState(false);\n const [errorMapping, setErrorMapping] = useState<string[][]>([]);\n const [textMarkerList, setTextMarkerList] = useState<TextMarker<MarkerRange>[]>([]);\n\n const removeInLineErrors = () => {\n if (textMarkerList.length) {\n textMarkerList.forEach(item => item.clear());\n }\n };\n\n useEffect(() => {\n removeInLineErrors();\n if (inLineErrors?.length && codeMirror) {\n const markerList: TextMarker<MarkerRange>[] = [];\n const errorMessageMap = inLineErrors?.map(({ start, end, messages }, index) => {\n if (messages.length) {\n markerList.push(\n codeMirror.markText(start, end, {\n className: `cm-ex-underline-error error-${index}`\n })\n );\n return messages;\n }\n return [];\n });\n setTextMarkerList(markerList);\n setErrorMapping(errorMessageMap);\n } else {\n setErrorMapping([]);\n }\n }, [inLineErrors, codeMirror]);\n\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n\n const getErrors = (target: Element) => {\n const errorMessages: string[] = [];\n if (target) {\n errorMapping.forEach((item, index) => {\n if (target.classList.contains(`error-${index}`)) {\n errorMessages.push(...item);\n }\n });\n }\n\n return errorMessages;\n };\n\n const onMouseMove = (event: Event | null, type?: string) => {\n if (codeMirror && errorMapping.length) {\n let target: Element | null;\n\n if (type === 'cursor') {\n const coords = codeMirror.getCursor();\n const charCoords = codeMirror.charCoords(coords, 'window');\n target = document.elementFromPoint(charCoords.left, charCoords.top);\n } else {\n target = event?.target instanceof Element ? event.target : null;\n }\n\n if (target) {\n const errorMessages = getErrors(target);\n if (errorMessages.length) {\n setPopoverInfo(() => {\n return {\n targetElement: target,\n errorMessages\n };\n });\n setShow(true);\n } else {\n setShow(false);\n }\n }\n }\n };\n\n const onMouseLeave = () => {\n setShow(false);\n };\n\n const hidePopover = (e: KeyboardEvent) => {\n if (e.shiftKey && (e.metaKey || e.ctrlKey) && e.key === ' ') {\n onMouseMove(null, 'cursor');\n } else {\n setShow(false);\n }\n };\n\n useEffect(() => {\n if (codeMirror && inLineErrors?.length && errorMapping.length) {\n const codeMirrorWrapper = codeMirror.getWrapperElement();\n\n codeMirrorWrapper.addEventListener('keydown', hidePopover);\n codeMirrorWrapper.addEventListener('mousedown', onMouseLeave);\n\n const elementsWithClassName = Array.from(\n codeMirrorWrapper.getElementsByClassName('cm-ex-underline-error')\n );\n\n elementsWithClassName.forEach(element => {\n element.addEventListener('mouseenter', onMouseMove);\n element.addEventListener('mouseleave', onMouseLeave);\n });\n\n return () => {\n codeMirrorWrapper.removeEventListener('keydown', hidePopover);\n codeMirrorWrapper.removeEventListener('mousedown', onMouseLeave);\n\n elementsWithClassName.forEach(element => {\n element.removeEventListener('mouseenter', onMouseMove);\n element.removeEventListener('mouseleave', onMouseLeave);\n });\n };\n }\n return undefined;\n }, [value, inLineErrors, errorMapping, codeMirror]);\n\n const extendModeWithSingleLine = (\n mode: EditorConfiguration['mode'],\n singleLineEditor: boolean\n ) => {\n if (typeof mode === 'string' || (mode && typeof mode.name === 'string')) {\n return {\n name: typeof mode === 'string' ? mode : mode.name,\n isSingleLine: singleLineEditor\n };\n }\n return mode;\n };\n\n useEffect(() => {\n (async () => {\n if (editorConfigProps?.placeholder) {\n await import('codemirror/addon/display/placeholder');\n }\n\n if (languages.includes(editorConfigProps?.mode as string)) {\n await import('codemirror/mode/javascript/javascript');\n await import('codemirror/theme/eclipse.css');\n }\n\n if (editorConfigProps?.foldGutter && !isSingleLine) {\n await import('codemirror/addon/fold/foldcode');\n await import('codemirror/addon/fold/foldgutter');\n await import('codemirror/addon/fold/brace-fold');\n await import('codemirror/addon/fold/comment-fold');\n await import('codemirror/addon/fold/foldgutter.css');\n }\n\n if (editorConfigProps?.lint) {\n await import('codemirror/addon/lint/lint.css');\n await import('codemirror/addon/lint/lint');\n\n if (editorConfigProps.mode === 'json') {\n await import('codemirror/addon/lint/json-lint');\n registerHelper('lint', 'json', jsonLint);\n }\n }\n setShowEditor(true);\n })();\n }, [editorConfigProps]);\n\n const updatedEditorConfig: EditorConfiguration = useMemo(() => {\n const mode = extendModeWithSingleLine(editorConfigProps?.mode || 'expression', isSingleLine);\n return {\n ...editorConfigProps,\n lineWrapping: !isSingleLine,\n smartIndent: true,\n autoCloseBrackets: true,\n matchBrackets: true,\n lineNumbers: !isSingleLine && editorConfigProps?.lineNumbers,\n placeholder: editorConfigProps?.placeholder,\n extraKeys: {\n /** default tab and shift tab behavior\n * https://codemirror.net/5/\n * https://discuss.codemirror.net/t/does-tab-key-work-in-codemirror-6/2705\n */\n Tab: isSingleLine ? false : () => Pass,\n 'Shift-Tab': isSingleLine ? false : () => Pass,\n ...(isSingleLine ? { Enter: () => {} } : {})\n },\n mode,\n ...(languages.includes(editorConfigProps?.mode as string) ? { theme: 'eclipse' } : {}),\n ...(editorConfigProps?.foldGutter && !isSingleLine\n ? {\n foldGutter: true,\n gutters: (() => {\n const guttersArr: string[] = [];\n if (editorConfigProps?.lint) guttersArr.push('CodeMirror-lint-markers');\n if (editorConfigProps?.lineNumbers) guttersArr.push('CodeMirror-linenumbers');\n return [...guttersArr, 'CodeMirror-foldgutter'];\n })()\n }\n : {}),\n ...(editorConfigProps?.mode === 'json'\n ? {\n mode: 'application/json',\n lint: editorConfigProps.lint\n }\n : {})\n };\n }, [isSingleLine, editorConfigProps]);\n\n const handlePaste = (editor: Editor, event: ClipboardEvent) => {\n if (isSingleLine) {\n const doc = editor.getDoc();\n const pastedContent = event.clipboardData?.getData('text/plain').trim();\n const singleLineContent = pastedContent?.replace(/\\r?\\n|\\r/g, ' ') || '';\n\n if (doc && doc.getSelection()) {\n doc.replaceSelection(singleLineContent);\n } else {\n const cursor: Position = doc.getCursor();\n doc.replaceRange(singleLineContent, cursor);\n }\n const cursor: Position = doc.getCursor();\n doc.setCursor(cursor);\n event.preventDefault();\n }\n };\n\n useEffect(() => {\n const editor = editorRef.current;\n if (editor && isSingleLine) {\n editor.on('paste', handlePaste);\n }\n return () => {\n if (editor) {\n editor.off('paste', handlePaste);\n }\n };\n }, [isSingleLine]);\n\n useEffect(() => {\n const textArea = codeMirror?.getInputField();\n if (!textArea) return;\n\n let describedBy = textArea.getAttribute('aria-describedby') || '';\n const ids = new Set(describedBy.split(' ').filter(item => item));\n\n if (ariaDescribedBy && !ids.has(ariaDescribedBy)) {\n ids.add(ariaDescribedBy);\n }\n\n if (errors && !ids.has(errorDescId)) {\n ids.add(errorDescId);\n } else if (!errors && ids.has(errorDescId)) {\n ids.delete(errorDescId);\n }\n\n if (!ariaDescribedBy) {\n describedBy = ids.has(errorDescId) ? errorDescId : '';\n } else describedBy = Array.from(ids).join(' ').trim();\n\n if (describedBy) {\n textArea.setAttribute('aria-describedby', describedBy);\n } else {\n textArea.removeAttribute('aria-describedby');\n }\n }, [codeMirror, errors, ariaDescribedBy]);\n\n return (\n <>\n <StyledSuggestions isLoading={loading} suggestions={suggestions} />\n <StyledCodeEditor\n {...restProps}\n data-testid={testIds.root}\n container={{\n direction: 'column',\n justify: 'between'\n }}\n item={{\n grow: 1\n }}\n ref={ref}\n errors={errors}\n readOnly={readOnly}\n isLoading={loading}\n suggestions={suggestions}\n isSingleLine={isSingleLine}\n editorConfigProps={updatedEditorConfig}\n >\n {showEditor && (\n <ReactCodeMirror\n value={value}\n onBeforeChange={onBeforeChange}\n options={updatedEditorConfig}\n editorDidMount={editor => {\n editor.setSize('100%', '100%');\n setCodeMirror(editor);\n editorRef.current = editor;\n }}\n onBlur={editor => {\n setIsFocused(false);\n if (onBlur) {\n onBlurHandler(editor);\n }\n }}\n onFocus={() => {\n setIsFocused(true);\n }}\n />\n )}\n {popoverInfo.errorMessages.length > 0 && popoverInfo.targetElement !== null && (\n <Popover\n as={StyledPopover}\n show={show}\n target={popoverInfo.targetElement}\n placement='bottom-start'\n data-testid={testIds.errorPopover}\n >\n <Flex container={{ direction: 'column', gap: 1 }}>\n <Flex container={{ gap: 1 }}>\n <StyledWarnIcon name='warn-solid' />\n <Text variant='h4'>\n {t('errors', [], {\n count:\n popoverInfo.errorMessages.length === 1\n ? 1\n : // Using NaN to always select \"other\" pluralization form\n NaN\n })}\n </Text>\n </Flex>\n {popoverInfo.errorMessages.length > 1 ? (\n <UnorderedList as={StyledList} items={popoverInfo.errorMessages} />\n ) : (\n <Text>{popoverInfo.errorMessages}</Text>\n )}\n </Flex>\n </Popover>\n )}\n {errors && (\n <StyledFormFieldInfo id={errorDescId} status='error' data-testid={testIds.errorMessage}>\n {errors}\n </StyledFormFieldInfo>\n )}\n </StyledCodeEditor>\n </>\n );\n }\n);\n\nexport default withTestIds(CodeEditor, getEditorsTestIds);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAK1E,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAEF,eAAO,MAAM,cAAc,0LAIzB,CAAC;AAIH,eAAO,MAAM,aAAa,yGAWxB,CAAC;AAIH,eAAO,MAAM,UAAU,yGAIrB,CAAC;AAGH,eAAO,MAAM,gBAAgB;gBAEb,OAAO;aACV,MAAM;eACJ,OAAO;iBACL,cAAc,EAAE;
|
|
1
|
+
{"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAK1E,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAEF,eAAO,MAAM,cAAc,0LAIzB,CA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AAS,CAAC,CAAC;;;mBAGX,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE;;;;0BAId,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE;;;4BAGnB,WAAW;;;;4BAIX,UAAU;;wBAEd,IAAI,CAAC,OAAO;;;;iBAInB,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO;;;MAGlC,CAAC,SAAS;QACZ,WAAW,EAAE,MAAM,GAAG,CAAC;QACvB,GAAG,CAAA;;4BAEqB,WAAW;;KAElC;GACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { createGlobalStyle, css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp, calculateFontSize, Flex, Icon } from '@pega/cosmos-react-core';\nimport { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\n\nimport type { CodeEditorProps, SuggestionType } from './CodeEditor.types';\n\nconst primaryBackground = 'primary-background';\nconst contentWidth = 'content-width';\n\nexport const StyledLoading = styled.div`\n font-size: 1.5rem;\n`;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPopover = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n font-size: ${fontSize.xxs};\n max-width: ${theme.base[contentWidth].sm};\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n `;\n});\n\nStyledPopover.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled.div(({ theme }) => {\n return css`\n padding-inline-start: calc(0.25 * ${theme.base.spacing});\n `;\n});\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledCodeEditor = styled(Flex)<\n Pick<CodeEditorProps, 'showEditorOnly' | 'editorConfigProps' | 'isSingleLine'> & {\n isLoading?: boolean;\n errors?: string;\n readOnly?: boolean;\n suggestions: SuggestionType[];\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 input\n }\n },\n errors,\n readOnly,\n showEditorOnly,\n editorConfigProps,\n isSingleLine = false\n}) => {\n const jsonMode = editorConfigProps?.mode === 'application/json';\n\n return css`\n width: 100%;\n ${showEditorOnly &&\n css`\n max-height: 10rem;\n `}\n position: relative;\n ${!showEditorOnly &&\n css`\n max-height: 100%;\n `}\n overflow-y: auto;\n ${StyledFormField} {\n flex-grow: 1;\n }\n\n /* PADDING */\n .react-codemirror2 {\n flex-grow: 1;\n ${isSingleLine\n ? css`\n min-height: ${input.height};\n & * {\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n }\n `\n : css`\n min-height: 3.75rem;\n `}\n overflow-y: auto;\n ${readOnly &&\n !jsonMode &&\n css`\n max-height: 5.625rem;\n `}\n }\n\n .CodeMirror-placeholder {\n opacity: ${base.transparency['transparent-3']};\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 0.063rem; /* prevents collapsing before first draw */\n padding: ${base.spacing} 0;\n }\n\n ${editorConfigProps?.theme === 'eclipse' &&\n css`\n .cm-s-eclipse .cm-string {\n color: ${base.palette.urgent};\n }\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 padding: 0 ${base.spacing};\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 ${isSingleLine &&\n css`\n white-space: nowrap;\n height: auto;\n padding-inline-end: ${base.spacing};\n `}\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\n .cm-ex-context {\n color: ${base.palette.interactive};\n }\n .cm-ex-additional-operators {\n color: ${base.palette.interactive};\n }\n .cm-ex-operator {\n color: ${base.palette.warn};\n font-weight: bold;\n }\n .cm-ex-comment {\n color: ${base.palette.info};\n }\n .cm-ex-ruleName {\n color: ${base.palette.success};\n }\n .cm-ex-delimeter {\n color: ${base.palette['foreground-color']};\n }\n .cm-ex-constant {\n color: ${base.palette.pending};\n }\n .cm-ex-underline-error {\n text-decoration: underline;\n text-decoration-style: wavy;\n text-decoration-color: ${base.colors.red.medium};\n }\n `;\n});\n\nStyledCodeEditor.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestions = createGlobalStyle<{\n isLoading?: boolean;\n suggestions: SuggestionType[];\n}>(({ theme: { base }, isLoading, suggestions }) => {\n const activeColor = mix(0.85, base.palette[primaryBackground], base.palette.interactive);\n\n const hoverColor = mix(0.95, base.palette[primaryBackground], base.palette.interactive);\n\n const fontSizes = calculateFontSize(base['font-size'], base['font-scale']);\n return css`\n .CodeMirror-hints {\n position: absolute;\n z-index: calc(${base['z-index'].backdrop} + 1);\n transition: height ${base.animation.speed} ${base.animation.timing.ease};\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[primaryBackground]};\n font-size: ${fontSizes.s};\n max-height: 12rem;\n overflow-y: auto;\n min-width: ${base[contentWidth].xs};\n }\n\n .CodeMirror-hint {\n width: calc(1.5 * ${base[contentWidth].xs});\n cursor: pointer;\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 body .CodeMirror-lint-tooltip {\n z-index: ${base['z-index'].tooltip};\n }\n\n ${!isLoading &&\n suggestions?.length > 0 &&\n css`\n li.CodeMirror-hint-active {\n background-color: ${activeColor};\n }\n `}\n `;\n});\n\nStyledSuggestions.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"CodeEditor.styles.js","sourceRoot":"","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C;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { createGlobalStyle, css } from 'styled-components';\nimport { mix } from 'polished';\n\nimport { defaultThemeProp, calculateFontSize, Flex, Icon } from '@pega/cosmos-react-core';\nimport { StyledFormField } from '@pega/cosmos-react-core/lib/components/FormField/FormField';\n\nimport type { CodeEditorProps, SuggestionType } from './CodeEditor.types';\n\nconst primaryBackground = 'primary-background';\nconst contentWidth = 'content-width';\n\nexport const StyledLoading = styled.div`\n font-size: 1.5rem;\n`;\n\nexport const StyledWarnIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.urgent};\n `;\n});\n\nStyledWarnIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPopover = styled.div(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n font-size: ${fontSize.xxs};\n max-width: ${theme.base[contentWidth].sm};\n padding: ${theme.base.spacing};\n white-space: pre-line;\n word-break: break-word;\n pointer-events: none;\n `;\n});\n\nStyledPopover.defaultProps = defaultThemeProp;\n\nexport const StyledList = styled.div(({ theme }) => {\n return css`\n padding-inline-start: calc(0.25 * ${theme.base.spacing});\n `;\n});\nStyledList.defaultProps = defaultThemeProp;\n\nexport const StyledCodeEditor = styled(Flex)<\n Pick<CodeEditorProps, 'showEditorOnly' | 'editorConfigProps' | 'isSingleLine'> & {\n isLoading?: boolean;\n errors?: string;\n readOnly?: boolean;\n suggestions: SuggestionType[];\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 input\n }\n },\n errors,\n readOnly,\n showEditorOnly,\n editorConfigProps,\n isSingleLine = false\n}) => {\n const jsonMode = editorConfigProps?.mode === 'application/json';\n\n return css`\n width: 100%;\n ${showEditorOnly &&\n css`\n max-height: 10rem;\n width: 27vw;\n `}\n position: relative;\n ${!showEditorOnly &&\n css`\n max-height: 100%;\n `}\n overflow-y: auto;\n ${StyledFormField} {\n flex-grow: 1;\n }\n\n /* PADDING */\n .react-codemirror2 {\n flex-grow: 1;\n ${isSingleLine\n ? css`\n min-height: ${input.height};\n & * {\n scrollbar-width: none;\n ::-webkit-scrollbar {\n display: none;\n }\n }\n `\n : css`\n min-height: 3.75rem;\n `}\n overflow-y: auto;\n ${readOnly &&\n !jsonMode &&\n css`\n max-height: 5.625rem;\n `}\n }\n\n .CodeMirror-placeholder {\n opacity: ${base.transparency['transparent-3']};\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 0.063rem; /* prevents collapsing before first draw */\n padding: ${base.spacing} 0;\n }\n\n ${editorConfigProps?.theme === 'eclipse' &&\n css`\n .cm-s-eclipse .cm-string {\n color: ${base.palette.urgent};\n }\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 padding: 0 ${base.spacing};\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 ${isSingleLine &&\n css`\n white-space: nowrap;\n height: auto;\n padding-inline-end: ${base.spacing};\n `}\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\n .cm-ex-context {\n color: ${base.palette.interactive};\n }\n .cm-ex-additional-operators {\n color: ${base.palette.interactive};\n }\n .cm-ex-operator {\n color: ${base.palette.warn};\n font-weight: bold;\n }\n .cm-ex-comment {\n color: ${base.palette.info};\n }\n .cm-ex-ruleName {\n color: ${base.palette.success};\n }\n .cm-ex-delimeter {\n color: ${base.palette['foreground-color']};\n }\n .cm-ex-constant {\n color: ${base.palette.pending};\n }\n .cm-ex-underline-error {\n text-decoration: underline;\n text-decoration-style: wavy;\n text-decoration-color: ${base.colors.red.medium};\n }\n `;\n});\n\nStyledCodeEditor.defaultProps = defaultThemeProp;\n\nexport const StyledSuggestions = createGlobalStyle<{\n isLoading?: boolean;\n suggestions: SuggestionType[];\n}>(({ theme: { base }, isLoading, suggestions }) => {\n const activeColor = mix(0.85, base.palette[primaryBackground], base.palette.interactive);\n\n const hoverColor = mix(0.95, base.palette[primaryBackground], base.palette.interactive);\n\n const fontSizes = calculateFontSize(base['font-size'], base['font-scale']);\n return css`\n .CodeMirror-hints {\n position: absolute;\n z-index: calc(${base['z-index'].backdrop} + 1);\n transition: height ${base.animation.speed} ${base.animation.timing.ease};\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[primaryBackground]};\n font-size: ${fontSizes.s};\n max-height: 12rem;\n overflow-y: auto;\n min-width: ${base[contentWidth].xs};\n }\n\n .CodeMirror-hint {\n width: calc(1.5 * ${base[contentWidth].xs});\n cursor: pointer;\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 body .CodeMirror-lint-tooltip {\n z-index: ${base['z-index'].tooltip};\n }\n\n ${!isLoading &&\n suggestions?.length > 0 &&\n css`\n li.CodeMirror-hint-active {\n background-color: ${activeColor};\n }\n `}\n `;\n});\n\nStyledSuggestions.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
2
2
|
import type { ExpressionBuilderProps } from './ExpressionBuilder.types';
|
|
3
|
-
declare const
|
|
4
|
-
|
|
3
|
+
declare const _default: ForwardRefForwardPropsComponent<ExpressionBuilderProps> & {
|
|
4
|
+
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["search", "explanation", "explain", "clear", "insert", "generate", "generated-expression", "describe-expression"]>;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
5
7
|
//# sourceMappingURL=ExpressionBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionBuilder/ExpressionBuilder.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpressionBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/ExpressionBuilder/ExpressionBuilder.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,KAAK,EAAuB,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;;;;AAuU7F,wBAAuE"}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';
|
|
3
|
-
import { Flex, SearchInput, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef, useEffect } from 'react';
|
|
3
|
+
import { Flex, SearchInput, useI18n, VisuallyHiddenText, withTestIds, useTestIds, useLiveLog, useAfterInitialEffect, Label, Text, Progress, AIButton, Button, TextArea } from '@pega/cosmos-react-core';
|
|
4
4
|
import ExpressionList from './ExpressionList';
|
|
5
|
-
import { StyledExpressionBuilder } from './ExpressionBuilder.styles';
|
|
5
|
+
import { StyledExpressionWrapper, StyledClearButton, StyledExplanationContainer, StyledExpressionBuilder, StyledCodeEditorContainer, StyledExplainContainer, StyledExpressions, StyledFormField, StyledGeneratedExpression, StyledInsertButton } from './ExpressionBuilder.styles';
|
|
6
6
|
import CodeEditor from './CodeEditor/CodeEditor';
|
|
7
7
|
import ExpressionBuilderContext from './ExpressionBuilderContext';
|
|
8
|
-
|
|
8
|
+
import { getExpressionBuilderIds } from './ExpressionBuilder.test-ids';
|
|
9
|
+
const ExpressionBuilder = forwardRef(({ testId, list, search, errors, defaultValue, handle, showEditorOnly = false, fetchSuggestions, loading, readOnly, onChange, inLineErrors, placeholder, generateExplanation, label, required, additionalInfo, generateExpression, ...restProps }, ref) => {
|
|
9
10
|
const t = useI18n();
|
|
11
|
+
const { announcePolite } = useLiveLog();
|
|
12
|
+
const textAreaRef = useRef(null);
|
|
10
13
|
const codeEditorHandle = useRef(null);
|
|
14
|
+
const generatedExpressionHandler = useRef(null);
|
|
15
|
+
const testIds = useTestIds(testId, getExpressionBuilderIds);
|
|
16
|
+
const { describeExpressionTextArea, onGenerateExpression, loadingExpression = false, generatedExpression, onInsert } = generateExpression || {};
|
|
11
17
|
const getExpression = () => {
|
|
12
18
|
return codeEditorHandle.current?.getValue() || '';
|
|
13
19
|
};
|
|
20
|
+
const insertExpression = (text, replaceContent) => {
|
|
21
|
+
return codeEditorHandle.current?.insertText(text, replaceContent);
|
|
22
|
+
};
|
|
14
23
|
useImperativeHandle(handle, () => ({
|
|
15
|
-
getExpression
|
|
16
|
-
|
|
24
|
+
getExpression,
|
|
25
|
+
...(!!generateExpression && { insertExpression })
|
|
26
|
+
}), [getExpression, insertExpression]);
|
|
17
27
|
const addExpression = (expression) => {
|
|
18
28
|
codeEditorHandle.current?.insertText(expression);
|
|
19
29
|
};
|
|
@@ -23,29 +33,60 @@ const ExpressionBuilder = forwardRef(function ExpressionBuilder({ list, search,
|
|
|
23
33
|
const ctxValue = useMemo(() => ({
|
|
24
34
|
accent: search.accent
|
|
25
35
|
}), [search.accent]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
useAfterInitialEffect(() => {
|
|
37
|
+
if (generateExplanation?.loadingExplanation) {
|
|
38
|
+
announcePolite({ message: t('generating_explanation') });
|
|
39
|
+
}
|
|
40
|
+
else if (generateExplanation?.explanation) {
|
|
41
|
+
announcePolite({ message: t('explanation_generated') });
|
|
42
|
+
}
|
|
43
|
+
}, [generateExplanation?.loadingExplanation, generateExplanation?.explanation]);
|
|
44
|
+
useAfterInitialEffect(() => {
|
|
45
|
+
if (loadingExpression) {
|
|
46
|
+
announcePolite({ message: t('generating_expression') });
|
|
47
|
+
}
|
|
48
|
+
if (generatedExpression && !loadingExpression) {
|
|
49
|
+
announcePolite({ message: t('expression_generated') });
|
|
50
|
+
}
|
|
51
|
+
}, [loadingExpression, generatedExpression]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (generatedExpression !== undefined) {
|
|
54
|
+
generatedExpressionHandler.current?.insertText(generatedExpression, true);
|
|
55
|
+
}
|
|
56
|
+
}, [generatedExpression]);
|
|
57
|
+
return (_jsxs(StyledExpressionBuilder, { "data-testid": testIds.root, ...restProps, ref: ref, container: {
|
|
58
|
+
justify: 'between'
|
|
30
59
|
}, item: {
|
|
31
60
|
grow: 1
|
|
32
|
-
}, children: [!readOnly && (_jsx(VisuallyHiddenText, { "aria-live": 'polite', role: 'status', children: t('results_count', [list.items?.length || 0], { count: list.items?.length || 0 }) })
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
61
|
+
}, showEditorOnly: showEditorOnly, showGenerateExpression: !!generateExpression, children: [!readOnly && !showEditorOnly && (_jsxs(_Fragment, { children: [_jsx(VisuallyHiddenText, { "aria-live": 'polite', role: 'status', children: t('results_count', [list.items?.length || 0], { count: list.items?.length || 0 }) }), _jsxs(Flex, { container: {
|
|
62
|
+
direction: 'column',
|
|
63
|
+
justify: 'between',
|
|
64
|
+
gap: 1,
|
|
65
|
+
pad: [1, 1, 1, 2]
|
|
66
|
+
}, item: {
|
|
67
|
+
grow: 1,
|
|
68
|
+
basis: '50%'
|
|
69
|
+
}, as: generateExpression ? StyledExpressions : undefined, children: [generateExpression && (_jsxs(_Fragment, { children: [_jsx(TextArea, { label: t('describe_expression'), defaultValue: describeExpressionTextArea?.defaultValue, autoResize: false, additionalInfo: describeExpressionTextArea?.additionalInfo, placeholder: describeExpressionTextArea?.placeholder, info: describeExpressionTextArea?.error, status: describeExpressionTextArea?.error ? 'error' : undefined, testId: testIds.describeExpression, ref: textAreaRef, row: 3 }), _jsx(Flex, { container: true, item: { alignSelf: 'end' }, children: loadingExpression ? (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [t('generating_expression'), _jsx(Progress, { placement: 'inline' })] })) : (onGenerateExpression && (_jsx(AIButton, { onClick: () => onGenerateExpression(textAreaRef.current?.value || ''), label: t('generate'), variant: 'secondary', "data-testid": testIds.generate }))) }), _jsxs(Flex, { container: { direction: 'column' }, item: { grow: 1 }, as: StyledGeneratedExpression, children: [_jsx(Label, { children: t('generated_expression') }), _jsx(CodeEditor, { codeEditorHandle: generatedExpressionHandler, editorConfigProps: {
|
|
70
|
+
mode: 'expression',
|
|
71
|
+
readOnly: true
|
|
72
|
+
}, readOnly: true, testId: testIds.generatedExpression }), loadingExpression && _jsx(Progress, { variant: 'ring', placement: 'local' })] }), onInsert && (_jsx(Button, { as: StyledInsertButton, onClick: () => onInsert(generatedExpressionHandler.current?.getValue() ?? ''), label: t('add'), "data-testid": testIds.insert, children: t('add') })), _jsx(Text, { variant: 'h4', children: t('library') })] })), _jsx(SearchInput, { testId: testIds.search, ...search }), _jsx(ExpressionBuilderContext.Provider, { value: ctxValue, children: _jsx(ExpressionList, { testId: testIds.root, ...list, onItemAdd: onItemAdd }) })] })] })), _jsxs(Flex, { container: {
|
|
40
73
|
direction: 'column',
|
|
41
|
-
|
|
74
|
+
gap: 1,
|
|
75
|
+
pad: [1, 2, 1, 1]
|
|
42
76
|
}, item: {
|
|
43
77
|
grow: 1,
|
|
44
78
|
basis: '50%'
|
|
45
|
-
}, children: _jsx(CodeEditor, { fetchSuggestions: fetchSuggestions, codeEditorHandle: codeEditorHandle, autoCompleteTriggers: ['.', '@', ':'], editorConfigProps: {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
}, as: StyledExpressionWrapper, children: [_jsx(Flex, { container: true, as: StyledCodeEditorContainer, explainEnabled: !!generateExplanation?.onExplain, children: label ? (_jsx(StyledFormField, { label: label, additionalInfo: additionalInfo, required: required, children: _jsx(CodeEditor, { testId: testIds.root, fetchSuggestions: fetchSuggestions, codeEditorHandle: codeEditorHandle, autoCompleteTriggers: ['.', '@', ':', '#', '(', ')'], editorConfigProps: {
|
|
80
|
+
mode: 'expression',
|
|
81
|
+
readOnly,
|
|
82
|
+
lineNumbers: true,
|
|
83
|
+
placeholder
|
|
84
|
+
}, defaultValue: defaultValue, loading: loading, errors: errors, readOnly: readOnly, onChange: onChange, "aria-label": t('expression_editor'), showEditorOnly: showEditorOnly, inLineErrors: inLineErrors }) })) : (_jsx(CodeEditor, { testId: testIds.root, fetchSuggestions: fetchSuggestions, codeEditorHandle: codeEditorHandle, autoCompleteTriggers: ['.', '@', ':', '#', '(', ')'], editorConfigProps: {
|
|
85
|
+
mode: 'expression',
|
|
86
|
+
readOnly,
|
|
87
|
+
lineNumbers: true,
|
|
88
|
+
placeholder
|
|
89
|
+
}, defaultValue: defaultValue, loading: loading, errors: errors, readOnly: readOnly, onChange: onChange, "aria-label": t('expression_editor'), showEditorOnly: showEditorOnly, inLineErrors: inLineErrors })) }), _jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsx(Flex, { container: true, item: { alignSelf: 'end' }, as: StyledExplainContainer, children: generateExplanation?.loadingExplanation ? (_jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [t('generating_explanation'), _jsx(Progress, { placement: 'inline' })] })) : (_jsx(AIButton, { onClick: generateExplanation?.onExplain, label: t('explain'), variant: 'secondary', "data-testid": testIds.explain })) }), _jsxs(Flex, { as: StyledExplanationContainer, container: { direction: 'column' }, children: [_jsx(TextArea, { label: 'Generated Explanation', value: generateExplanation?.explanation, autoResize: false, testId: testIds.explanation, readOnly: true }), generateExplanation?.loadingExplanation && (_jsx(Progress, { variant: 'ring', placement: 'local' }))] }), generateExplanation?.onClearExplanation && (_jsx(Button, { as: StyledClearButton, onClick: generateExplanation.onClearExplanation, label: t('clear_explanation'), "data-testid": testIds.clear, children: t('clear') }))] })] })] }));
|
|
49
90
|
});
|
|
50
|
-
export default ExpressionBuilder;
|
|
91
|
+
export default withTestIds(ExpressionBuilder, getExpressionBuilderIds);
|
|
51
92
|
//# sourceMappingURL=ExpressionBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpressionBuilder.js","sourceRoot":"","sources":["../../../src/components/ExpressionBuilder/ExpressionBuilder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAKzF,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,MAAM,iBAAiB,GAA4D,UAAU,CAC3F,SAAS,iBAAiB,CACxB,EACE,IAAI,EACJ,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,GAAG,SAAS,EAC4B,EAC1C,GAAkC;IAElC,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,gBAAgB,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAEnD,MAAM,aAAa,GAAG,GAAG,EAAE;QACzB,OAAO,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACpD,CAAC,CAAC;IAEF,mBAAmB,CACj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MAAM,GAAI,EAC3B,KAAC,wBAAwB,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAChD,KAAC,cAAc,OAAK,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,GAChB,IAC/B,CACR,EAED,KAAC,IAAI,IACH,SAAS,EAAE;oBACT,SAAS,EAAE,QAAQ;oBACnB,OAAO,EAAE,SAAS;iBACnB,EACD,IAAI,EAAE;oBACJ,IAAI,EAAE,CAAC;oBACP,KAAK,EAAE,KAAK;iBACb,YAED,KAAC,UAAU,IACT,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACrC,iBAAiB,EAAE;wBACjB,IAAI,EAAE,YAAY;wBAClB,QAAQ;qBACT,EACD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,gBACN,CAAC,CAAC,mBAAmB,CAAC,GAClC,GACG,IACF,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { forwardRef, useImperativeHandle, useMemo, useRef } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport { Flex, SearchInput, useI18n, VisuallyHiddenText } from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport type { ExpressionItemProps, ExpressionBuilderProps } from './ExpressionBuilder.types';\nimport type { EditorState } from './CodeEditor/CodeEditor.types';\nimport ExpressionList from './ExpressionList';\nimport { StyledExpressionBuilder } from './ExpressionBuilder.styles';\nimport CodeEditor from './CodeEditor/CodeEditor';\nimport ExpressionBuilderContext from './ExpressionBuilderContext';\n\nconst ExpressionBuilder: ForwardRefForwardPropsComponent<ExpressionBuilderProps> = forwardRef(\n function ExpressionBuilder(\n {\n list,\n search,\n errors,\n defaultValue,\n handle,\n fetchSuggestions,\n loading,\n readOnly,\n onChange,\n ...restProps\n }: PropsWithoutRef<ExpressionBuilderProps>,\n ref: ExpressionBuilderProps['ref']\n ) {\n const t = useI18n();\n const codeEditorHandle = useRef<EditorState>(null);\n\n const getExpression = () => {\n return codeEditorHandle.current?.getValue() || '';\n };\n\n useImperativeHandle(\n handle,\n () => ({\n getExpression\n }),\n [getExpression]\n );\n\n const addExpression = (expression: string) => {\n codeEditorHandle.current?.insertText(expression);\n };\n const onItemAdd = (id: ExpressionItemProps['id']) => {\n list.onItemAdd(id, addExpression);\n };\n\n const ctxValue = useMemo(\n () => ({\n accent: search.accent\n }),\n [search.accent]\n );\n\n return (\n <Flex\n {...restProps}\n as={StyledExpressionBuilder}\n ref={ref}\n container={{\n justify: 'between',\n colGap: 2,\n pad: 1\n }}\n item={{\n grow: 1\n }}\n >\n {!readOnly && (\n <VisuallyHiddenText aria-live='polite' role='status'>\n {t('results_count', [list.items?.length || 0], { count: list.items?.length || 0 })}\n </VisuallyHiddenText>\n )}\n {/* Column 1 */}\n {!readOnly && (\n <Flex\n container={{\n direction: 'column',\n justify: 'between',\n gap: 1\n }}\n item={{\n grow: 1,\n basis: '50%'\n }}\n >\n <SearchInput {...search} />\n <ExpressionBuilderContext.Provider value={ctxValue}>\n <ExpressionList {...list} onItemAdd={onItemAdd} />\n </ExpressionBuilderContext.Provider>\n </Flex>\n )}\n {/* Column 2 */}\n <Flex\n container={{\n direction: 'column',\n justify: 'between'\n }}\n item={{\n grow: 1,\n basis: '50%'\n }}\n >\n <CodeEditor\n fetchSuggestions={fetchSuggestions}\n codeEditorHandle={codeEditorHandle}\n autoCompleteTriggers={['.', '@', ':']}\n editorConfigProps={{\n mode: 'expression',\n readOnly\n }}\n defaultValue={defaultValue}\n loading={loading}\n errors={errors}\n readOnly={readOnly}\n onChange={onChange}\n aria-label={t('expression_editor')}\n />\n </Flex>\n </Flex>\n );\n }\n);\n\nexport default ExpressionBuilder;\n"]}
|
|
1
|
+
{"version":3,"file":"ExpressionBuilder.js","sourceRoot":"","sources":["../../../src/components/ExpressionBuilder/ExpressionBuilder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGpF,OAAO,EACL,IAAI,EACJ,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,UAAU,EACV,qBAAqB,EACrB,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAKjC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,iBAAiB,GAA4D,UAAU,CAC3F,CACE,EACE,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,YAAY,EACZ,MAAM,EACN,cAAc,GAAG,KAAK,EACtB,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,QAAQ,EACR,cAAc,EACd,kBAAkB,EAClB,GAAG,SAAS,EAC4B,EAC1C,GAAkC,EAClC,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,CAAC;IACxC,MAAM,WAAW,GAAG,MAAM,CAA6B,IAAI,CAAC,C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AI,IAAC,EAAE,EAAE,0BAA0B,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,aACtE,KAAC,QAAQ,IACP,KAAK,EAAC,uBAAuB,EAC7B,KAAK,EAAE,mBAAmB,EAAE,WAAW,EACvC,UAAU,EAAE,KAAK,EACjB,MAAM,EAAE,OAAO,CAAC,WAAW,EAC3B,QAAQ,SACR,EACD,mBAAmB,EAAE,kBAAkB,IAAI,CAC1C,KAAC,QAAQ,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,OAAO,GAAG,CAC9C,IACI,EAEN,mBAAmB,EAAE,kBAAkB,IAAI,CAC1C,KAAC,MAAM,IACL,EAAE,EAAE,iBAAiB,EACrB,OAAO,EAAE,mBAAmB,CAAC,kBAAkB,EAC/C,KAAK,EAAE,CAAC,CAAC,mBAAmB,CAAC,iBAChB,OAAO,CAAC,KAAK,YAEzB,CAAC,CAAC,OAAO,CAAC,GACJ,CACV,IACI,IACF,IACiB,CAC3B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["import { forwardRef, useImperativeHandle, useMemo, useRef, useEffect } from 'react';\nimport type { PropsWithoutRef } from 'react';\n\nimport {\n Flex,\n SearchInput,\n useI18n,\n VisuallyHiddenText,\n withTestIds,\n useTestIds,\n useLiveLog,\n useAfterInitialEffect,\n Label,\n Text,\n Progress,\n AIButton,\n Button,\n TextArea\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nimport type { ExpressionItemProps, ExpressionBuilderProps } from './ExpressionBuilder.types';\nimport type { EditorState } from './CodeEditor/CodeEditor.types';\nimport ExpressionList from './ExpressionList';\nimport {\n StyledExpressionWrapper,\n StyledClearButton,\n StyledExplanationContainer,\n StyledExpressionBuilder,\n StyledCodeEditorContainer,\n StyledExplainContainer,\n StyledExpressions,\n StyledFormField,\n StyledGeneratedExpression,\n StyledInsertButton\n} from './ExpressionBuilder.styles';\nimport CodeEditor from './CodeEditor/CodeEditor';\nimport ExpressionBuilderContext from './ExpressionBuilderContext';\nimport { getExpressionBuilderIds } from './ExpressionBuilder.test-ids';\n\nconst ExpressionBuilder: ForwardRefForwardPropsComponent<ExpressionBuilderProps> = forwardRef(\n (\n {\n testId,\n list,\n search,\n errors,\n defaultValue,\n handle,\n showEditorOnly = false,\n fetchSuggestions,\n loading,\n readOnly,\n onChange,\n inLineErrors,\n placeholder,\n generateExplanation,\n label,\n required,\n additionalInfo,\n generateExpression,\n ...restProps\n }: PropsWithoutRef<ExpressionBuilderProps>,\n ref: ExpressionBuilderProps['ref']\n ) => {\n const t = useI18n();\n const { announcePolite } = useLiveLog();\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const codeEditorHandle = useRef<EditorState>(null);\n const generatedExpressionHandler = useRef<EditorState>(null);\n const testIds = useTestIds(testId, getExpressionBuilderIds);\n const {\n describeExpressionTextArea,\n onGenerateExpression,\n loadingExpression = false,\n generatedExpression,\n onInsert\n } = generateExpression || {};\n\n const getExpression = () => {\n return codeEditorHandle.current?.getValue() || '';\n };\n\n const insertExpression = (text: string, replaceContent?: boolean) => {\n return codeEditorHandle.current?.insertText(text, replaceContent);\n };\n\n useImperativeHandle(\n handle,\n () => ({\n getExpression,\n ...(!!generateExpression && { insertExpression })\n }),\n [getExpression, insertExpression]\n );\n\n const addExpression = (expression: string) => {\n codeEditorHandle.current?.insertText(expression);\n };\n const onItemAdd = (id: ExpressionItemProps['id']) => {\n list.onItemAdd(id, addExpression);\n };\n\n const ctxValue = useMemo(\n () => ({\n accent: search.accent\n }),\n [search.accent]\n );\n\n useAfterInitialEffect(() => {\n if (generateExplanation?.loadingExplanation) {\n announcePolite({ message: t('generating_explanation') });\n } else if (generateExplanation?.explanation) {\n announcePolite({ message: t('explanation_generated') });\n }\n }, [generateExplanation?.loadingExplanation, generateExplanation?.explanation]);\n\n useAfterInitialEffect(() => {\n if (loadingExpression) {\n announcePolite({ message: t('generating_expression') });\n }\n if (generatedExpression && !loadingExpression) {\n announcePolite({ message: t('expression_generated') });\n }\n }, [loadingExpression, generatedExpression]);\n\n useEffect(() => {\n if (generatedExpression !== undefined) {\n generatedExpressionHandler.current?.insertText(generatedExpression, true);\n }\n }, [generatedExpression]);\n\n return (\n <StyledExpressionBuilder\n data-testid={testIds.root}\n {...restProps}\n ref={ref}\n container={{\n justify: 'between'\n }}\n item={{\n grow: 1\n }}\n showEditorOnly={showEditorOnly}\n showGenerateExpression={!!generateExpression}\n >\n {/* Results count and Column 1 */}\n {!readOnly && !showEditorOnly && (\n <>\n <VisuallyHiddenText aria-live='polite' role='status'>\n {t('results_count', [list.items?.length || 0], { count: list.items?.length || 0 })}\n </VisuallyHiddenText>\n <Flex\n container={{\n direction: 'column',\n justify: 'between',\n gap: 1,\n pad: [1, 1, 1, 2]\n }}\n item={{\n grow: 1,\n basis: '50%'\n }}\n as={generateExpression ? StyledExpressions : undefined}\n >\n {generateExpression && (\n <>\n <TextArea\n label={t('describe_expression')}\n defaultValue={describeExpressionTextArea?.defaultValue}\n autoResize={false}\n additionalInfo={describeExpressionTextArea?.additionalInfo}\n placeholder={describeExpressionTextArea?.placeholder}\n info={describeExpressionTextArea?.error}\n status={describeExpressionTextArea?.error ? 'error' : undefined}\n testId={testIds.describeExpression}\n ref={textAreaRef}\n row={3}\n />\n\n <Flex container item={{ alignSelf: 'end' }}>\n {loadingExpression ? (\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n {t('generating_expression')}\n <Progress placement='inline' />\n </Flex>\n ) : (\n onGenerateExpression && (\n <AIButton\n onClick={() => onGenerateExpression(textAreaRef.current?.value || '')}\n label={t('generate')}\n variant='secondary'\n data-testid={testIds.generate}\n />\n )\n )}\n </Flex>\n\n <Flex\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n as={StyledGeneratedExpression}\n >\n <Label>{t('generated_expression')}</Label>\n <CodeEditor\n codeEditorHandle={generatedExpressionHandler}\n editorConfigProps={{\n mode: 'expression',\n readOnly: true\n }}\n readOnly\n testId={testIds.generatedExpression}\n />\n {loadingExpression && <Progress variant='ring' placement='local' />}\n </Flex>\n\n {onInsert && (\n <Button\n as={StyledInsertButton}\n onClick={() => onInsert(generatedExpressionHandler.current?.getValue() ?? '')}\n label={t('add')}\n data-testid={testIds.insert}\n >\n {t('add')}\n </Button>\n )}\n\n <Text variant='h4'>{t('library')}</Text>\n </>\n )}\n <SearchInput testId={testIds.search} {...search} />\n <ExpressionBuilderContext.Provider value={ctxValue}>\n <ExpressionList testId={testIds.root} {...list} onItemAdd={onItemAdd} />\n </ExpressionBuilderContext.Provider>\n </Flex>\n </>\n )}\n {/* Column 2 */}\n <Flex\n container={{\n direction: 'column',\n gap: 1,\n pad: [1, 2, 1, 1]\n }}\n item={{\n grow: 1,\n basis: '50%'\n }}\n as={StyledExpressionWrapper}\n >\n <Flex\n container\n as={StyledCodeEditorContainer}\n explainEnabled={!!generateExplanation?.onExplain}\n >\n {label ? (\n <StyledFormField label={label} additionalInfo={additionalInfo} required={required}>\n <CodeEditor\n testId={testIds.root}\n fetchSuggestions={fetchSuggestions}\n codeEditorHandle={codeEditorHandle}\n autoCompleteTriggers={['.', '@', ':', '#', '(', ')']}\n editorConfigProps={{\n mode: 'expression',\n readOnly,\n lineNumbers: true,\n placeholder\n }}\n defaultValue={defaultValue}\n loading={loading}\n errors={errors}\n readOnly={readOnly}\n onChange={onChange}\n aria-label={t('expression_editor')}\n showEditorOnly={showEditorOnly}\n inLineErrors={inLineErrors}\n />\n </StyledFormField>\n ) : (\n <CodeEditor\n testId={testIds.root}\n fetchSuggestions={fetchSuggestions}\n codeEditorHandle={codeEditorHandle}\n autoCompleteTriggers={['.', '@', ':', '#', '(', ')']}\n editorConfigProps={{\n mode: 'expression',\n readOnly,\n lineNumbers: true,\n placeholder\n }}\n defaultValue={defaultValue}\n loading={loading}\n errors={errors}\n readOnly={readOnly}\n onChange={onChange}\n aria-label={t('expression_editor')}\n showEditorOnly={showEditorOnly}\n inLineErrors={inLineErrors}\n />\n )}\n </Flex>\n <Flex container={{ direction: 'column', gap: 1 }}>\n <Flex container item={{ alignSelf: 'end' }} as={StyledExplainContainer}>\n {generateExplanation?.loadingExplanation ? (\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n {t('generating_explanation')}\n <Progress placement='inline' />\n </Flex>\n ) : (\n <AIButton\n onClick={generateExplanation?.onExplain}\n label={t('explain')}\n variant='secondary'\n data-testid={testIds.explain}\n />\n )}\n </Flex>\n <Flex as={StyledExplanationContainer} container={{ direction: 'column' }}>\n <TextArea\n label='Generated Explanation'\n value={generateExplanation?.explanation}\n autoResize={false}\n testId={testIds.explanation}\n readOnly\n />\n {generateExplanation?.loadingExplanation && (\n <Progress variant='ring' placement='local' />\n )}\n </Flex>\n\n {generateExplanation?.onClearExplanation && (\n <Button\n as={StyledClearButton}\n onClick={generateExplanation.onClearExplanation}\n label={t('clear_explanation')}\n data-testid={testIds.clear}\n >\n {t('clear')}\n </Button>\n )}\n </Flex>\n </Flex>\n </StyledExpressionBuilder>\n );\n }\n);\n\nexport default withTestIds(ExpressionBuilder, getExpressionBuilderIds);\n"]}
|