mirror of
https://github.com/xiaoshi930/xiaoshi-pad-card.git
synced 2025-11-28 16:49:42 +00:00
Update xiaoshi-device-balance-card.js
This commit is contained in:
@@ -308,24 +308,6 @@ class XiaoshiBalanceCardEditor extends LitElement {
|
|||||||
class="attribute-input"
|
class="attribute-input"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="override-config">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
class="override-checkbox"
|
|
||||||
@change=${(e) => this._updateEntityOverride(index, 'name', e.target.checked)}
|
|
||||||
.checked=${entityConfig.overrides?.name !== undefined}
|
|
||||||
/>
|
|
||||||
<span class="override-label">名称:</span>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="override-input"
|
|
||||||
@change=${(e) => this._updateEntityOverrideValue(index, 'name', e.target.value)}
|
|
||||||
.value=${entityConfig.overrides?.name || ''}
|
|
||||||
placeholder="自定义名称"
|
|
||||||
?disabled=${entityConfig.overrides?.name === undefined}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="override-config">
|
<div class="override-config">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -343,7 +325,25 @@ class XiaoshiBalanceCardEditor extends LitElement {
|
|||||||
?disabled=${entityConfig.overrides?.icon === undefined}
|
?disabled=${entityConfig.overrides?.icon === undefined}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="override-config">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="override-checkbox"
|
||||||
|
@change=${(e) => this._updateEntityOverride(index, 'name', e.target.checked)}
|
||||||
|
.checked=${entityConfig.overrides?.name !== undefined}
|
||||||
|
/>
|
||||||
|
<span class="override-label">名称:</span>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="override-input"
|
||||||
|
@change=${(e) => this._updateEntityOverrideValue(index, 'name', e.target.value)}
|
||||||
|
.value=${entityConfig.overrides?.name || ''}
|
||||||
|
placeholder="自定义名称"
|
||||||
|
?disabled=${entityConfig.overrides?.name === undefined}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="override-config">
|
<div class="override-config">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -783,7 +783,7 @@ class XiaoshiBalanceCard extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.device-icon {
|
.device-icon {
|
||||||
margin-left: 12px;
|
margin-right: 12px;
|
||||||
color: var(--fg-color, #000);
|
color: var(--fg-color, #000);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
@@ -910,6 +910,9 @@ class XiaoshiBalanceCard extends LitElement {
|
|||||||
// 尝试从属性中获取单位
|
// 尝试从属性中获取单位
|
||||||
if (attributes.unit_of_measurement) {
|
if (attributes.unit_of_measurement) {
|
||||||
unit = attributes.unit_of_measurement;
|
unit = attributes.unit_of_measurement;
|
||||||
|
} else {
|
||||||
|
// 如果实体没有单位,则不显示单位
|
||||||
|
unit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用属性重定义
|
// 应用属性重定义
|
||||||
@@ -1002,8 +1005,8 @@ class XiaoshiBalanceCard extends LitElement {
|
|||||||
return html`
|
return html`
|
||||||
<div class="device-item" @click=${() => this._handleEntityClick(balanceData)}>
|
<div class="device-item" @click=${() => this._handleEntityClick(balanceData)}>
|
||||||
<div class="device-left">
|
<div class="device-left">
|
||||||
<div class="device-name">${balanceData.friendly_name}</div>
|
|
||||||
<ha-icon class="device-icon" icon="${balanceData.icon}"></ha-icon>
|
<ha-icon class="device-icon" icon="${balanceData.icon}"></ha-icon>
|
||||||
|
<div class="device-name">${balanceData.friendly_name}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="device-value ${isWarning ? 'warning' : ''}">
|
<div class="device-value ${isWarning ? 'warning' : ''}">
|
||||||
${balanceData.value}
|
${balanceData.value}
|
||||||
|
|||||||
Reference in New Issue
Block a user