gd-bs 6.2.8 → 6.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/popover/index.js +24 -0
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +6 -0
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/src/components/popover/index.ts +24 -0
- package/src/components/popover/types.d.ts +6 -0
package/index.html
CHANGED
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
text: "Popover Demo",
|
|
207
207
|
id: "popover-demo"
|
|
208
208
|
});
|
|
209
|
-
GD.Components.Popover({
|
|
209
|
+
window["popover1"] = GD.Components.Popover({
|
|
210
210
|
target: btnPopover.el,
|
|
211
211
|
title: "My Popover",
|
|
212
212
|
placement: 10,
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
trigger: "click"
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
|
-
GD.Components.Popover({
|
|
218
|
+
window["popover2"] = GD.Components.Popover({
|
|
219
219
|
el: document.querySelector("#popover1"),
|
|
220
220
|
btnProps: {
|
|
221
221
|
id: "popover-demo2",
|
package/package.json
CHANGED
|
@@ -287,12 +287,36 @@ class _Popover extends Base<IPopoverProps> implements IPopover {
|
|
|
287
287
|
// The tippy instance
|
|
288
288
|
get tippy() { return this._tippy; }
|
|
289
289
|
|
|
290
|
+
// Sets the popover body element
|
|
291
|
+
setBody(content: string | Element) {
|
|
292
|
+
let elBody: HTMLElement = this.tippy.popper.querySelector(".popover-body");
|
|
293
|
+
if (elBody) {
|
|
294
|
+
// Clear the content
|
|
295
|
+
while (elBody.firstChild) { elBody.removeChild(elBody.firstChild); }
|
|
296
|
+
|
|
297
|
+
// Update the content
|
|
298
|
+
appendContent(elBody, content);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
290
302
|
// Sets the tippy content
|
|
291
303
|
setContent(content: string | Element) {
|
|
292
304
|
// Set the tippy content
|
|
293
305
|
this.tippy.setContent(content);
|
|
294
306
|
}
|
|
295
307
|
|
|
308
|
+
// Sets the popover header element
|
|
309
|
+
setHeader(content: string | Element) {
|
|
310
|
+
let elHeader: HTMLElement = this.tippy.popper.querySelector(".popover-header");
|
|
311
|
+
if (elHeader) {
|
|
312
|
+
// Clear the content
|
|
313
|
+
while (elHeader.firstChild) { elHeader.removeChild(elHeader.firstChild); }
|
|
314
|
+
|
|
315
|
+
// Update the content
|
|
316
|
+
appendContent(elHeader, content);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
296
320
|
// Shows the popover
|
|
297
321
|
show() {
|
|
298
322
|
// See if it's hidden
|
|
@@ -84,9 +84,15 @@ export interface IPopover {
|
|
|
84
84
|
/** Toggles an element's popover. */
|
|
85
85
|
toggle: () => void;
|
|
86
86
|
|
|
87
|
+
/** Sets the body element of the popover. */
|
|
88
|
+
setBody: (content: string | Element) => void;
|
|
89
|
+
|
|
87
90
|
/** Sets the tippy content. */
|
|
88
91
|
setContent: (content: string | Element) => void;
|
|
89
92
|
|
|
93
|
+
/** Sets the header element of the popover. */
|
|
94
|
+
setHeader: (content: string | Element) => void;
|
|
95
|
+
|
|
90
96
|
/** Reveals an element’s popover. */
|
|
91
97
|
show: () => void;
|
|
92
98
|
}
|