@sap-ux/control-property-editor 0.4.3 → 0.4.4

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "Control Property Editor",
4
4
  "description": "Control Property Editor",
5
5
  "license": "Apache-2.0",
6
- "version": "0.4.3",
6
+ "version": "0.4.4",
7
7
  "main": "dist/app.js",
8
8
  "repository": {
9
9
  "type": "git",
@@ -49,8 +49,8 @@
49
49
  "autoprefixer": "10.4.7",
50
50
  "postcss": "8.4.31",
51
51
  "yargs-parser": "21.1.1",
52
- "@sap-ux-private/control-property-editor-common": "0.3.1",
53
- "@sap-ux/ui-components": "1.13.3"
52
+ "@sap-ux/ui-components": "1.13.4",
53
+ "@sap-ux-private/control-property-editor-common": "0.3.1"
54
54
  },
55
55
  "scripts": {
56
56
  "clean": "rimraf ./dist ./coverage *.tsbuildinfo",
package/src/App.tsx CHANGED
@@ -4,6 +4,8 @@ import { useSelector } from 'react-redux';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { UIDialog, UILink, UIToggle } from '@sap-ux/ui-components';
6
6
 
7
+ import type { Scenario } from '@sap-ux-private/control-property-editor-common';
8
+
7
9
  import { PropertiesPanel, LeftPanel } from './panels';
8
10
  import { useLocalStorage } from './use-local-storage';
9
11
  import type { RootState } from './store';
@@ -37,6 +39,7 @@ export default function App(appProps: AppProps): ReactElement {
37
39
  }, []);
38
40
  const { t } = useTranslation();
39
41
  const dispatch = useAppDispatch();
42
+ const scenario = useSelector<RootState, Scenario>((state) => state.scenario);
40
43
  const [hideWarningDialog, setHideWarningDialog] = useLocalStorage('hide-warning-dialog', false);
41
44
  const [isWarningDialogVisible, setWarningDialogVisibility] = useState(() => hideWarningDialog !== true);
42
45
 
@@ -107,30 +110,34 @@ export default function App(appProps: AppProps): ReactElement {
107
110
  <PropertiesPanel />
108
111
  </section>
109
112
 
110
- <UIDialog
111
- hidden={!isWarningDialogVisible}
112
- closeButtonAriaLabel={t('CLOSE')}
113
- dialogContentProps={{
114
- title: t('TOOL_DISCLAIMER_TITLE'),
115
- subText: t('TOOL_DISCLAIMER_TEXT')
116
- }}
117
- acceptButtonText={t('OK')}
118
- onAccept={closeWarningDialog}>
119
- <UILink href="https://ui5.sap.com/#/topic/03265b0408e2432c9571d6b3feb6b1fd">
120
- {t('FE_DOCUMENTATION_LINK_TEXT')}
121
- </UILink>
122
- <UIToggle
123
- className="space space-toggle"
124
- label={t('DONT_SHOW_WARNING_ON_START')}
125
- inlineLabel
126
- inlineLabelLeft
127
- labelFlexGrow
128
- checked={hideWarningDialog}
129
- onChange={(_event, checked = false): void => {
130
- setHideWarningDialog(checked);
113
+ {scenario === 'FE_FROM_SCRATCH' ? (
114
+ <UIDialog
115
+ hidden={!isWarningDialogVisible}
116
+ closeButtonAriaLabel={t('CLOSE')}
117
+ dialogContentProps={{
118
+ title: t('TOOL_DISCLAIMER_TITLE'),
119
+ subText: t('TOOL_DISCLAIMER_TEXT')
131
120
  }}
132
- />
133
- </UIDialog>
121
+ acceptButtonText={t('OK')}
122
+ onAccept={closeWarningDialog}>
123
+ <UILink href="https://ui5.sap.com/#/topic/03265b0408e2432c9571d6b3feb6b1fd">
124
+ {t('FE_DOCUMENTATION_LINK_TEXT')}
125
+ </UILink>
126
+ <UIToggle
127
+ className="space space-toggle"
128
+ label={t('DONT_SHOW_WARNING_ON_START')}
129
+ inlineLabel
130
+ inlineLabelLeft
131
+ labelFlexGrow
132
+ checked={hideWarningDialog}
133
+ onChange={(_event, checked = false): void => {
134
+ setHideWarningDialog(checked);
135
+ }}
136
+ />
137
+ </UIDialog>
138
+ ) : (
139
+ <></>
140
+ )}
134
141
  </div>
135
142
  );
136
143
  }
@@ -6,7 +6,7 @@ import { render, mockDomEventListener } from './utils';
6
6
  import { initI18n } from '../../src/i18n';
7
7
 
8
8
  import App from '../../src/App';
9
- import { controlSelected } from '@sap-ux-private/control-property-editor-common';
9
+ import { controlSelected, scenarioLoaded } from '@sap-ux-private/control-property-editor-common';
10
10
  import { mockResizeObserver } from '../utils/utils';
11
11
  import { InputType } from '../../src/panels/properties/types';
12
12
  import { registerAppIcons } from '../../src/icons';
@@ -163,8 +163,17 @@ test('renders properties', () => {
163
163
  expect(notFoundException).toBeTruthy();
164
164
  });
165
165
 
166
- test('renders warning dialog', async () => {
166
+ test('does not render warning dialog', async () => {
167
167
  render(<App previewUrl="" />);
168
+ const dialogContent = screen.queryByText(
169
+ /The Control Property Editor enables you to change control properties and behavior directly. These changes may not have the desired effect with Fiori elements applications. Please consult documentation to learn which changes are supported./i
170
+ );
171
+ expect(dialogContent).not.toBeInTheDocument();
172
+ });
173
+
174
+ test('renders warning dialog for "FE_FROM_SCRATCH" scenario', async () => {
175
+ const { store } = render(<App previewUrl="" />, { initialState });
176
+ store.dispatch(scenarioLoaded('FE_FROM_SCRATCH'));
168
177
  const dialogContent = screen.getByText(
169
178
  /The Control Property Editor enables you to change control properties and behavior directly. These changes may not have the desired effect with Fiori elements applications. Please consult documentation to learn which changes are supported./i
170
179
  );