Fix: Add a boolean prop to prevent the node field from using title case
This commit is contained in:
parent
7bd113dfaf
commit
a371515956
1 changed files with 5 additions and 3 deletions
|
|
@ -58,11 +58,12 @@ export function normalCaseToSnakeCase(str: string): string {
|
|||
.join("_");
|
||||
}
|
||||
|
||||
export function toTitleCase(str: string | undefined): string {
|
||||
export function toTitleCase(str: string | undefined, isNodeField?: boolean): string {
|
||||
if (!str) return "";
|
||||
let result = str
|
||||
.split("_")
|
||||
.map((word, index) => {
|
||||
if (isNodeField) return word
|
||||
if (index === 0) {
|
||||
return checkUpperWords(
|
||||
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
||||
|
|
@ -75,6 +76,7 @@ export function toTitleCase(str: string | undefined): string {
|
|||
return result
|
||||
.split("-")
|
||||
.map((word, index) => {
|
||||
if (isNodeField) return word
|
||||
if (index === 0) {
|
||||
return checkUpperWords(
|
||||
word[0].toUpperCase() + word.slice(1).toLowerCase()
|
||||
|
|
@ -642,6 +644,6 @@ export function getFieldTitle(
|
|||
return template[templateField].display_name
|
||||
? template[templateField].display_name!
|
||||
: template[templateField].name
|
||||
? toTitleCase(template[templateField].name!)
|
||||
: toTitleCase(templateField);
|
||||
? toTitleCase(template[templateField].name!, true)
|
||||
: toTitleCase(templateField, true);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue