Skip to content

armgit / core

Public Imported from GitHub
0

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

UI updates: minor

Rich Turner4f7d916587e5
diff --git a/ui/component/or-attribute-input/src/index.ts b/ui/component/or-attribute-input/src/index.ts
index e4c6f07ea..f6982043a 100644
--- a/ui/component/or-attribute-input/src/index.ts
+++ b/ui/component/or-attribute-input/src/index.ts
@@ -32,7 +32,8 @@ export function getAttributeValueTemplate(
disabled: boolean,
valueChangedCallback: (value: any) => void,
customProvider?: (assetType: string | undefined, attribute: Attribute | undefined, attributeDescriptor: AttributeDescriptor | undefined, valueDescriptor: AttributeValueDescriptor | undefined, valueChangeNotifier: (value: any | undefined) => void, readonly: boolean, disabled: boolean) => ((value: any) => TemplateResult) | undefined,
- forceInputType?: InputType) {
+ forceInputType?: InputType,
+ labelOverride?: string) {
let template: ((value: any) => TemplateResult) | undefined;
@@ -107,7 +108,7 @@ export function getAttributeValueTemplate(
}
if (!inputType) {
- let currentValue = attribute.value;
+ const currentValue = attribute.value;
if (currentValue) {
if (typeof currentValue === "number") {
@@ -126,7 +127,7 @@ export function getAttributeValueTemplate(
// TODO: Update to use 'effective' meta so not dependent on meta items being defined on the asset itself
min = AssetModelUtil.getMetaValue(MetaItemType.RANGE_MIN, attribute, attributeDescriptor) as number;
max = AssetModelUtil.getMetaValue(MetaItemType.RANGE_MAX, attribute, attributeDescriptor) as number;
- label = getAttributeLabel(attribute, attributeDescriptor);
+ label = labelOverride ? labelOverride : getAttributeLabel(attribute, attributeDescriptor);
ro = AssetModelUtil.getMetaValue(MetaItemType.READ_ONLY, attribute, attributeDescriptor);
options = AssetModelUtil.getMetaValue(MetaItemType.ALLOWED_VALUES, attribute, attributeDescriptor);
@@ -134,7 +135,7 @@ export function getAttributeValueTemplate(
inputType = InputType.SELECT;
}
- let getValue = (value: any) => {
+ const getValue = (value: any) => {
if (inputType === InputType.JSON && value !== null && typeof(value) !== "string") {
value = JSON.stringify(value, null, 2);
}
@@ -142,7 +143,7 @@ export function getAttributeValueTemplate(
return value;
};
- let setValue = (value: any) => {
+ const setValue = (value: any) => {
if (inputType === InputType.JSON && value !== null && typeof(value) !== "string") {
if (typeof(value) === "string") {
value = JSON.parse(value);
diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.ts
index a2470d54e..132c98eb9 100644
--- a/ui/component/or-input/src/index.ts
+++ b/ui/component/or-input/src/index.ts
@@ -191,7 +191,7 @@ export class OrInput extends LitElement {
public helperPersistent: boolean = false;
@property({type: String})
- public validationMessage = '';
+ public validationMessage = "";
@property({type: Boolean})
public charCounter: boolean = false;
diff --git a/ui/component/or-input/src/style.ts b/ui/component/or-input/src/style.ts
index 23fec08d2..eb22749df 100644
--- a/ui/component/or-input/src/style.ts
+++ b/ui/component/or-input/src/style.ts
@@ -18,13 +18,17 @@ export const orInputStyle = css`
border-radius: 50% !important;
}
- /* MDC TEXT FIELD DOESN'T USE THEME VARS */
+ /* MDC TEXT FIELD AND SELECT DON'T USE THEME VARS */
.mdc-text-field--focused:not(.mdc-text-field--disabled) .mdc-floating-label {
- color: var(--mdc-theme-primary);
+ color: var(--mdc-theme-primary);
}
.mdc-text-field--focused .mdc-text-field__input:required ~ .mdc-floating-label::after,
.mdc-text-field--focused .mdc-text-field__input:required ~ .mdc-notched-outline .mdc-floating-label::after {
- color: var(--mdc-theme-primary);
+ color: var(--mdc-theme-primary);
+ }
+
+ .mdc-select:not(.mdc-select--disabled).mdc-select--focused .mdc-floating-label {
+ color: var(--mdc-theme-primary);
}
.mdc-text-field, .mdc-text-field-helper-line {