@record-evolution/widget-switch 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,14 +2,15 @@
2
2
  "name": "@record-evolution/widget-switch",
3
3
  "description": "IronFlock Widget widget-switch",
4
4
  "license": "MIT",
5
- "author": "widget-switch",
6
- "version": "1.0.1",
5
+ "author": "Record Evolution GmbH",
6
+ "version": "1.0.2",
7
7
  "engines": {
8
8
  "node": "18.18.2",
9
9
  "npm": ">=10.0.2"
10
10
  },
11
11
  "type": "module",
12
12
  "main": "dist/widget-switch.js",
13
+ "module": "dist/widget-switch.js",
13
14
  "types": "dist/src/widget-switch.d.ts",
14
15
  "files": [
15
16
  "dist",
@@ -5,8 +5,8 @@
5
5
  {
6
6
  "label": "Lamp",
7
7
  "stateMap": {
8
- "on": ">1",
9
- "off": "<=1"
8
+ "on": ">=1",
9
+ "off": "<1"
10
10
  },
11
11
  "styling": {
12
12
  "labelColor": "#000000",
@@ -90,6 +90,7 @@
90
90
  "actionApp": {
91
91
  "title": "Action App",
92
92
  "description": "The app that should handle the click on the switch.",
93
+ "dataDrivenDisabled": true,
93
94
  "type": "actionApp",
94
95
  "order": 3
95
96
  },
@@ -99,7 +99,9 @@ export class WidgetSwitch extends LitElement {
99
99
  const prefix = piv ?? ''
100
100
  const label = ds.label ?? ''
101
101
  const value =
102
- distincts.length === 1 ? ds.data?.[0] : ds.data?.filter((d) => d.pivot === piv)?.[0]
102
+ distincts.length === 1
103
+ ? ds.data?.at(-1)
104
+ : ds.data?.filter((d) => d.pivot === piv)?.at(-1)
103
105
  const pds: Dataseries = {
104
106
  label: prefix + (!!prefix && !!label ? ' - ' : '') + label,
105
107
  actionApp: value?.actionApp,
@@ -178,7 +180,6 @@ export class WidgetSwitch extends LitElement {
178
180
  actionTopic: switchEl?.actionTopic,
179
181
  label: switchEl?.label
180
182
  }
181
- console.log('Action Submit', payload)
182
183
  this.dispatchEvent(
183
184
  new CustomEvent('action-submit', {
184
185
  detail: payload,