diff --git a/examples/ui-prompting-examples/CHANGELOG.md b/examples/ui-prompting-examples/CHANGELOG.md index 2001e208bc..44e532ff6f 100644 --- a/examples/ui-prompting-examples/CHANGELOG.md +++ b/examples/ui-prompting-examples/CHANGELOG.md @@ -1,5 +1,13 @@ # @sap-ux-private/ui-prompting-examples +## 0.2.17 + +### Patch Changes + +- Updated dependencies [32191dd] + - @sap-ux/ui-components@1.21.1 + - @sap-ux/ui-prompting@0.3.3 + ## 0.2.16 ### Patch Changes diff --git a/examples/ui-prompting-examples/package.json b/examples/ui-prompting-examples/package.json index 4e0c6c2e57..fac6ef7549 100644 --- a/examples/ui-prompting-examples/package.json +++ b/examples/ui-prompting-examples/package.json @@ -1,6 +1,6 @@ { "name": "@sap-ux-private/ui-prompting-examples", - "version": "0.2.16", + "version": "0.2.17", "description": "This project contains UI storybook stories with exampleS with prompt ui and FPM based building blocks.", "license": "Apache-2.0", "private": true, diff --git a/packages/create/CHANGELOG.md b/packages/create/CHANGELOG.md index 5a580fee94..f4ab0c2c77 100644 --- a/packages/create/CHANGELOG.md +++ b/packages/create/CHANGELOG.md @@ -1,5 +1,13 @@ # @sap-ux/create +## 0.8.77 + +### Patch Changes + +- Updated dependencies [f2d3335] + - @sap-ux/preview-middleware@0.16.117 + - @sap-ux/app-config-writer@0.4.52 + ## 0.8.76 ### Patch Changes diff --git a/packages/create/package.json b/packages/create/package.json index 0551c22490..bf947fbdb6 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -1,7 +1,7 @@ { "name": "@sap-ux/create", "description": "SAP Fiori tools module to add or remove features", - "version": "0.8.76", + "version": "0.8.77", "repository": { "type": "git", "url": "https://github.com/SAP/open-ux-tools.git", diff --git a/packages/preview-middleware-client/CHANGELOG.md b/packages/preview-middleware-client/CHANGELOG.md index e07a7d6457..e465767035 100644 --- a/packages/preview-middleware-client/CHANGELOG.md +++ b/packages/preview-middleware-client/CHANGELOG.md @@ -1,5 +1,11 @@ # @sap-ux-private/preview-middleware-client +## 0.11.30 + +### Patch Changes + +- f2d3335: Hide "Semantic Date Range" Quick Action behind feature toggle. + ## 0.11.29 ### Patch Changes diff --git a/packages/preview-middleware-client/package.json b/packages/preview-middleware-client/package.json index 4c211d1dc0..7a8d2428a2 100644 --- a/packages/preview-middleware-client/package.json +++ b/packages/preview-middleware-client/package.json @@ -1,6 +1,6 @@ { "name": "@sap-ux-private/preview-middleware-client", - "version": "0.11.29", + "version": "0.11.30", "description": "Client-side coding hosted by the preview middleware", "repository": { "type": "git", diff --git a/packages/preview-middleware-client/src/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts b/packages/preview-middleware-client/src/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts index 5fd8a25d21..00b8972c60 100644 --- a/packages/preview-middleware-client/src/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +++ b/packages/preview-middleware-client/src/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts @@ -1,6 +1,7 @@ import FlexCommand from 'sap/ui/rta/command/FlexCommand'; import FilterBar from 'sap/ui/mdc/FilterBar'; +import { FeatureService } from '../../../cpe/feature-service'; import { QuickActionContext, SimpleQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition'; import { pageHasControlId } from '../../../cpe/quick-actions/utils'; import { getControlById } from '../../../utils/core'; @@ -28,6 +29,9 @@ export class ToggleSemanticDateRangeFilterBar private isUseDateRangeTypeEnabled = false; initialize(): void { + if (FeatureService.isFeatureEnabled('cpe.beta.quick-actions') === false) { + return; + } const controls = this.context.controlIndex[CONTROL_TYPE] ?? []; for (const control of controls) { const isActionApplicable = pageHasControlId(this.context.view, control.controlId); diff --git a/packages/preview-middleware-client/test/unit/adp/quick-actions/fe-v4.test.ts b/packages/preview-middleware-client/test/unit/adp/quick-actions/fe-v4.test.ts index 475f01fe02..8135a354d8 100644 --- a/packages/preview-middleware-client/test/unit/adp/quick-actions/fe-v4.test.ts +++ b/packages/preview-middleware-client/test/unit/adp/quick-actions/fe-v4.test.ts @@ -846,6 +846,91 @@ describe('FE V2 quick actions', () => { }); describe('disable/enable "Semantic Date Range" in Filter Bar', () => { + test('not available by default', async () => { + jest.spyOn(FeatureService, 'isFeatureEnabled').mockReturnValue(false); + const appComponent = new AppComponentMock(); + const component = new TemplateComponentMock(); + jest.spyOn(component, 'getAppComponent').mockReturnValue(appComponent); + jest.spyOn(ComponentMock, 'getOwnerComponentFor').mockImplementation(() => { + return component as unknown as UIComponent; + }); + sapCoreMock.byId.mockImplementation((id) => { + if (id == 'FilterBar') { + return { + getDomRef: () => ({}), + getParent: () => ({}), + data: jest.fn().mockImplementation((key) => { + // Mock the return value for 'useSemanticDateRange' + if (key === 'useSemanticDateRange') { + return true; + } + return undefined; + }) + }; + } + if (id == 'NavContainer') { + const container = new NavContainer(); + const pageView = new XMLView(); + pageView.getDomRef.mockImplementation(() => { + return { + contains: () => true + }; + }); + pageView.getId.mockReturnValue('test.app::ProductsList'); + pageView.getViewName.mockImplementation(() => 'sap.fe.templates.ListReport.ListReport'); + const componentContainer = new ComponentContainer(); + jest.spyOn(componentContainer, 'getComponent').mockImplementation(() => { + return 'component-id'; + }); + jest.spyOn(Component, 'getComponentById').mockImplementation((id: string | undefined) => { + if (id === 'component-id') { + return component; + } + }); + container.getCurrentPage.mockImplementation(() => { + return componentContainer; + }); + component.getRootControl.mockImplementation(() => { + return pageView; + }); + return container; + } + }); + + CommandFactory.getCommandFor.mockImplementation((control, type, value, _, settings) => { + return { type, value, settings }; + }); + + const rtaMock = new RuntimeAuthoringMock({} as RTAOptions) as unknown as RuntimeAuthoring; + const registry = new FEV4QuickActionRegistry(); + const service = new QuickActionService(rtaMock, new OutlineService(rtaMock, mockChangeService), [ + registry + ]); + await service.init(sendActionMock, subscribeMock); + + await service.reloadQuickActions({ + 'sap.fe.macros.controls.FilterBar': [ + { + controlId: 'FilterBar' + } as any + ], + 'sap.m.NavContainer': [ + { + controlId: 'NavContainer' + } as any + ] + }); + + expect(sendActionMock).toHaveBeenCalledWith( + quickActionListChanged([ + { + title: 'LIST REPORT', + actions: [] + } + ]) + ); + }); + test('initialize and execute action', async () => { const appComponent = new AppComponentMock(); const component = new TemplateComponentMock(); @@ -949,7 +1034,8 @@ describe('FE V2 quick actions', () => { parameters: { page: 'ProductsList', entityPropertyChange: { - propertyPath: 'controlConfiguration/@com.sap.vocabularies.UI.v1.SelectionFields/useSemanticDateRange', + propertyPath: + 'controlConfiguration/@com.sap.vocabularies.UI.v1.SelectionFields/useSemanticDateRange', propertyValue: false, operation: 'UPSERT' } diff --git a/packages/preview-middleware/CHANGELOG.md b/packages/preview-middleware/CHANGELOG.md index 6703db4594..b04e1b34cb 100644 --- a/packages/preview-middleware/CHANGELOG.md +++ b/packages/preview-middleware/CHANGELOG.md @@ -1,5 +1,11 @@ # @sap-ux/preview-middleware +## 0.16.117 + +### Patch Changes + +- f2d3335: Hide "Semantic Date Range" Quick Action behind feature toggle. + ## 0.16.116 ### Patch Changes diff --git a/packages/preview-middleware/package.json b/packages/preview-middleware/package.json index 77e6cb3900..d5af5dccd9 100644 --- a/packages/preview-middleware/package.json +++ b/packages/preview-middleware/package.json @@ -9,7 +9,7 @@ "bugs": { "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware" }, - "version": "0.16.116", + "version": "0.16.117", "license": "Apache-2.0", "author": "@SAP/ux-tools-team", "main": "dist/index.js", diff --git a/packages/reload-middleware/CHANGELOG.md b/packages/reload-middleware/CHANGELOG.md index 78e83117e9..8a79446b87 100644 --- a/packages/reload-middleware/CHANGELOG.md +++ b/packages/reload-middleware/CHANGELOG.md @@ -1,5 +1,11 @@ # @sap-ux/reload-middleware +## 0.2.6 + +### Patch Changes + +- f2d3335: Expose `watchManifestChanges` function. + ## 0.2.5 ### Patch Changes diff --git a/packages/reload-middleware/package.json b/packages/reload-middleware/package.json index 7524b732c9..1b4c0c3d3d 100644 --- a/packages/reload-middleware/package.json +++ b/packages/reload-middleware/package.json @@ -9,7 +9,7 @@ "bugs": { "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Areload-middleware" }, - "version": "0.2.5", + "version": "0.2.6", "author": "@SAP/ux-tools-team", "license": "Apache-2.0", "main": "dist/index.js", diff --git a/packages/reload-middleware/src/base/index.ts b/packages/reload-middleware/src/base/index.ts index 9859debcde..d1bb5c1715 100644 --- a/packages/reload-middleware/src/base/index.ts +++ b/packages/reload-middleware/src/base/index.ts @@ -1,3 +1,3 @@ -export { getLivereloadServer, getConnectLivereload } from './livereload'; +export { getLivereloadServer, getConnectLivereload, watchManifestChanges } from './livereload'; export { ReloaderConfig, LiveReloadOptions, ConnectLivereloadOptions, HttpsOptions } from './types'; export { defaultLiveReloadOpts, defaultConnectLivereloadOpts } from './constants'; diff --git a/packages/reload-middleware/src/index.ts b/packages/reload-middleware/src/index.ts index 7ff18f5c7d..fbc1b32b7b 100644 --- a/packages/reload-middleware/src/index.ts +++ b/packages/reload-middleware/src/index.ts @@ -1,6 +1,7 @@ export { getLivereloadServer, getConnectLivereload, + watchManifestChanges, ReloaderConfig, LiveReloadOptions, ConnectLivereloadOptions, diff --git a/packages/ui-components/CHANGELOG.md b/packages/ui-components/CHANGELOG.md index ef31fcf387..d3d379ba06 100644 --- a/packages/ui-components/CHANGELOG.md +++ b/packages/ui-components/CHANGELOG.md @@ -1,5 +1,11 @@ # @sap-ux/ui-components +## 1.21.1 + +### Patch Changes + +- 32191dd: UITranslationInput. Screen readers read the resolved translation tooltip/title of UITranslationInput as part of the screen reader speech, displaying it as 'Value: ... Translation: ...'. + ## 1.21.0 ### Minor Changes diff --git a/packages/ui-components/package.json b/packages/ui-components/package.json index 1bf64d1fa0..d1cce332bf 100644 --- a/packages/ui-components/package.json +++ b/packages/ui-components/package.json @@ -1,6 +1,6 @@ { "name": "@sap-ux/ui-components", - "version": "1.21.0", + "version": "1.21.1", "license": "Apache-2.0", "description": "SAP UI Components Library", "repository": { diff --git a/packages/ui-components/src/components/UIInput/UITextInput.tsx b/packages/ui-components/src/components/UIInput/UITextInput.tsx index 1dc0500be9..27dd9981ef 100644 --- a/packages/ui-components/src/components/UIInput/UITextInput.tsx +++ b/packages/ui-components/src/components/UIInput/UITextInput.tsx @@ -38,7 +38,7 @@ const COLOR_STYLES = { } }; -type InputRenderProps = React.InputHTMLAttributes & React.RefAttributes; +export type InputRenderProps = React.InputHTMLAttributes & React.RefAttributes; /** * UITextInput component @@ -57,7 +57,7 @@ export class UITextInput extends React.Component { public constructor(props: UITextInputProps) { super(props); - this.onRenderDisabledInput = this.onRenderDisabledInput.bind(this); + this.onRenderInput = this.onRenderInput.bind(this); } /** @@ -227,25 +227,46 @@ export class UITextInput extends React.Component { }; /** - * Method to render HTML input element. + * Method to extend HTML input element. * Custom rendering is used to use "readonly" attribute instead of "disabled" to make disabled field focusable. * * @param {InputRenderProps} [props] Input props. * @param {(props?: InputRenderProps) => JSX.Element | null} [defaultRender] Default renderer. * @returns {JSX.Element | null} Input element to render. */ - private onRenderDisabledInput = ( + private onRenderDisabledInput( props?: InputRenderProps, defaultRender?: (props?: InputRenderProps) => JSX.Element | null - ): JSX.Element | null => { - const inputProps = { - ...props, - disabled: undefined, - readOnly: true, - ['aria-disabled']: true - }; + ): JSX.Element | null { + const inputProps = this.props.disabled + ? { + ...props, + disabled: undefined, + readOnly: true, + ['aria-disabled']: true + } + : props; return defaultRender?.(inputProps) || null; - }; + } + + /** + * Method to render HTML input element. + * + * @param {InputRenderProps} [props] Input props. + * @param {(props?: InputRenderProps) => JSX.Element | null} [defaultRender] Default renderer. + * @returns {JSX.Element | null} Input element to render. + */ + private onRenderInput( + props?: InputRenderProps, + defaultRender?: (props?: InputRenderProps) => JSX.Element | null + ): JSX.Element | null { + if (this.props.onRenderInput) { + return this.props.onRenderInput(props, (renderProps?: InputRenderProps): JSX.Element | null => { + return this.onRenderDisabledInput(renderProps, defaultRender); + }); + } + return this.onRenderDisabledInput(props, defaultRender); + } /** * @returns {JSX.Element} @@ -255,8 +276,8 @@ export class UITextInput extends React.Component { const textFieldStyles = this.getStyles; return ( diff --git a/packages/ui-components/src/components/UITranslationInput/UITranslationInput.scss b/packages/ui-components/src/components/UITranslationInput/UITranslationInput.scss index e8f72ece0f..f925c5a82a 100644 --- a/packages/ui-components/src/components/UITranslationInput/UITranslationInput.scss +++ b/packages/ui-components/src/components/UITranslationInput/UITranslationInput.scss @@ -37,4 +37,11 @@ } } } + &__field { + width: 100%; + height: 100%; + input { + height: 100%; + } + } } diff --git a/packages/ui-components/src/components/UITranslationInput/UITranslationInput.tsx b/packages/ui-components/src/components/UITranslationInput/UITranslationInput.tsx index bd0c7ce61a..77aef9d532 100644 --- a/packages/ui-components/src/components/UITranslationInput/UITranslationInput.tsx +++ b/packages/ui-components/src/components/UITranslationInput/UITranslationInput.tsx @@ -1,7 +1,7 @@ import React, { useCallback } from 'react'; import type { ReactElement } from 'react'; import { UITextInput } from '../UIInput'; -import type { ITextFieldProps } from '../UIInput'; +import type { InputRenderProps, ITextFieldProps } from '../UIInput'; import { UiIcons } from '../Icons'; import { UITranslationButton } from './UITranslationButton'; import type { @@ -216,12 +216,29 @@ export const UITranslationInput = JSX.Element | null + ): JSX.Element | null => { + if (defaultRender) { + return ( +
+ {defaultRender({ ...props, title: undefined })} +
+ ); + } + return null; + }, + [title] + ); + return ( ); }; diff --git a/packages/ui-components/test/unit/components/UITextfield.test.tsx b/packages/ui-components/test/unit/components/UITextfield.test.tsx index 2350962747..f86762f29e 100644 --- a/packages/ui-components/test/unit/components/UITextfield.test.tsx +++ b/packages/ui-components/test/unit/components/UITextfield.test.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import * as Enzyme from 'enzyme'; import type { IStyleFunction, ITextFieldStyleProps, ITextFieldStyles } from '@fluentui/react'; import { TextField } from '@fluentui/react'; -import type { UITextInputProps } from '../../../src/components/UIInput'; +import type { InputRenderProps, UITextInputProps } from '../../../src/components/UIInput'; import { UITextInput } from '../../../src/components/UIInput'; describe('', () => { @@ -157,4 +157,37 @@ describe('', () => { expect(element.querySelectorAll('.dummyError').length).toEqual(1); }); }); + + describe('Custom renderers for "onRenderInput"', () => { + it('External "onRenderInput"', () => { + wrapper.setProps({ + onRenderInput: ( + props?: InputRenderProps, + defaultRender?: (props?: InputRenderProps) => JSX.Element | null + ) => { + return
{defaultRender?.(props)}
; + } + }); + expect(wrapper.find('.custom-render-option').length).toEqual(1); + const inputProps = wrapper.find('input.ms-TextField-field')?.props(); + expect(inputProps?.disabled).toEqual(undefined); + expect(inputProps?.readOnly).toEqual(undefined); + }); + + it('External and internal "onRenderInput"', () => { + wrapper.setProps({ + disabled: true, + onRenderInput: ( + props?: InputRenderProps, + defaultRender?: (props?: InputRenderProps) => JSX.Element | null + ) => { + return
{defaultRender?.(props)}
; + } + }); + expect(wrapper.find('.custom-render-option').length).toEqual(1); + const inputProps = wrapper.find('input.ms-TextField-field')?.props(); + expect(inputProps?.disabled).toEqual(undefined); + expect(inputProps?.readOnly).toEqual(true); + }); + }); }); diff --git a/packages/ui-components/test/unit/components/UITranslationInput/UITranslationInput.test.tsx b/packages/ui-components/test/unit/components/UITranslationInput/UITranslationInput.test.tsx index b9f1e3e85e..b5b21be4cf 100644 --- a/packages/ui-components/test/unit/components/UITranslationInput/UITranslationInput.test.tsx +++ b/packages/ui-components/test/unit/components/UITranslationInput/UITranslationInput.test.tsx @@ -18,7 +18,8 @@ describe('', () => { input: '.ms-TextField', button: '.ms-Button', callout: '.ms-Callout', - loader: '.ms-Spinner' + loader: '.ms-Spinner', + inputField: '.ui-translatable__field' }; const getButtonIdSelector = (id: string, goToCode = false): string => { @@ -264,7 +265,10 @@ describe('', () => { 'value': { 'value': result.entry.value } }); // Check title - expect(container.querySelector(`${selectors.input} input`)?.getAttribute('title')).toEqual(result.title); + expect(container.querySelector(`${selectors.input} input`)?.getAttribute('title')).toEqual(null); + expect( + container.querySelector(`${selectors.input} ${selectors.inputField}`)?.getAttribute('title') + ).toEqual(result.title); } ); @@ -430,6 +434,8 @@ describe('', () => { /> ); // Check title - expect(container.querySelector(`${selectors.input} input`)?.getAttribute('title')).toEqual(externalTitle); + expect(container.querySelector(`${selectors.input} ${selectors.inputField}`)?.getAttribute('title')).toEqual( + externalTitle + ); }); }); diff --git a/packages/ui-prompting/CHANGELOG.md b/packages/ui-prompting/CHANGELOG.md index dab7f99001..5e77d5064f 100644 --- a/packages/ui-prompting/CHANGELOG.md +++ b/packages/ui-prompting/CHANGELOG.md @@ -1,5 +1,12 @@ # @sap-ux/ui-prompting +## 0.3.3 + +### Patch Changes + +- Updated dependencies [32191dd] + - @sap-ux/ui-components@1.21.1 + ## 0.3.2 ### Patch Changes diff --git a/packages/ui-prompting/package.json b/packages/ui-prompting/package.json index d4b2bc3a43..e3e672d429 100644 --- a/packages/ui-prompting/package.json +++ b/packages/ui-prompting/package.json @@ -1,6 +1,6 @@ { "name": "@sap-ux/ui-prompting", - "version": "0.3.2", + "version": "0.3.3", "license": "Apache-2.0", "description": "SAP UI Components Library", "repository": {