Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Show number for read only slider input

Don319bae9772ae
diff --git a/model/src/main/java/org/openremote/model/asset/AssetType.java b/model/src/main/java/org/openremote/model/asset/AssetType.java
index 69d38f9f5..6f4ae237c 100644
--- a/model/src/main/java/org/openremote/model/asset/AssetType.java
+++ b/model/src/main/java/org/openremote/model/asset/AssetType.java
@@ -392,7 +392,10 @@ public enum AssetType implements AssetDescriptor {
),
GROUP(ASSET_NAMESPACE + ":group", "folder", "B3B3B3",
- new AttributeDescriptorImpl("childAssetType", STRING, null, READ_ONLY)
+ new AttributeDescriptorImpl("childAssetType", STRING, null,
+ LABEL.withInitialValue(Values.create("Child asset type")),
+ DESCRIPTION.withInitialValue(Values.create("Asset type of children")),
+ READ_ONLY)
),
THING(ASSET_NAMESPACE + ":thing", "cube-outline", null),
diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.ts
index 2db627510..b76a7445d 100644
--- a/ui/component/or-attribute-input/src/index.ts
+++ b/ui/component/or-attribute-input/src/index.ts
@@ -240,7 +240,7 @@ export function getAttributeInputWrapper(content: TemplateResult, loading: boole
if (helperText) {
content = html`
<div id="wrapper-helper">
- ${label ? html`<div>${label}</div>` : ``}
+ ${label ? html`<div style="margin-left: 16px">${label}</div>` : ``}
<div id="wrapper-input">${content}</div>
<div id="helper-text">${helperText}</div>
</div>
@@ -807,7 +807,7 @@ export class OrAttributeInput extends subscribe(manager)(translate(i18next)(LitE
content = html`<or-input id="input" .type="${this._inputType}" .label="${label}" .value="${value}"
.allowedValues="${this._options}" .min="${this._min}" .max="${this._max}" .format="${this._valueFormat}"
.options="${this._options}" .readonly="${this.isReadonly()}" .disabled="${this.disabled || loading}"
- .helperText="${supportsHelperText ? helperText : undefined}" .helperPersistent="${true}" .disableSliderNumberInput="${this.isReadonly()}"
+ .helperText="${supportsHelperText ? helperText : undefined}" .helperPersistent="${true}"
@keyup="${(e: KeyboardEvent) => {
if ((e.code === "Enter" || e.code === "NumpadEnter") && this._inputType !== InputType.JSON && this._inputType !== InputType.TEXTAREA) {
this._updateValue(this._attrInput.value);
diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.ts
index 8cee18245..b32c462ec 100644
--- a/ui/component/or-input/src/index.ts
+++ b/ui/component/or-input/src/index.ts
@@ -684,7 +684,7 @@ export class OrInput extends LitElement {
if (this.type === InputType.RANGE) {
// Change vars so number input can be included alongside the slider
label = undefined;
- outlined = true;
+ outlined = false;
hasHelper = false;
denseComfortable = true;
rounded = true;
@@ -692,63 +692,61 @@ export class OrInput extends LitElement {
componentId = "number";
}
- if (!(this.type === InputType.RANGE && this.disableSliderNumberInput)) {
- const classes = {
- "mdc-text-field": true,
- "mdc-text-field--filled": !outlined,
- "mdc-text-field--outlined": outlined,
- "mdc-text-field--textarea": type === InputType.TEXTAREA || type === InputType.JSON,
- "mdc-text-field--disabled": this.disabled,
- "mdc-text-field--fullwidth": this.fullWidth && !outlined,
- "dense-comfortable": denseComfortable,
- "dense-compact": denseCompact,
- "is-rounded": rounded,
- "mdc-text-field--label-floating" : hasValue,
- "mdc-text-field--no-label": !this.label,
- "mdc-text-field--with-leading-icon": !!this.icon,
- "mdc-text-field--with-trailing-icon": !!this.iconTrailing
- };
-
- inputElem = type === InputType.TEXTAREA || type === InputType.JSON
- ? html`
- <textarea id="elem" class="mdc-text-field__input" ?required="${this.required}"
- ?readonly="${this.readonly}" ?disabled="${this.disabled}" minlength="${ifDefined(this.minLength)}"
- maxlength="${ifDefined(this.maxLength)}" rows="${this.rows ? this.rows : 5}"
- cols="${ifDefined(this.cols)}" aria-label="${ifDefined(label)}"
- aria-labelledby="${ifDefined(label ? "label" : undefined)}"
- @change="${(e: Event) => this.onValueChange((e.target as HTMLTextAreaElement), (e.target as HTMLTextAreaElement).value)}">${valMinMax[0] ? valMinMax[0] : ""}</textarea>`
- : html`
- <input type="${type}" id="elem" aria-labelledby="${ifDefined(label ? "label" : undefined)}"
- class="mdc-text-field__input" ?required="${this.required}" ?readonly="${this.readonly}"
- ?disabled="${this.disabled}" min="${ifDefined(valMinMax[1])}" max="${ifDefined(valMinMax[2])}"
- step="${ifDefined(this.step)}" minlength="${ifDefined(this.minLength)}" pattern="${ifDefined(this.pattern)}"
- maxlength="${ifDefined(this.maxLength)}" placeholder="${ifDefined(this.placeHolder)}"
- .value="${valMinMax[0] !== null && valMinMax[0] !== undefined ? valMinMax[0] : ""}"
- @change="${(e: Event) => this.onValueChange((e.target as HTMLInputElement), (e.target as HTMLInputElement).value)}" />`;
+ const classes = {
+ "mdc-text-field": true,
+ "mdc-text-field--filled": !outlined,
+ "mdc-text-field--outlined": outlined,
+ "mdc-text-field--textarea": type === InputType.TEXTAREA || type === InputType.JSON,
+ "mdc-text-field--disabled": this.disabled,
+ "mdc-text-field--fullwidth": this.fullWidth && !outlined,
+ "dense-comfortable": denseComfortable,
+ "dense-compact": denseCompact,
+ "is-rounded": rounded,
+ "mdc-text-field--label-floating" : hasValue,
+ "mdc-text-field--no-label": !this.label,
+ "mdc-text-field--with-leading-icon": !!this.icon,
+ "mdc-text-field--with-trailing-icon": !!this.iconTrailing
+ };
- inputElem = html`
- <label id="${componentId}" class="${classMap(classes)}">
- ${this.icon ? html`<or-icon class="mdc-text-field__icon mdc-text-field__icon--leading" aria-hidden="true" icon="${this.icon}"></or-icon>` : ``}
- ${outlined ? `` : html`<span class="mdc-text-field__ripple"></span>`}
- ${inputElem}
- ${outlined ? this.renderOutlined(labelTemplate) : labelTemplate}
- ${outlined ? `` : html`<span class="mdc-line-ripple"></span>`}
- ${this.iconTrailing ? html`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>` : ``}
- </label>
- ${hasHelper ? html`
- <div class="mdc-text-field-helper-line">
- <div class="mdc-text-field-helper-text ${classMap(helperClasses)}">${showValidationMessage ? this.validationMessage : this.helperText}</div>
- ${this.charCounter && !this.readonly ? html`<div class="mdc-text-field-character-counter"></div>` : ``}
- </div>
- ` : ``}
- `;
- }
+ inputElem = type === InputType.TEXTAREA || type === InputType.JSON
+ ? html`
+ <textarea id="elem" class="mdc-text-field__input" ?required="${this.required}"
+ ?readonly="${this.readonly}" ?disabled="${this.disabled}" minlength="${ifDefined(this.minLength)}"
+ maxlength="${ifDefined(this.maxLength)}" rows="${this.rows ? this.rows : 5}"
+ cols="${ifDefined(this.cols)}" aria-label="${ifDefined(label)}"
+ aria-labelledby="${ifDefined(label ? "label" : undefined)}"
+ @change="${(e: Event) => this.onValueChange((e.target as HTMLTextAreaElement), (e.target as HTMLTextAreaElement).value)}">${valMinMax[0] ? valMinMax[0] : ""}</textarea>`
+ : html`
+ <input type="${type}" id="elem" aria-labelledby="${ifDefined(label ? "label" : undefined)}"
+ class="mdc-text-field__input" ?required="${this.required}" ?readonly="${this.readonly}"
+ ?disabled="${this.disabled}" min="${ifDefined(valMinMax[1])}" max="${ifDefined(valMinMax[2])}"
+ step="${ifDefined(this.step)}" minlength="${ifDefined(this.minLength)}" pattern="${ifDefined(this.pattern)}"
+ maxlength="${ifDefined(this.maxLength)}" placeholder="${ifDefined(this.placeHolder)}"
+ .value="${valMinMax[0] !== null && valMinMax[0] !== undefined ? valMinMax[0] : ""}"
+ @change="${(e: Event) => this.onValueChange((e.target as HTMLInputElement), (e.target as HTMLInputElement).value)}" />`;
+
+ inputElem = html`
+ <label id="${componentId}" class="${classMap(classes)}">
+ ${this.icon ? html`<or-icon class="mdc-text-field__icon mdc-text-field__icon--leading" aria-hidden="true" icon="${this.icon}"></or-icon>` : ``}
+ ${outlined ? `` : html`<span class="mdc-text-field__ripple"></span>`}
+ ${inputElem}
+ ${outlined ? this.renderOutlined(labelTemplate) : labelTemplate}
+ ${outlined ? `` : html`<span class="mdc-line-ripple"></span>`}
+ ${this.iconTrailing ? html`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>` : ``}
+ </label>
+ ${hasHelper ? html`
+ <div class="mdc-text-field-helper-line">
+ <div class="mdc-text-field-helper-text ${classMap(helperClasses)}">${showValidationMessage ? this.validationMessage : this.helperText}</div>
+ ${this.charCounter && !this.readonly ? html`<div class="mdc-text-field-character-counter"></div>` : ``}
+ </div>
+ ` : ``}
+ `;
if (this.type === InputType.RANGE) {
inputElem = html`
<span id="wrapper">
${this.label ? html`<label for="component" class="${this.disabled ? "mdc-switch--disabled" : ""}">${this.label}</label>` : ``}
- <div id="component" class="mdc-slider mdc-slider--discrete" tabindex="10" role="slider"
+ <div id="component" class="mdc-slider mdc-slider--discrete" tabindex="10" role="slider"
aria-valuemin="${ifDefined(valMinMax[1])}" aria-valuemax="${ifDefined(valMinMax[2])}"
aria-valuenow="${ifDefined(valMinMax[0])}" aria-label="${ifDefined(this.label)}"
aria-disabled="${(this.readonly || this.disabled) ? "true" : "false"}"
@@ -766,7 +764,7 @@ export class OrInput extends LitElement {
<div class="mdc-slider__focus-ring"></div>
</div>
</div>
- ${inputElem ? html`<div style="width: 75px; margin-left: 10px;">${inputElem}</div>` : ``}
+ ${inputElem ? html`<div style="width: 75px; margin-left: 20px;">${inputElem}</div>` : ``}
</span>
`;
}