@sap-ux/preview-middleware 1.0.10 → 1.0.11

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.
@@ -81,8 +81,8 @@ sap.ui.define(["sap/ui/core/mvc/XMLView", "sap/ui/core/UIComponent", "../utils/c
81
81
  ...item,
82
82
  defaultValue: item.value,
83
83
  configuration: true,
84
- name: item.id,
85
- readableName: item.name,
84
+ name: item.name ?? item.id,
85
+ readableName: item.name ?? item.id,
86
86
  manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
87
87
  type: item.type === 'number' ? 'int' : item.type,
88
88
  value: propertyValue
@@ -137,8 +137,8 @@ export function getManifestProperties(
137
137
  ...item,
138
138
  defaultValue: item.value,
139
139
  configuration: true,
140
- name: item.id,
141
- readableName: item.name,
140
+ name: item.name ?? item.id,
141
+ readableName: item.name ?? item.id,
142
142
  manifestPropertyPath: `${overlayData?.manifestPropertyPath(control)}/${propertyId}`,
143
143
  type: item.type === 'number' ? 'int' : (item.type as 'string' | 'boolean' | 'undefined'),
144
144
  value: propertyValue
@@ -300,7 +300,34 @@ sap.ui.define(['exports'], (function (exports) { 'use strict';
300
300
  const isUpperCase = (code) => code >= 65 && code <= 90;
301
301
  const isLowerCase = (code) => code >= 97 && code <= 122;
302
302
  const isWordDelimiter = (code) => code === 45 || code === 95 || code === 32; // - or _ or space
303
+ const isSentenceCase = (text) => {
304
+ if (!text || text.length === 0 || !isUpperCase(text.charCodeAt(0))) {
305
+ return false;
306
+ }
307
+ // Sentence case should have spaces between words
308
+ for (let i = 0; i < text.length; i++) {
309
+ const code = text.charCodeAt(i);
310
+ if (code === 32) {
311
+ return true;
312
+ }
313
+ else if (code === 45 || code === 95) {
314
+ // Has hyphens or underscores - not sentence case
315
+ return false;
316
+ }
317
+ }
318
+ return true;
319
+ };
320
+ const isEndOfAbbreviatedWord = (text, index) => {
321
+ if (index + 2 >= text.length) {
322
+ return false;
323
+ }
324
+ return isUpperCase(text.charCodeAt(index + 1)) && isLowerCase(text.charCodeAt(index + 2));
325
+ };
303
326
  const convertCamelCaseToPascalCase = (text) => {
327
+ // Early return if already in sentence case
328
+ if (isSentenceCase(text)) {
329
+ return text;
330
+ }
304
331
  const words = [];
305
332
  let word = '';
306
333
  let lookForUpperCase = true;
@@ -313,7 +340,7 @@ sap.ui.define(['exports'], (function (exports) { 'use strict';
313
340
  // First lower case character after upper case character -> switch mode to collect only lower case characters
314
341
  lookForUpperCase = false;
315
342
  }
316
- else if (isUpperCase(text.charCodeAt(i + 1)) && isLowerCase(text.charCodeAt(i + 2))) {
343
+ else if (isEndOfAbbreviatedWord(text, i)) {
317
344
  // Next character is the last uppercase character after a sequence of upper case character -> create an abbreviated word
318
345
  words.push(word);
319
346
  word = '';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "bugs": {
11
11
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
12
12
  },
13
- "version": "1.0.10",
13
+ "version": "1.0.11",
14
14
  "license": "Apache-2.0",
15
15
  "author": "@SAP/ux-tools-team",
16
16
  "main": "dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "@sap/bas-sdk": "3.13.7",
31
31
  "@sap-ux/adp-tooling": "1.0.8",
32
32
  "@sap-ux/btp-utils": "2.0.1",
33
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@1.0.3",
33
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@1.0.4",
34
34
  "@sap-ux/feature-toggle": "1.0.1",
35
35
  "@sap-ux/logger": "1.0.1",
36
36
  "@sap-ux/project-access": "2.1.1",
@@ -54,7 +54,7 @@
54
54
  "nock": "14.0.11",
55
55
  "npm-run-all2": "8.0.4",
56
56
  "supertest": "7.2.2",
57
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.0.10",
57
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@1.0.11",
58
58
  "@sap-ux-private/playwright": "1.0.2",
59
59
  "@sap-ux/axios-extension": "2.0.1",
60
60
  "@sap-ux/store": "2.0.1",