@sap-ux/preview-middleware 0.11.35 → 0.12.0

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.
Files changed (50) hide show
  1. package/dist/base/flp.d.ts +8 -2
  2. package/dist/base/flp.js +28 -19
  3. package/dist/client/adp/api-handler.js +141 -141
  4. package/dist/client/adp/command-executor.js +54 -41
  5. package/dist/client/adp/command-executor.ts +18 -4
  6. package/dist/client/adp/control-utils.js +44 -44
  7. package/dist/client/adp/controllers/AddFragment.controller.js +206 -203
  8. package/dist/client/adp/controllers/AddFragment.controller.ts +11 -5
  9. package/dist/client/adp/controllers/BaseDialog.controller.js +57 -57
  10. package/dist/client/adp/controllers/BaseDialog.controller.ts +8 -2
  11. package/dist/client/adp/controllers/ControllerExtension.controller.js +174 -173
  12. package/dist/client/adp/controllers/ControllerExtension.controller.ts +10 -6
  13. package/dist/client/adp/controllers/ExtensionPoint.controller.js +100 -100
  14. package/dist/client/adp/controllers/ExtensionPoint.controller.ts +8 -6
  15. package/dist/client/adp/init-dialogs.js +74 -73
  16. package/dist/client/adp/init-dialogs.ts +13 -8
  17. package/dist/client/adp/init.js +23 -7
  18. package/dist/client/adp/init.ts +14 -6
  19. package/dist/client/adp/ui/AddFragment.fragment.xml +69 -0
  20. package/dist/client/adp/ui/ControllerExtension.fragment.xml +51 -0
  21. package/dist/client/adp/ui/ExtensionPoint.fragment.xml +51 -0
  22. package/dist/client/adp/ui5-version-utils.js +63 -63
  23. package/dist/client/adp/utils.js +33 -33
  24. package/dist/client/cpe/changes/flex-change.js +51 -51
  25. package/dist/client/cpe/changes/index.js +10 -10
  26. package/dist/client/cpe/changes/validator.js +35 -35
  27. package/dist/client/cpe/documentation.js +164 -164
  28. package/dist/client/cpe/logger.js +30 -30
  29. package/dist/client/cpe/outline/nodes.js +84 -84
  30. package/dist/client/cpe/outline/utils.js +37 -37
  31. package/dist/client/cpe/types.js +4 -4
  32. package/dist/client/cpe/ui5-utils.js +49 -49
  33. package/dist/client/cpe/utils.js +48 -48
  34. package/dist/client/flp/WorkspaceConnector.js +69 -77
  35. package/dist/client/flp/WorkspaceConnector.ts +5 -25
  36. package/dist/client/flp/common.js +30 -0
  37. package/dist/client/flp/common.ts +26 -0
  38. package/dist/client/flp/enableFakeConnector.js +79 -0
  39. package/dist/client/flp/enableFakeConnector.ts +93 -0
  40. package/dist/client/flp/init.js +212 -204
  41. package/dist/client/flp/init.ts +27 -11
  42. package/dist/client/flp/initConnectors.js +35 -0
  43. package/dist/client/flp/initConnectors.ts +30 -0
  44. package/dist/client/flp/initRta.js +180 -0
  45. package/dist/client/flp/initRta.ts +193 -0
  46. package/package.json +4 -3
  47. package/templates/flp/sandbox.html +7 -1
  48. package/dist/client/adp/ui/AddFragment.view.xml +0 -68
  49. package/dist/client/adp/ui/ControllerExtension.view.xml +0 -49
  50. package/dist/client/adp/ui/ExtensionPoint.view.xml +0 -49
@@ -1,75 +1,76 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/mvc/XMLView", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller"], function (XMLView, __AddFragment, __ControllerExtension, __ExtensionPoint) {
4
- "use strict";
5
-
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
- }
9
- const AddFragment = _interopRequireDefault(__AddFragment);
10
- const ControllerExtension = _interopRequireDefault(__ControllerExtension);
11
- const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
12
- var DialogNames = /*#__PURE__*/function (DialogNames) {
13
- DialogNames["ADD_FRAGMENT"] = "AddFragment";
14
- DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
15
- DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
16
- return DialogNames;
17
- }(DialogNames || {});
18
- /**
19
- * Adds a new item to the context menu
20
- *
21
- * @param rta Runtime Authoring
22
- */
23
- const initDialogs = rta => {
24
- const contextMenu = rta.getDefaultPlugins().contextMenu;
25
- contextMenu.addMenuItem({
26
- id: 'ADD_FRAGMENT',
27
- text: 'Add: Fragment',
28
- handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
29
- icon: 'sap-icon://attachment-html'
30
- });
31
- contextMenu.addMenuItem({
32
- id: 'EXTEND_CONTROLLER',
33
- text: 'Extend With Controller',
34
- handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
35
- icon: 'sap-icon://create-form'
36
- });
37
- };
38
-
39
- /**
40
- * Handler for new context menu entry
41
- *
42
- * @param overlays Control overlays
43
- * @param rta Runtime Authoring
44
- * @param dialogName Dialog name
45
- * @param extensionPointData Control ID
46
- */
47
- async function handler(overlays, rta, dialogName, extensionPointData) {
48
- let controller;
49
- switch (dialogName) {
50
- case DialogNames.ADD_FRAGMENT:
51
- controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlays, rta);
52
- break;
53
- case DialogNames.CONTROLLER_EXTENSION:
54
- controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlays, rta);
55
- break;
56
- case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
57
- controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlays, rta, extensionPointData);
58
- break;
59
- }
60
- const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
61
- await XMLView.create({
62
- viewName: `open.ux.preview.client.adp.ui.${dialogName}`,
63
- controller,
64
- id
65
- });
66
- }
67
- var __exports = {
68
- __esModule: true
69
- };
70
- __exports.DialogNames = DialogNames;
71
- __exports.initDialogs = initDialogs;
72
- __exports.handler = handler;
73
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Fragment", "./controllers/AddFragment.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller"], function (Fragment, __AddFragment, __ControllerExtension, __ExtensionPoint) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const AddFragment = _interopRequireDefault(__AddFragment);
10
+ const ControllerExtension = _interopRequireDefault(__ControllerExtension);
11
+ const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
12
+ var DialogNames = /*#__PURE__*/function (DialogNames) {
13
+ DialogNames["ADD_FRAGMENT"] = "AddFragment";
14
+ DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
15
+ DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
16
+ return DialogNames;
17
+ }(DialogNames || {});
18
+ /**
19
+ * Adds a new item to the context menu
20
+ *
21
+ * @param rta Runtime Authoring
22
+ */
23
+ const initDialogs = rta => {
24
+ const contextMenu = rta.getDefaultPlugins().contextMenu;
25
+ contextMenu.addMenuItem({
26
+ id: 'ADD_FRAGMENT',
27
+ text: 'Add: Fragment',
28
+ handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
29
+ icon: 'sap-icon://attachment-html'
30
+ });
31
+ contextMenu.addMenuItem({
32
+ id: 'EXTEND_CONTROLLER',
33
+ text: 'Extend With Controller',
34
+ handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
35
+ icon: 'sap-icon://create-form'
36
+ });
37
+ };
38
+
39
+ /**
40
+ * Handler for new context menu entry
41
+ *
42
+ * @param overlay Control overlays
43
+ * @param rta Runtime Authoring
44
+ * @param dialogName Dialog name
45
+ * @param extensionPointData Control ID
46
+ */
47
+ async function handler(overlay, rta, dialogName, extensionPointData) {
48
+ let controller;
49
+ switch (dialogName) {
50
+ case DialogNames.ADD_FRAGMENT:
51
+ controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
52
+ break;
53
+ case DialogNames.CONTROLLER_EXTENSION:
54
+ controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
55
+ break;
56
+ case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
57
+ controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
58
+ break;
59
+ }
60
+ const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
61
+ const dialog = await Fragment.load({
62
+ name: `open.ux.preview.client.adp.ui.${dialogName}`,
63
+ controller,
64
+ id
65
+ });
66
+ await controller.setup(dialog);
67
+ }
68
+ var __exports = {
69
+ __esModule: true
70
+ };
71
+ __exports.DialogNames = DialogNames;
72
+ __exports.initDialogs = initDialogs;
73
+ __exports.handler = handler;
74
+ return __exports;
74
75
  });
75
76
  //# sourceMappingURL=init-dialogs.js.map
@@ -1,5 +1,8 @@
1
+ /** sap.m */
2
+ import type Dialog from 'sap/m/Dialog';
3
+
1
4
  /** sap.ui.core */
2
- import XMLView from 'sap/ui/core/mvc/XMLView';
5
+ import Fragment from 'sap/ui/core/Fragment';
3
6
  import type UI5Element from 'sap/ui/core/Element';
4
7
 
5
8
  /** sap.ui.rta */
@@ -44,13 +47,13 @@ export const initDialogs = (rta: RuntimeAuthoring): void => {
44
47
  /**
45
48
  * Handler for new context menu entry
46
49
  *
47
- * @param overlays Control overlays
50
+ * @param overlay Control overlays
48
51
  * @param rta Runtime Authoring
49
52
  * @param dialogName Dialog name
50
53
  * @param extensionPointData Control ID
51
54
  */
52
55
  export async function handler(
53
- overlays: UI5Element,
56
+ overlay: UI5Element,
54
57
  rta: RuntimeAuthoring,
55
58
  dialogName: DialogNames,
56
59
  extensionPointData?: ExtensionPointData
@@ -59,15 +62,15 @@ export async function handler(
59
62
 
60
63
  switch (dialogName) {
61
64
  case DialogNames.ADD_FRAGMENT:
62
- controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlays, rta);
65
+ controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
63
66
  break;
64
67
  case DialogNames.CONTROLLER_EXTENSION:
65
- controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlays, rta);
68
+ controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
66
69
  break;
67
70
  case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
68
71
  controller = new ExtensionPoint(
69
72
  `open.ux.preview.client.adp.controllers.${dialogName}`,
70
- overlays,
73
+ overlay,
71
74
  rta,
72
75
  extensionPointData!
73
76
  );
@@ -76,9 +79,11 @@ export async function handler(
76
79
 
77
80
  const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
78
81
 
79
- await XMLView.create({
80
- viewName: `open.ux.preview.client.adp.ui.${dialogName}`,
82
+ const dialog = await Fragment.load({
83
+ name: `open.ux.preview.client.adp.ui.${dialogName}`,
81
84
  controller,
82
85
  id
83
86
  });
87
+
88
+ await controller.setup(dialog as Dialog);
84
89
  }
@@ -4,22 +4,35 @@ sap.ui.define([
4
4
  '../cpe/init',
5
5
  './init-dialogs',
6
6
  'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
7
- './extension-point',
8
7
  'sap/ui/VersionInfo',
9
8
  './ui5-version-utils'
10
- ], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, __ExtensionPointService, VersionInfo, ___ui5_version_utils) {
9
+ ], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, VersionInfo, ___ui5_version_utils) {
11
10
  'use strict';
12
11
  function _interopRequireDefault(obj) {
13
12
  return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
14
13
  }
14
+ function __ui5_require_async(path) {
15
+ return new Promise(function (resolve, reject) {
16
+ sap.ui.require([path], function (module) {
17
+ if (!(module && module.__esModule)) {
18
+ module = module === null || !(typeof module === 'object' && path.endsWith('/library')) ? { default: module } : module;
19
+ Object.defineProperty(module, '__esModule', { value: true });
20
+ }
21
+ resolve(module);
22
+ }, function (err) {
23
+ reject(err);
24
+ });
25
+ });
26
+ }
15
27
  const init = _interopRequireDefault(__init);
16
28
  const initDialogs = ___init_dialogs['initDialogs'];
17
29
  const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
18
30
  const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
19
- const ExtensionPointService = _interopRequireDefault(__ExtensionPointService);
20
31
  const getUI5VersionValidationMessage = ___ui5_version_utils['getUI5VersionValidationMessage'];
21
32
  var __exports = async function (rta) {
22
- const extPointService = new ExtensionPointService(rta);
33
+ const {version} = await VersionInfo.load();
34
+ const versionParts = version.split('.');
35
+ const minor = parseInt(versionParts[1], 10);
23
36
  const actionHandlers = [];
24
37
  function subscribe(handler) {
25
38
  actionHandlers.push(handler);
@@ -34,10 +47,13 @@ sap.ui.define([
34
47
  }
35
48
  });
36
49
  initDialogs(rta);
37
- extPointService.init(subscribe);
50
+ if (minor > 77) {
51
+ const ExtensionPointService = (await __ui5_require_async('open/ux/preview/client/adp/extension-point')).default;
52
+ const extPointService = new ExtensionPointService(rta);
53
+ extPointService.init(subscribe);
54
+ }
38
55
  init(rta);
39
- const ui5Version = await VersionInfo.load();
40
- const ui5VersionValidationMsg = getUI5VersionValidationMessage(ui5Version.version);
56
+ const ui5VersionValidationMsg = getUI5VersionValidationMessage(version);
41
57
  if (ui5VersionValidationMsg) {
42
58
  sendAction(showMessage(ui5VersionValidationMsg));
43
59
  }
@@ -8,13 +8,16 @@ import {
8
8
  showMessage,
9
9
  startPostMessageCommunication
10
10
  } from '@sap-ux-private/control-property-editor-common';
11
+
11
12
  import { ActionHandler } from '../cpe/types';
12
- import ExtensionPointService from './extension-point';
13
13
  import VersionInfo from 'sap/ui/VersionInfo';
14
14
  import { getUI5VersionValidationMessage } from './ui5-version-utils';
15
15
 
16
16
  export default async function (rta: RuntimeAuthoring) {
17
- const extPointService = new ExtensionPointService(rta);
17
+ const { version } = (await VersionInfo.load()) as { version: string };
18
+ const versionParts = version.split('.');
19
+ const minor = parseInt(versionParts[1], 10);
20
+
18
21
  const actionHandlers: ActionHandler[] = [];
19
22
  /**
20
23
  *
@@ -26,7 +29,7 @@ export default async function (rta: RuntimeAuthoring) {
26
29
 
27
30
  const { sendAction } = startPostMessageCommunication<ExternalAction>(
28
31
  window.parent,
29
- async function onAction(action) {
32
+ async function onAction(action: ExternalAction) {
30
33
  for (const handler of actionHandlers) {
31
34
  try {
32
35
  await handler(action);
@@ -39,13 +42,18 @@ export default async function (rta: RuntimeAuthoring) {
39
42
 
40
43
  // initialize fragment content menu entry
41
44
  initDialogs(rta);
45
+
42
46
  // initialize extension point service
43
- extPointService.init(subscribe);
47
+ if (minor > 77) {
48
+ const ExtensionPointService = (await import('open/ux/preview/client/adp/extension-point')).default;
49
+ const extPointService = new ExtensionPointService(rta);
50
+ extPointService.init(subscribe);
51
+ }
52
+
44
53
  // also initialize the editor
45
54
  init(rta);
46
55
 
47
- const ui5Version = (await VersionInfo.load()) as { version: string };
48
- const ui5VersionValidationMsg = getUI5VersionValidationMessage(ui5Version.version);
56
+ const ui5VersionValidationMsg = getUI5VersionValidationMessage(version);
49
57
 
50
58
  if (ui5VersionValidationMsg) {
51
59
  sendAction(showMessage(ui5VersionValidationMsg));
@@ -0,0 +1,69 @@
1
+ <Dialog id="addNewFragmentDialog"
2
+ xmlns="sap.m"
3
+ xmlns:core="sap.ui.core"
4
+ xmlns:f="sap.ui.layout.form"
5
+ title="Add XML Fragment"
6
+ contentWidth="500px"
7
+ class="sapUiRTABorder">
8
+ <content>
9
+ <f:SimpleForm id="addNewFragmentDialog_Form"
10
+ editable="true"
11
+ layout="ResponsiveGridLayout"
12
+ labelSpanS="4"
13
+ singleContainerFullSize="false">
14
+ <f:content>
15
+ <Label text="Control Type" />
16
+ <Text text="{/selectedControlName}" />
17
+ <Label text="Target Aggregation" />
18
+ <Select
19
+ change="onAggregationChanged"
20
+ selectedKey="{/selectedAggregation/key}"
21
+ items="{
22
+ path: '/targetAggregation',
23
+ sorter: { path: 'text' }
24
+ }">
25
+ <core:Item key="{key}" text="{value}" />
26
+ </Select>
27
+ <Label text="Index" />
28
+ <HBox alignItems="Center">
29
+ <Select
30
+ enabled="{/indexHandlingFlag}"
31
+ selectedKey='{/selectedIndex}'
32
+ items="{
33
+ path: '/index',
34
+ sorter: { path: 'text' }
35
+ }">
36
+ <core:Item key="{key}" text="{value}" />
37
+ </Select>
38
+ <core:Icon
39
+ useIconTooltip="false"
40
+ visible="{/specialIndexHandlingIcon}"
41
+ src="sap-icon://message-information"
42
+ class= "sapUiTinyMarginBegin"
43
+ tooltip="{/iconTooltip}" />
44
+ </HBox>
45
+ <Label text="Fragment Name" />
46
+ <Input
47
+ description=".fragment.xml"
48
+ value="{/newFragmentName}"
49
+ liveChange="onFragmentNameInputChange">
50
+ </Input>
51
+ </f:content>
52
+ </f:SimpleForm>
53
+ </content>
54
+ <beginButton>
55
+ <Button
56
+ id="createDialogBtn"
57
+ text="Create"
58
+ press="onCreateBtnPress"
59
+ enabled="false"
60
+ type="Emphasized" />
61
+ </beginButton>
62
+ <endButton>
63
+ <Button
64
+ id="closeDialogBtn"
65
+ text="Cancel"
66
+ press="handleDialogClose"
67
+ type="Reject" />
68
+ </endButton>
69
+ </Dialog>
@@ -0,0 +1,51 @@
1
+ <Dialog id="controllerExtensionDialog"
2
+ xmlns:mvc="sap.ui.core.mvc"
3
+ xmlns="sap.m"
4
+ xmlns:core="sap.ui.core"
5
+ xmlns:f="sap.ui.layout.form"
6
+ title="Extend With Controller"
7
+ contentWidth="450px"
8
+ class="sapUiRTABorder">
9
+ <content>
10
+ <f:SimpleForm
11
+ editable="true"
12
+ layout="ResponsiveGridLayout"
13
+ labelSpanS="4"
14
+ singleContainerFullSize="false">
15
+ <f:content>
16
+ <Label text="Controller Name" />
17
+ <Input
18
+ description=".js"
19
+ value="{/newControllerName}"
20
+ liveChange="onControllerNameInputChange">
21
+ </Input>
22
+ </f:content>
23
+ </f:SimpleForm>
24
+ <f:SimpleForm
25
+ editable="true"
26
+ layout="ResponsiveGridLayout"
27
+ labelSpanS="12"
28
+ visible="false"
29
+ singleContainerFullSize="false">
30
+ <f:content>
31
+ <Label text="An existing controller extension has been found. Please use the previously created extension controller" />
32
+ <Text text="{/controllerPathFromRoot}" />
33
+ </f:content>
34
+ </f:SimpleForm>
35
+ </content>
36
+ <beginButton>
37
+ <Button
38
+ id="createDialogBtn"
39
+ text="Create"
40
+ press="onCreateBtnPress"
41
+ enabled="false"
42
+ type="Emphasized" />
43
+ </beginButton>
44
+ <endButton>
45
+ <Button
46
+ id="closeDialogBtn"
47
+ text="Cancel"
48
+ press="handleDialogClose"
49
+ type="Reject" />
50
+ </endButton>
51
+ </Dialog>
@@ -0,0 +1,51 @@
1
+ <Dialog id="addFragmentAtExtPointDialog"
2
+ xmlns:mvc="sap.ui.core.mvc"
3
+ xmlns="sap.m"
4
+ xmlns:core="sap.ui.core"
5
+ xmlns:f="sap.ui.layout.form"
6
+ title="Add XML Fragment at Extension Point"
7
+ contentWidth="500px"
8
+ class="sapUiRTABorder">
9
+ <content>
10
+ <f:SimpleForm id="addFragmentAtExtPointDialog_Form"
11
+ editable="true"
12
+ layout="ResponsiveGridLayout"
13
+ labelSpanS="4"
14
+ singleContainerFullSize="false">
15
+ <f:content>
16
+ <Label text="Extension Point" />
17
+ <Select
18
+ enabled="{/extensionListEnabled}"
19
+ change="onExtensionPointHandler"
20
+ selectedKey='{/extensionPointKey}'
21
+ items="{
22
+ path: '/extensionPointList',
23
+ sorter: { path: 'text' }
24
+ }">
25
+ <core:Item key="{key}" text="{value}" />
26
+ </Select>
27
+ <Label text="Fragment Name" />
28
+ <Input
29
+ description=".fragment.xml"
30
+ value="{/newFragmentName}"
31
+ liveChange="onFragmentNameInputChange">
32
+ </Input>
33
+ </f:content>
34
+ </f:SimpleForm>
35
+ </content>
36
+ <beginButton>
37
+ <Button
38
+ id="createDialogBtn"
39
+ text="Create"
40
+ press="onCreateBtnPress"
41
+ enabled="false"
42
+ type="Emphasized" />
43
+ </beginButton>
44
+ <endButton>
45
+ <Button
46
+ id="closeDialogBtn"
47
+ text="Cancel"
48
+ press="handleDialogClose"
49
+ type="Reject" />
50
+ </endButton>
51
+ </Dialog>
@@ -1,65 +1,65 @@
1
- "use strict";
2
-
3
- sap.ui.define([], function () {
4
- "use strict";
5
-
6
- /**
7
- * Checks if the given version is lower than the required minimal version.
8
- * @param version to check
9
- * @param minVersion to check
10
- *
11
- * @returns boolean
12
- */
13
- function isLowerThanMinimalUi5Version(version, minVersion) {
14
- if (version && minVersion) {
15
- const minVersionParsed = parseUI5Version(minVersion);
16
- const ui5VersionParsed = parseUI5Version(version);
17
- if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
18
- if (ui5VersionParsed.major < minVersionParsed.major) {
19
- return true;
20
- }
21
- if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
22
- return true;
23
- }
24
- }
25
- }
26
- return false;
27
- }
28
-
29
- /**
30
- * Get UI5 version validation message based on conditions.
31
- * @param ui5Version to validate
32
- * @returns string with validation message or undefined if non condition is met.
33
- */
34
- function getUI5VersionValidationMessage(ui5Version) {
35
- if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
36
- return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
37
- }
38
- return undefined;
39
- }
40
-
41
- /**
42
- * Parses the UI5 version
43
- * Returns NaN for snapshot or snapshot-untested
44
- * Returns x.xx for snapshot-x.xx
45
- *
46
- * @param version the UI5 version to parse
47
- * @returns The major and the minor version, e.g. 1.86
48
- */
49
- function parseUI5Version(version) {
50
- const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
51
- const major = parseInt(versionParts[0], 10);
52
- const minor = parseInt(versionParts[1], 10);
53
- return {
54
- major,
55
- minor
56
- };
57
- }
58
- var __exports = {
59
- __esModule: true
60
- };
61
- __exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
62
- __exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
63
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define([], function () {
4
+ "use strict";
5
+
6
+ /**
7
+ * Checks if the given version is lower than the required minimal version.
8
+ * @param version to check
9
+ * @param minVersion to check
10
+ *
11
+ * @returns boolean
12
+ */
13
+ function isLowerThanMinimalUi5Version(version, minVersion) {
14
+ if (version && minVersion) {
15
+ const minVersionParsed = parseUI5Version(minVersion);
16
+ const ui5VersionParsed = parseUI5Version(version);
17
+ if (!isNaN(ui5VersionParsed.major) && !isNaN(ui5VersionParsed.minor)) {
18
+ if (ui5VersionParsed.major < minVersionParsed.major) {
19
+ return true;
20
+ }
21
+ if (ui5VersionParsed.major === minVersionParsed.major && ui5VersionParsed.minor < minVersionParsed.minor) {
22
+ return true;
23
+ }
24
+ }
25
+ }
26
+ return false;
27
+ }
28
+
29
+ /**
30
+ * Get UI5 version validation message based on conditions.
31
+ * @param ui5Version to validate
32
+ * @returns string with validation message or undefined if non condition is met.
33
+ */
34
+ function getUI5VersionValidationMessage(ui5Version) {
35
+ if (isLowerThanMinimalUi5Version(ui5Version, '1.71')) {
36
+ return `The current SAPUI5 version set for this Adaptation project is ${ui5Version}. The minimum version to use for SAPUI5 Adaptation Project and its SAPUI5 Visual Editor is 1.71`;
37
+ }
38
+ return undefined;
39
+ }
40
+
41
+ /**
42
+ * Parses the UI5 version
43
+ * Returns NaN for snapshot or snapshot-untested
44
+ * Returns x.xx for snapshot-x.xx
45
+ *
46
+ * @param version the UI5 version to parse
47
+ * @returns The major and the minor version, e.g. 1.86
48
+ */
49
+ function parseUI5Version(version) {
50
+ const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
51
+ const major = parseInt(versionParts[0], 10);
52
+ const minor = parseInt(versionParts[1], 10);
53
+ return {
54
+ major,
55
+ minor
56
+ };
57
+ }
58
+ var __exports = {
59
+ __esModule: true
60
+ };
61
+ __exports.isLowerThanMinimalUi5Version = isLowerThanMinimalUi5Version;
62
+ __exports.getUI5VersionValidationMessage = getUI5VersionValidationMessage;
63
+ return __exports;
64
64
  });
65
65
  //# sourceMappingURL=ui5-version-utils.js.map