updates
This commit is contained in:
32
node_modules/stimulus-popover/dist/stimulus-popover.mjs
generated
vendored
Normal file
32
node_modules/stimulus-popover/dist/stimulus-popover.mjs
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Controller as o } from "@hotwired/stimulus";
|
||||
class r extends o {
|
||||
async show(e) {
|
||||
const n = e.currentTarget;
|
||||
let t = null;
|
||||
if (this.hasContentTarget ? t = this.contentTarget.innerHTML : t = await this.fetch(), !t)
|
||||
return;
|
||||
const a = document.createRange().createContextualFragment(t);
|
||||
n.appendChild(a);
|
||||
}
|
||||
hide() {
|
||||
this.hasCardTarget && this.cardTarget.remove();
|
||||
}
|
||||
async fetch() {
|
||||
if (!this.remoteContent) {
|
||||
if (!this.hasUrlValue) {
|
||||
console.error("[stimulus-popover] You need to pass an url to fetch the popover content.");
|
||||
return;
|
||||
}
|
||||
const e = await fetch(this.urlValue);
|
||||
this.remoteContent = await e.text();
|
||||
}
|
||||
return this.remoteContent;
|
||||
}
|
||||
}
|
||||
r.targets = ["card", "content"];
|
||||
r.values = {
|
||||
url: String
|
||||
};
|
||||
export {
|
||||
r as default
|
||||
};
|
||||
Reference in New Issue
Block a user