property editor ui name, using label value

This commit is contained in:
Niels Lyngsø
2024-10-16 10:33:03 +02:00
parent 85ed0c6194
commit 928a3352bf
4 changed files with 12 additions and 11 deletions

View File

@@ -109,8 +109,9 @@ export class UmbLocalizationController<LocalizationSetType extends UmbLocalizati
/**
* Outputs a translated term.
* @param key
* @param {...any} args
* @param {string} key - the localization key, the indicator of what localization entry you want to retrieve.
* @param {...any} args - the arguments to parse for this localization entry.
* @returns {string} - the translated term as a string.
*/
term<K extends keyof LocalizationSetType>(key: K, ...args: FunctionParams<LocalizationSetType[K]>): string {
if (!this.#usedKeys.includes(key)) {

View File

@@ -1,7 +1,7 @@
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
export interface UmbPropertyEditorUiElement extends HTMLElement {
alias?: string;
name?: string;
value?: unknown;
config?: UmbPropertyEditorConfigCollection;
mandatory?: boolean;

View File

@@ -182,9 +182,6 @@ export class UmbPropertyElement extends UmbLitElement {
this.#propertyContext.alias,
(alias) => {
this._alias = alias;
if (this._element) {
this._element.alias = alias;
}
},
null,
);
@@ -193,6 +190,9 @@ export class UmbPropertyElement extends UmbLitElement {
this.#propertyContext.label,
(label) => {
this._label = label;
if (this._element) {
this._element.name = label;
}
},
null,
);
@@ -297,9 +297,9 @@ export class UmbPropertyElement extends UmbLitElement {
if (this._element) {
this._element.addEventListener('change', this._onPropertyEditorChange as any as EventListener);
this._element.addEventListener('property-value-change', this._onPropertyEditorChange as any as EventListener);
// No need to observe mandatory or alias, as we already do so and set it on the _element if present: [NL]
// No need to observe mandatory or label, as we already do so and set it on the _element if present: [NL]
this._element.mandatory = this._mandatory;
this._element.alias = this._alias;
this._element.name = this._label;
// No need for a controller alias, as the clean is handled via the observer prop:
this.#valueObserver = this.observe(

View File

@@ -35,11 +35,11 @@ export class UmbPropertyEditorUITextBoxElement
mandatoryMessage = UMB_VALIDATION_EMPTY_LOCALIZATION_KEY;
/**
* The alias of this field.
* The name of this field.
* @type {string}
*/
@property({ type: String })
alias?: string;
name?: string;
#defaultType: UuiInputTypeType = 'text';
@@ -79,7 +79,7 @@ export class UmbPropertyEditorUITextBoxElement
override render() {
return html`<uui-input
.label=${this.localize.term('general_fieldFor', [this.alias])}
.label=${this.localize.term('general_fieldFor', [this.name])}
.value=${this.value ?? ''}
.type=${this._type}
placeholder=${ifDefined(this._placeholder)}