Skip to content

Commit

Permalink
support for fire-dom-event and url added
Browse files Browse the repository at this point in the history
  • Loading branch information
bhuebschen committed Aug 15, 2024
1 parent 891c58f commit 41f0699
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.0.2 (2024-08-15)

support for "fire-dom-event" and "url"

### 1.0.1 (2024-07-11)

fixed navigation issues
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ left: false
| active_color | string | **Optional** | Background color of the button when active | `--accent-color` |
| icon | string | **Required** | Icon to display on the FAB button | `mdi:menu` |
| action | object | **Required** | Action to perform when the button is clicked | |
| action.action | string | **Required** | Type of action (`navigate`, `call-service`, etc.) | |
| action.action | string | **Required** | Type of action (`navigate`, `call-service`, `more-info`, `fire-dom-event`, `url`) | |
| action.navigation_path | string | **Optional** | Path to navigate to (required if action is `navigate`) | |
| action.service | string | **Optional** | Service to call (required if action is `call-service`) | |
| action.service_data | object | **Optional** | Data to include with the service call (required if action is `call-service`) | |
| action.url_path | string | **Optional** | URL to navigate to (required if action is `url`) |
| action.target | string | **Optional** | Sets the target-frame/window/tab of the URL (optional if action is `url`) |
| entity | string | **Optional** | Entity to monitor for state changes | |
| positive_states | list | **Optional** | List of states considered positive | `['true', 'on', 'open', 'active', 'detected', 'occupied', 'unlocked', 'home', 'above_horizon', 'ready']` |
| left | boolean | **Optional** | Position the button on the left side | `false` |
Expand Down
14 changes: 14 additions & 0 deletions fab-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ class FABCard extends HTMLElement {
config.service_data,
);
break;
case 'fire-dom-event':
const event = new Event('ll-custom', { composed: true, bubbles: true });
event.detail = config;
this.dispatchEvent(event);
break;
case 'url':
if (config.url_path) {
if (config.target) {
window.open(config.url_path, config.target);
} else {
window.location.href = config.url_path;
}
}
break;
default:
break;
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bhuebschen/fab-card",
"version": "1.0.1",
"version": "1.0.2",
"description": "Floating ActionButton for Home Assistant Lovelace UI",
"main": "dist/fab-card.js",
"scripts": {
Expand Down

0 comments on commit 41f0699

Please sign in to comment.