12 Commits

Author SHA1 Message Date
xiaoshi
81b40138f5 Update xiaoshi-pad-card.js 2025-11-28 21:50:16 +08:00
xiaoshi
4783085a99 Update xiaoshi-device-update-card.js 2025-11-28 21:49:39 +08:00
xiaoshi
737b174953 Update xiaoshi-device-todo-card.js 2025-11-28 21:49:28 +08:00
xiaoshi
d49426da73 Update xiaoshi-device-offline-card.js 2025-11-28 21:49:16 +08:00
xiaoshi
3bf33ef0cb Update xiaoshi-device-ha-info-card.js 2025-11-28 21:49:02 +08:00
xiaoshi
2c3c3fd42d Update xiaoshi-device-consumables-card.js 2025-11-28 21:48:49 +08:00
xiaoshi
4fe21a2c74 Update xiaoshi-device-consumables-button2.js 2025-11-28 21:48:35 +08:00
xiaoshi
3900897f15 Update xiaoshi-device-consumables-button.js 2025-11-28 21:48:19 +08:00
xiaoshi
2170f5423c Update xiaoshi-device-balance-card.js 2025-11-28 21:48:06 +08:00
xiaoshi
82e71cf38d Update xiaoshi-device-consumables-button.js 2025-11-28 20:49:17 +08:00
xiaoshi
c79052b1e1 Update xiaoshi-device-consumables-button2.js 2025-11-28 20:49:01 +08:00
xiaoshi
5ef261877c Update xiaoshi-device-consumables-card.js 2025-11-28 20:48:46 +08:00
9 changed files with 129 additions and 42 deletions

View File

@@ -975,12 +975,12 @@ class XiaoshiBalanceCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOilPriceData();
navigator.vibrate(50);
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true });
@@ -989,6 +989,17 @@ class XiaoshiBalanceCard extends LitElement {
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
_evaluateWarningCondition(value, condition) {
if (!condition) return false;

View File

@@ -1044,7 +1044,7 @@ class XiaoshiConsumablesButton extends LitElement {
margin-right: 8px;
color: var(--fg-color, #000);
flex-shrink: 0;
font-size: 10px;
font-size: 11px;
width: 12px;
height: 12px;
display: flex;
@@ -1054,7 +1054,7 @@ class XiaoshiConsumablesButton extends LitElement {
.device-name {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -1064,13 +1064,12 @@ class XiaoshiConsumablesButton extends LitElement {
.device-value {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
flex-shrink: 0;
font-weight: bold;
max-width: 45%;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1079,7 +1078,7 @@ class XiaoshiConsumablesButton extends LitElement {
}
.device-unit {
font-size: 9px;
font-size: 11px;
color: var(--fg-color, #000);
margin-left: 0.5px;
font-weight: bold;
@@ -1261,12 +1260,12 @@ class XiaoshiConsumablesButton extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOilPriceData();
navigator.vibrate(50);
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true });
@@ -1274,6 +1273,18 @@ class XiaoshiConsumablesButton extends LitElement {
this.dispatchEvent(evt);
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
/*button新元素 开始*/
_handleButtonClick() {
const tapAction = this.config.tap_action;
@@ -1307,7 +1318,7 @@ class XiaoshiConsumablesButton extends LitElement {
console.warn('browser_mod not available, cannot show popup');
}
}
navigator.vibrate(50);
this._handleClick();
}
/*button新元素 结束*/

View File

@@ -1524,7 +1524,7 @@ class XiaoshiConsumablesButton extends LitElement {
.device-name {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -1534,13 +1534,12 @@ class XiaoshiConsumablesButton extends LitElement {
.device-value {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
flex-shrink: 0;
font-weight: bold;
max-width: 45%;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -1549,7 +1548,7 @@ class XiaoshiConsumablesButton extends LitElement {
}
.device-unit {
font-size: 9px;
font-size: 11px;
color: var(--fg-color, #000);
margin-left: 0.5px;
font-weight: bold;
@@ -1731,12 +1730,12 @@ class XiaoshiConsumablesButton extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOilPriceData();
navigator.vibrate(50);
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true });
@@ -1745,7 +1744,18 @@ class XiaoshiConsumablesButton extends LitElement {
}
}
/*button新元素 开始*/
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
// 获取默认弹出样式
_getDefaultPopupStyle() {
return '--mdc-theme-surface: rgba(0,0,0,0)\n--dialog-backdrop-filter: blur(10px) brightness(1);';
@@ -1893,7 +1903,7 @@ class XiaoshiConsumablesButton extends LitElement {
});
}
}
navigator.vibrate(50);
this._handleClick();
}
// 备选的弹出方案

View File

@@ -906,7 +906,7 @@ class XiaoshiConsumablesCard extends LitElement {
.device-name {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -916,13 +916,12 @@ class XiaoshiConsumablesCard extends LitElement {
.device-value {
color: var(--fg-color, #000);
font-size: 9px;
font-size: 11px;
flex-shrink: 0;
font-weight: bold;
max-width: 45%;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
@@ -931,7 +930,7 @@ class XiaoshiConsumablesCard extends LitElement {
}
.device-unit {
font-size: 9px;
font-size: 11px;
color: var(--fg-color, #000);
margin-left: 0.5px;
font-weight: bold;
@@ -1113,12 +1112,12 @@ class XiaoshiConsumablesCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOilPriceData();
navigator.vibrate(50);
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true });
@@ -1127,6 +1126,17 @@ class XiaoshiConsumablesCard extends LitElement {
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
_renderDeviceItem(consumablesData) {
let isWarning = false;

View File

@@ -788,13 +788,13 @@ export class XiaoshiHaInfoCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOfflineDevices();
navigator.vibrate(50);
}
_handleDeviceClick(device) {
navigator.vibrate(50);
// 点击设备时跳转到设备详情页
this._handleClick();
if (device.device_id) {
// 先关闭当前弹窗/界面
this._closeCurrentDialog();
@@ -817,7 +817,7 @@ export class XiaoshiHaInfoCard extends LitElement {
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
// 使用您建议的第一种方式
@@ -826,7 +826,18 @@ export class XiaoshiHaInfoCard extends LitElement {
this.dispatchEvent(evt);
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
_closeCurrentDialog() {
// 查找并关闭当前可能的弹窗或对话框
const dialogs = document.querySelectorAll('ha-dialog, .mdc-dialog, paper-dialog, vaadin-dialog');
@@ -946,14 +957,14 @@ export class XiaoshiHaInfoCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadUpdateData();
this._loadOfflineDevices();
navigator.vibrate(50);
}
_handleUpdateClick(update) {
navigator.vibrate(50);
// 点击更新项时弹出实体详情
this._handleClick();
// 如果有entity_id弹出实体详情
if (update.entity_id) {
@@ -972,9 +983,9 @@ export class XiaoshiHaInfoCard extends LitElement {
}
_handleConfirmUpdate(update, event) {
this._handleClick();
event.stopPropagation(); // 阻止事件冒泡
event.preventDefault(); // 阻止默认行为
navigator.vibrate(50);
// 弹出确认对话框
const confirmed = confirm(`确认要更新 ${update.name} 吗?\n当前版本: ${update.current_version}\n最新版本: ${update.latest_version}`);
@@ -986,6 +997,7 @@ export class XiaoshiHaInfoCard extends LitElement {
this._loadUpdateData();
}, 1000);
}
}
_executeUpdate(update) {

View File

@@ -667,12 +667,12 @@ export class XiaoshiOfflineCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadOfflineDevices();
navigator.vibrate(50);
}
_handleDeviceClick(device) {
navigator.vibrate(50);
this._handleClick();
// 点击设备时跳转到设备详情页
if (device.device_id) {
// 先关闭当前弹窗/界面
@@ -696,7 +696,7 @@ export class XiaoshiOfflineCard extends LitElement {
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
// 使用您建议的第一种方式
@@ -705,7 +705,18 @@ export class XiaoshiOfflineCard extends LitElement {
this.dispatchEvent(evt);
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
_closeCurrentDialog() {
// 查找并关闭当前可能的弹窗或对话框
const dialogs = document.querySelectorAll('ha-dialog, .mdc-dialog, paper-dialog, vaadin-dialog');

View File

@@ -941,12 +941,12 @@ class XiaoshiTodoCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadTodoData();
navigator.vibrate(50);
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
const evt = new Event('hass-more-info', { composed: true });
@@ -955,6 +955,17 @@ class XiaoshiTodoCard extends LitElement {
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
async _addTodoItem(entityId, item, description = '', due = '') {
try {
const params = {

View File

@@ -468,7 +468,7 @@ export class XiaoshiUpdateCard extends LitElement {
}
_handleEntityClick(entity) {
navigator.vibrate(50);
this._handleClick();
// 点击实体时打开实体详情页
if (entity.entity_id) {
// 使用您建议的第一种方式
@@ -478,6 +478,17 @@ export class XiaoshiUpdateCard extends LitElement {
}
}
_handleClick(){
if (navigator.vibrate) {
navigator.vibrate(50);
}
else if (navigator.webkitVibrate) {
navigator.webkitVibrate(50);
}
else {
}
}
async _loadUpdateData() {
if (!this.hass) return;
@@ -552,12 +563,12 @@ export class XiaoshiUpdateCard extends LitElement {
}
_handleRefresh() {
this._handleClick();
this._loadUpdateData();
navigator.vibrate(50);
}
_handleUpdateClick(update) {
navigator.vibrate(50);
this._handleClick();
// 点击更新项时弹出实体详情
// 如果有entity_id弹出实体详情
@@ -577,9 +588,9 @@ export class XiaoshiUpdateCard extends LitElement {
}
_handleConfirmUpdate(update, event) {
this._handleClick();
event.stopPropagation(); // 阻止事件冒泡
event.preventDefault(); // 阻止默认行为
navigator.vibrate(50);
// 弹出确认对话框
const confirmed = confirm(`确认要更新 ${update.name} 吗?\n当前版本: ${update.current_version}\n最新版本: ${update.latest_version}`);

View File

@@ -1,4 +1,4 @@
console.info("%c 消逝卡-平板端 \n%c v 0.1.4 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
console.info("%c 消逝卡-平板端 \n%c v 0.1.5 ", "color: red; font-weight: bold; background: black", "color: white; font-weight: bold; background: black");
const loadCards = async () => {
await import('./xiaoshi-pad-grid-card.js');