I have created a popup widget with a fixed size after much assistance from Justin G, however have run into a weird issue that I just can’t solve/debug.
When calling the same widget via action:popup
my vars are initialized as “null”, however when called via f7-popup
the var seems to be populated and I don’t know where the value is coming from or how to alter the initial value.
By way of explanation here is a demo of what I am doing with a stripped down version of my end widget:
The first cell calls the widget via f7-popup
(to take advantage of the fixed size I require). The second uses action:popup
which does not allow any configuration of the actual popup size.
Widget Code:
uid: caddx_popup_size_text
tags: []
props:
parameters:
- default: Partition1
description: Default (Fallback) Partition
label: Default (Fallback) Partition
name: selectedPartition
required: false
type: TEXT
- description: Show Tooltips in Widget
label: Show Tooltips in Widget
name: tooltipEnable
required: false
type: BOOLEAN
- description: Replace pincode characters with this string, leave blank to show it as-is
label: Mask character
name: mask
required: false
parameterGroups: []
timestamp: Dec 13, 2022, 9:39:26 AM
component: f7-page
config:
style:
--f7-bars-translucent-blur: none
--f7-bars-translucent-opacity: none
--f7-card-margin-horizontal: 0px
--f7-navbar-bg-color: transparent
--f7-navbar-border-color: transparent
--f7-navbar-font-size: 15px
--f7-navbar-height: 35px
--f7-navbar-link-color: white
--f7-navbar-shadow-image: none
--f7-navbar-text-color: white
--f7-popup-tablet-width: 40px
background-color: rgb(220,220,220)
border-radius: 20px
height: 320px
left: 0px
text-overflow: ellipsis
top: 0px
width: 360px
slots:
default:
- component: oh-button
config:
bgColor: gray
large: true
popupClose: .modal-in
style:
color: white
height: 55px
left: 6.0%
position: absolute
top: 5%
width: 40px
tooltip: '=!(props.tooltipEnable) ? false : "Close Popup"'
tooltip-trigger: hover
slots:
default:
- component: f7-icon
config:
color: white
f7: clear_fill
style:
color: black
font-size: 25px
left: 20%
overflow: hidden
position: absolute
top: 30%
- component: f7-badge
config:
bgColor: gray
style:
border-radius: 0px
height: 55px
left: 20%
position: absolute
top: 5%
width: 60%
- component: oh-link
config:
bgColor: gray
large: true
raised: true
style:
left: 20%
position: absolute
top: 5.5%
width: 60%
text: '=(vars.selectedPartition === NULL) ? "Select Partition" : vars.selectedPartition '
textColor: white
tooltip: '=!(props.tooltipEnable) ? false : "Selected Partition"'
tooltip-trigger: hover
- component: f7-block
config:
class:
- padding
style:
--f7-button-bg-color: var(--f7-card-bg-color)
--f7-button-text-color: var(--f7-text-color)
--f7-theme-color-rgb: var(--f7-color-blue-rgb)
position: absolute
top: 100px
width: 100%
z-index: 999
slots:
default:
- component: f7-row
config:
class: no-gap
style:
--f7-button-bg-color: transparent
--f7-theme-color: var(--f7-color-blue)
slots:
default:
- component: oh-repeater
config:
for: partition
fragment: true
in:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
slots:
default:
- component: f7-row
config:
width: "10"
slots:
default:
- component: oh-button
config:
action: variable
actionVariable: selectedPartition
actionVariableValue: ='Partition' + loop.partition
bgColor: '=(items["Partition" + loop.partition + "_Armed"].state === "-") ? "gray" : (items["Partition" + loop.partition + "_Armed"].state === "ON") ? "red" : "green"'
clearVariable: true
disabled: '=(items["Partition" + loop.partition + "_Armed"].state === "-") ? true : false'
fill: true
raised: false
style:
--f7-button-hover-bg-color: var(--f7-color-blue-tint)
--f7-button-pressed-bg-color: var(--f7-color-blue-tint)
border-radius: 12px
overflow: hidden
text-overflow: ellipsis
white-space: nowrap
z-index: 999
text: =["P" + loop.partition]
textColor: white
tooltip: '=!(props.tooltipEnable) ? false : "Apply Partition to current run"'
tooltip-trigger: hover
- component: f7-row
config:
class: no-gap
style:
--f7-button-bg-color: transparent
--f7-theme-color: var(--f7-color-blue)
slots:
default:
- component: Label
config:
text: selectedPartition currently -
- component: Label
config:
text: "=([vars.selectedPartition]) "
Cell Code for f7-popup:
component: oh-cell
config:
title: Alarm Popup Test
slots:
background:
- component: f7-block
config:
bgColor: none
style:
height: 40%
left: 0%
position: absolute
top: 60%
width: 100%
slots:
default:
- component: oh-button
config:
popupOpen: .test-pop
style:
height: 100%
width: 100%
text: OPEN
- component: f7-popup
config:
class: test-pop
style:
background-color: rgb(220,220,220)
border-radius: 30px
height: 320px
text-overflow: ellipsis
width: 360px
slots:
default:
- component: widget:caddx_popup_size_text
config:
popupClose: .test-pop
tooltipEnable: true
Cell Code for action: popup:
component: oh-cell
config:
action: popup
actionModal: widget:caddx_popup_size_text
actionModalConfig:
tooltipEnable: true
title: Alarm Direct Popup
Any advise will be greatly received.
EDIT: So did more testing. Cut the widget to completely bare bones and inserted a non-existent var to see what happened. That comes up as “null”
Also took most everything out of the oh-cell:
component: oh-cell
config:
title: Alarm Popup Test
slots:
background:
- component: f7-block
config: null
slots:
default:
- component: oh-button
config:
popupOpen: .test-pop
text: OPEN
- component: f7-popup
config:
class: test-pop
slots:
default:
- component: widget:caddx_popup_size_text_V2_no_repeater
config:
popupClose: .test-pop
And Widget:
uid: caddx_popup_size_text_V2_no_repeater
tags: []
props:
parameters:
- description: Show Tooltips in Widget
label: Show Tooltips in Widget
name: tooltipEnable
required: false
type: BOOLEAN
parameterGroups: []
timestamp: Dec 13, 2022, 2:08:54 PM
component: f7-row
slots:
default:
- component: Label
config:
text: selectedPartition currently -
- component: Label
config:
text: "=([vars.selectedPartition]) "
- component: Label
config:
text: selectedPartitionZZZ currently -
- component: Label
config:
text: "=([vars.selectedPartitionZZZZ]) "