Skip to content

Commit cd98ea9

Browse files
author
Marko Petzold
committed
refactor: update author information, enhance data handling, and improve schema definitions
1 parent e12da83 commit cd98ea9

5 files changed

Lines changed: 10 additions & 5 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
"name": "@record-evolution/widget-switch",
33
"description": "IronFlock Widget widget-switch",
44
"license": "MIT",
5-
"author": "widget-switch",
5+
"author": "Record Evolution GmbH",
66
"version": "1.0.1",
77
"engines": {
88
"node": "18.18.2",
99
"npm": ">=10.0.2"
1010
},
1111
"type": "module",
1212
"main": "dist/widget-switch.js",
13+
"module": "dist/widget-switch.js",
1314
"types": "dist/src/widget-switch.d.ts",
1415
"files": [
1516
"dist",

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export default {
1717
banner: `/* @license Copyright (c) 2023 Record Evolution GmbH. All rights reserved.*/`,
1818
format: 'esm'
1919
},
20+
external: (id) => id.startsWith('@material/web/'),
21+
2022
plugins: [
2123
replace({
2224
versionplaceholder: npmPackage.version,

src/default-data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
{
66
"label": "Lamp",
77
"stateMap": {
8-
"on": ">1",
9-
"off": "<=1"
8+
"on": ">=1",
9+
"off": "<1"
1010
},
1111
"styling": {
1212
"labelColor": "#000000",

src/definition-schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"actionApp": {
9191
"title": "Action App",
9292
"description": "The app that should handle the click on the switch.",
93+
"dataDrivenDisabled": true,
9394
"type": "actionApp",
9495
"order": 3
9596
},

src/widget-switch.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ export class WidgetSwitch extends LitElement {
9999
const prefix = piv ?? ''
100100
const label = ds.label ?? ''
101101
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)
103105
const pds: Dataseries = {
104106
label: prefix + (!!prefix && !!label ? ' - ' : '') + label,
105107
actionApp: value?.actionApp,
@@ -178,7 +180,6 @@ export class WidgetSwitch extends LitElement {
178180
actionTopic: switchEl?.actionTopic,
179181
label: switchEl?.label
180182
}
181-
console.log('Action Submit', payload)
182183
this.dispatchEvent(
183184
new CustomEvent('action-submit', {
184185
detail: payload,

0 commit comments

Comments
 (0)