6 Commits

Author SHA1 Message Date
xiaoshi
53e06aacf7 Update xiaoshi-device-todo-card.js 2025-11-25 13:35:29 +08:00
xiaoshi
9a59c2bb90 Create xiaoshi-device-todo-card.js 2025-11-25 13:34:43 +08:00
xiaoshi
0ae5851361 Update xiaoshi-pad-card.js 2025-11-25 13:34:07 +08:00
xiaoshi
a17033c0f0 Update README.md 2025-11-25 13:33:09 +08:00
xiaoshi
44a1d81265 Update xiaoshi-pad-card.js 2025-11-24 15:34:14 +08:00
xiaoshi
2de0668d37 Update xiaoshi-device-balance-card.js 2025-11-24 15:33:59 +08:00
4 changed files with 1333 additions and 25 deletions

View File

@@ -28,7 +28,7 @@ mode: 湿度 # 【温度】或者【湿度】
**引用示例** **引用示例**
~~~ ~~~
type: custom:xiaoshi-update-card type: custom:xiaoshi-update-card
width: 100p% width: 100%
theme: on theme: on
~~~ ~~~
@@ -36,7 +36,8 @@ theme: on
**引用示例** **引用示例**
~~~ ~~~
type: custom:xiaoshi-offline-card type: custom:xiaoshi-offline-card
width: 320px width: 100%
theme: on
exclude_devices: exclude_devices:
- *设备* - *设备*
exclude_entities: exclude_entities:
@@ -48,7 +49,8 @@ exclude_entities:
~~~ ~~~
type: custom:xiaoshi-balance-card type: custom:xiaoshi-balance-card
name: 电话余额信息 name: 电话余额信息
width: 350px width: 100%
theme: on
entities: entities:
- entity_id: sensor.999 - entity_id: sensor.999
attribute: null attribute: null
@@ -65,3 +67,14 @@ entities:
unit_of_measurement: "" unit_of_measurement: ""
warning: "99" warning: "99"
~~~ ~~~
## 功能4待办事项卡(手机平板端通用)
**引用示例**
~~~
type: custom:xiaoshi-todo-card
width: 100%
theme: on
entities:
- todo.kuai_di
- todo.ji_shi_ben
~~~

View File

@@ -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}

1285
xiaoshi-device-todo-card.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,11 @@
console.info("%c 消逝卡-平板端 \n%c v 0.0.6 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black"); console.info("%c 消逝卡-平板端 \n%c v 0.0.8 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
const loadCards = async () => { const loadCards = async () => {
await import('./xiaoshi-pad-grid-card.js'); await import('./xiaoshi-pad-grid-card.js');
await import('./xiaoshi-device-update-card.js'); await import('./xiaoshi-device-update-card.js');
await import('./xiaoshi-device-offline-card.js'); await import('./xiaoshi-device-offline-card.js');
await import('./xiaoshi-device-balance-card.js'); await import('./xiaoshi-device-balance-card.js');
await import('./xiaoshi-device-todo-card.js');
window.customCards = window.customCards || []; window.customCards = window.customCards || [];
window.customCards.push(...cardConfigs); window.customCards.push(...cardConfigs);
@@ -33,6 +34,12 @@ const cardConfigs = [
name: '消逝电话余额卡', name: '消逝电话余额卡',
description: '消逝电话余额卡', description: '消逝电话余额卡',
preview: true preview: true
},
{
type: 'xiaoshi-todo-card',
name: '消逝待办事项',
description: '消逝待办事项',
preview: true
} }
]; ];