@sap-ux/preview-middleware 0.17.19 → 0.17.20

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 (66) hide show
  1. package/dist/client/adp/api-handler.js +153 -153
  2. package/dist/client/adp/command-executor.js +75 -75
  3. package/dist/client/adp/control-utils.js +44 -44
  4. package/dist/client/adp/controllers/BaseDialog.controller.js +187 -187
  5. package/dist/client/adp/controllers/ControllerExtension.controller.js +213 -213
  6. package/dist/client/adp/controllers/ExtensionPoint.controller.js +138 -138
  7. package/dist/client/adp/controllers/FileExistsDialog.controller.js +66 -66
  8. package/dist/client/adp/dialog-factory.js +122 -122
  9. package/dist/client/adp/init-dialogs.js +100 -100
  10. package/dist/client/adp/quick-actions/common/add-controller-to-page.js +55 -55
  11. package/dist/client/adp/quick-actions/common/create-page-action.js +50 -50
  12. package/dist/client/adp/quick-actions/common/op-add-custom-section.js +36 -36
  13. package/dist/client/adp/quick-actions/common/op-add-header-field.js +48 -48
  14. package/dist/client/adp/quick-actions/common/utils.js +18 -18
  15. package/dist/client/adp/quick-actions/control-types.js +21 -21
  16. package/dist/client/adp/quick-actions/dialog-enablement-validator.js +24 -24
  17. package/dist/client/adp/quick-actions/enablement-validator.js +4 -4
  18. package/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +101 -101
  19. package/dist/client/adp/quick-actions/fe-v2/create-table-action.js +70 -70
  20. package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +96 -96
  21. package/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +78 -78
  22. package/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +77 -77
  23. package/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +69 -69
  24. package/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +58 -58
  25. package/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +93 -93
  26. package/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +81 -81
  27. package/dist/client/adp/quick-actions/fe-v2/registry.js +75 -75
  28. package/dist/client/adp/quick-actions/fe-v2/utils.js +95 -95
  29. package/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +73 -73
  30. package/dist/client/adp/quick-actions/fe-v4/create-table-action.js +49 -49
  31. package/dist/client/adp/quick-actions/fe-v4/create-table-custom-column.js +46 -46
  32. package/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +81 -81
  33. package/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +55 -55
  34. package/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +82 -82
  35. package/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +52 -52
  36. package/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +89 -89
  37. package/dist/client/adp/quick-actions/fe-v4/registry.js +58 -58
  38. package/dist/client/adp/quick-actions/fe-v4/utils.js +47 -47
  39. package/dist/client/adp/quick-actions/load.js +44 -44
  40. package/dist/client/adp/quick-actions/quick-action-base.js +53 -53
  41. package/dist/client/adp/utils.js +160 -160
  42. package/dist/client/cpe/changes/index.js +10 -10
  43. package/dist/client/cpe/changes/validator.js +39 -39
  44. package/dist/client/cpe/documentation.js +164 -164
  45. package/dist/client/cpe/feature-service.js +36 -36
  46. package/dist/client/cpe/logger.js +30 -30
  47. package/dist/client/cpe/outline/editable.js +37 -37
  48. package/dist/client/cpe/outline/nodes.js +222 -222
  49. package/dist/client/cpe/quick-actions/quick-action-definition.js +4 -4
  50. package/dist/client/cpe/quick-actions/registry.js +143 -143
  51. package/dist/client/cpe/quick-actions/utils.js +92 -92
  52. package/dist/client/cpe/types.js +4 -4
  53. package/dist/client/cpe/ui5-utils.js +33 -33
  54. package/dist/client/cpe/utils.js +138 -138
  55. package/dist/client/flp/WorkspaceConnector.js +86 -86
  56. package/dist/client/flp/common.js +28 -28
  57. package/dist/client/flp/enableFakeConnector.js +83 -83
  58. package/dist/client/flp/initConnectors.js +30 -30
  59. package/dist/client/flp/initRta.js +178 -178
  60. package/dist/client/i18n.js +56 -56
  61. package/dist/client/utils/application.js +32 -32
  62. package/dist/client/utils/core.js +68 -68
  63. package/dist/client/utils/error.js +19 -19
  64. package/dist/client/utils/fe-v4.js +118 -118
  65. package/dist/client/utils/version.js +102 -102
  66. package/package.json +2 -2
@@ -1,140 +1,140 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (JSONModel, ___api_handler, __BaseDialog, ___utils) {
4
- "use strict";
5
-
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
- }
9
- const getFragments = ___api_handler["getFragments"];
10
- const BaseDialog = _interopRequireDefault(__BaseDialog);
11
- const notifyUser = ___utils["notifyUser"];
12
- /**
13
- * @namespace open.ux.preview.client.adp.controllers
14
- */
15
- const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
16
- constructor: function _constructor(name, _overlays, rta, data) {
17
- BaseDialog.prototype.constructor.call(this, name);
18
- this.model = new JSONModel();
19
- this.data = data;
20
- this.rta = rta;
21
- },
22
- /**
23
- * Setups the Dialog and the JSON Model
24
- *
25
- * @param {Dialog} dialog - Dialog instance
26
- */
27
- setup: async function _setup(dialog) {
28
- this.dialog = dialog;
29
- this.setEscapeHandler();
30
- await this.buildDialogData();
31
- this.dialog.setModel(this.model);
32
- this.dialog.open();
33
- },
34
- /**
35
- * Handles create button press
36
- *
37
- * @param event Event
38
- */
39
- onCreateBtnPress: function _onCreateBtnPress(event) {
40
- const source = event.getSource();
41
- source.setEnabled(false);
42
- const fragmentName = this.model.getProperty('/newFragmentName');
43
- this.createExtensionPointFragmentChange(fragmentName);
44
- notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
45
- this.handleDialogClose();
46
- },
47
- /**
48
- * Handler for extension point select control
49
- *
50
- * @param event Select control change event
51
- */
52
- onExtensionPointHandler: function _onExtensionPointHandler(event) {
53
- const source = event.getSource();
54
- const selectedItem = source.getSelectedItem();
55
- let extensionPointName = '';
56
- if (selectedItem) {
57
- extensionPointName = selectedItem.getText();
58
- }
59
- this.model.setProperty('/extensionPointName', extensionPointName);
60
- const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
61
- this.model.setProperty('/hasDefaultContent', hasDefaultContent);
62
- },
63
- /**
64
- * Determines whether there is default content associated with the given name.
65
- *
66
- * @param {string} name - The name to check for associated default content.
67
- * @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
68
- */
69
- hasDefaultContentForName: function _hasDefaultContentForName(name) {
70
- const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
71
- return defaultContent ? defaultContent.length > 0 : false;
72
- },
73
- /**
74
- * Builds data that is used in the dialog
75
- */
76
- buildDialogData: async function _buildDialogData() {
77
- const name = this.data?.name;
78
- if (name) {
79
- const hasDefaultContent = this.hasDefaultContentForName(name);
80
- const extensionPointList = [{
81
- key: 0,
82
- value: name
83
- }];
84
- this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
85
- } else {
86
- // In this case we are selecting from the application. There can be many extension points under one control.
87
- const extensionPointList = this.data.info.map((v, idx) => {
88
- return {
89
- key: idx,
90
- value: v.name
91
- };
92
- });
93
- const firstElName = extensionPointList[0].value;
94
- const enabled = extensionPointList.length > 1;
95
- const hasDefaultContent = this.hasDefaultContentForName(firstElName);
96
- this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
97
- }
98
- try {
99
- const {
100
- fragments
101
- } = await getFragments();
102
- this.model.setProperty('/fragmentList', fragments);
103
- } catch (e) {
104
- this.handleError(e);
105
- }
106
- },
107
- /**
108
- * Updates the Select control according to provided values
109
- *
110
- * @param name Extension point name
111
- * @param key Selected extension point key
112
- * @param list All of the extension points that are under a view
113
- * @param enabled Enables the select control
114
- * @param hasDefaultContent Whether there is default content associated with the extension name
115
- */
116
- updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
117
- this.model.setProperty('/extensionPointName', name);
118
- this.model.setProperty('/extensionPointKey', key);
119
- this.model.setProperty('/extensionPointList', list);
120
- this.model.setProperty('/extensionListEnabled', enabled);
121
- this.model.setProperty('/hasDefaultContent', hasDefaultContent);
122
- },
123
- /**
124
- * Creates add xml at extension point changes
125
- *
126
- * @param fragmentName Fragment name
127
- */
128
- createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
129
- const extensionPointName = this.model.getProperty('/extensionPointName');
130
- const modifiedValue = {
131
- fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
132
- fragmentPath: `fragments/${fragmentName}.fragment.xml`,
133
- extensionPointName
134
- };
135
- this.data.deferred.resolve(modifiedValue);
136
- }
137
- });
138
- return ExtensionPoint;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (JSONModel, ___api_handler, __BaseDialog, ___utils) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const getFragments = ___api_handler["getFragments"];
10
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
11
+ const notifyUser = ___utils["notifyUser"];
12
+ /**
13
+ * @namespace open.ux.preview.client.adp.controllers
14
+ */
15
+ const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
16
+ constructor: function _constructor(name, _overlays, rta, data) {
17
+ BaseDialog.prototype.constructor.call(this, name);
18
+ this.model = new JSONModel();
19
+ this.data = data;
20
+ this.rta = rta;
21
+ },
22
+ /**
23
+ * Setups the Dialog and the JSON Model
24
+ *
25
+ * @param {Dialog} dialog - Dialog instance
26
+ */
27
+ setup: async function _setup(dialog) {
28
+ this.dialog = dialog;
29
+ this.setEscapeHandler();
30
+ await this.buildDialogData();
31
+ this.dialog.setModel(this.model);
32
+ this.dialog.open();
33
+ },
34
+ /**
35
+ * Handles create button press
36
+ *
37
+ * @param event Event
38
+ */
39
+ onCreateBtnPress: function _onCreateBtnPress(event) {
40
+ const source = event.getSource();
41
+ source.setEnabled(false);
42
+ const fragmentName = this.model.getProperty('/newFragmentName');
43
+ this.createExtensionPointFragmentChange(fragmentName);
44
+ notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
45
+ this.handleDialogClose();
46
+ },
47
+ /**
48
+ * Handler for extension point select control
49
+ *
50
+ * @param event Select control change event
51
+ */
52
+ onExtensionPointHandler: function _onExtensionPointHandler(event) {
53
+ const source = event.getSource();
54
+ const selectedItem = source.getSelectedItem();
55
+ let extensionPointName = '';
56
+ if (selectedItem) {
57
+ extensionPointName = selectedItem.getText();
58
+ }
59
+ this.model.setProperty('/extensionPointName', extensionPointName);
60
+ const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
61
+ this.model.setProperty('/hasDefaultContent', hasDefaultContent);
62
+ },
63
+ /**
64
+ * Determines whether there is default content associated with the given name.
65
+ *
66
+ * @param {string} name - The name to check for associated default content.
67
+ * @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
68
+ */
69
+ hasDefaultContentForName: function _hasDefaultContentForName(name) {
70
+ const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
71
+ return defaultContent ? defaultContent.length > 0 : false;
72
+ },
73
+ /**
74
+ * Builds data that is used in the dialog
75
+ */
76
+ buildDialogData: async function _buildDialogData() {
77
+ const name = this.data?.name;
78
+ if (name) {
79
+ const hasDefaultContent = this.hasDefaultContentForName(name);
80
+ const extensionPointList = [{
81
+ key: 0,
82
+ value: name
83
+ }];
84
+ this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
85
+ } else {
86
+ // In this case we are selecting from the application. There can be many extension points under one control.
87
+ const extensionPointList = this.data.info.map((v, idx) => {
88
+ return {
89
+ key: idx,
90
+ value: v.name
91
+ };
92
+ });
93
+ const firstElName = extensionPointList[0].value;
94
+ const enabled = extensionPointList.length > 1;
95
+ const hasDefaultContent = this.hasDefaultContentForName(firstElName);
96
+ this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
97
+ }
98
+ try {
99
+ const {
100
+ fragments
101
+ } = await getFragments();
102
+ this.model.setProperty('/fragmentList', fragments);
103
+ } catch (e) {
104
+ this.handleError(e);
105
+ }
106
+ },
107
+ /**
108
+ * Updates the Select control according to provided values
109
+ *
110
+ * @param name Extension point name
111
+ * @param key Selected extension point key
112
+ * @param list All of the extension points that are under a view
113
+ * @param enabled Enables the select control
114
+ * @param hasDefaultContent Whether there is default content associated with the extension name
115
+ */
116
+ updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
117
+ this.model.setProperty('/extensionPointName', name);
118
+ this.model.setProperty('/extensionPointKey', key);
119
+ this.model.setProperty('/extensionPointList', list);
120
+ this.model.setProperty('/extensionListEnabled', enabled);
121
+ this.model.setProperty('/hasDefaultContent', hasDefaultContent);
122
+ },
123
+ /**
124
+ * Creates add xml at extension point changes
125
+ *
126
+ * @param fragmentName Fragment name
127
+ */
128
+ createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
129
+ const extensionPointName = this.model.getProperty('/extensionPointName');
130
+ const modifiedValue = {
131
+ fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
132
+ fragmentPath: `fragments/${fragmentName}.fragment.xml`,
133
+ extensionPointName
134
+ };
135
+ this.data.deferred.resolve(modifiedValue);
136
+ }
137
+ });
138
+ return ExtensionPoint;
139
139
  });
140
140
  //# sourceMappingURL=ExtensionPoint.controller.js.map
@@ -1,68 +1,68 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/model/json/JSONModel", "./BaseDialog.controller", "../../i18n"], function (JSONModel, __BaseDialog, ____i18n) {
4
- "use strict";
5
-
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
- }
9
- const BaseDialog = _interopRequireDefault(__BaseDialog);
10
- const getResourceModel = ____i18n["getResourceModel"];
11
- /**
12
- * @namespace open.ux.preview.client.adp.controllers
13
- */
14
- const FileExistsDialog = BaseDialog.extend("open.ux.preview.client.adp.controllers.FileExistsDialog", {
15
- constructor: function _constructor(name, options) {
16
- BaseDialog.prototype.constructor.call(this, name);
17
- this.model = new JSONModel();
18
- this.options = options;
19
- },
20
- /**
21
- * Setups the Dialog and the JSON Model
22
- *
23
- * @param {Dialog} dialog - Dialog instance
24
- */
25
- setup: async function _setup(dialog) {
26
- this.dialog = dialog;
27
- this.setEscapeHandler();
28
- this.model.setProperty('/filePath', this.options.filePath);
29
- this.model.setProperty('/filePathFromRoot', this.options.fileName);
30
- this.model.setProperty('/isRunningInBAS', this.options.isRunningInBAS);
31
- this.buildDialogData();
32
- const resourceModel = await getResourceModel();
33
- this.dialog.setModel(this.model);
34
- this.dialog.setModel(resourceModel, 'i18n');
35
- this.dialog.open();
36
- },
37
- /**
38
- * Handles create button press
39
- *
40
- * @param _event Event
41
- */
42
- onShowFileInVscodeBtn: function _onShowFileInVscodeBtn(_event) {
43
- const annotationPath = this.model.getProperty('/filePath');
44
- window.open(`vscode://file${annotationPath}`);
45
- this.handleDialogClose();
46
- },
47
- /**
48
- * Builds data that is used in the dialog.
49
- */
50
- buildDialogData: function _buildDialogData() {
51
- const content = this.dialog.getContent();
52
- const messageForm = content[0];
53
- messageForm.setVisible(true);
54
- const isRunningInBAS = this.model.getProperty('/isRunningInBAS');
55
- if (isRunningInBAS) {
56
- this.dialog.getBeginButton().setVisible(false);
57
- }
58
- },
59
- /**
60
- * Handles create button press
61
- *
62
- * @param _event Event
63
- */
64
- onCreateBtnPress: function _onCreateBtnPress(_event) {}
65
- });
66
- return FileExistsDialog;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/model/json/JSONModel", "./BaseDialog.controller", "../../i18n"], function (JSONModel, __BaseDialog, ____i18n) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
10
+ const getResourceModel = ____i18n["getResourceModel"];
11
+ /**
12
+ * @namespace open.ux.preview.client.adp.controllers
13
+ */
14
+ const FileExistsDialog = BaseDialog.extend("open.ux.preview.client.adp.controllers.FileExistsDialog", {
15
+ constructor: function _constructor(name, options) {
16
+ BaseDialog.prototype.constructor.call(this, name);
17
+ this.model = new JSONModel();
18
+ this.options = options;
19
+ },
20
+ /**
21
+ * Setups the Dialog and the JSON Model
22
+ *
23
+ * @param {Dialog} dialog - Dialog instance
24
+ */
25
+ setup: async function _setup(dialog) {
26
+ this.dialog = dialog;
27
+ this.setEscapeHandler();
28
+ this.model.setProperty('/filePath', this.options.filePath);
29
+ this.model.setProperty('/filePathFromRoot', this.options.fileName);
30
+ this.model.setProperty('/isRunningInBAS', this.options.isRunningInBAS);
31
+ this.buildDialogData();
32
+ const resourceModel = await getResourceModel();
33
+ this.dialog.setModel(this.model);
34
+ this.dialog.setModel(resourceModel, 'i18n');
35
+ this.dialog.open();
36
+ },
37
+ /**
38
+ * Handles create button press
39
+ *
40
+ * @param _event Event
41
+ */
42
+ onShowFileInVscodeBtn: function _onShowFileInVscodeBtn(_event) {
43
+ const annotationPath = this.model.getProperty('/filePath');
44
+ window.open(`vscode://file${annotationPath}`);
45
+ this.handleDialogClose();
46
+ },
47
+ /**
48
+ * Builds data that is used in the dialog.
49
+ */
50
+ buildDialogData: function _buildDialogData() {
51
+ const content = this.dialog.getContent();
52
+ const messageForm = content[0];
53
+ messageForm.setVisible(true);
54
+ const isRunningInBAS = this.model.getProperty('/isRunningInBAS');
55
+ if (isRunningInBAS) {
56
+ this.dialog.getBeginButton().setVisible(false);
57
+ }
58
+ },
59
+ /**
60
+ * Handles create button press
61
+ *
62
+ * @param _event Event
63
+ */
64
+ onCreateBtnPress: function _onCreateBtnPress(_event) {}
65
+ });
66
+ return FileExistsDialog;
67
67
  });
68
68
  //# sourceMappingURL=FileExistsDialog.controller.js.map
@@ -1,124 +1,124 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.controller", "./controllers/AddTableColumnFragments.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "./controllers/FileExistsDialog.controller"], function (Fragment, ___i18n, __AddFragment, __AddTableColumnFragments, __ControllerExtension, __ExtensionPoint, __FileExistsDialog) {
4
- "use strict";
5
-
6
- function _interopRequireDefault(obj) {
7
- return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
- }
9
- const getTextBundle = ___i18n["getTextBundle"];
10
- const AddFragment = _interopRequireDefault(__AddFragment);
11
- const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
12
- const ControllerExtension = _interopRequireDefault(__ControllerExtension);
13
- const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
14
- const FileExistsDialog = _interopRequireDefault(__FileExistsDialog);
15
- var DialogNames = /*#__PURE__*/function (DialogNames) {
16
- DialogNames["ADD_FRAGMENT"] = "AddFragment";
17
- DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
18
- DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
19
- DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
20
- DialogNames["FILE_EXISTS"] = "FileExistsDialog";
21
- return DialogNames;
22
- }(DialogNames || {});
23
- const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
24
- class DialogFactory {
25
- static eventTarget = new EventTarget();
26
- static isDialogOpen = false;
27
- /**
28
- * Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
29
- */
30
-
31
- static get canOpenDialog() {
32
- return !this.isDialogOpen;
33
- }
34
-
35
- /**
36
- * Factory method for creating a new dialog.
37
- *
38
- * @param overlay - Control overlay.
39
- * @param rta - Runtime Authoring instance.
40
- * @param dialogName - Dialog name.
41
- * @param extensionPointData - Control ID.
42
- * @param options - Dialog options.
43
- */
44
- static async createDialog(overlay, rta, dialogName, extensionPointData) {
45
- let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
46
- if (this.isDialogOpen) {
47
- return;
48
- }
49
- let controller;
50
- const resources = await getTextBundle();
51
- switch (dialogName) {
52
- case DialogNames.ADD_FRAGMENT:
53
- controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
54
- ...('aggregation' in options && {
55
- aggregation: options.aggregation
56
- }),
57
- title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
58
- });
59
- break;
60
- case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
61
- controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
62
- ...('aggregation' in options && {
63
- aggregation: options.aggregation
64
- }),
65
- title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
66
- });
67
- break;
68
- case DialogNames.CONTROLLER_EXTENSION:
69
- controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
70
- break;
71
- case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
72
- controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
73
- break;
74
- case DialogNames.FILE_EXISTS:
75
- controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
76
- break;
77
- }
78
- const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
79
- const dialog = await Fragment.load({
80
- name: `open.ux.preview.client.adp.ui.${dialogName}`,
81
- controller,
82
- id
83
- });
84
- this.isDialogOpen = true;
85
- dialog.attachBeforeClose(() => {
86
- this.updateStatus(false);
87
- });
88
- await controller.setup(dialog);
89
- this.updateStatus(true);
90
- }
91
-
92
- /**
93
- * Updates open dialog status.
94
- *
95
- * @param isDialogOpen Flag indicating if there is an open dialog.
96
- */
97
- static updateStatus(isDialogOpen) {
98
- this.isDialogOpen = isDialogOpen;
99
- const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
100
- this.eventTarget.dispatchEvent(event);
101
- }
102
-
103
- /**
104
- * Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
105
- *
106
- * @param handler Event handler.
107
- * @returns Function that removes listener.
108
- */
109
- static onOpenDialogStatusChange(handler) {
110
- this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
111
- return () => {
112
- this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
113
- };
114
- }
115
- }
116
- var __exports = {
117
- __esModule: true
118
- };
119
- __exports.DialogNames = DialogNames;
120
- __exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
121
- __exports.DialogFactory = DialogFactory;
122
- return __exports;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/ui/core/Fragment", "../i18n", "./controllers/AddFragment.controller", "./controllers/AddTableColumnFragments.controller", "./controllers/ControllerExtension.controller", "./controllers/ExtensionPoint.controller", "./controllers/FileExistsDialog.controller"], function (Fragment, ___i18n, __AddFragment, __AddTableColumnFragments, __ControllerExtension, __ExtensionPoint, __FileExistsDialog) {
4
+ "use strict";
5
+
6
+ function _interopRequireDefault(obj) {
7
+ return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
8
+ }
9
+ const getTextBundle = ___i18n["getTextBundle"];
10
+ const AddFragment = _interopRequireDefault(__AddFragment);
11
+ const AddTableColumnFragments = _interopRequireDefault(__AddTableColumnFragments);
12
+ const ControllerExtension = _interopRequireDefault(__ControllerExtension);
13
+ const ExtensionPoint = _interopRequireDefault(__ExtensionPoint);
14
+ const FileExistsDialog = _interopRequireDefault(__FileExistsDialog);
15
+ var DialogNames = /*#__PURE__*/function (DialogNames) {
16
+ DialogNames["ADD_FRAGMENT"] = "AddFragment";
17
+ DialogNames["ADD_TABLE_COLUMN_FRAGMENTS"] = "AddTableColumnFragments";
18
+ DialogNames["CONTROLLER_EXTENSION"] = "ControllerExtension";
19
+ DialogNames["ADD_FRAGMENT_AT_EXTENSION_POINT"] = "ExtensionPoint";
20
+ DialogNames["FILE_EXISTS"] = "FileExistsDialog";
21
+ return DialogNames;
22
+ }(DialogNames || {});
23
+ const OPEN_DIALOG_STATUS_CHANGED = 'OPEN_DIALOG_STATUS_CHANGED';
24
+ class DialogFactory {
25
+ static eventTarget = new EventTarget();
26
+ static isDialogOpen = false;
27
+ /**
28
+ * Only one dialog can be open at a time. This flag indicates if a new dialog can be opened.
29
+ */
30
+
31
+ static get canOpenDialog() {
32
+ return !this.isDialogOpen;
33
+ }
34
+
35
+ /**
36
+ * Factory method for creating a new dialog.
37
+ *
38
+ * @param overlay - Control overlay.
39
+ * @param rta - Runtime Authoring instance.
40
+ * @param dialogName - Dialog name.
41
+ * @param extensionPointData - Control ID.
42
+ * @param options - Dialog options.
43
+ */
44
+ static async createDialog(overlay, rta, dialogName, extensionPointData) {
45
+ let options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
46
+ if (this.isDialogOpen) {
47
+ return;
48
+ }
49
+ let controller;
50
+ const resources = await getTextBundle();
51
+ switch (dialogName) {
52
+ case DialogNames.ADD_FRAGMENT:
53
+ controller = new AddFragment(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
54
+ ...('aggregation' in options && {
55
+ aggregation: options.aggregation
56
+ }),
57
+ title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
58
+ });
59
+ break;
60
+ case DialogNames.ADD_TABLE_COLUMN_FRAGMENTS:
61
+ controller = new AddTableColumnFragments(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, {
62
+ ...('aggregation' in options && {
63
+ aggregation: options.aggregation
64
+ }),
65
+ title: resources.getText(options.title ?? 'ADP_ADD_FRAGMENT_DIALOG_TITLE')
66
+ });
67
+ break;
68
+ case DialogNames.CONTROLLER_EXTENSION:
69
+ controller = new ControllerExtension(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta);
70
+ break;
71
+ case DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT:
72
+ controller = new ExtensionPoint(`open.ux.preview.client.adp.controllers.${dialogName}`, overlay, rta, extensionPointData);
73
+ break;
74
+ case DialogNames.FILE_EXISTS:
75
+ controller = new FileExistsDialog(`open.ux.preview.client.adp.controllers.${dialogName}`, options);
76
+ break;
77
+ }
78
+ const id = dialogName === DialogNames.ADD_FRAGMENT_AT_EXTENSION_POINT ? `dialog--${dialogName}` : undefined;
79
+ const dialog = await Fragment.load({
80
+ name: `open.ux.preview.client.adp.ui.${dialogName}`,
81
+ controller,
82
+ id
83
+ });
84
+ this.isDialogOpen = true;
85
+ dialog.attachBeforeClose(() => {
86
+ this.updateStatus(false);
87
+ });
88
+ await controller.setup(dialog);
89
+ this.updateStatus(true);
90
+ }
91
+
92
+ /**
93
+ * Updates open dialog status.
94
+ *
95
+ * @param isDialogOpen Flag indicating if there is an open dialog.
96
+ */
97
+ static updateStatus(isDialogOpen) {
98
+ this.isDialogOpen = isDialogOpen;
99
+ const event = new CustomEvent(OPEN_DIALOG_STATUS_CHANGED);
100
+ this.eventTarget.dispatchEvent(event);
101
+ }
102
+
103
+ /**
104
+ * Attach event handler for OPEN_DIALOG_STATUS_CHANGED event.
105
+ *
106
+ * @param handler Event handler.
107
+ * @returns Function that removes listener.
108
+ */
109
+ static onOpenDialogStatusChange(handler) {
110
+ this.eventTarget.addEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
111
+ return () => {
112
+ this.eventTarget.removeEventListener(OPEN_DIALOG_STATUS_CHANGED, handler);
113
+ };
114
+ }
115
+ }
116
+ var __exports = {
117
+ __esModule: true
118
+ };
119
+ __exports.DialogNames = DialogNames;
120
+ __exports.OPEN_DIALOG_STATUS_CHANGED = OPEN_DIALOG_STATUS_CHANGED;
121
+ __exports.DialogFactory = DialogFactory;
122
+ return __exports;
123
123
  });
124
124
  //# sourceMappingURL=dialog-factory.js.map