UX: fix #1873, allow SvelteUIElements to be a span
This commit is contained in:
parent
6812ab3890
commit
9163d57039
2 changed files with 9 additions and 3 deletions
|
@ -22,6 +22,7 @@ export default class SvelteUIElement<
|
||||||
private readonly _props: Props
|
private readonly _props: Props
|
||||||
private readonly _events: Events
|
private readonly _events: Events
|
||||||
private readonly _slots: Slots
|
private readonly _slots: Slots
|
||||||
|
private tag : "div" | "span" = "div"
|
||||||
|
|
||||||
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
|
constructor(svelteElement, props?: Props, events?: Events, slots?: Slots) {
|
||||||
super()
|
super()
|
||||||
|
@ -31,8 +32,13 @@ export default class SvelteUIElement<
|
||||||
this._slots = slots
|
this._slots = slots
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setSpan(){
|
||||||
|
this.tag = "span"
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
protected InnerConstructElement(): HTMLElement {
|
protected InnerConstructElement(): HTMLElement {
|
||||||
const el = document.createElement("div")
|
const el = document.createElement(this.tag)
|
||||||
new this._svelteComponent({
|
new this._svelteComponent({
|
||||||
target: el,
|
target: el,
|
||||||
props: this._props,
|
props: this._props,
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ export default class SpecialVisualizations {
|
||||||
state,
|
state,
|
||||||
feature,
|
feature,
|
||||||
layer
|
layer
|
||||||
}).SetClass("px-1")
|
}).SetClass("px-1").setSpan()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
@ -1249,7 +1249,7 @@ export default class SpecialVisualizations {
|
||||||
download: tagSource.map(tags => Utils.SubstituteKeys(download, tags)),
|
download: tagSource.map(tags => Utils.SubstituteKeys(download, tags)),
|
||||||
ariaLabel: tagSource.map(tags => Utils.SubstituteKeys(ariaLabel, tags)),
|
ariaLabel: tagSource.map(tags => Utils.SubstituteKeys(ariaLabel, tags)),
|
||||||
newTab: new ImmutableStore(newTab)
|
newTab: new ImmutableStore(newTab)
|
||||||
})
|
}).setSpan()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue