make custom fields case sensitive (#1242)

* remove custom field lowercasing

* don't allow custom field form to submit duplicate field

* remove unused

* update custom field tests

* also keep upper case when editing

* show key in UI

* also kep upper case when creating a new field

* fix test

* allow old forced case keys to stay as is

* allow space

* add extension to import

* supply initial key to CustomFieldForm

* refactor: improve element contrast

* refactor: style and composition

* consistent use of `customFieldLabelToKey`

* fix CopyTag

* remove log

---------

Co-authored-by: arc-alex <ac@omnivox.dk>
Co-authored-by: Carlos Valente <carlosvalente@pm.me>
This commit is contained in:
2024-10-18 11:53:23 -05:00
committed by GitHub
parent b73b529c00
commit c5870452e3
15 changed files with 161 additions and 59 deletions
@@ -0,0 +1,12 @@
import { isAlphanumericWithSpace } from '../regex-utils/isAlphanumeric.js';
/**
* @description Transforms a Custom field label into a valid key or returns null if not possible
* @returns {string | null}
*/
export const customFieldLabelToKey = (label: string): string | null => {
if (isAlphanumericWithSpace(label)) {
return label.trim().replaceAll(' ', '_');
}
return null;
};