Skip to content

Commit

Permalink
Merge branch 'main' into 2128/confirm-validator-not-invoked
Browse files Browse the repository at this point in the history
  • Loading branch information
longieirl authored Oct 8, 2024
2 parents 864a295 + 97d63d5 commit 1f18bc2
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 9 deletions.
7 changes: 7 additions & 0 deletions examples/ui-prompting-examples/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @sap-ux-private/ui-prompting-examples

## 0.2.3

### Patch Changes

- Updated dependencies [0b8a374]
- @sap-ux/ui-prompting@0.2.3

## 0.2.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/ui-prompting-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sap-ux-private/ui-prompting-examples",
"version": "0.2.2",
"version": "0.2.3",
"description": "This project contains UI storybook stories with exampleS with prompt ui and FPM based building blocks.",
"license": "Apache-2.0",
"private": true,
Expand Down
6 changes: 6 additions & 0 deletions packages/control-property-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sap-ux/control-property-editor

## 0.5.16

### Patch Changes

- ed1c915: Clean up copied to clipboard pop up

## 0.5.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/control-property-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Control Property Editor",
"description": "Control Property Editor",
"license": "Apache-2.0",
"version": "0.5.15",
"version": "0.5.16",
"main": "dist/app.js",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ export function Clipboard(clipBoardProps: ClipboardProps): ReactElement {
return (
<UICallout
styles={{
root: {
boxShadow: 'none'
},
calloutMain: {
minWidth: 0,
padding: '5px 10px 5px 10px',
outline: '1px solid var(--vscode-terminal-ansiGreen) !important',
padding: '5px 10px 5px 5px',
outline: '1px solid var(--vscode-charts-green) !important',
borderRadius: '2px',
fontSize: defaultFontSize
}
}}
Expand All @@ -34,7 +38,7 @@ export function Clipboard(clipBoardProps: ClipboardProps): ReactElement {
directionalHint={9}
contentPadding={UICalloutContentPadding.None}>
<span data-testid="copied-to-clipboard-popup" style={{ display: 'flex', alignItems: 'center' }}>
<Icon iconName={UiIcons.Success} />
<Icon iconName={UiIcons.Success} style={{ display: 'flex' }} />
<span data-testid="copied-to-clipboard-message" style={{ marginLeft: '5px' }}>
{t('COPIED_TO_CLIPBOARD')}
</span>
Expand Down
6 changes: 6 additions & 0 deletions packages/ui-prompting/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sap-ux/ui-prompting

## 0.2.3

### Patch Changes

- 0b8a374: Do not show the translation input if the translation props are not provided (i.e., no I18N bundle and no translation event handler).

## 0.2.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-prompting/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sap-ux/ui-prompting",
"version": "0.2.2",
"version": "0.2.3",
"license": "Apache-2.0",
"description": "SAP UI Components Library",
"repository": {
Expand Down
5 changes: 3 additions & 2 deletions packages/ui-prompting/src/components/Question/Question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ export interface QuestionProps {
choices?: PromptListChoices;
pending?: boolean;
validation: ValidationResults;
isI18nInputSupported?: boolean;
}

export const Question = (props: QuestionProps) => {
const { question, onChange, answers, choices, pending, validation = {}, id } = props;
const { question, onChange, answers, choices, pending, validation = {}, id, isI18nInputSupported } = props;
let questionInput: JSX.Element;
let errorMessage = '';
const value: AnswerValue = getAnswer(answers, question.name) as AnswerValue;
Expand All @@ -28,7 +29,7 @@ export const Question = (props: QuestionProps) => {
switch (question?.type) {
case 'input': {
const { translatable } = question.guiOptions ?? {};
if (translatable) {
if (isI18nInputSupported && translatable) {
questionInput = (
<TranslationInput
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export const Questions = (props: QuestionsProps) => {
onChange={onAnswerChange}
choices={externalChoices}
pending={pendingRequests[name]}
isI18nInputSupported={!!props.translationProps}
/>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { ListPromptQuestion, PromptQuestion } from '../../../src/types';
import type { QuestionsProps } from '../../../src';
import { questions } from '../../mock-data/questions';
import { getDependantQuestions } from '../../../src/utilities';
import { acceptI18nCallout, clickI18nButton, isI18nLoading } from '../utils';
import { acceptI18nCallout, clickI18nButton, isI18nLoading, translationInputSelectors } from '../utils';

describe('Questions', () => {
initIcons();
Expand Down Expand Up @@ -359,5 +359,11 @@ describe('Questions', () => {
// Check result
expect(isI18nLoading()).toEqual(true);
});

it('Do not show translation input when no translation props passed', async () => {
render(<Questions {...props} id="my-prompt" questions={[question]} translationProps={undefined} />);
// Check that there no translation input rendered
expect(document.querySelectorAll(translationInputSelectors.button).length).toEqual(0);
});
});
});

0 comments on commit 1f18bc2

Please sign in to comment.