@sap-ux/preview-middleware 0.17.24 → 0.17.25

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 (68) 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/selection.js +7 -1
  53. package/dist/client/cpe/selection.ts +3 -1
  54. package/dist/client/cpe/types.js +4 -4
  55. package/dist/client/cpe/ui5-utils.js +33 -33
  56. package/dist/client/cpe/utils.js +138 -138
  57. package/dist/client/flp/WorkspaceConnector.js +86 -86
  58. package/dist/client/flp/common.js +28 -28
  59. package/dist/client/flp/enableFakeConnector.js +83 -83
  60. package/dist/client/flp/initConnectors.js +30 -30
  61. package/dist/client/flp/initRta.js +178 -178
  62. package/dist/client/i18n.js +56 -56
  63. package/dist/client/utils/application.js +32 -32
  64. package/dist/client/utils/core.js +68 -68
  65. package/dist/client/utils/error.js +19 -19
  66. package/dist/client/utils/fe-v4.js +118 -118
  67. package/dist/client/utils/version.js +102 -102
  68. package/package.json +3 -3
@@ -1,215 +1,215 @@
1
- "use strict";
2
-
3
- sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (MessageToast, sap_ui_core_library, 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
- /** sap.ui.core */
10
- const ValueState = sap_ui_core_library["ValueState"];
11
- /** sap.ui.base */
12
- const getExistingController = ___api_handler["getExistingController"];
13
- const getManifestAppdescr = ___api_handler["getManifestAppdescr"];
14
- const readControllers = ___api_handler["readControllers"];
15
- const writeChange = ___api_handler["writeChange"];
16
- const writeController = ___api_handler["writeController"];
17
- const BaseDialog = _interopRequireDefault(__BaseDialog);
18
- const getControllerInfo = ___utils["getControllerInfo"];
19
- /**
20
- * @namespace open.ux.preview.client.adp.controllers
21
- */
22
- const ControllerExtension = BaseDialog.extend("open.ux.preview.client.adp.controllers.ControllerExtension", {
23
- constructor: function _constructor(name, overlays, rta) {
24
- BaseDialog.prototype.constructor.call(this, name);
25
- this.rta = rta;
26
- this.overlays = overlays;
27
- this.model = new JSONModel();
28
- },
29
- /**
30
- * Setups the Dialog and the JSON Model
31
- *
32
- * @param {Dialog} dialog - Dialog instance
33
- */
34
- setup: async function _setup(dialog) {
35
- this.dialog = dialog;
36
- this.setEscapeHandler();
37
- await this.buildDialogData();
38
- this.dialog.setModel(this.model);
39
- this.dialog.open();
40
- },
41
- /**
42
- * Handles fragment name input change
43
- *
44
- * @param event Event
45
- */
46
- onControllerNameInputChange: function _onControllerNameInputChange(event) {
47
- const input = event.getSource();
48
- const beginBtn = this.dialog.getBeginButton();
49
- const controllerName = input.getValue();
50
- const controllerList = this.model.getProperty('/controllersList');
51
- const updateDialogState = function (valueState) {
52
- let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
53
- input.setValueState(valueState).setValueStateText(valueStateText);
54
- beginBtn.setEnabled(valueState === ValueState.Success);
55
- };
56
- if (controllerName.length <= 0) {
57
- updateDialogState(ValueState.None);
58
- this.model.setProperty('/newControllerName', null);
59
- return;
60
- }
61
- const fileExists = controllerList.some(f => f.controllerName === `${controllerName}.js`);
62
- if (fileExists) {
63
- updateDialogState(ValueState.Error, 'Enter a different name. The controller name that you entered already exists in your project.');
64
- return;
65
- }
66
- const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(controllerName);
67
- if (!isValidName) {
68
- updateDialogState(ValueState.Error, 'The controller name cannot contain white spaces or special characters.');
69
- return;
70
- }
71
- if (controllerName.length > 64) {
72
- updateDialogState(ValueState.Error, 'A controller file name cannot contain more than 64 characters.');
73
- return;
74
- }
75
- updateDialogState(ValueState.Success);
76
- this.model.setProperty('/newControllerName', controllerName);
77
- },
78
- /**
79
- * Handles create button press
80
- *
81
- * @param event Event
82
- */
83
- onCreateBtnPress: async function _onCreateBtnPress(event) {
84
- const source = event.getSource();
85
- const controllerExists = this.model.getProperty('/controllerExists');
86
- if (!controllerExists) {
87
- source.setEnabled(false);
88
- const controllerName = this.model.getProperty('/newControllerName');
89
- const viewId = this.model.getProperty('/viewId');
90
- await this.createNewController(controllerName, viewId);
91
- } else {
92
- const controllerPath = this.model.getProperty('/controllerPath');
93
- window.open(`vscode://file${controllerPath}`);
94
- }
95
- this.handleDialogClose();
96
- },
97
- /**
98
- * Builds data that is used in the dialog.
99
- */
100
- buildDialogData: async function _buildDialogData() {
101
- const selectorId = this.overlays.getId();
102
- const overlayControl = sap.ui.getCore().byId(selectorId);
103
- const {
104
- controllerName,
105
- viewId
106
- } = getControllerInfo(overlayControl);
107
- const existingController = await this.getExistingController(controllerName);
108
- if (existingController) {
109
- const {
110
- controllerExists,
111
- controllerPath,
112
- controllerPathFromRoot,
113
- isRunningInBAS
114
- } = existingController;
115
- if (controllerExists) {
116
- this.updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS);
117
- } else {
118
- this.updateModelForNewController(viewId);
119
- await this.getControllers();
120
- }
121
- }
122
- },
123
- /**
124
- * Updates the model properties for an existing controller.
125
- *
126
- * @param {boolean} controllerExists - Whether the controller exists.
127
- * @param {string} controllerPath - The controller path.
128
- * @param {string} controllerPathFromRoot - The controller path from the project root.
129
- * @param {boolean} isRunningInBAS - Whether the environment is BAS or VS Code.
130
- */
131
- updateModelForExistingController: function _updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS) {
132
- this.model.setProperty('/controllerExists', controllerExists);
133
- this.model.setProperty('/controllerPath', controllerPath);
134
- this.model.setProperty('/controllerPathFromRoot', controllerPathFromRoot);
135
- const content = this.dialog.getContent();
136
- const form = content[0];
137
- form.setVisible(false);
138
- const messageForm = content[1];
139
- messageForm.setVisible(true);
140
- if (isRunningInBAS) {
141
- this.dialog.getBeginButton().setVisible(false);
142
- } else {
143
- this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
144
- }
145
- this.dialog.getEndButton().setText('Close');
146
- },
147
- /**
148
- * Updates the model property for a new controller.
149
- *
150
- * @param viewId The view ID
151
- */
152
- updateModelForNewController: function _updateModelForNewController(viewId) {
153
- this.model.setProperty('/viewId', viewId);
154
- },
155
- /**
156
- * Retrieves existing controller data if found in the project's workspace.
157
- *
158
- * @param controllerName Controller name that exists in the view
159
- * @returns Returnsexisting controller data
160
- */
161
- getExistingController: async function _getExistingController(controllerName) {
162
- let data;
163
- try {
164
- data = await getExistingController(controllerName);
165
- } catch (e) {
166
- this.handleError(e);
167
- }
168
- return data;
169
- },
170
- /**
171
- * Retrieves controller files and fills the model with data
172
- */
173
- getControllers: async function _getControllers() {
174
- try {
175
- const {
176
- controllers
177
- } = await readControllers();
178
- this.model.setProperty('/controllersList', controllers);
179
- } catch (e) {
180
- this.handleError(e);
181
- }
182
- },
183
- /**
184
- * Creates a new fragment for the specified control
185
- *
186
- * @param controllerName Controller Name
187
- * @param viewId View Id
188
- */
189
- createNewController: async function _createNewController(controllerName, viewId) {
190
- try {
191
- const manifest = await getManifestAppdescr();
192
- await writeController({
193
- controllerName,
194
- projectId: manifest.id
195
- });
196
- const controllerRef = {
197
- codeRef: `coding/${controllerName}.js`,
198
- viewId
199
- };
200
- const service = await this.rta.getService('controllerExtension');
201
- const change = await service.add(controllerRef.codeRef, controllerRef.viewId);
202
- change.creation = new Date().toISOString();
203
- await writeChange(change);
204
- MessageToast.show(`Controller extension with name '${controllerName}' was created.`);
205
- } catch (e) {
206
- // We want to update the model incase we have already created a controller file but failed when creating a change file,
207
- // so when the user types the same controller name again he does not get 409 from the server, instead an error is shown in the UI
208
- await this.getControllers();
209
- this.handleError(e);
210
- }
211
- }
212
- });
213
- return ControllerExtension;
1
+ "use strict";
2
+
3
+ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/JSONModel", "../api-handler", "./BaseDialog.controller", "../utils"], function (MessageToast, sap_ui_core_library, 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
+ /** sap.ui.core */
10
+ const ValueState = sap_ui_core_library["ValueState"];
11
+ /** sap.ui.base */
12
+ const getExistingController = ___api_handler["getExistingController"];
13
+ const getManifestAppdescr = ___api_handler["getManifestAppdescr"];
14
+ const readControllers = ___api_handler["readControllers"];
15
+ const writeChange = ___api_handler["writeChange"];
16
+ const writeController = ___api_handler["writeController"];
17
+ const BaseDialog = _interopRequireDefault(__BaseDialog);
18
+ const getControllerInfo = ___utils["getControllerInfo"];
19
+ /**
20
+ * @namespace open.ux.preview.client.adp.controllers
21
+ */
22
+ const ControllerExtension = BaseDialog.extend("open.ux.preview.client.adp.controllers.ControllerExtension", {
23
+ constructor: function _constructor(name, overlays, rta) {
24
+ BaseDialog.prototype.constructor.call(this, name);
25
+ this.rta = rta;
26
+ this.overlays = overlays;
27
+ this.model = new JSONModel();
28
+ },
29
+ /**
30
+ * Setups the Dialog and the JSON Model
31
+ *
32
+ * @param {Dialog} dialog - Dialog instance
33
+ */
34
+ setup: async function _setup(dialog) {
35
+ this.dialog = dialog;
36
+ this.setEscapeHandler();
37
+ await this.buildDialogData();
38
+ this.dialog.setModel(this.model);
39
+ this.dialog.open();
40
+ },
41
+ /**
42
+ * Handles fragment name input change
43
+ *
44
+ * @param event Event
45
+ */
46
+ onControllerNameInputChange: function _onControllerNameInputChange(event) {
47
+ const input = event.getSource();
48
+ const beginBtn = this.dialog.getBeginButton();
49
+ const controllerName = input.getValue();
50
+ const controllerList = this.model.getProperty('/controllersList');
51
+ const updateDialogState = function (valueState) {
52
+ let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
53
+ input.setValueState(valueState).setValueStateText(valueStateText);
54
+ beginBtn.setEnabled(valueState === ValueState.Success);
55
+ };
56
+ if (controllerName.length <= 0) {
57
+ updateDialogState(ValueState.None);
58
+ this.model.setProperty('/newControllerName', null);
59
+ return;
60
+ }
61
+ const fileExists = controllerList.some(f => f.controllerName === `${controllerName}.js`);
62
+ if (fileExists) {
63
+ updateDialogState(ValueState.Error, 'Enter a different name. The controller name that you entered already exists in your project.');
64
+ return;
65
+ }
66
+ const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(controllerName);
67
+ if (!isValidName) {
68
+ updateDialogState(ValueState.Error, 'The controller name cannot contain white spaces or special characters.');
69
+ return;
70
+ }
71
+ if (controllerName.length > 64) {
72
+ updateDialogState(ValueState.Error, 'A controller file name cannot contain more than 64 characters.');
73
+ return;
74
+ }
75
+ updateDialogState(ValueState.Success);
76
+ this.model.setProperty('/newControllerName', controllerName);
77
+ },
78
+ /**
79
+ * Handles create button press
80
+ *
81
+ * @param event Event
82
+ */
83
+ onCreateBtnPress: async function _onCreateBtnPress(event) {
84
+ const source = event.getSource();
85
+ const controllerExists = this.model.getProperty('/controllerExists');
86
+ if (!controllerExists) {
87
+ source.setEnabled(false);
88
+ const controllerName = this.model.getProperty('/newControllerName');
89
+ const viewId = this.model.getProperty('/viewId');
90
+ await this.createNewController(controllerName, viewId);
91
+ } else {
92
+ const controllerPath = this.model.getProperty('/controllerPath');
93
+ window.open(`vscode://file${controllerPath}`);
94
+ }
95
+ this.handleDialogClose();
96
+ },
97
+ /**
98
+ * Builds data that is used in the dialog.
99
+ */
100
+ buildDialogData: async function _buildDialogData() {
101
+ const selectorId = this.overlays.getId();
102
+ const overlayControl = sap.ui.getCore().byId(selectorId);
103
+ const {
104
+ controllerName,
105
+ viewId
106
+ } = getControllerInfo(overlayControl);
107
+ const existingController = await this.getExistingController(controllerName);
108
+ if (existingController) {
109
+ const {
110
+ controllerExists,
111
+ controllerPath,
112
+ controllerPathFromRoot,
113
+ isRunningInBAS
114
+ } = existingController;
115
+ if (controllerExists) {
116
+ this.updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS);
117
+ } else {
118
+ this.updateModelForNewController(viewId);
119
+ await this.getControllers();
120
+ }
121
+ }
122
+ },
123
+ /**
124
+ * Updates the model properties for an existing controller.
125
+ *
126
+ * @param {boolean} controllerExists - Whether the controller exists.
127
+ * @param {string} controllerPath - The controller path.
128
+ * @param {string} controllerPathFromRoot - The controller path from the project root.
129
+ * @param {boolean} isRunningInBAS - Whether the environment is BAS or VS Code.
130
+ */
131
+ updateModelForExistingController: function _updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS) {
132
+ this.model.setProperty('/controllerExists', controllerExists);
133
+ this.model.setProperty('/controllerPath', controllerPath);
134
+ this.model.setProperty('/controllerPathFromRoot', controllerPathFromRoot);
135
+ const content = this.dialog.getContent();
136
+ const form = content[0];
137
+ form.setVisible(false);
138
+ const messageForm = content[1];
139
+ messageForm.setVisible(true);
140
+ if (isRunningInBAS) {
141
+ this.dialog.getBeginButton().setVisible(false);
142
+ } else {
143
+ this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
144
+ }
145
+ this.dialog.getEndButton().setText('Close');
146
+ },
147
+ /**
148
+ * Updates the model property for a new controller.
149
+ *
150
+ * @param viewId The view ID
151
+ */
152
+ updateModelForNewController: function _updateModelForNewController(viewId) {
153
+ this.model.setProperty('/viewId', viewId);
154
+ },
155
+ /**
156
+ * Retrieves existing controller data if found in the project's workspace.
157
+ *
158
+ * @param controllerName Controller name that exists in the view
159
+ * @returns Returnsexisting controller data
160
+ */
161
+ getExistingController: async function _getExistingController(controllerName) {
162
+ let data;
163
+ try {
164
+ data = await getExistingController(controllerName);
165
+ } catch (e) {
166
+ this.handleError(e);
167
+ }
168
+ return data;
169
+ },
170
+ /**
171
+ * Retrieves controller files and fills the model with data
172
+ */
173
+ getControllers: async function _getControllers() {
174
+ try {
175
+ const {
176
+ controllers
177
+ } = await readControllers();
178
+ this.model.setProperty('/controllersList', controllers);
179
+ } catch (e) {
180
+ this.handleError(e);
181
+ }
182
+ },
183
+ /**
184
+ * Creates a new fragment for the specified control
185
+ *
186
+ * @param controllerName Controller Name
187
+ * @param viewId View Id
188
+ */
189
+ createNewController: async function _createNewController(controllerName, viewId) {
190
+ try {
191
+ const manifest = await getManifestAppdescr();
192
+ await writeController({
193
+ controllerName,
194
+ projectId: manifest.id
195
+ });
196
+ const controllerRef = {
197
+ codeRef: `coding/${controllerName}.js`,
198
+ viewId
199
+ };
200
+ const service = await this.rta.getService('controllerExtension');
201
+ const change = await service.add(controllerRef.codeRef, controllerRef.viewId);
202
+ change.creation = new Date().toISOString();
203
+ await writeChange(change);
204
+ MessageToast.show(`Controller extension with name '${controllerName}' was created.`);
205
+ } catch (e) {
206
+ // We want to update the model incase we have already created a controller file but failed when creating a change file,
207
+ // so when the user types the same controller name again he does not get 409 from the server, instead an error is shown in the UI
208
+ await this.getControllers();
209
+ this.handleError(e);
210
+ }
211
+ }
212
+ });
213
+ return ControllerExtension;
214
214
  });
215
215
  //# sourceMappingURL=ControllerExtension.controller.js.map