@sap-ux/odata-service-inquirer 3.1.0 → 3.2.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.
@@ -1,4 +1,5 @@
1
1
  import { Severity } from '@sap-devx/yeoman-ui-types';
2
+ import { PageTemplateType, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK, MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT } from '@sap-ux/fe-fpm-writer';
2
3
  import { searchChoices, getRecursiveHierarchyQualifierForEntitySet, findEntitySetByName } from '@sap-ux/inquirer-common';
3
4
  import { OdataVersion } from '@sap-ux/odata-service-writer';
4
5
  import { t } from '../../i18n.js';
@@ -150,43 +151,67 @@ export function getEntitySelectionQuestions(metadata, templateType, isCapService
150
151
  return entityQuestions;
151
152
  }
152
153
  /**
153
- * Get the questions for page building block.
154
+ * Get the questions for the page building block prompts.
154
155
  *
155
156
  * @returns the page building block questions
156
157
  */
157
158
  function getPageBuildingBlockQuestions() {
158
- const pageBuildingBlockQuestions = [];
159
- pageBuildingBlockQuestions.push({
160
- type: 'confirm',
161
- name: EntityPromptNames.addPageBuildingBlock,
162
- message: t('prompts.pageBuildingBlock.message'),
163
- default: false,
164
- guiOptions: {
165
- breadcrumb: true,
166
- hint: t('prompts.pageBuildingBlock.tooltip')
159
+ return [
160
+ {
161
+ type: 'confirm',
162
+ name: EntityPromptNames.addPageBuildingBlock,
163
+ message: t('prompts.pageBuildingBlock.message'),
164
+ default: false,
165
+ guiOptions: {
166
+ breadcrumb: true,
167
+ hint: t('prompts.pageBuildingBlock.tooltip', {
168
+ minUi5VersionForPageBuildingBlock: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK
169
+ })
170
+ }
167
171
  },
168
- additionalMessages: (addPageBuildingBlock) => {
169
- if (addPageBuildingBlock) {
170
- return {
171
- message: t('prompts.pageBuildingBlock.warning'),
172
- severity: Severity.warning
173
- };
172
+ {
173
+ when: (answers) => answers.addPageBuildingBlock === true,
174
+ type: 'confirm',
175
+ name: EntityPromptNames.pageBuildingBlockLayout,
176
+ message: t('prompts.pageBuildingBlock.layoutMessage'),
177
+ default: true,
178
+ labelTrue: t('prompts.pageBuildingBlock.choiceBasic'),
179
+ labelFalse: t('prompts.pageBuildingBlock.choiceFull'),
180
+ filter: (val) => (val ? PageTemplateType.Basic : PageTemplateType.Full),
181
+ guiOptions: {
182
+ breadcrumb: t('prompts.pageBuildingBlock.layoutMessage')
183
+ },
184
+ additionalMessages: (input) => {
185
+ if (input === true) {
186
+ return {
187
+ message: t('prompts.pageBuildingBlock.basicLayoutWarning', {
188
+ minUi5VersionForPageBuildingBlock: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK
189
+ }),
190
+ severity: Severity.warning
191
+ };
192
+ }
193
+ if (input === false) {
194
+ return {
195
+ message: t('prompts.pageBuildingBlock.fullLayoutWarning', {
196
+ minUi5VersionForFullLayout: MIN_UI5_VERSION_PAGE_BUILDING_BLOCK_FULL_LAYOUT
197
+ }),
198
+ severity: Severity.warning
199
+ };
200
+ }
174
201
  }
175
- }
176
- });
177
- // If the user wants to add a Page Building Block, ask for the title
178
- pageBuildingBlockQuestions.push({
179
- when: (answers) => answers.addPageBuildingBlock === true,
180
- type: 'input',
181
- name: EntityPromptNames.pageBuildingBlockTitle,
182
- message: t('prompts.pageBuildingBlock.titleMessage'),
183
- guiOptions: {
184
- breadcrumb: true,
185
- mandatory: true
186
202
  },
187
- validate: (input) => !!input
188
- });
189
- return pageBuildingBlockQuestions;
203
+ {
204
+ when: (answers) => answers.addPageBuildingBlock === true,
205
+ type: 'input',
206
+ name: EntityPromptNames.pageBuildingBlockTitle,
207
+ message: t('prompts.pageBuildingBlock.titleMessage'),
208
+ guiOptions: {
209
+ breadcrumb: true,
210
+ mandatory: true
211
+ },
212
+ validate: (input) => !!input
213
+ }
214
+ ];
190
215
  }
191
216
  /**
192
217
  * Get the questions that may be used to prompt for table layout options.
@@ -153,9 +153,13 @@
153
153
  },
154
154
  "pageBuildingBlock": {
155
155
  "message": "Add a Page Building Block to the Application?",
156
- "tooltip": "The Page building block is supported from SAPUI5 version 1.136. By choosing this option, you will be restricting the minimum SAPUI5 versions available for the application to be 1.136 and above.",
157
- "warning": "The Page building block is supported with SAPUI5 version 1.136 and above.",
158
- "titleMessage": "Page Title"
156
+ "tooltip": "The Page building block is supported from SAPUI5 version {{ minUi5VersionForPageBuildingBlock }}. By choosing this option, you are restricting the minimum SAPUI5 version to {{ minUi5VersionForPageBuildingBlock }} and above.",
157
+ "titleMessage": "Page Title",
158
+ "layoutMessage": "Page Building Block Layout",
159
+ "choiceFull": "Full Layout",
160
+ "choiceBasic": "Basic Layout",
161
+ "basicLayoutWarning": "The Page building block is supported with SAPUI5 version {{ minUi5VersionForPageBuildingBlock }} and above.",
162
+ "fullLayoutWarning": "Full Layout is supported with SAPUI5 version {{ minUi5VersionForFullLayout }} and above."
159
163
  },
160
164
  "tableType": {
161
165
  "message": "Table Type",
package/dist/types.d.ts CHANGED
@@ -8,6 +8,7 @@ import type { BackendSystem, BackendSystemFilter } from '@sap-ux/store';
8
8
  import type { ListChoiceOptions } from 'inquirer';
9
9
  import type { serviceUrlInternalPromptNames } from './prompts/datasources/service-url/types.js';
10
10
  import type { EntityAnswer, NavigationEntityAnswer } from './prompts/edmx/entity-helper.js';
11
+ import type { PageTemplateType } from '@sap-ux/fe-fpm-writer';
11
12
  /**
12
13
  * This file contains types that are exported by the module and are needed for consumers using the APIs `prompt` and `getPrompts`.
13
14
  */
@@ -159,6 +160,7 @@ export declare const EntityPromptNames: {
159
160
  readonly navigationEntity: "navigationEntity";
160
161
  readonly filterEntitySet: "filterEntitySet";
161
162
  readonly addPageBuildingBlock: "addPageBuildingBlock";
163
+ readonly pageBuildingBlockLayout: "pageBuildingBlockLayout";
162
164
  readonly pageBuildingBlockTitle: "pageBuildingBlockTitle";
163
165
  readonly tableType: "tableType";
164
166
  readonly hierarchyQualifier: "hierarchyQualifier";
@@ -180,9 +182,9 @@ export interface EntitySelectionAnswers {
180
182
  * Answers related to the Page Building Block prompt.
181
183
  */
182
184
  export interface PageBuildingBlockAnswers {
183
- /** Indicates if a Page Building Block should be addedn*/
184
185
  [EntityPromptNames.addPageBuildingBlock]?: boolean;
185
- /** The title for the Page Building Block, required if addPageBuildingBlock is true */
186
+ /** The layout type for the page building block. This is only applicable if addPageBuildingBlock is true. */
187
+ [EntityPromptNames.pageBuildingBlockLayout]?: PageTemplateType;
186
188
  [EntityPromptNames.pageBuildingBlockTitle]?: string;
187
189
  }
188
190
  export interface TableConfigAnswers {
package/dist/types.js CHANGED
@@ -76,6 +76,7 @@ export const EntityPromptNames = {
76
76
  navigationEntity: 'navigationEntity',
77
77
  filterEntitySet: 'filterEntitySet',
78
78
  addPageBuildingBlock: 'addPageBuildingBlock',
79
+ pageBuildingBlockLayout: 'pageBuildingBlockLayout',
79
80
  pageBuildingBlockTitle: 'pageBuildingBlockTitle',
80
81
  tableType: 'tableType',
81
82
  hierarchyQualifier: 'hierarchyQualifier',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/odata-service-inquirer",
3
3
  "description": "Prompts module that can prompt users for inputs required for odata service writing",
4
- "version": "3.1.0",
4
+ "version": "3.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -34,14 +34,14 @@
34
34
  "@sap-ux/axios-extension": "2.0.7",
35
35
  "@sap-ux/btp-utils": "2.0.5",
36
36
  "@sap-ux/fiori-generator-shared": "1.2.0",
37
- "@sap-ux/telemetry": "1.0.18",
38
37
  "@sap-ux/guided-answers-helper": "1.0.1",
39
- "@sap-ux/logger": "1.0.3",
38
+ "@sap-ux/telemetry": "1.0.18",
40
39
  "@sap-ux/inquirer-common": "1.0.23",
40
+ "@sap-ux/logger": "1.0.3",
41
+ "@sap-ux/nodejs-utils": "1.0.7",
41
42
  "@sap-ux/project-access": "2.1.6",
42
- "@sap-ux/store": "2.0.4",
43
43
  "@sap-ux/project-input-validator": "1.0.10",
44
- "@sap-ux/nodejs-utils": "1.0.7"
44
+ "@sap-ux/store": "2.0.4"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jest/globals": "30.4.1",
@@ -49,9 +49,10 @@
49
49
  "@types/inquirer-autocomplete-prompt": "2.0.2",
50
50
  "@types/inquirer": "8.2.6",
51
51
  "jest-extended": "7.0.0",
52
- "@sap-ux/fiori-elements-writer": "3.0.60",
53
- "@sap-ux/fiori-freestyle-writer": "3.0.53",
52
+ "@sap-ux/fe-fpm-writer": "1.3.0",
54
53
  "@sap-ux/fiori-generator-shared": "1.2.0",
54
+ "@sap-ux/fiori-elements-writer": "3.1.0",
55
+ "@sap-ux/fiori-freestyle-writer": "3.0.53",
55
56
  "@sap-ux/feature-toggle": "1.0.5",
56
57
  "@sap-ux/odata-service-writer": "1.0.12",
57
58
  "@sap-ux/cap-config-writer": "1.0.22"