@pega/cosmos-react-build 10.0.0-build.15.0 → 10.0.0-build.15.1
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/DynamicInput/ConstantControl.d.ts +4 -2
- package/lib/components/DynamicInput/ConstantControl.d.ts.map +1 -1
- package/lib/components/DynamicInput/ConstantControl.js +12 -4
- package/lib/components/DynamicInput/ConstantControl.js.map +1 -1
- package/lib/components/DynamicInput/ConstantControl.styles.d.ts +3 -0
- package/lib/components/DynamicInput/ConstantControl.styles.d.ts.map +1 -0
- package/lib/components/DynamicInput/ConstantControl.styles.js +87 -0
- package/lib/components/DynamicInput/ConstantControl.styles.js.map +1 -0
- package/lib/components/DynamicInput/DynamicInput.test-ids.d.ts +1 -0
- package/lib/components/DynamicInput/DynamicInput.test-ids.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.test-ids.js +3 -0
- package/lib/components/DynamicInput/DynamicInput.test-ids.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +10 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +27 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/package.json +4 -4
|
@@ -53,8 +53,10 @@ type ConstantPhoneConfig = {
|
|
|
53
53
|
format: 'Phone';
|
|
54
54
|
props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;
|
|
55
55
|
};
|
|
56
|
-
export type ConstantControlConfig = ConstantTextConfig | ConstantDecimalConfig | ConstantIntegerConfig | ConstantPercentageConfig | ConstantTextAreaConfig | ConstantDateConfig | ConstantDateTimeConfig | ConstantTimeConfig | ConstantBooleanConfig | ConstantCurrencyConfig | ConstantPhoneConfig
|
|
57
|
-
|
|
56
|
+
export type ConstantControlConfig = (ConstantTextConfig | ConstantDecimalConfig | ConstantIntegerConfig | ConstantPercentageConfig | ConstantTextAreaConfig | ConstantDateConfig | ConstantDateTimeConfig | ConstantTimeConfig | ConstantBooleanConfig | ConstantCurrencyConfig | ConstantPhoneConfig) & {
|
|
57
|
+
onConfigurationAction?: () => void;
|
|
58
|
+
} & Pick<FormControlProps, 'status' | 'disabled' | 'readOnly'>;
|
|
59
|
+
declare const ConstantControl: ({ format, props, required, disabled, readOnly, onConfigurationAction, "data-testid": testId, id: inputUid }: Pick<FormControlProps, "id" | "required" | "disabled" | "status" | "readOnly"> & {
|
|
58
60
|
"data-testid"?: string;
|
|
59
61
|
} & ConstantControlConfig) => JSX.Element | null;
|
|
60
62
|
export default ConstantControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConstantControl.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,yBAAyB,CAAC;AAQjC,MAAM,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAC7C,gBAAgB,EAChB,OAAO,GAAG,aAAa,GAAG,gBAAgB,GAAG,MAAM,GAAG,UAAU,CACjE,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,UAAU,CAAC,UAAU,EAAE,sBAAsB,GAAG,UAAU,CAAC,GAAG;QACnE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;KAC/C,CAAC;CACH,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAA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,OAAO,GAAG,UAAU,CAAC,GAAG;QAChF,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;QACnC,aAAa,CAAC,EAAE,aAAa,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC,kBAAkB,EAAE,sBAAsB,CAAC,CAAC;CAC/D,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC,eAAe,EAAE,sBAAsB,GAAG,iBAAiB,CAAC,CAAC;CAChF,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,CAChC,kBAAkB,GAClB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,GACxB,sBAAsB,GACtB,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,qBAAqB,GACrB,sBAAsB,GACtB,mBAAmB,CACtB,GAAG;IACF,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CACpC,GAAG,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;AAE/D,QAAA,MAAM,eAAe,GAAI,6GAStB,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,qBAAqB,uBA4HxB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CurrencyInput, DateInput, DateTimeInput, Input, NumberInput, PhoneInput, TextArea, TimeInput } from '@pega/cosmos-react-core';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, CurrencyInput, DateInput, DateTimeInput, Icon, Input, NumberInput, PhoneInput, TextArea, TimeInput, useI18n, useTestIds, registerIcon } from '@pega/cosmos-react-core';
|
|
3
|
+
import * as ToolboxOpen from '@pega/cosmos-react-core/lib/components/Icon/streamline-icons/toolbox-open.icon';
|
|
3
4
|
import BooleanControl from './BooleanControl';
|
|
4
|
-
|
|
5
|
+
import StyledConstantControl from './ConstantControl.styles';
|
|
6
|
+
import { getConstantControlTestIds } from './DynamicInput.test-ids';
|
|
7
|
+
registerIcon(ToolboxOpen);
|
|
8
|
+
const ConstantControl = ({ format, props, required, disabled, readOnly, onConfigurationAction, 'data-testid': testId, id: inputUid }) => {
|
|
9
|
+
const t = useI18n();
|
|
10
|
+
const testIds = useTestIds(testId, getConstantControlTestIds);
|
|
5
11
|
let control = null;
|
|
6
12
|
const { value } = props;
|
|
7
13
|
// Note: This is just a typeguard for the value prop.
|
|
@@ -52,7 +58,9 @@ const ConstantControl = ({ format, props, required, 'data-testid': testId, id: i
|
|
|
52
58
|
control = _jsx(TimeInput, { ...props, "data-testid": testId, id: inputUid, required: required });
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
|
-
|
|
61
|
+
if (!control || !onConfigurationAction || disabled || readOnly)
|
|
62
|
+
return control;
|
|
63
|
+
return (_jsxs(StyledConstantControl, { children: [control, _jsx(Button, { "data-testid": testIds.configurationAction, icon: true, label: t('use_configuration_label'), onClick: onConfigurationAction, variant: 'simple', children: _jsx(Icon, { name: 'toolbox-open', set: 'streamline' }) })] }));
|
|
56
64
|
};
|
|
57
65
|
export default ConstantControl;
|
|
58
66
|
//# sourceMappingURL=ConstantControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConstantControl.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,aAAa,EACb,SAAS,EACT,aAAa,EACb,KAAK,EACL,WAAW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AAC,aAAa,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAChG,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;QAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,GAAG,KAAC,SAAS,OAAK,KAAK,iBAAe,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;QAC5F,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import type { ChangeEvent } from 'react';\n\nimport {\n CurrencyInput,\n DateInput,\n DateTimeInput,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput\n} from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n CurrencyInputProps,\n DateInputProps,\n DateTimeInputProps,\n FormControlProps,\n InputProps,\n NumberInputProps,\n OmitStrict,\n PhoneInputProps,\n TextAreaProps,\n TimeInputProps\n} from '@pega/cosmos-react-core';\n\nimport BooleanControl from './BooleanControl';\n\nexport type FormControlPropsToOmit = keyof Pick<\n FormControlProps,\n 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig =\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig;\n\nconst ConstantControl = ({\n format,\n props,\n required,\n 'data-testid': testId,\n id: inputUid\n}: Pick<FormControlProps, 'id' | 'required' | 'disabled' | 'status' | 'readOnly'> & {\n 'data-testid'?: string;\n} & ConstantControlConfig) => {\n let control: JSX.Element | null = null;\n\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = <CurrencyInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = <NumberInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testId}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = <BooleanControl {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = <DateTimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Date') {\n control = <DateInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n }\n return control;\n};\n\nexport default ConstantControl;\n"]}
|
|
1
|
+
{"version":3,"file":"ConstantControl.js","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EAAE,qBAAqB,EAC9B,OAAO,EAAC,QAAQ,YAEhB,KAAC,IAAI,IAAC,IAAI,EAAC,cAAc,EAAC,GAAG,EAAC,YAAY,GAAG,GACtC,IACa,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import type { ChangeEvent } from 'react';\n\nimport {\n Button,\n CurrencyInput,\n DateInput,\n DateTimeInput,\n Icon,\n Input,\n NumberInput,\n PhoneInput,\n TextArea,\n TimeInput,\n useI18n,\n useTestIds,\n registerIcon\n} from '@pega/cosmos-react-core';\nimport type {\n ComboBoxProps,\n CurrencyInputProps,\n DateInputProps,\n DateTimeInputProps,\n FormControlProps,\n InputProps,\n NumberInputProps,\n OmitStrict,\n PhoneInputProps,\n TextAreaProps,\n TimeInputProps\n} from '@pega/cosmos-react-core';\nimport * as ToolboxOpen from '@pega/cosmos-react-core/lib/components/Icon/streamline-icons/toolbox-open.icon';\n\nimport BooleanControl from './BooleanControl';\nimport StyledConstantControl from './ConstantControl.styles';\nimport { getConstantControlTestIds } from './DynamicInput.test-ids';\n\nregisterIcon(ToolboxOpen);\nexport type FormControlPropsToOmit = keyof Pick<\n FormControlProps,\n 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required'\n>;\n\ntype ConstantTextConfig = {\n format: 'Text';\n props: OmitStrict<InputProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDecimalConfig = {\n format: 'Decimal';\n props: OmitStrict<NumberInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantIntegerConfig = {\n format: 'Integer';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'showDecimal'\n >;\n};\n\ntype ConstantPercentageConfig = {\n format: 'Percentage';\n props: OmitStrict<\n NumberInputProps,\n FormControlPropsToOmit | 'showGroupSeparators' | 'numberOfDecimals' | 'unit'\n >;\n};\n\ntype ConstantTextAreaConfig = {\n format: 'Text (paragraph)';\n props: OmitStrict<TextAreaProps, FormControlPropsToOmit | 'onChange'> & {\n onChange: (value: string | undefined) => void;\n };\n};\n\ntype ConstantDateConfig = {\n format: 'Date';\n props: OmitStrict<DateInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantDateTimeConfig = {\n format: 'DateTime';\n props: OmitStrict<DateTimeInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantTimeConfig = {\n format: 'Time';\n props: OmitStrict<TimeInputProps, FormControlPropsToOmit>;\n};\n\nexport type BooleanLabels = 'true|false' | 'always|never';\n\nexport type ConstantBooleanConfig = {\n format: 'Boolean';\n props: OmitStrict<ComboBoxProps, FormControlPropsToOmit | 'value' | 'onChange'> & {\n value?: boolean;\n onChange: (value: boolean) => void;\n booleanLabels?: BooleanLabels;\n };\n};\n\ntype ConstantCurrencyConfig = {\n format: 'Currency';\n props: OmitStrict<CurrencyInputProps, FormControlPropsToOmit>;\n};\n\ntype ConstantPhoneConfig = {\n format: 'Phone';\n props: OmitStrict<PhoneInputProps, FormControlPropsToOmit | 'showCountryCode'>;\n};\n\nexport type ConstantControlConfig = (\n | ConstantTextConfig\n | ConstantDecimalConfig\n | ConstantIntegerConfig\n | ConstantPercentageConfig\n | ConstantTextAreaConfig\n | ConstantDateConfig\n | ConstantDateTimeConfig\n | ConstantTimeConfig\n | ConstantBooleanConfig\n | ConstantCurrencyConfig\n | ConstantPhoneConfig\n) & {\n onConfigurationAction?: () => void;\n} & Pick<FormControlProps, 'status' | 'disabled' | 'readOnly'>;\n\nconst ConstantControl = ({\n format,\n props,\n required,\n disabled,\n readOnly,\n onConfigurationAction,\n 'data-testid': testId,\n id: inputUid\n}: Pick<FormControlProps, 'id' | 'required' | 'disabled' | 'status' | 'readOnly'> & {\n 'data-testid'?: string;\n} & ConstantControlConfig) => {\n const t = useI18n();\n const testIds = useTestIds(testId, getConstantControlTestIds);\n let control: JSX.Element | null = null;\n\n const { value } = props;\n // Note: This is just a typeguard for the value prop.\n if (typeof value === 'string' || value === undefined) {\n if (format === 'Text') {\n control = (\n <Input\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Text (paragraph)') {\n control = (\n <TextArea\n {...props}\n data-testid={testId}\n id={inputUid}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => {\n props.onChange(e.target.value);\n }}\n required={required}\n />\n );\n }\n\n if (format === 'Currency') {\n control = <CurrencyInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Percentage') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n numberOfDecimals={undefined}\n unit='percent'\n required={required}\n />\n );\n }\n\n if (format === 'Integer') {\n control = (\n <NumberInput\n {...props}\n data-testid={testId}\n id={inputUid}\n showGroupSeparators={false}\n // Note: Getting single occurrence of callback when '.' is entered w/o showDecimal = false.\n showDecimal={false}\n required={required}\n />\n );\n }\n\n if (format === 'Decimal') {\n control = <NumberInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Phone') {\n control = (\n <PhoneInput\n {...props}\n data-testid={testId}\n id={inputUid}\n required={required}\n showCountryCode\n />\n );\n }\n }\n\n if (format === 'Boolean') {\n control = <BooleanControl {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n // Note: This is just a typeguard for the value prop.\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n value instanceof Date ||\n value === undefined\n ) {\n if (format === 'DateTime') {\n control = <DateTimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Date') {\n control = <DateInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n\n if (format === 'Time') {\n control = <TimeInput {...props} data-testid={testId} id={inputUid} required={required} />;\n }\n }\n if (!control || !onConfigurationAction || disabled || readOnly) return control;\n\n return (\n <StyledConstantControl>\n {control}\n <Button\n data-testid={testIds.configurationAction}\n icon\n label={t('use_configuration_label')}\n onClick={onConfigurationAction}\n variant='simple'\n >\n <Icon name='toolbox-open' set='streamline' />\n </Button>\n </StyledConstantControl>\n );\n};\n\nexport default ConstantControl;\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const StyledConstantControl: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export default StyledConstantControl;
|
|
3
|
+
//# sourceMappingURL=ConstantControl.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstantControl.styles.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.styles.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,qBAAqB,6NA8FzB,CAAC;AAIH,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { StyledButton, StyledFormControl, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
3
|
+
// Layout-only wrapper: the control keeps its own StyledFormControl and the action is joined to it.
|
|
4
|
+
const StyledConstantControl = styled.div(({ theme }) => {
|
|
5
|
+
const { base: { 'border-radius': baseRadius, 'hit-area': hitArea, spacing }, components: { input: { height: inputHeight }, 'form-control': { 'background-color': backgroundColor, 'border-radius': radius, 'border-width': borderWidth, 'foreground-color': foregroundColor, ':focus': { 'border-color': focusBorderColor, 'box-shadow': focusBoxShadow } } } } = theme;
|
|
6
|
+
const endRadius = `calc(${baseRadius} * ${radius})`;
|
|
7
|
+
return css `
|
|
8
|
+
position: relative;
|
|
9
|
+
isolation: isolate;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: stretch;
|
|
12
|
+
width: 100%;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
border-start-end-radius: ${endRadius};
|
|
15
|
+
border-end-end-radius: ${endRadius};
|
|
16
|
+
|
|
17
|
+
> :first-child {
|
|
18
|
+
flex: 1 1 0%;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> ${StyledButton} {
|
|
23
|
+
display: none;
|
|
24
|
+
flex: 0 0 auto;
|
|
25
|
+
align-self: center;
|
|
26
|
+
width: calc(${inputHeight} - 2 * ${borderWidth});
|
|
27
|
+
min-width: calc(${inputHeight} - 2 * ${borderWidth});
|
|
28
|
+
height: calc(${inputHeight} - 2 * ${borderWidth});
|
|
29
|
+
min-height: calc(${inputHeight} - 2 * ${borderWidth});
|
|
30
|
+
|
|
31
|
+
/* Leaves room for the focus ring of the control's own trailing button (e.g. Date picker). */
|
|
32
|
+
margin-inline: calc(${spacing} / 2) ${borderWidth};
|
|
33
|
+
padding: 0;
|
|
34
|
+
border: 0;
|
|
35
|
+
border-radius: ${endRadius};
|
|
36
|
+
background-color: transparent;
|
|
37
|
+
color: ${foregroundColor};
|
|
38
|
+
|
|
39
|
+
@media (pointer: coarse) {
|
|
40
|
+
width: calc(${hitArea['finger-min']} - 2 * ${borderWidth});
|
|
41
|
+
min-width: calc(${hitArea['finger-min']} - 2 * ${borderWidth});
|
|
42
|
+
height: calc(${hitArea['finger-min']} - 2 * ${borderWidth});
|
|
43
|
+
min-height: calc(${hitArea['finger-min']} - 2 * ${borderWidth});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* The wrapper draws one focus border and ring around the control and the action, so the
|
|
48
|
+
nested form controls (e.g. Phone, Number, ComboBox) must not draw their own. */
|
|
49
|
+
&:focus-within {
|
|
50
|
+
background-color: ${backgroundColor};
|
|
51
|
+
|
|
52
|
+
&::after {
|
|
53
|
+
content: '';
|
|
54
|
+
position: absolute;
|
|
55
|
+
inset: 0;
|
|
56
|
+
border: ${borderWidth} solid ${focusBorderColor};
|
|
57
|
+
border-start-end-radius: ${endRadius};
|
|
58
|
+
border-end-end-radius: ${endRadius};
|
|
59
|
+
box-shadow: ${focusBoxShadow};
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
|
|
62
|
+
/* Behind the children so their own focus rings (action, Date picker) are not covered. */
|
|
63
|
+
z-index: -1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
> ${StyledButton} {
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&& ${StyledFormControl} {
|
|
71
|
+
border-color: ${focusBorderColor};
|
|
72
|
+
box-shadow: none;
|
|
73
|
+
transition: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&& > :first-child,
|
|
77
|
+
&& > :first-child ${StyledFormControl}:last-child {
|
|
78
|
+
border-inline-end-width: 0;
|
|
79
|
+
border-start-end-radius: 0;
|
|
80
|
+
border-end-end-radius: 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
});
|
|
85
|
+
StyledConstantControl.defaultProps = defaultThemeProp;
|
|
86
|
+
export default StyledConstantControl;
|
|
87
|
+
//# sourceMappingURL=ConstantControl.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConstantControl.styles.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/ConstantControl.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE5F,mGAAmG;AACnG,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrD,MAAM,EACJ,IAAI,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EACnE,UAAU,EAAE,EACV,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAC9B,cAAc,EAAE,EACd,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,WAAW,EAC3B,kBAAkB,EAAE,eAAe,EACnC,QAAQ,EAAE,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,EAC7E,EACF,EACF,GAAG,KAAK,CAAC;IAEV,MAAM,SAAS,GAAG,QAAQ,UAAU,MAAM,MAAM,GAAG,CAAC;IAEpD,OAAO,GAAG,CAAA;;;;;;;+BAOmB,SAAS;6BACX,SAAS;;;;;;;QAO9B,YAAY;;;;oBAIA,WAAW,UAAU,WAAW;wBAC5B,WAAW,UAAU,WAAW;qBACnC,WAAW,UAAU,WAAW;yBAC5B,WAAW,UAAU,WAAW;;;4BAG7B,OAAO,SAAS,WAAW;;;uBAGhC,SAAS;;eAEjB,eAAe;;;sBAGR,OAAO,CAAC,YAAY,CAAC,UAAU,WAAW;0BACtC,OAAO,CAAC,YAAY,CAAC,UAAU,WAAW;uBAC7C,OAAO,CAAC,YAAY,CAAC,UAAU,WAAW;2BACtC,OAAO,CAAC,YAAY,CAAC,UAAU,WAAW;;;;;;;0BAO3C,eAAe;;;;;;kBAMvB,WAAW,UAAU,gBAAgB;mCACpB,SAAS;iCACX,SAAS;sBACpB,cAAc;;;;;;;UAO1B,YAAY;;;;WAIX,iBAAiB;wBACJ,gBAAgB;;;;;;0BAMd,iBAAiB;;;;;;GAMxC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,eAAe,qBAAqB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport { StyledButton, StyledFormControl, defaultThemeProp } from '@pega/cosmos-react-core';\n\n// Layout-only wrapper: the control keeps its own StyledFormControl and the action is joined to it.\nconst StyledConstantControl = styled.div(({ theme }) => {\n const {\n base: { 'border-radius': baseRadius, 'hit-area': hitArea, spacing },\n components: {\n input: { height: inputHeight },\n 'form-control': {\n 'background-color': backgroundColor,\n 'border-radius': radius,\n 'border-width': borderWidth,\n 'foreground-color': foregroundColor,\n ':focus': { 'border-color': focusBorderColor, 'box-shadow': focusBoxShadow }\n }\n }\n } = theme;\n\n const endRadius = `calc(${baseRadius} * ${radius})`;\n\n return css`\n position: relative;\n isolation: isolate;\n display: flex;\n align-items: stretch;\n width: 100%;\n min-width: 0;\n border-start-end-radius: ${endRadius};\n border-end-end-radius: ${endRadius};\n\n > :first-child {\n flex: 1 1 0%;\n min-width: 0;\n }\n\n > ${StyledButton} {\n display: none;\n flex: 0 0 auto;\n align-self: center;\n width: calc(${inputHeight} - 2 * ${borderWidth});\n min-width: calc(${inputHeight} - 2 * ${borderWidth});\n height: calc(${inputHeight} - 2 * ${borderWidth});\n min-height: calc(${inputHeight} - 2 * ${borderWidth});\n\n /* Leaves room for the focus ring of the control's own trailing button (e.g. Date picker). */\n margin-inline: calc(${spacing} / 2) ${borderWidth};\n padding: 0;\n border: 0;\n border-radius: ${endRadius};\n background-color: transparent;\n color: ${foregroundColor};\n\n @media (pointer: coarse) {\n width: calc(${hitArea['finger-min']} - 2 * ${borderWidth});\n min-width: calc(${hitArea['finger-min']} - 2 * ${borderWidth});\n height: calc(${hitArea['finger-min']} - 2 * ${borderWidth});\n min-height: calc(${hitArea['finger-min']} - 2 * ${borderWidth});\n }\n }\n\n /* The wrapper draws one focus border and ring around the control and the action, so the\n nested form controls (e.g. Phone, Number, ComboBox) must not draw their own. */\n &:focus-within {\n background-color: ${backgroundColor};\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n border: ${borderWidth} solid ${focusBorderColor};\n border-start-end-radius: ${endRadius};\n border-end-end-radius: ${endRadius};\n box-shadow: ${focusBoxShadow};\n pointer-events: none;\n\n /* Behind the children so their own focus rings (action, Date picker) are not covered. */\n z-index: -1;\n }\n\n > ${StyledButton} {\n display: inline-flex;\n }\n\n && ${StyledFormControl} {\n border-color: ${focusBorderColor};\n box-shadow: none;\n transition: none;\n }\n\n && > :first-child,\n && > :first-child ${StyledFormControl}:last-child {\n border-inline-end-width: 0;\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n }\n `;\n});\n\nStyledConstantControl.defaultProps = defaultThemeProp;\n\nexport default StyledConstantControl;\n"]}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const getDynamicInputTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["field", "menu", "control", "label", "info", "additional-info", "actions", "suggestion-accept", "suggestion-reject"]>;
|
|
2
|
+
export declare const getConstantControlTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["configuration-action"]>;
|
|
2
3
|
//# sourceMappingURL=DynamicInput.test-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,0PAKxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"DynamicInput.test-ids.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.test-ids.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,0PAKxB,CAAC;AAEZ,eAAO,MAAM,yBAAyB,6JAE3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.test-ids.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qEAAqE,CAAC;AAE/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,eAAe,EAAE;IACnE,OAAO;IACP,MAAM;IACN,SAAS;IACT,GAAG,QAAQ;CACH,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\nimport { elements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';\n\nexport const getDynamicInputTestIds = createTestIds('dynamic-input', [\n 'field',\n 'menu',\n 'control',\n ...elements\n] as const);\n"]}
|
|
1
|
+
{"version":3,"file":"DynamicInput.test-ids.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.test-ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,qEAAqE,CAAC;AAE/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC,eAAe,EAAE;IACnE,OAAO;IACP,MAAM;IACN,SAAS;IACT,GAAG,QAAQ;CACH,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC,kBAAkB,EAAE;IACzE,sBAAsB;CACd,CAAC,CAAC","sourcesContent":["import { createTestIds } from '@pega/cosmos-react-core';\nimport { elements } from '@pega/cosmos-react-core/lib/components/FormField/FormField.test-ids';\n\nexport const getDynamicInputTestIds = createTestIds('dynamic-input', [\n 'field',\n 'menu',\n 'control',\n ...elements\n] as const);\n\nexport const getConstantControlTestIds = createTestIds('constant-control', [\n 'configuration-action'\n] as const);\n"]}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import 'codemirror/addon/hint/show-hint.js';
|
|
2
2
|
import 'codemirror/addon/edit/closebrackets';
|
|
3
3
|
import 'codemirror/addon/edit/matchbrackets';
|
|
4
|
+
import type { Editor } from 'codemirror';
|
|
4
5
|
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
5
|
-
import type { CodeEditorProps } from './CodeEditor.types';
|
|
6
|
+
import type { AutoCompleteTriggerChar, CodeEditorProps } from './CodeEditor.types';
|
|
7
|
+
/** Finds the latest occurrence of a trigger character before the cursor, or returns null if none exists. */
|
|
8
|
+
export declare const getUpdatedTrigger: (editor: Pick<Editor, "getCursor" | "getLine">, character: AutoCompleteTriggerChar) => {
|
|
9
|
+
character: AutoCompleteTriggerChar;
|
|
10
|
+
cursorPosition: {
|
|
11
|
+
line: number;
|
|
12
|
+
ch: number;
|
|
13
|
+
};
|
|
14
|
+
} | null;
|
|
6
15
|
declare const _default: ForwardRefForwardPropsComponent<CodeEditorProps> & {
|
|
7
16
|
getTestIds: (testIdProp?: import("@pega/cosmos-react-core").TestIdProp["testId"]) => import("@pega/cosmos-react-core").TestIdsRecord<readonly ["error-popover", "error-message"]>;
|
|
8
17
|
};
|
|
@@ -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;
|
|
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;AAE7C,OAAO,KAAK,EACV,MAAM,EAMP,MAAM,YAAY,CAAC;AAiBpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAG/E,OAAO,KAAK,EACV,uBAAuB,EACvB,eAAe,EAIhB,MAAM,oBAAoB,CAAC;AAwB5B,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,IAAI,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC,EAC7C,WAAW,uBAAuB;;;;;;QAiBnC,CAAC;;;;AAy1BF,wBAA0D"}
|
|
@@ -17,6 +17,22 @@ const commentText = 'ex-comment';
|
|
|
17
17
|
const javaScriptLanguages = ['json', 'javascript'];
|
|
18
18
|
const modesWithEclipseTheme = ['json', 'javascript', 'css'];
|
|
19
19
|
const additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];
|
|
20
|
+
/** Finds the latest occurrence of a trigger character before the cursor, or returns null if none exists. */
|
|
21
|
+
export const getUpdatedTrigger = (editor, character) => {
|
|
22
|
+
const latestCursor = editor.getCursor();
|
|
23
|
+
const latestLine = editor.getLine(latestCursor.line) || '';
|
|
24
|
+
const latestTriggerIndex = latestLine.lastIndexOf(character, latestCursor.ch - 1);
|
|
25
|
+
if (latestTriggerIndex < 0) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
character,
|
|
30
|
+
cursorPosition: {
|
|
31
|
+
line: latestCursor.line,
|
|
32
|
+
ch: latestTriggerIndex + 1
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
};
|
|
20
36
|
defineMode('expression', (config, parserConfig) => {
|
|
21
37
|
const isSingleLine = parserConfig.isSingleLine;
|
|
22
38
|
const tokens = [
|
|
@@ -294,6 +310,11 @@ const CodeEditor = forwardRef(({ testId, fetchSuggestions, autoCompleteTriggers,
|
|
|
294
310
|
}
|
|
295
311
|
isFetchingRef.current = false;
|
|
296
312
|
fetchAbortRef.current = null;
|
|
313
|
+
const updatedTrigger = getUpdatedTrigger(editor, currentCharacter);
|
|
314
|
+
if (updatedTrigger) {
|
|
315
|
+
suggestionTriggerRef.current = updatedTrigger;
|
|
316
|
+
setSuggestionTrigger(updatedTrigger);
|
|
317
|
+
}
|
|
297
318
|
if (suggestionData === undefined) {
|
|
298
319
|
hasSuggestionRef.current = false;
|
|
299
320
|
suggestionTriggerRef.current = null;
|
|
@@ -313,6 +334,12 @@ const CodeEditor = forwardRef(({ testId, fetchSuggestions, autoCompleteTriggers,
|
|
|
313
334
|
return;
|
|
314
335
|
const line = editor.getLine(trigger.cursorPosition.line);
|
|
315
336
|
if (line?.[trigger.cursorPosition.ch - 1] !== trigger.character) {
|
|
337
|
+
const updatedTrigger = getUpdatedTrigger(editor, trigger.character);
|
|
338
|
+
if (updatedTrigger) {
|
|
339
|
+
suggestionTriggerRef.current = updatedTrigger;
|
|
340
|
+
setSuggestionTrigger(updatedTrigger);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
316
343
|
debouncedShowHintRef.current.cancel();
|
|
317
344
|
fetchAbortRef.current?.abort();
|
|
318
345
|
isFetchingRef.current = false;
|
|
@@ -1 +1 @@
|
|
|
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,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUxE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AASjG,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,IAAI,IAAI,QAA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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 useTheme,\n Popover,\n Text,\n UnorderedList,\n Flex,\n Button,\n Icon,\n useI18n,\n useTestIds,\n withTestIds,\n useUID,\n debounce,\n Actions\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 EditorHintOptions,\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 javaScriptLanguages = ['json', 'javascript'];\nconst modesWithEclipseTheme = ['json', 'javascript', 'css'];\n\nconst additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];\n\ninterface ExpressionModeState {\n inString: false | '\"' | \"'\";\n inMultiLineComment: boolean;\n}\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(): ExpressionModeState {\n return { inString: false, inMultiLineComment: false };\n },\n token(stream, state: ExpressionModeState) {\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\n /* Highlights single and multi line comments - only if not inside a string */\n if (!state.inString) {\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 }\n\n // Used to identify the constants in the expression\n if (!state.inMultiLineComment) {\n // Check if we're starting a string\n if (!state.inString) {\n const nextChar = stream.peek();\n if (nextChar === \"'\" || nextChar === '\"') {\n state.inString = nextChar; // Store which quote type we're in\n stream.next(); // Skip opening quote\n }\n }\n\n // Process string content\n if (state.inString) {\n const quoteChar = state.inString;\n let escaped = false;\n\n while (!stream.eol()) {\n const char = stream.next();\n\n if (escaped) {\n // Previous char was backslash, this char is escaped\n escaped = false;\n } else if (char === '\\\\') {\n // Start escape sequence\n escaped = true;\n } else if (char === quoteChar) {\n // Found unescaped closing quote\n state.inString = false;\n return quoteChar === '\"' ? 'ex-constant' : contextText;\n }\n }\n\n // Reached end of line while still in string\n return quoteChar === '\"' ? 'ex-constant' : contextText;\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 value: controlledValue,\n loading = false,\n readOnly,\n isSingleLine = false,\n errors,\n onChange,\n onBlur,\n inLineErrors,\n 'aria-describedby': ariaDescribedBy,\n onFormat,\n actions,\n label,\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 const isFetchingRef = useRef(false);\n const fetchAbortRef = useRef<AbortController | null>(null);\n const suggestionTriggerRef = useRef<{\n character: AutoCompleteTriggerChar;\n cursorPosition: Position;\n } | null>(null);\n\n const isReplacingHintRef = useRef(false);\n const debouncedShowHintRef = useRef(\n debounce((codeEditor: Editor, hintOptions: EditorHintOptions) => {\n isReplacingHintRef.current = true;\n try {\n codeEditor.closeHint();\n showHint(codeEditor, getCodeSuggestions, hintOptions);\n } finally {\n isReplacingHintRef.current = false;\n }\n }, 200)\n );\n const theme = useTheme();\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: loading || isFetchingRef.current,\n triggerCharacterCursorPos: suggestionTrigger?.cursorPosition,\n theme\n };\n\n debouncedShowHintRef.current(codeEditor, hintOptions);\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 useEffect(() => {\n if (typeof controlledValue === 'string') {\n setCode(prevValue => (controlledValue !== prevValue ? controlledValue : prevValue));\n }\n }, [controlledValue]);\n\n useEffect(() => {\n if (!codeMirror) return;\n\n const refreshEditor = () => {\n codeMirror.refresh();\n };\n\n let frameA = 0;\n let frameB = 0;\n\n const scheduleRefresh = () => {\n cancelAnimationFrame(frameA);\n cancelAnimationFrame(frameB);\n\n frameA = requestAnimationFrame(() => {\n refreshEditor();\n frameB = requestAnimationFrame(refreshEditor);\n });\n };\n\n scheduleRefresh();\n\n const codeMirrorWrapper = codeMirror.getWrapperElement();\n const resizeObserver = new ResizeObserver(entries => {\n const [entry] = entries;\n if (!entry) return;\n\n const { width, height } = entry.contentRect;\n if (width > 0 && height > 0) {\n scheduleRefresh();\n }\n });\n\n resizeObserver.observe(codeMirrorWrapper);\n\n return () => {\n cancelAnimationFrame(frameA);\n cancelAnimationFrame(frameB);\n resizeObserver.disconnect();\n };\n }, [codeMirror]);\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 normalizedTextValue = textvalue.replaceAll(/\\r\\n?/g, '\\n');\n const updatedTextValue = isSingleLine\n ? normalizedTextValue.replaceAll(/\\n/g, '')\n : normalizedTextValue;\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\n if (_data.origin === 'paste') {\n // Recalculate layout/gutters right after paste so line indices render correctly.\n requestAnimationFrame(() => editor.refresh());\n }\n\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 fetchAbortRef.current?.abort();\n const abortController = new AbortController();\n fetchAbortRef.current = abortController;\n\n isFetchingRef.current = true;\n suggestionTriggerRef.current = {\n character: currentCharacter,\n cursorPosition: currentCursor\n };\n setSuggestionTrigger({\n character: currentCharacter,\n cursorPosition: currentCursor\n });\n setSuggestions([]);\n let suggestionData;\n try {\n suggestionData = await fetchSuggestions(currentCharacter, {\n line: currentCursor.line,\n ch: currentCursor.ch\n });\n } catch {\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n return;\n }\n\n if (abortController.signal.aborted) {\n return;\n }\n\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n\n if (suggestionData === undefined) {\n hasSuggestionRef.current = false;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n return;\n }\n\n hasSuggestionRef.current = true;\n newSuggestions = [...suggestionData];\n if (mounted.current) {\n setSuggestions(newSuggestions);\n }\n }\n };\n\n const onChangeMirror = (editor: Editor) => {\n const trigger = suggestionTriggerRef.current;\n if (!trigger) return;\n const line = editor.getLine(trigger.cursorPosition.line);\n if (line?.[trigger.cursorPosition.ch - 1] !== trigger.character) {\n debouncedShowHintRef.current.cancel();\n fetchAbortRef.current?.abort();\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n setSuggestions([]);\n editor.closeHint();\n showPopover(false);\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) {\n autoComplete(codeMirror);\n showPopover(true);\n } else {\n codeMirror?.closeHint();\n setSuggestionTrigger(null);\n showPopover(false);\n }\n }, [suggestions, loading, suggestionTrigger, codeMirror]);\n\n // endCompletion fires whenever CodeMirror closes the hint widget for any reason:\n // clicking outside, pressing Escape, or selecting an item. Clear trigger state\n // so the useEffect above does not immediately re-open the hint.\n useEffect(() => {\n if (!codeMirror) return;\n const handleEndCompletion = () => {\n // Ignore endCompletion fired by showHint replacing an existing hint widget\n if (isReplacingHintRef.current) return;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n setSuggestions([]);\n showPopover(false);\n };\n codeMirror.on('endCompletion', handleEndCompletion);\n return () => {\n codeMirror.off('endCompletion', handleEndCompletion);\n };\n }, [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 fetchAbortRef.current?.abort();\n debouncedShowHintRef.current.cancel();\n editorRef.current?.closeHint();\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 const mode =\n typeof editorConfigProps?.mode === 'string'\n ? editorConfigProps.mode\n : editorConfigProps?.mode?.name;\n\n if (editorConfigProps?.placeholder) {\n await import('codemirror/addon/display/placeholder');\n }\n\n if (mode && javaScriptLanguages.includes(mode)) {\n await import('codemirror/mode/javascript/javascript');\n }\n\n if (mode === 'css') {\n await import('codemirror/mode/css/css');\n await import('codemirror/addon/hint/css-hint');\n }\n\n if (mode && modesWithEclipseTheme.includes(mode)) {\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 (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 modeName =\n typeof editorConfigProps?.mode === 'string'\n ? editorConfigProps.mode\n : editorConfigProps?.mode?.name;\n const mode = extendModeWithSingleLine(editorConfigProps?.mode || 'expression', isSingleLine);\n return {\n ...editorConfigProps,\n readOnly: readOnly ? 'nocursor' : false,\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 ...(modeName && modesWithEclipseTheme.includes(modeName) ? { 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 ...(modeName === 'json'\n ? {\n mode: 'application/json',\n lint: editorConfigProps?.lint\n }\n : {})\n };\n }, [isSingleLine, editorConfigProps, readOnly]);\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 const showToolbar = !!(onFormat || actions || label);\n\n return (\n <>\n <StyledSuggestions isLoading={loading} suggestions={suggestions} theme={theme} />\n <StyledCodeEditor\n {...restProps}\n data-testid={testIds.root}\n container={{\n direction: 'column',\n justify: 'start',\n gap: 1\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 {showToolbar && (\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 0.5 }}\n item={{ shrink: 0 }}\n >\n {label && (\n <Text as='span' variant='h4'>\n {label}\n </Text>\n )}\n {(onFormat || actions) && (\n <div>\n {onFormat && (\n <Button\n variant='simple'\n icon\n onClick={() => onFormat()}\n disabled={readOnly || !value.trim()}\n label={t('format')}\n >\n <Icon name='expression' set='streamline' />\n </Button>\n )}\n {actions && <Actions items={actions} iconOnly />}\n </div>\n )}\n </Flex>\n )}\n {showEditor && (\n <ReactCodeMirror\n value={value}\n onBeforeChange={onBeforeChange}\n onChange={onChangeMirror}\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={editor => {\n editor.refresh();\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,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAUxE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,aAAa,EACb,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,OAAO,EACR,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AASjG,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACnD,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,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,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,aACzB,KAAC,cAAc,IAAC,IAAI,EAAC,YAAY,GAAG,EACpC,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YACf,CAAC,CAAC,QAAQ,EAAE,EAAE,EAAE;gDACf,KAAK,EACH,WAAW,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC;oDACpC,CAAC,CAAC,CAAC;oDACH,CAAC,CAAC,wDAAwD;wDACxD,GAAG;6CACV,CAAC,GACG,IACF,EACN,WAAW,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACtC,KAAC,aAAa,IAAC,EAAE,EAAE,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 useTheme,\n Popover,\n Text,\n UnorderedList,\n Flex,\n Button,\n Icon,\n useI18n,\n useTestIds,\n withTestIds,\n useUID,\n debounce,\n Actions\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 EditorHintOptions,\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 javaScriptLanguages = ['json', 'javascript'];\nconst modesWithEclipseTheme = ['json', 'javascript', 'css'];\n\nconst additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];\n\ninterface ExpressionModeState {\n inString: false | '\"' | \"'\";\n inMultiLineComment: boolean;\n}\n\n/** Finds the latest occurrence of a trigger character before the cursor, or returns null if none exists. */\nexport const getUpdatedTrigger = (\n editor: Pick<Editor, 'getCursor' | 'getLine'>,\n character: AutoCompleteTriggerChar\n) => {\n const latestCursor = editor.getCursor();\n const latestLine = editor.getLine(latestCursor.line) || '';\n const latestTriggerIndex = latestLine.lastIndexOf(character, latestCursor.ch - 1);\n\n if (latestTriggerIndex < 0) {\n return null;\n }\n\n return {\n character,\n cursorPosition: {\n line: latestCursor.line,\n ch: latestTriggerIndex + 1\n }\n };\n};\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(): ExpressionModeState {\n return { inString: false, inMultiLineComment: false };\n },\n token(stream, state: ExpressionModeState) {\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\n /* Highlights single and multi line comments - only if not inside a string */\n if (!state.inString) {\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 }\n\n // Used to identify the constants in the expression\n if (!state.inMultiLineComment) {\n // Check if we're starting a string\n if (!state.inString) {\n const nextChar = stream.peek();\n if (nextChar === \"'\" || nextChar === '\"') {\n state.inString = nextChar; // Store which quote type we're in\n stream.next(); // Skip opening quote\n }\n }\n\n // Process string content\n if (state.inString) {\n const quoteChar = state.inString;\n let escaped = false;\n\n while (!stream.eol()) {\n const char = stream.next();\n\n if (escaped) {\n // Previous char was backslash, this char is escaped\n escaped = false;\n } else if (char === '\\\\') {\n // Start escape sequence\n escaped = true;\n } else if (char === quoteChar) {\n // Found unescaped closing quote\n state.inString = false;\n return quoteChar === '\"' ? 'ex-constant' : contextText;\n }\n }\n\n // Reached end of line while still in string\n return quoteChar === '\"' ? 'ex-constant' : contextText;\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 value: controlledValue,\n loading = false,\n readOnly,\n isSingleLine = false,\n errors,\n onChange,\n onBlur,\n inLineErrors,\n 'aria-describedby': ariaDescribedBy,\n onFormat,\n actions,\n label,\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 const isFetchingRef = useRef(false);\n const fetchAbortRef = useRef<AbortController | null>(null);\n const suggestionTriggerRef = useRef<{\n character: AutoCompleteTriggerChar;\n cursorPosition: Position;\n } | null>(null);\n\n const isReplacingHintRef = useRef(false);\n const debouncedShowHintRef = useRef(\n debounce((codeEditor: Editor, hintOptions: EditorHintOptions) => {\n isReplacingHintRef.current = true;\n try {\n codeEditor.closeHint();\n showHint(codeEditor, getCodeSuggestions, hintOptions);\n } finally {\n isReplacingHintRef.current = false;\n }\n }, 200)\n );\n const theme = useTheme();\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: loading || isFetchingRef.current,\n triggerCharacterCursorPos: suggestionTrigger?.cursorPosition,\n theme\n };\n\n debouncedShowHintRef.current(codeEditor, hintOptions);\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 useEffect(() => {\n if (typeof controlledValue === 'string') {\n setCode(prevValue => (controlledValue !== prevValue ? controlledValue : prevValue));\n }\n }, [controlledValue]);\n\n useEffect(() => {\n if (!codeMirror) return;\n\n const refreshEditor = () => {\n codeMirror.refresh();\n };\n\n let frameA = 0;\n let frameB = 0;\n\n const scheduleRefresh = () => {\n cancelAnimationFrame(frameA);\n cancelAnimationFrame(frameB);\n\n frameA = requestAnimationFrame(() => {\n refreshEditor();\n frameB = requestAnimationFrame(refreshEditor);\n });\n };\n\n scheduleRefresh();\n\n const codeMirrorWrapper = codeMirror.getWrapperElement();\n const resizeObserver = new ResizeObserver(entries => {\n const [entry] = entries;\n if (!entry) return;\n\n const { width, height } = entry.contentRect;\n if (width > 0 && height > 0) {\n scheduleRefresh();\n }\n });\n\n resizeObserver.observe(codeMirrorWrapper);\n\n return () => {\n cancelAnimationFrame(frameA);\n cancelAnimationFrame(frameB);\n resizeObserver.disconnect();\n };\n }, [codeMirror]);\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 normalizedTextValue = textvalue.replaceAll(/\\r\\n?/g, '\\n');\n const updatedTextValue = isSingleLine\n ? normalizedTextValue.replaceAll(/\\n/g, '')\n : normalizedTextValue;\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\n if (_data.origin === 'paste') {\n // Recalculate layout/gutters right after paste so line indices render correctly.\n requestAnimationFrame(() => editor.refresh());\n }\n\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 fetchAbortRef.current?.abort();\n const abortController = new AbortController();\n fetchAbortRef.current = abortController;\n\n isFetchingRef.current = true;\n suggestionTriggerRef.current = {\n character: currentCharacter,\n cursorPosition: currentCursor\n };\n setSuggestionTrigger({\n character: currentCharacter,\n cursorPosition: currentCursor\n });\n setSuggestions([]);\n let suggestionData;\n try {\n suggestionData = await fetchSuggestions(currentCharacter, {\n line: currentCursor.line,\n ch: currentCursor.ch\n });\n } catch {\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n return;\n }\n\n if (abortController.signal.aborted) {\n return;\n }\n\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n\n const updatedTrigger = getUpdatedTrigger(editor, currentCharacter);\n if (updatedTrigger) {\n suggestionTriggerRef.current = updatedTrigger;\n setSuggestionTrigger(updatedTrigger);\n }\n\n if (suggestionData === undefined) {\n hasSuggestionRef.current = false;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n return;\n }\n\n hasSuggestionRef.current = true;\n newSuggestions = [...suggestionData];\n if (mounted.current) {\n setSuggestions(newSuggestions);\n }\n }\n };\n\n const onChangeMirror = (editor: Editor) => {\n const trigger = suggestionTriggerRef.current;\n if (!trigger) return;\n const line = editor.getLine(trigger.cursorPosition.line);\n if (line?.[trigger.cursorPosition.ch - 1] !== trigger.character) {\n const updatedTrigger = getUpdatedTrigger(editor, trigger.character);\n if (updatedTrigger) {\n suggestionTriggerRef.current = updatedTrigger;\n setSuggestionTrigger(updatedTrigger);\n return;\n }\n\n debouncedShowHintRef.current.cancel();\n fetchAbortRef.current?.abort();\n isFetchingRef.current = false;\n fetchAbortRef.current = null;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n setSuggestions([]);\n editor.closeHint();\n showPopover(false);\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) {\n autoComplete(codeMirror);\n showPopover(true);\n } else {\n codeMirror?.closeHint();\n setSuggestionTrigger(null);\n showPopover(false);\n }\n }, [suggestions, loading, suggestionTrigger, codeMirror]);\n\n // endCompletion fires whenever CodeMirror closes the hint widget for any reason:\n // clicking outside, pressing Escape, or selecting an item. Clear trigger state\n // so the useEffect above does not immediately re-open the hint.\n useEffect(() => {\n if (!codeMirror) return;\n const handleEndCompletion = () => {\n // Ignore endCompletion fired by showHint replacing an existing hint widget\n if (isReplacingHintRef.current) return;\n suggestionTriggerRef.current = null;\n setSuggestionTrigger(null);\n setSuggestions([]);\n showPopover(false);\n };\n codeMirror.on('endCompletion', handleEndCompletion);\n return () => {\n codeMirror.off('endCompletion', handleEndCompletion);\n };\n }, [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 fetchAbortRef.current?.abort();\n debouncedShowHintRef.current.cancel();\n editorRef.current?.closeHint();\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 const mode =\n typeof editorConfigProps?.mode === 'string'\n ? editorConfigProps.mode\n : editorConfigProps?.mode?.name;\n\n if (editorConfigProps?.placeholder) {\n await import('codemirror/addon/display/placeholder');\n }\n\n if (mode && javaScriptLanguages.includes(mode)) {\n await import('codemirror/mode/javascript/javascript');\n }\n\n if (mode === 'css') {\n await import('codemirror/mode/css/css');\n await import('codemirror/addon/hint/css-hint');\n }\n\n if (mode && modesWithEclipseTheme.includes(mode)) {\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 (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 modeName =\n typeof editorConfigProps?.mode === 'string'\n ? editorConfigProps.mode\n : editorConfigProps?.mode?.name;\n const mode = extendModeWithSingleLine(editorConfigProps?.mode || 'expression', isSingleLine);\n return {\n ...editorConfigProps,\n readOnly: readOnly ? 'nocursor' : false,\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 ...(modeName && modesWithEclipseTheme.includes(modeName) ? { 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 ...(modeName === 'json'\n ? {\n mode: 'application/json',\n lint: editorConfigProps?.lint\n }\n : {})\n };\n }, [isSingleLine, editorConfigProps, readOnly]);\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 const showToolbar = !!(onFormat || actions || label);\n\n return (\n <>\n <StyledSuggestions isLoading={loading} suggestions={suggestions} theme={theme} />\n <StyledCodeEditor\n {...restProps}\n data-testid={testIds.root}\n container={{\n direction: 'column',\n justify: 'start',\n gap: 1\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 {showToolbar && (\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 0.5 }}\n item={{ shrink: 0 }}\n >\n {label && (\n <Text as='span' variant='h4'>\n {label}\n </Text>\n )}\n {(onFormat || actions) && (\n <div>\n {onFormat && (\n <Button\n variant='simple'\n icon\n onClick={() => onFormat()}\n disabled={readOnly || !value.trim()}\n label={t('format')}\n >\n <Icon name='expression' set='streamline' />\n </Button>\n )}\n {actions && <Actions items={actions} iconOnly />}\n </div>\n )}\n </Flex>\n )}\n {showEditor && (\n <ReactCodeMirror\n value={value}\n onBeforeChange={onBeforeChange}\n onChange={onChangeMirror}\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={editor => {\n editor.refresh();\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-build",
|
|
3
|
-
"version": "10.0.0-build.15.
|
|
3
|
+
"version": "10.0.0-build.15.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@dagrejs/dagre": "^3.0.0",
|
|
18
|
-
"@pega/cosmos-react-core": "10.0.0-build.15.
|
|
19
|
-
"@pega/cosmos-react-dnd": "10.0.0-build.15.
|
|
20
|
-
"@pega/cosmos-react-rte": "10.0.0-build.15.
|
|
18
|
+
"@pega/cosmos-react-core": "10.0.0-build.15.1",
|
|
19
|
+
"@pega/cosmos-react-dnd": "10.0.0-build.15.1",
|
|
20
|
+
"@pega/cosmos-react-rte": "10.0.0-build.15.1",
|
|
21
21
|
"@types/codemirror": "^5.60.15",
|
|
22
22
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
23
23
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|