mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-07 06:59:46 +00:00
In HA hp-dialog renders ha-dialog, whose own `.body` is the scroller and is not a flex container; `.summary-editor` (overflow:auto, overscroll-behavior:contain, min-height:0) therefore grew to its content and became a scroll container that never scrolls — Chromium stops wheel and touch scroll chaining at such a child, so nothing moved (reproduced on ha.jbstudio.pro, HA 2026.9.1, and in an isolated Playwright page). hp-dialog gains an opt-in `flex-content` attribute forwarded as ha-dialog's `flexcontent`, which lays the body out as a flex column: the editor is height-bound again and scrolls itself, header and footer stay, exactly as the native branch already did. Only the summary dialog opts in. Smoke demo/smoke_summary_dialog_scroll.mjs stubs ha-dialog after the HA 2026.9 contract: wheel on desktop, touch swipe on a phone, dialog within the viewport, and a witness that the stub reproduces the bug without flexcontent. Docs screenshots: 11/11 pixel-identical (docs:accept --identical, #512), fingerprint refreshed. Mutants: summary-dialog-drops-flex-content, hp-dialog-ignores-flex-content. Issue: #508 User-Visible: yes
15 lines
3.7 KiB
JavaScript
15 lines
3.7 KiB
JavaScript
globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="d400624eeb3db04eb31dcbe3699a028bd6d523224ea026292d43df657cabc9db";import{t as e,l as o,x as t,e5 as s,A as a,e6 as i,e7 as l,e8 as n,dW as r,b as c}from"./houseplan-card-COZ5IbS-.js";class h extends e{constructor(){super(...arguments),this._spaces=null,this._spacesLoading=!1,this._spacesAuthoritative=!1}setConfig(e){this._config=e}async _loadSpaces(){if(!this._spaces&&!this._spacesLoading&&this.hass){this._spacesLoading=!0;try{const e=await this.hass.callWS({type:"houseplan/config/get"});this._spaces=(e?.config?.spaces||[]).map(e=>({value:e.id,label:e.title||e.id})),this._spacesAuthoritative=!0}catch{this._spaces=[],this._spacesAuthoritative=!1}finally{this._spacesLoading=!1}}}get _lang(){return o(this.hass,this._config?.language)}get _floorToken(){const e=this._config?.floor;return"number"==typeof e?`__houseplan_yaml_floor_index__:${String(e)}`:null}get _formData(){const e={...this._config},o=this._floorToken;return o?e.floor=o:Object.prototype.hasOwnProperty.call(e,"floor")||(e.floor=""),e}get _schema(){const e=this._spaces||[],o=this._lang,a=[{value:"",label:t(o,"editor.floor_none")}],i=this._floorToken;i&&a.push({value:i,label:t(o,"editor.floor_index",{index:String(this._config?.floor)})});const l="string"==typeof this._config?.floor?this._config.floor:"";l&&!e.some(e=>e.value===l)&&a.push({value:l,label:l}),a.push(...e);const n="string"==typeof this._config?.default_floor?this._config.default_floor:"",r=[...e];return n&&!e.some(e=>e.value===n)&&r.unshift({value:n,label:n}),[{name:"title",selector:{text:{}}},{name:"floor",selector:{select:{mode:"dropdown",options:a}}},e.length?{name:"default_floor",selector:{select:{mode:"dropdown",options:r}}}:{name:"default_floor",selector:{text:{}}},{name:"language",selector:{select:{mode:"dropdown",options:s(t(o,"editor.lang_auto"),this._config?.language)}}},{name:"icon_size",selector:{number:{min:1,max:6,step:.1,mode:"box"}}},{name:"show_temperature",selector:{boolean:{}}},{name:"live_states",selector:{boolean:{}}},{name:"show_signal",selector:{boolean:{}}},{name:"kiosk",selector:{boolean:{}}},{name:"cycle",selector:{number:{min:0,max:3600,step:5,mode:"box"}}}]}render(){if(!this.hass||!this._config)return a;const e=i(this,l,o(this.hass,this._config.language));if("cold"===e)return n();if("warm"===e)return r;this._loadSpaces();const s=this._lang,h={title:t(s,"editor.title"),floor:t(s,"editor.floor"),default_floor:t(s,"editor.default_floor"),language:t(s,"editor.language"),icon_size:t(s,"editor.icon_size"),show_temperature:t(s,"editor.show_temperature"),live_states:t(s,"editor.live_states"),show_signal:t(s,"editor.show_signal"),kiosk:t(s,"editor.kiosk"),cycle:t(s,"editor.cycle")},_=this._schema,f=function(e,o,t){if(!t||null===o)return null;const s="string"==typeof e?.default_floor?e.default_floor:"";return!s||o.some(e=>e.value===s)?null:s}(this._config,this._spaces,this._spacesAuthoritative),d=e=>c`<ha-form
|
|
.hass=${this.hass}
|
|
.data=${this._formData}
|
|
.schema=${e}
|
|
.computeLabel=${e=>h[e.name]||e.name}
|
|
@value-changed=${this._valueChanged}
|
|
></ha-form>`;return c`
|
|
${d(_.slice(0,3))}
|
|
${f?c`<div class="default-floor-error" role="alert"
|
|
style="color:var(--error-color,#db4437);margin:-4px 0 12px;overflow-wrap:anywhere">
|
|
${t(s,"editor.default_floor_missing",{id:f})}
|
|
</div>`:a}
|
|
${d(_.slice(3))}
|
|
`}_valueChanged(e){const o={...this._config,...e.detail.value};""===o.floor?delete o.floor:o.floor===this._floorToken&&(o.floor=this._config?.floor);const t=new Event("config-changed",{bubbles:!0,composed:!0});t.detail={config:o},this.dispatchEvent(t)}}h.properties={hass:{attribute:!1},_config:{state:!0},_spaces:{state:!0}},customElements.get("houseplan-card-editor")||customElements.define("houseplan-card-editor",h);
|