mirror of
https://github.com/xiaoshi930/xiaoshi-pad-card.git
synced 2026-02-11 22:23:48 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16e8cb8493 | ||
|
|
d0c11c3f08 | ||
|
|
1908ec0fae | ||
|
|
98ec3bfd5e | ||
|
|
57d4627fa0 |
@@ -1,4 +1,4 @@
|
||||
console.info("%c 消逝卡-平板端 \n%c v 1.0.3 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
|
||||
console.info("%c 消逝卡-平板端 \n%c v 1.0.4 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
|
||||
|
||||
const loadCards = () => {
|
||||
import('./xiaoshi-pad-climate-card.js');
|
||||
|
||||
@@ -1410,6 +1410,7 @@ class XiaoshiPadClimateCard extends LitElement {
|
||||
background: rgb(0,0,0,0);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -1967,7 +1968,7 @@ _renderExtraButtons(buttonType = 1) {
|
||||
const domain = buttonEntityId.split('.')[0];
|
||||
const friendlyName = entity.attributes.friendly_name || '';
|
||||
const displayName = friendlyName.slice(0, 4);
|
||||
const displayValueColor = entity.state === '低' ? 'red' : fgColor;
|
||||
const displayValueColor = entity.state.includes('低') || entity.state.includes('少') || entity.state.includes('缺') ? 'red' : fgColor;
|
||||
|
||||
// 根据名称自定义图标
|
||||
const _getCustomIcon = (name, isActive) => {
|
||||
@@ -1977,6 +1978,9 @@ _renderExtraButtons(buttonType = 1) {
|
||||
if (name.includes('睡眠')) return isActive ? 'mdi:sleep' : 'mdi:sleep-off';
|
||||
if (name.includes('指示灯')) return isActive ? 'mdi:lightbulb-on' : 'mdi:lightbulb-off';
|
||||
if (name.includes('提示音')) return isActive ? 'mdi:volume-high' : 'mdi:volume-mute';
|
||||
if (name.includes('防冻')) return isActive ? 'mdi:snowflake' : 'mdi:snowflake-off';
|
||||
if (name.includes('防烫伤')) return isActive ? 'mdi:fire' : 'mdi:fire-off';
|
||||
if (name.includes('按键锁')) return isActive ? 'mdi:lock-open' : 'mdi:lock-open-variant';
|
||||
return null;
|
||||
};
|
||||
|
||||
@@ -2006,7 +2010,7 @@ _renderExtraButtons(buttonType = 1) {
|
||||
|
||||
return html`
|
||||
<div class="side-extra-button" style="cursor: default; --bg-color: ${bgColor};">
|
||||
<div class="side-value" style="color: ${displayValueColor}; font-size: 12px;">${displayValue}</div>
|
||||
<div class="side-value" style="color: ${displayValueColor}; font-size: 11px; font-weight: bold; white-space: nowrap">${displayValue}</div>
|
||||
<span class="side-text" style="color: ${fgColor};">${displayName}</span>
|
||||
</div>
|
||||
`;
|
||||
@@ -2024,15 +2028,14 @@ _renderExtraButtons(buttonType = 1) {
|
||||
`;
|
||||
|
||||
case 'select':
|
||||
const options = entity.attributes.options || [];
|
||||
const firstOption = options[0] || '';
|
||||
const selectDisplayValue = firstOption.slice(0, 4);
|
||||
const state = entity.state || '';
|
||||
const selectDisplayValue = state.slice(0, 4);
|
||||
|
||||
return html`
|
||||
<div class="side-extra-button"
|
||||
@click=${() => this._handleExtraButtonClick(buttonEntityId, domain)}
|
||||
style="cursor: default; --bg-color: ${bgColor};">
|
||||
<div class="side-value" style="color: ${fgColor}; font-size: 12px;">${selectDisplayValue}</div>
|
||||
<div class="side-value" style="color: ${fgColor}; font-size: 11px; font-weight: bold; white-space: nowrap">${selectDisplayValue}</div>
|
||||
<span class="side-text" style="color: ${fgColor};">${displayName}</span>
|
||||
</div>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user