Reused fromCamelCase function

to clear up some old TODO notes.
This commit is contained in:
leekelleher
2024-04-23 15:06:50 +01:00
parent 84459444f7
commit cc48d0d778
2 changed files with 4 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import { getPropertyValueByAlias } from '../index.js';
import type { UmbCollectionColumnConfiguration } from '../../../../../core/collection/types.js';
import type { UmbDocumentCollectionFilterModel, UmbDocumentCollectionItemModel } from '../../types.js';
import { css, html, customElement, state, repeat } from '@umbraco-cms/backoffice/external/lit';
import { fromCamelCase } from '@umbraco-cms/backoffice/utils';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UMB_DEFAULT_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
@@ -137,10 +138,7 @@ export class UmbDocumentGridCollectionViewElement extends UmbLitElement {
>${this.localize.term('content_notCreated')}</uui-tag
>`;
default:
// TODO: [LK] Check if we have a `SplitPascalCase`-esque utility function that could be used here.
return html`<uui-tag slot="tag" color="danger" look="secondary"
>${item.state.replace(/([A-Z])/g, ' $1')}</uui-tag
>`;
return html`<uui-tag slot="tag" color="danger" look="secondary">${fromCamelCase(item.state)}</uui-tag>`;
}
}

View File

@@ -1,5 +1,6 @@
import type { UmbDocumentCollectionItemModel } from '../../../types.js';
import { customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
import { fromCamelCase } from '@umbraco-cms/backoffice/utils';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbTableColumn, UmbTableColumnLayoutElement, UmbTableItem } from '@umbraco-cms/backoffice/components';
@@ -25,8 +26,7 @@ export class UmbDocumentTableColumnStateElement extends UmbLitElement implements
case 'NotCreated':
return html`<uui-tag color="danger" look="secondary">${this.localize.term('content_notCreated')}</uui-tag>`;
default:
// TODO: [LK] Check if we have a `SplitPascalCase`-esque utility function that could be used here.
return html`<uui-tag color="danger" look="secondary">${this.value.state.replace(/([A-Z])/g, ' $1')}</uui-tag>`;
return html`<uui-tag color="danger" look="secondary">${fromCamelCase(this.value.state)}</uui-tag>`;
}
}
}