@pega/cosmos-react-build 8.0.0-build.9.1 → 8.0.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/AppShell/AppShell.styles.d.ts +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +1 -46
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.d.ts +2 -3
- package/lib/components/AppShell/Header/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.js +4 -4
- package/lib/components/AppShell/Header/AppHeader.js.map +1 -1
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts +2 -2
- package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/BackgroundPicker/BackgroundPicker.d.ts +6 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.js +82 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts +15 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.js +152 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.styles.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.d.ts +5 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.js +30 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.test-ids.js.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.d.ts +98 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.js +29 -0
- package/lib/components/BackgroundPicker/BackgroundPicker.types.js.map +1 -0
- package/lib/components/BackgroundPicker/GradientConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/GradientConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/GradientConfig.js +149 -0
- package/lib/components/BackgroundPicker/GradientConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/ImageConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/ImageConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/ImageConfig.js +64 -0
- package/lib/components/BackgroundPicker/ImageConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.d.ts +6 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.js +24 -0
- package/lib/components/BackgroundPicker/SolidColorConfig.js.map +1 -0
- package/lib/components/BackgroundPicker/index.d.ts +3 -0
- package/lib/components/BackgroundPicker/index.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/index.js +2 -0
- package/lib/components/BackgroundPicker/index.js.map +1 -0
- package/lib/components/BackgroundPicker/utils.d.ts +24 -0
- package/lib/components/BackgroundPicker/utils.d.ts.map +1 -0
- package/lib/components/BackgroundPicker/utils.js +186 -0
- package/lib/components/BackgroundPicker/utils.js.map +1 -0
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts +2 -3
- package/lib/components/DynamicContentEditor/DynamicContentEditor.d.ts.map +1 -1
- package/lib/components/DynamicContentEditor/DynamicContentEditor.js.map +1 -1
- package/lib/components/DynamicInput/BooleanControl.d.ts +3 -5
- package/lib/components/DynamicInput/BooleanControl.d.ts.map +1 -1
- package/lib/components/DynamicInput/BooleanControl.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.d.ts +1 -2
- package/lib/components/DynamicInput/DynamicInput.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.js +33 -33
- package/lib/components/DynamicInput/DynamicInput.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts +2 -2
- package/lib/components/DynamicInput/DynamicInput.styles.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.styles.js +1 -0
- package/lib/components/DynamicInput/DynamicInput.styles.js.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.d.ts +61 -11
- package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
- package/lib/components/Expression/Expression.d.ts +6 -0
- package/lib/components/Expression/Expression.d.ts.map +1 -0
- package/lib/components/Expression/Expression.js +36 -0
- package/lib/components/Expression/Expression.js.map +1 -0
- package/lib/components/Expression/Expression.styles.d.ts +7 -0
- package/lib/components/Expression/Expression.styles.d.ts.map +1 -0
- package/lib/components/Expression/Expression.styles.js +47 -0
- package/lib/components/Expression/Expression.styles.js.map +1 -0
- package/lib/components/Expression/Expression.test-ids.d.ts +2 -0
- package/lib/components/Expression/Expression.test-ids.d.ts.map +1 -0
- package/lib/components/Expression/Expression.test-ids.js +8 -0
- package/lib/components/Expression/Expression.test-ids.js.map +1 -0
- package/lib/components/Expression/Expression.types.d.ts +53 -0
- package/lib/components/Expression/Expression.types.d.ts.map +1 -0
- package/lib/components/Expression/Expression.types.js +2 -0
- package/lib/components/Expression/Expression.types.js.map +1 -0
- package/lib/components/Expression/index.d.ts +3 -0
- package/lib/components/Expression/index.d.ts.map +1 -0
- package/lib/components/Expression/index.js +2 -0
- package/lib/components/Expression/index.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts +7 -5
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js +393 -76
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts +9 -2
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js +100 -26
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.styles.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.d.ts +2 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.js +6 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.test-ids.js.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts +32 -6
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/CodeEditor.types.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/getCodeSuggestions.js.map +1 -1
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.d.ts +3 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.d.ts.map +1 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.js +34 -0
- package/lib/components/ExpressionBuilder/CodeEditor/mode/jsonLinter.js.map +1 -0
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts +2 -3
- package/lib/components/ExpressionBuilder/ExpressionBuilder.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionBuilder.types.d.ts +3 -1
- 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 +2 -3
- package/lib/components/ExpressionBuilder/ExpressionDetails.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionDetails.js.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts +2 -3
- package/lib/components/ExpressionBuilder/ExpressionList.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/ExpressionList.js.map +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts +1 -1
- package/lib/components/ExpressionBuilder/index.d.ts.map +1 -1
- package/lib/components/ExpressionBuilder/index.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.d.ts +1 -0
- package/lib/components/FieldReference/FieldReference.styles.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.styles.js +45 -37
- package/lib/components/FieldReference/FieldReference.styles.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.test-ids.d.ts +1 -0
- package/lib/components/FieldReference/FieldReference.test-ids.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.test-ids.js +3 -0
- package/lib/components/FieldReference/FieldReference.test-ids.js.map +1 -1
- package/lib/components/FieldReference/FieldReference.types.d.ts +6 -1
- package/lib/components/FieldReference/FieldReference.types.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReference.types.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceDisplay.js +11 -7
- package/lib/components/FieldReference/FieldReferenceDisplay.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceInput.js +17 -11
- package/lib/components/FieldReference/FieldReferenceInput.js.map +1 -1
- package/lib/components/FieldReference/FieldReferenceMenuList.d.ts +5 -4
- package/lib/components/FieldReference/FieldReferenceMenuList.d.ts.map +1 -1
- package/lib/components/FieldReference/FieldReferenceMenuList.js +7 -5
- package/lib/components/FieldReference/FieldReferenceMenuList.js.map +1 -1
- package/lib/components/FieldReference/index.d.ts +2 -2
- package/lib/components/FieldReference/index.d.ts.map +1 -1
- package/lib/components/FieldReference/index.js +1 -1
- package/lib/components/FieldReference/index.js.map +1 -1
- package/lib/components/IconTile/IconTile.d.ts +7 -3
- package/lib/components/IconTile/IconTile.d.ts.map +1 -1
- package/lib/components/IconTile/IconTile.js +40 -4
- package/lib/components/IconTile/IconTile.js.map +1 -1
- package/lib/components/IconTile/IconTile.types.d.ts +17 -15
- package/lib/components/IconTile/IconTile.types.d.ts.map +1 -1
- package/lib/components/IconTile/IconTile.types.js.map +1 -1
- package/lib/components/IconTile/Tiles/Ai.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Ai.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Ai.js.map +1 -1
- package/lib/components/IconTile/Tiles/Automation.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Automation.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Automation.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationAppend.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationCall.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationForEach.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationReturn.js.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.d.ts +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/AutomationSet.js.map +1 -1
- package/lib/components/IconTile/Tiles/Case.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Case.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Case.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseGoTo.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseProcess.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseSla.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseStage.js.map +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.d.ts +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/CaseWait.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicDecisionStep.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicFunction.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicValidation.js.map +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.d.ts +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/LogicWhen.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleAuthenticate.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConfiguration.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleConnector.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleDataPage.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleField.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleField.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleField.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleInsight.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleIntegrationSystem.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleLiveData.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleParagraph.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePermission.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePersona.js.map +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RulePortal.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleRecord.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleSystem.js.map +1 -1
- package/lib/components/IconTile/Tiles/RuleView.d.ts +1 -1
- package/lib/components/IconTile/Tiles/RuleView.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/RuleView.js.map +1 -1
- package/lib/components/IconTile/Tiles/Task.d.ts +1 -1
- package/lib/components/IconTile/Tiles/Task.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/Task.js.map +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.d.ts +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.d.ts.map +1 -1
- package/lib/components/IconTile/Tiles/TaskAction.js.map +1 -1
- package/lib/components/IconTile/iconUtils.d.ts +11 -0
- package/lib/components/IconTile/iconUtils.d.ts.map +1 -0
- package/lib/components/IconTile/iconUtils.js +41 -0
- package/lib/components/IconTile/iconUtils.js.map +1 -0
- package/lib/components/IconTile/index.d.ts +1 -0
- package/lib/components/IconTile/index.d.ts.map +1 -1
- package/lib/components/IconTile/index.js.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.d.ts +10 -10
- package/lib/components/ItemLibrary/ItemLibrary.d.ts.map +1 -1
- package/lib/components/ItemLibrary/ItemLibrary.js +26 -18
- package/lib/components/ItemLibrary/ItemLibrary.js.map +1 -1
- package/lib/components/LifeCycle/Category.d.ts +8 -6
- package/lib/components/LifeCycle/Category.d.ts.map +1 -1
- package/lib/components/LifeCycle/Category.js +53 -36
- package/lib/components/LifeCycle/Category.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.d.ts +8 -4
- package/lib/components/LifeCycle/LifeCycle.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.js +113 -19
- package/lib/components/LifeCycle/LifeCycle.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.test-ids.d.ts +6 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.js +10 -0
- package/lib/components/LifeCycle/LifeCycle.test-ids.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycle.types.d.ts +713 -58
- package/lib/components/LifeCycle/LifeCycle.types.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycle.types.js +71 -61
- package/lib/components/LifeCycle/LifeCycle.types.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleContext.d.ts +16 -4
- package/lib/components/LifeCycle/LifeCycleContext.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleContext.js +7 -1
- package/lib/components/LifeCycle/LifeCycleContext.js.map +1 -1
- package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts +21 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.d.ts.map +1 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.js +298 -0
- package/lib/components/LifeCycle/LifeCycleDragDropList.js.map +1 -0
- package/lib/components/LifeCycle/LifeCycleList.d.ts +8 -6
- package/lib/components/LifeCycle/LifeCycleList.d.ts.map +1 -1
- package/lib/components/LifeCycle/LifeCycleList.js +20 -30
- package/lib/components/LifeCycle/LifeCycleList.js.map +1 -1
- package/lib/components/LifeCycle/Stage.d.ts +12 -7
- package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
- package/lib/components/LifeCycle/Stage.js +87 -72
- package/lib/components/LifeCycle/Stage.js.map +1 -1
- package/lib/components/LifeCycle/Step.d.ts +21 -14
- package/lib/components/LifeCycle/Step.d.ts.map +1 -1
- package/lib/components/LifeCycle/Step.js +75 -51
- package/lib/components/LifeCycle/Step.js.map +1 -1
- package/lib/components/LifeCycle/Task.d.ts +18 -7
- package/lib/components/LifeCycle/Task.d.ts.map +1 -1
- package/lib/components/LifeCycle/Task.js +119 -55
- package/lib/components/LifeCycle/Task.js.map +1 -1
- package/lib/components/LifeCycle/index.d.ts +2 -1
- package/lib/components/LifeCycle/index.d.ts.map +1 -1
- package/lib/components/LifeCycle/index.js +1 -0
- package/lib/components/LifeCycle/index.js.map +1 -1
- package/lib/components/LifeCycle/utils.d.ts +14 -0
- package/lib/components/LifeCycle/utils.d.ts.map +1 -0
- package/lib/components/LifeCycle/utils.js +250 -0
- package/lib/components/LifeCycle/utils.js.map +1 -0
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +2 -3
- package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
- package/lib/components/MobileBuildSummary/MobileBuildSummary.js.map +1 -1
- package/lib/components/ObjectSelect/ObjectPicker.d.ts +2 -2
- package/lib/components/ObjectSelect/ObjectPicker.d.ts.map +1 -1
- package/lib/components/ObjectSelect/ObjectPicker.js.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.d.ts +2 -2
- package/lib/components/PageTemplates/GalleryPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/GalleryPage.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +5 -5
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.d.ts +2 -2
- package/lib/components/PageTemplates/ShowcasePage.d.ts.map +1 -1
- package/lib/components/PageTemplates/ShowcasePage.js.map +1 -1
- package/lib/components/RuleSelect/RuleSelect.js +3 -3
- package/lib/components/RuleSelect/RuleSelect.js.map +1 -1
- package/lib/components/Workbench/Workbench.d.ts +2 -3
- package/lib/components/Workbench/Workbench.d.ts.map +1 -1
- package/lib/components/Workbench/Workbench.js.map +1 -1
- package/lib/components/Workbench/Workbench.styles.d.ts +2 -2
- package/lib/components/Workbench/Workbench.styles.d.ts.map +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/{components/FieldReference → utils}/typeIconMapping.d.ts +8 -0
- package/lib/utils/typeIconMapping.d.ts.map +1 -0
- package/lib/{components/FieldReference → utils}/typeIconMapping.js +15 -3
- package/lib/utils/typeIconMapping.js.map +1 -0
- package/package.json +16 -14
- package/lib/components/FieldReference/typeIconMapping.d.ts.map +0 -1
- package/lib/components/FieldReference/typeIconMapping.js.map +0 -1
- package/lib/components/FlowModeller/AddNode.d.ts +0 -18
- package/lib/components/FlowModeller/AddNode.d.ts.map +0 -1
- package/lib/components/FlowModeller/AddNode.js +0 -86
- package/lib/components/FlowModeller/AddNode.js.map +0 -1
- package/lib/components/FlowModeller/Connector.d.ts +0 -6
- package/lib/components/FlowModeller/Connector.d.ts.map +0 -1
- package/lib/components/FlowModeller/Connector.js +0 -69
- package/lib/components/FlowModeller/Connector.js.map +0 -1
- package/lib/components/FlowModeller/DeletePopover.d.ts +0 -19
- package/lib/components/FlowModeller/DeletePopover.d.ts.map +0 -1
- package/lib/components/FlowModeller/DeletePopover.js +0 -136
- package/lib/components/FlowModeller/DeletePopover.js.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.d.ts +0 -5
- package/lib/components/FlowModeller/FlowModeller.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.js +0 -317
- package/lib/components/FlowModeller/FlowModeller.js.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.types.d.ts +0 -27
- package/lib/components/FlowModeller/FlowModeller.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModeller.types.js +0 -2
- package/lib/components/FlowModeller/FlowModeller.types.js.map +0 -1
- package/lib/components/FlowModeller/FlowModellerContext.d.ts +0 -10
- package/lib/components/FlowModeller/FlowModellerContext.d.ts.map +0 -1
- package/lib/components/FlowModeller/FlowModellerContext.js +0 -8
- package/lib/components/FlowModeller/FlowModellerContext.js.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.d.ts +0 -75
- package/lib/components/FlowModeller/Node/Node.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/Node.types.js +0 -27
- package/lib/components/FlowModeller/Node/Node.types.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +0 -20
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +0 -151
- package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts +0 -6
- package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node/NodeTemplates.js +0 -69
- package/lib/components/FlowModeller/Node/NodeTemplates.js.map +0 -1
- package/lib/components/FlowModeller/Node.d.ts +0 -5
- package/lib/components/FlowModeller/Node.d.ts.map +0 -1
- package/lib/components/FlowModeller/Node.js +0 -22
- package/lib/components/FlowModeller/Node.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts +0 -5
- package/lib/components/FlowModeller/Renderer/Renderer.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.js +0 -48
- package/lib/components/FlowModeller/Renderer/Renderer.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts +0 -18
- package/lib/components/FlowModeller/Renderer/Renderer.types.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Renderer.types.js +0 -2
- package/lib/components/FlowModeller/Renderer/Renderer.types.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts +0 -59
- package/lib/components/FlowModeller/Renderer/Utils/Graph.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js +0 -258
- package/lib/components/FlowModeller/Renderer/Utils/Graph.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts +0 -36
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js +0 -120
- package/lib/components/FlowModeller/Renderer/Utils/GraphLayout.js.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts +0 -28
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.d.ts.map +0 -1
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js +0 -172
- package/lib/components/FlowModeller/Renderer/Utils/GraphTraversal.js.map +0 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts +0 -18
- package/lib/components/FlowModeller/Utils/addNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/addNodeUtils.js +0 -141
- package/lib/components/FlowModeller/Utils/addNodeUtils.js.map +0 -1
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts +0 -30
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.d.ts.map +0 -1
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js +0 -81
- package/lib/components/FlowModeller/Utils/deleteNodeUtils.js.map +0 -1
- package/lib/components/FlowModeller/helper.d.ts +0 -39
- package/lib/components/FlowModeller/helper.d.ts.map +0 -1
- package/lib/components/FlowModeller/helper.js +0 -198
- package/lib/components/FlowModeller/helper.js.map +0 -1
- package/lib/components/FlowModeller/index.d.ts +0 -20
- package/lib/components/FlowModeller/index.d.ts.map +0 -1
- package/lib/components/FlowModeller/index.js +0 -12
- package/lib/components/FlowModeller/index.js.map +0 -1
- package/lib/components/IconTile/IconTile.styles.d.ts +0 -7
- package/lib/components/IconTile/IconTile.styles.d.ts.map +0 -1
- package/lib/components/IconTile/IconTile.styles.js +0 -68
- package/lib/components/IconTile/IconTile.styles.js.map +0 -1
|
@@ -1,64 +1,102 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// cspell:words unfocus
|
|
3
|
-
import { forwardRef, useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
3
|
+
import { forwardRef, useRef, useState, useEffect, useImperativeHandle, useMemo } from 'react';
|
|
4
4
|
import { Controlled as ReactCodeMirror } from 'react-codemirror2';
|
|
5
|
-
import { showHint, defineMode } from 'codemirror';
|
|
6
|
-
import 'codemirror/addon/edit/closebrackets';
|
|
7
5
|
import 'codemirror/addon/hint/show-hint.js';
|
|
8
|
-
import
|
|
6
|
+
import 'codemirror/addon/edit/closebrackets';
|
|
7
|
+
import 'codemirror/addon/edit/matchbrackets';
|
|
8
|
+
import { Pass, showHint, defineMode, registerHelper } from 'codemirror';
|
|
9
|
+
import { Popover, Text, UnorderedList, Flex, useI18n, useTestIds, withTestIds, useUID, debounce } from '@pega/cosmos-react-core';
|
|
9
10
|
import { StyledFormFieldInfo } from '@pega/cosmos-react-core/lib/components/FormField/FormField';
|
|
10
|
-
import { StyledCodeEditor } from './CodeEditor.styles';
|
|
11
|
+
import { StyledSuggestions, StyledCodeEditor, StyledPopover, StyledList, StyledWarnIcon } from './CodeEditor.styles';
|
|
11
12
|
import getCodeSuggestions from './getCodeSuggestions';
|
|
12
|
-
|
|
13
|
+
import { getEditorsTestIds } from './CodeEditor.test-ids';
|
|
14
|
+
import { lint as jsonLint } from './mode/jsonLinter';
|
|
15
|
+
const contextText = 'ex-context';
|
|
16
|
+
const commentText = 'ex-comment';
|
|
17
|
+
const languages = ['json', 'javascript'];
|
|
18
|
+
const additionalOperators = ['and', 'or', 'when', 'otherwise', 'isA', 'asA', 'define', 'isNone'];
|
|
19
|
+
defineMode('expression', (config, parserConfig) => {
|
|
20
|
+
const isSingleLine = parserConfig.isSingleLine;
|
|
13
21
|
const tokens = [
|
|
14
22
|
// Below regex is used to identify the context
|
|
15
|
-
{ token: /\w+@/, style:
|
|
23
|
+
{ token: /\w+@/, style: contextText },
|
|
16
24
|
// Below regex is used to identify the RuleType
|
|
17
|
-
{ token: /\w+:/, style:
|
|
25
|
+
{ token: /\w+:/, style: contextText },
|
|
18
26
|
// Below regex is used to identify the RuleName
|
|
19
27
|
{ token: /\w+[(]/, style: 'ex-ruleName' },
|
|
20
28
|
// Below regex is used to identify the delimeters
|
|
21
|
-
{ token: /[:.(),]/, style: 'ex-delimeter' },
|
|
29
|
+
{ token: /[:.(),[\]]/, style: 'ex-delimeter' },
|
|
22
30
|
// Below regex is used to identify the operators
|
|
23
|
-
{ token: /[
|
|
31
|
+
{ token: /[-+\\/*=<>@#]+/, style: 'ex-operator' },
|
|
24
32
|
// Below regex is used to identify the spaces
|
|
25
33
|
{ token: / /, style: 'ex-space' }
|
|
26
34
|
];
|
|
27
35
|
return {
|
|
28
36
|
startState() {
|
|
29
|
-
return { inString: false };
|
|
37
|
+
return { inString: false, inMultiLineComment: false };
|
|
30
38
|
},
|
|
31
39
|
token(stream, state) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
/** Additional operator highlighting */
|
|
41
|
+
for (let i = 0; i < additionalOperators.length; i += 1) {
|
|
42
|
+
const keyword = additionalOperators[i];
|
|
43
|
+
const len = keyword.length;
|
|
44
|
+
const currentPos = stream.pos;
|
|
45
|
+
if (stream.match(keyword, true)) {
|
|
46
|
+
const before = currentPos === 0 ? null : stream.string.charAt(currentPos - 1);
|
|
47
|
+
const after = stream.eol() ? null : stream.peek();
|
|
48
|
+
const isWordChar = (char) => char.includes(' ');
|
|
49
|
+
if ((!before || isWordChar(before)) && (!after || isWordChar(after))) {
|
|
50
|
+
return 'ex-additional-operators';
|
|
51
|
+
}
|
|
52
|
+
stream.backUp(len);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/* Highlights single and multi line comments */
|
|
56
|
+
if (state.inMultiLineComment && !isSingleLine) {
|
|
57
|
+
if (stream.match(/.*?\*\//)) {
|
|
58
|
+
state.inMultiLineComment = false;
|
|
43
59
|
}
|
|
44
60
|
else {
|
|
45
|
-
stream.skipToEnd();
|
|
61
|
+
stream.skipToEnd();
|
|
46
62
|
}
|
|
47
|
-
return
|
|
63
|
+
return commentText;
|
|
64
|
+
}
|
|
65
|
+
if (stream.match(/\/\*/) && !isSingleLine) {
|
|
66
|
+
state.inMultiLineComment = true;
|
|
67
|
+
return commentText;
|
|
48
68
|
}
|
|
49
|
-
if (stream.
|
|
50
|
-
stream.
|
|
51
|
-
|
|
52
|
-
return 'ex-delimeter';
|
|
69
|
+
if (stream.match(/\/\//) && !isSingleLine) {
|
|
70
|
+
stream.skipToEnd();
|
|
71
|
+
return commentText;
|
|
53
72
|
}
|
|
54
|
-
// Used to
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
73
|
+
// Used to identify the constants in the expression
|
|
74
|
+
if (!state.inMultiLineComment) {
|
|
75
|
+
const nextChar = stream.peek();
|
|
76
|
+
if (!state.inString && (nextChar === "'" || nextChar === '"')) {
|
|
77
|
+
stream.next(); // Skip quote
|
|
78
|
+
state.inString = true; // Update state
|
|
79
|
+
}
|
|
80
|
+
if (state.inString) {
|
|
81
|
+
if (nextChar && stream.skipTo(nextChar)) {
|
|
82
|
+
// Quote found on this line
|
|
83
|
+
stream.next(); // Skip quote
|
|
84
|
+
state.inString = false; // Clear flag
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
stream.skipToEnd(); // Rest of line is string
|
|
88
|
+
}
|
|
89
|
+
return nextChar === '"' ? 'ex-constant' : contextText; // Token style
|
|
90
|
+
}
|
|
91
|
+
// Used to match the regex in the expression
|
|
92
|
+
for (const element of tokens) {
|
|
93
|
+
const match = stream.match(element.token, false);
|
|
94
|
+
if (match) {
|
|
95
|
+
if (stream.pos === stream.start) {
|
|
96
|
+
stream.next();
|
|
97
|
+
}
|
|
98
|
+
return element.style;
|
|
60
99
|
}
|
|
61
|
-
return element.style;
|
|
62
100
|
}
|
|
63
101
|
}
|
|
64
102
|
stream.next();
|
|
@@ -66,76 +104,109 @@ defineMode('expression', () => {
|
|
|
66
104
|
}
|
|
67
105
|
};
|
|
68
106
|
});
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
smartIndent: true,
|
|
72
|
-
autoCloseBrackets: true,
|
|
73
|
-
extraKeys: { Tab: false, 'Shift-Tab': false }
|
|
74
|
-
};
|
|
75
|
-
const CodeEditor = forwardRef(function CodeEditor({ fetchSuggestions, autoCompleteTriggers, editorConfigProps, codeEditorHandle, defaultValue = '', loading = false, readOnly, errors, onChange, ...props }, ref) {
|
|
107
|
+
const CodeEditor = forwardRef(({ testId, fetchSuggestions, autoCompleteTriggers, editorConfigProps, codeEditorHandle, defaultValue = '', loading = false, readOnly, isSingleLine = false, errors, onChange, onBlur, inLineErrors, 'aria-describedby': ariaDescribedBy, ...restProps }, ref) => {
|
|
108
|
+
const t = useI18n();
|
|
76
109
|
const [value, setCode] = useState(defaultValue);
|
|
110
|
+
const [showEditor, setShowEditor] = useState(false);
|
|
111
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
77
112
|
const [suggestions, setSuggestions] = useState([]);
|
|
78
113
|
const [codeMirror, setCodeMirror] = useState(null);
|
|
79
|
-
const [codeEditorContainer, setCodeEditorContainer] = useElement();
|
|
80
|
-
const codeEditorConsolidatedRef = useConsolidatedRef(setCodeEditorContainer, ref);
|
|
81
114
|
const [suggestionTrigger, setSuggestionTrigger] = useState(null);
|
|
82
115
|
const [popover, showPopover] = useState(false);
|
|
83
116
|
const mounted = useRef(false);
|
|
117
|
+
const testIds = useTestIds(testId, getEditorsTestIds);
|
|
118
|
+
const editorRef = useRef(null);
|
|
119
|
+
const uId = useUID();
|
|
120
|
+
const errorDescId = `${uId}-description`;
|
|
121
|
+
const onBlurRef = useRef(onBlur);
|
|
122
|
+
const hasSuggestionRef = useRef(true);
|
|
84
123
|
useImperativeHandle(codeEditorHandle, () => ({
|
|
85
|
-
insertText: (text) => {
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
88
|
-
|
|
124
|
+
insertText: (text, resetContent, customPosition) => {
|
|
125
|
+
if (editorRef.current) {
|
|
126
|
+
if (editorRef.current.getSelection()) {
|
|
127
|
+
editorRef.current.replaceSelection(text);
|
|
128
|
+
}
|
|
129
|
+
else if (customPosition?.start && customPosition?.end) {
|
|
130
|
+
editorRef.current.replaceRange(text, { ...customPosition.start }, { ...customPosition.end });
|
|
89
131
|
}
|
|
90
132
|
else {
|
|
91
|
-
const cur =
|
|
92
|
-
|
|
133
|
+
const cur = editorRef.current.getCursor();
|
|
134
|
+
const doc = editorRef.current.getDoc();
|
|
135
|
+
const lastLine = doc.lastLine(); // Get the index of the last line
|
|
136
|
+
const lastCharIndex = doc.getLine(lastLine).length;
|
|
137
|
+
editorRef.current.replaceRange(text, resetContent ? { ch: lastCharIndex, line: lastLine } : cur, resetContent ? { ch: 0, line: 0 } : undefined);
|
|
93
138
|
}
|
|
94
139
|
}
|
|
95
140
|
},
|
|
96
141
|
getValue: () => {
|
|
97
|
-
return
|
|
142
|
+
return editorRef.current?.getValue();
|
|
98
143
|
}
|
|
99
|
-
}), [
|
|
144
|
+
}), []);
|
|
100
145
|
const autoComplete = (codeEditor) => {
|
|
101
146
|
const hintOptions = {
|
|
102
147
|
completeSingle: false,
|
|
103
148
|
completeOnSingleClick: true,
|
|
104
149
|
closeOnUnfocus: true,
|
|
105
150
|
suggestions,
|
|
106
|
-
container: codeEditorContainer,
|
|
107
151
|
loading,
|
|
108
152
|
triggerCharacterCursorPos: suggestionTrigger?.cursorPosition
|
|
109
153
|
};
|
|
110
|
-
showHint(codeEditor, getCodeSuggestions, hintOptions);
|
|
154
|
+
debounce(() => showHint(codeEditor, getCodeSuggestions, hintOptions), 100)();
|
|
155
|
+
};
|
|
156
|
+
const errorHandler = (val) => {
|
|
157
|
+
if (!editorConfigProps?.lint)
|
|
158
|
+
return;
|
|
159
|
+
const mode = editorConfigProps?.mode;
|
|
160
|
+
switch (mode) {
|
|
161
|
+
case 'json':
|
|
162
|
+
return jsonLint(val);
|
|
163
|
+
case 'expression':
|
|
164
|
+
default:
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
onBlurRef.current = onBlur;
|
|
170
|
+
}, [onBlur]);
|
|
171
|
+
const onBlurHandler = (editor) => {
|
|
172
|
+
if (onBlurRef.current) {
|
|
173
|
+
onBlurRef.current(editor.getDoc().getValue());
|
|
174
|
+
}
|
|
111
175
|
};
|
|
112
176
|
const onBeforeChange = async (editor, _data, textvalue) => {
|
|
113
|
-
|
|
114
|
-
|
|
177
|
+
const updatedTextValue = isSingleLine ? textvalue.replaceAll(/\n/g, '') : textvalue;
|
|
178
|
+
setCode(updatedTextValue);
|
|
179
|
+
/** _data.origin is a flag from codemirror that tells from where the change was made in the code editor input */
|
|
180
|
+
onChange?.(updatedTextValue, errorHandler(updatedTextValue), _data.origin);
|
|
115
181
|
const currentCursor = editor.getCursor();
|
|
116
182
|
const currentCharacter = editor
|
|
117
183
|
.getTokenAt(currentCursor)
|
|
118
184
|
.string.trim();
|
|
119
185
|
let newSuggestions = [];
|
|
120
186
|
if (autoCompleteTriggers?.includes(currentCharacter) && fetchSuggestions) {
|
|
187
|
+
const suggestionData = await fetchSuggestions(currentCharacter, {
|
|
188
|
+
line: currentCursor.line,
|
|
189
|
+
ch: currentCursor.ch
|
|
190
|
+
});
|
|
191
|
+
if (suggestionData === undefined) {
|
|
192
|
+
hasSuggestionRef.current = false;
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
121
195
|
setSuggestionTrigger({
|
|
122
196
|
character: currentCharacter,
|
|
123
197
|
cursorPosition: currentCursor
|
|
124
198
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
line: currentCursor.line,
|
|
128
|
-
ch: currentCursor.ch
|
|
129
|
-
}))
|
|
130
|
-
];
|
|
199
|
+
hasSuggestionRef.current = true;
|
|
200
|
+
newSuggestions = [...suggestionData];
|
|
131
201
|
if (mounted.current) {
|
|
132
202
|
setSuggestions(newSuggestions);
|
|
133
203
|
}
|
|
134
204
|
}
|
|
135
205
|
};
|
|
136
206
|
useEffect(() => {
|
|
137
|
-
if (!popover)
|
|
207
|
+
if (!popover) {
|
|
138
208
|
return;
|
|
209
|
+
}
|
|
139
210
|
const isSuggestionTriggerPresent = suggestionTrigger &&
|
|
140
211
|
codeMirror
|
|
141
212
|
?.getTokenAt(suggestionTrigger.cursorPosition)
|
|
@@ -147,7 +218,7 @@ const CodeEditor = forwardRef(function CodeEditor({ fetchSuggestions, autoComple
|
|
|
147
218
|
}
|
|
148
219
|
}, [onBeforeChange]);
|
|
149
220
|
useEffect(() => {
|
|
150
|
-
if (codeMirror && (suggestionTrigger || loading)) {
|
|
221
|
+
if (codeMirror && isFocused && hasSuggestionRef.current && (suggestionTrigger || loading)) {
|
|
151
222
|
autoComplete(codeMirror);
|
|
152
223
|
showPopover(true);
|
|
153
224
|
}
|
|
@@ -155,22 +226,268 @@ const CodeEditor = forwardRef(function CodeEditor({ fetchSuggestions, autoComple
|
|
|
155
226
|
codeMirror?.closeHint();
|
|
156
227
|
showPopover(false);
|
|
157
228
|
}
|
|
158
|
-
}, [suggestions, loading]);
|
|
229
|
+
}, [suggestions, loading, suggestionTrigger, codeMirror]);
|
|
230
|
+
const [popoverInfo, setPopoverInfo] = useState({ targetElement: null, errorMessages: [] });
|
|
231
|
+
const [show, setShow] = useState(false);
|
|
232
|
+
const [errorMapping, setErrorMapping] = useState([]);
|
|
233
|
+
const [textMarkerList, setTextMarkerList] = useState([]);
|
|
234
|
+
const removeInLineErrors = () => {
|
|
235
|
+
if (textMarkerList.length) {
|
|
236
|
+
textMarkerList.forEach(item => item.clear());
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
removeInLineErrors();
|
|
241
|
+
if (inLineErrors?.length && codeMirror) {
|
|
242
|
+
const markerList = [];
|
|
243
|
+
const errorMessageMap = inLineErrors?.map(({ start, end, messages }, index) => {
|
|
244
|
+
if (messages.length) {
|
|
245
|
+
markerList.push(codeMirror.markText(start, end, {
|
|
246
|
+
className: `cm-ex-underline-error error-${index}`
|
|
247
|
+
}));
|
|
248
|
+
return messages;
|
|
249
|
+
}
|
|
250
|
+
return [];
|
|
251
|
+
});
|
|
252
|
+
setTextMarkerList(markerList);
|
|
253
|
+
setErrorMapping(errorMessageMap);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
setErrorMapping([]);
|
|
257
|
+
}
|
|
258
|
+
}, [inLineErrors, codeMirror]);
|
|
159
259
|
useEffect(() => {
|
|
160
260
|
mounted.current = true;
|
|
161
261
|
return () => {
|
|
162
262
|
mounted.current = false;
|
|
163
263
|
};
|
|
164
264
|
}, []);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
265
|
+
const getErrors = (target) => {
|
|
266
|
+
const errorMessages = [];
|
|
267
|
+
if (target) {
|
|
268
|
+
errorMapping.forEach((item, index) => {
|
|
269
|
+
if (target.classList.contains(`error-${index}`)) {
|
|
270
|
+
errorMessages.push(...item);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return errorMessages;
|
|
275
|
+
};
|
|
276
|
+
const onMouseMove = (event, type) => {
|
|
277
|
+
if (codeMirror && errorMapping.length) {
|
|
278
|
+
let target;
|
|
279
|
+
if (type === 'cursor') {
|
|
280
|
+
const coords = codeMirror.getCursor();
|
|
281
|
+
const charCoords = codeMirror.charCoords(coords, 'window');
|
|
282
|
+
target = document.elementFromPoint(charCoords.left, charCoords.top);
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
target = event?.target instanceof Element ? event.target : null;
|
|
286
|
+
}
|
|
287
|
+
if (target) {
|
|
288
|
+
const errorMessages = getErrors(target);
|
|
289
|
+
if (errorMessages.length) {
|
|
290
|
+
setPopoverInfo(() => {
|
|
291
|
+
return {
|
|
292
|
+
targetElement: target,
|
|
293
|
+
errorMessages
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
setShow(true);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
setShow(false);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const onMouseLeave = () => {
|
|
305
|
+
setShow(false);
|
|
306
|
+
};
|
|
307
|
+
const hidePopover = (e) => {
|
|
308
|
+
if (e.shiftKey && (e.metaKey || e.ctrlKey) && e.key === ' ') {
|
|
309
|
+
onMouseMove(null, 'cursor');
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
setShow(false);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
if (codeMirror && inLineErrors?.length && errorMapping.length) {
|
|
317
|
+
const codeMirrorWrapper = codeMirror.getWrapperElement();
|
|
318
|
+
codeMirrorWrapper.addEventListener('keydown', hidePopover);
|
|
319
|
+
codeMirrorWrapper.addEventListener('mousedown', onMouseLeave);
|
|
320
|
+
const elementsWithClassName = Array.from(codeMirrorWrapper.getElementsByClassName('cm-ex-underline-error'));
|
|
321
|
+
elementsWithClassName.forEach(element => {
|
|
322
|
+
element.addEventListener('mouseenter', onMouseMove);
|
|
323
|
+
element.addEventListener('mouseleave', onMouseLeave);
|
|
324
|
+
});
|
|
325
|
+
return () => {
|
|
326
|
+
codeMirrorWrapper.removeEventListener('keydown', hidePopover);
|
|
327
|
+
codeMirrorWrapper.removeEventListener('mousedown', onMouseLeave);
|
|
328
|
+
elementsWithClassName.forEach(element => {
|
|
329
|
+
element.removeEventListener('mouseenter', onMouseMove);
|
|
330
|
+
element.removeEventListener('mouseleave', onMouseLeave);
|
|
331
|
+
});
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
return undefined;
|
|
335
|
+
}, [value, inLineErrors, errorMapping, codeMirror]);
|
|
336
|
+
const extendModeWithSingleLine = (mode, singleLineEditor) => {
|
|
337
|
+
if (typeof mode === 'string' || (mode && typeof mode.name === 'string')) {
|
|
338
|
+
return {
|
|
339
|
+
name: typeof mode === 'string' ? mode : mode.name,
|
|
340
|
+
isSingleLine: singleLineEditor
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return mode;
|
|
344
|
+
};
|
|
345
|
+
useEffect(() => {
|
|
346
|
+
(async () => {
|
|
347
|
+
if (editorConfigProps?.placeholder) {
|
|
348
|
+
await import('codemirror/addon/display/placeholder');
|
|
349
|
+
}
|
|
350
|
+
if (languages.includes(editorConfigProps?.mode)) {
|
|
351
|
+
await import('codemirror/mode/javascript/javascript');
|
|
352
|
+
await import('codemirror/theme/eclipse.css');
|
|
353
|
+
}
|
|
354
|
+
if (editorConfigProps?.foldGutter && !isSingleLine) {
|
|
355
|
+
await import('codemirror/addon/fold/foldcode');
|
|
356
|
+
await import('codemirror/addon/fold/foldgutter');
|
|
357
|
+
await import('codemirror/addon/fold/brace-fold');
|
|
358
|
+
await import('codemirror/addon/fold/comment-fold');
|
|
359
|
+
await import('codemirror/addon/fold/foldgutter.css');
|
|
360
|
+
}
|
|
361
|
+
if (editorConfigProps?.lint) {
|
|
362
|
+
await import('codemirror/addon/lint/lint.css');
|
|
363
|
+
await import('codemirror/addon/lint/lint');
|
|
364
|
+
if (editorConfigProps.mode === 'json') {
|
|
365
|
+
await import('codemirror/addon/lint/json-lint');
|
|
366
|
+
registerHelper('lint', 'json', jsonLint);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
setShowEditor(true);
|
|
370
|
+
})();
|
|
371
|
+
}, [editorConfigProps]);
|
|
372
|
+
const updatedEditorConfig = useMemo(() => {
|
|
373
|
+
const mode = extendModeWithSingleLine(editorConfigProps?.mode || 'expression', isSingleLine);
|
|
374
|
+
return {
|
|
375
|
+
...editorConfigProps,
|
|
376
|
+
lineWrapping: !isSingleLine,
|
|
377
|
+
smartIndent: true,
|
|
378
|
+
autoCloseBrackets: true,
|
|
379
|
+
matchBrackets: true,
|
|
380
|
+
lineNumbers: !isSingleLine && editorConfigProps?.lineNumbers,
|
|
381
|
+
placeholder: editorConfigProps?.placeholder,
|
|
382
|
+
extraKeys: {
|
|
383
|
+
/** default tab and shift tab behavior
|
|
384
|
+
* https://codemirror.net/5/
|
|
385
|
+
* https://discuss.codemirror.net/t/does-tab-key-work-in-codemirror-6/2705
|
|
386
|
+
*/
|
|
387
|
+
Tab: isSingleLine ? false : () => Pass,
|
|
388
|
+
'Shift-Tab': isSingleLine ? false : () => Pass,
|
|
389
|
+
...(isSingleLine ? { Enter: () => { } } : {})
|
|
390
|
+
},
|
|
391
|
+
mode,
|
|
392
|
+
...(languages.includes(editorConfigProps?.mode) ? { theme: 'eclipse' } : {}),
|
|
393
|
+
...(editorConfigProps?.foldGutter && !isSingleLine
|
|
394
|
+
? {
|
|
395
|
+
foldGutter: true,
|
|
396
|
+
gutters: (() => {
|
|
397
|
+
const guttersArr = [];
|
|
398
|
+
if (editorConfigProps?.lint)
|
|
399
|
+
guttersArr.push('CodeMirror-lint-markers');
|
|
400
|
+
if (editorConfigProps?.lineNumbers)
|
|
401
|
+
guttersArr.push('CodeMirror-linenumbers');
|
|
402
|
+
return [...guttersArr, 'CodeMirror-foldgutter'];
|
|
403
|
+
})()
|
|
404
|
+
}
|
|
405
|
+
: {}),
|
|
406
|
+
...(editorConfigProps?.mode === 'json'
|
|
407
|
+
? {
|
|
408
|
+
mode: 'application/json',
|
|
409
|
+
lint: editorConfigProps.lint
|
|
410
|
+
}
|
|
411
|
+
: {})
|
|
412
|
+
};
|
|
413
|
+
}, [isSingleLine, editorConfigProps]);
|
|
414
|
+
const handlePaste = (editor, event) => {
|
|
415
|
+
if (isSingleLine) {
|
|
416
|
+
const doc = editor.getDoc();
|
|
417
|
+
const pastedContent = event.clipboardData?.getData('text/plain').trim();
|
|
418
|
+
const singleLineContent = pastedContent?.replace(/\r?\n|\r/g, ' ') || '';
|
|
419
|
+
if (doc && doc.getSelection()) {
|
|
420
|
+
doc.replaceSelection(singleLineContent);
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
const cursor = doc.getCursor();
|
|
424
|
+
doc.replaceRange(singleLineContent, cursor);
|
|
425
|
+
}
|
|
426
|
+
const cursor = doc.getCursor();
|
|
427
|
+
doc.setCursor(cursor);
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
useEffect(() => {
|
|
432
|
+
const editor = editorRef.current;
|
|
433
|
+
if (editor && isSingleLine) {
|
|
434
|
+
editor.on('paste', handlePaste);
|
|
435
|
+
}
|
|
436
|
+
return () => {
|
|
437
|
+
if (editor) {
|
|
438
|
+
editor.off('paste', handlePaste);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
}, [isSingleLine]);
|
|
442
|
+
useEffect(() => {
|
|
443
|
+
const textArea = codeMirror?.getInputField();
|
|
444
|
+
if (!textArea)
|
|
445
|
+
return;
|
|
446
|
+
let describedBy = textArea.getAttribute('aria-describedby') || '';
|
|
447
|
+
const ids = new Set(describedBy.split(' ').filter(item => item));
|
|
448
|
+
if (ariaDescribedBy && !ids.has(ariaDescribedBy)) {
|
|
449
|
+
ids.add(ariaDescribedBy);
|
|
450
|
+
}
|
|
451
|
+
if (errors && !ids.has(errorDescId)) {
|
|
452
|
+
ids.add(errorDescId);
|
|
453
|
+
}
|
|
454
|
+
else if (!errors && ids.has(errorDescId)) {
|
|
455
|
+
ids.delete(errorDescId);
|
|
456
|
+
}
|
|
457
|
+
if (!ariaDescribedBy) {
|
|
458
|
+
describedBy = ids.has(errorDescId) ? errorDescId : '';
|
|
459
|
+
}
|
|
460
|
+
else
|
|
461
|
+
describedBy = Array.from(ids).join(' ').trim();
|
|
462
|
+
if (describedBy) {
|
|
463
|
+
textArea.setAttribute('aria-describedby', describedBy);
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
textArea.removeAttribute('aria-describedby');
|
|
467
|
+
}
|
|
468
|
+
}, [codeMirror, errors, ariaDescribedBy]);
|
|
469
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledSuggestions, { isLoading: loading, suggestions: suggestions }), _jsxs(StyledCodeEditor, { ...restProps, "data-testid": testIds.root, container: {
|
|
470
|
+
direction: 'column',
|
|
471
|
+
justify: 'between'
|
|
472
|
+
}, item: {
|
|
473
|
+
grow: 1
|
|
474
|
+
}, ref: ref, errors: errors, readOnly: readOnly, isLoading: loading, suggestions: suggestions, isSingleLine: isSingleLine, editorConfigProps: updatedEditorConfig, children: [showEditor && (_jsx(ReactCodeMirror, { value: value, onBeforeChange: onBeforeChange, options: updatedEditorConfig, editorDidMount: editor => {
|
|
475
|
+
editor.setSize('100%', '100%');
|
|
476
|
+
setCodeMirror(editor);
|
|
477
|
+
editorRef.current = editor;
|
|
478
|
+
}, onBlur: editor => {
|
|
479
|
+
setIsFocused(false);
|
|
480
|
+
if (onBlur) {
|
|
481
|
+
onBlurHandler(editor);
|
|
482
|
+
}
|
|
483
|
+
}, onFocus: () => {
|
|
484
|
+
setIsFocused(true);
|
|
485
|
+
} })), popoverInfo.errorMessages.length > 0 && popoverInfo.targetElement !== null && (_jsx(Popover, { as: StyledPopover, show: show, target: popoverInfo.targetElement, placement: 'bottom-start', "data-testid": testIds.errorPopover, children: _jsxs(Flex, { container: { direction: 'column', gap: 1 }, children: [_jsxs(Flex, { container: { gap: 1 }, children: [_jsx(StyledWarnIcon, { name: 'warn-solid' }), _jsx(Text, { variant: 'h4', children: t('errors', [], {
|
|
486
|
+
count: popoverInfo.errorMessages.length === 1
|
|
487
|
+
? 1
|
|
488
|
+
: // Using NaN to always select "other" pluralization form
|
|
489
|
+
NaN
|
|
490
|
+
}) })] }), popoverInfo.errorMessages.length > 1 ? (_jsx(UnorderedList, { as: StyledList, items: popoverInfo.errorMessages })) : (_jsx(Text, { children: popoverInfo.errorMessages }))] }) })), errors && (_jsx(StyledFormFieldInfo, { id: errorDescId, status: 'error', "data-testid": testIds.errorMessage, children: errors }))] })] }));
|
|
174
491
|
});
|
|
175
|
-
export default CodeEditor;
|
|
492
|
+
export default withTestIds(CodeEditor, getEditorsTestIds);
|
|
176
493
|
//# sourceMappingURL=CodeEditor.js.map
|