gd-bs 5.3.4 → 5.3.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "5.3.4",
3
+ "version": "5.3.5",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -1,7 +1,7 @@
1
- import { ITooltip } from "../tooltip/types";
1
+ import { ITooltip, ITooltipProps } from "../tooltip/types";
2
2
  import { ITooltipGroup, ITooltipGroupProps } from "./types";
3
3
  import { Base } from "../base";
4
- import { Tooltip } from "../tooltip";
4
+ import { Tooltip, } from "../tooltip";
5
5
  import { HTML } from "./templates";
6
6
 
7
7
  /**
@@ -38,39 +38,49 @@ class _TooltipGroup extends Base<ITooltipGroupProps> implements ITooltipGroup {
38
38
  }
39
39
 
40
40
  // Render the tooltips
41
- private renderTooltips(tooltipTemplate: string) {
41
+ private renderTooltips(btnTemplate: string) {
42
42
  // Clear the tooltips
43
43
  this._tooltips = [];
44
44
 
45
45
  // Parse the tooltips
46
46
  let tooltips = this.props.tooltips || [];
47
47
  for (let i = 0; i < tooltips.length; i++) {
48
- let tooltipProps = tooltips[i];
48
+ // Render the tooltip
49
+ this.renderTooltip(tooltips[i], btnTemplate);
50
+ }
51
+ }
49
52
 
50
- // Set the properties
51
- tooltipProps.options = tooltipProps.options || this.props.tooltipOptions;
52
- tooltipProps.placement = tooltipProps.placement || this.props.tooltipPlacement;
53
- tooltipProps.type = tooltipProps.type || this.props.tooltipType;
53
+ // Renders a tooltip
54
+ private renderTooltip(props: ITooltipProps, btnTemplate?: string) {
55
+ // Set the properties
56
+ props.options = props.options || this.props.tooltipOptions;
57
+ props.placement = props.placement || this.props.tooltipPlacement;
58
+ props.type = props.type || this.props.tooltipType;
54
59
 
55
- // See if the button props exists
56
- if (tooltipProps.btnProps) {
57
- // Set the button type
58
- tooltipProps.btnProps.type = tooltipProps.btnProps.type || this.props.buttonType;
59
- }
60
+ // See if the button props exists
61
+ if (props.btnProps) {
62
+ // Set the button type
63
+ props.btnProps.type = props.btnProps.type || this.props.buttonType;
64
+ }
60
65
 
61
- // Create the tooltip
62
- let tooltip = Tooltip(tooltipProps, tooltipTemplate);
63
- this._tooltips.push(tooltip);
66
+ // Create the tooltip
67
+ let tooltip = Tooltip(props, btnTemplate);
68
+ this._tooltips.push(tooltip);
64
69
 
65
- // Append the tooltip to the group
66
- this.el.appendChild(tooltip.el);
67
- }
70
+ // Append the tooltip to the group
71
+ this.el.appendChild(tooltip.el);
68
72
  }
69
73
 
70
74
  /**
71
75
  * Public Interface
72
76
  */
73
77
 
78
+ // Adds a button to the group
79
+ add(props: ITooltipProps, tooltipTemplate?: string) {
80
+ // Render the tooltip
81
+ this.renderTooltip(props);
82
+ }
83
+
74
84
  // Reference to the tooltips
75
85
  get tooltips(): Array<ITooltip> { return this._tooltips; }
76
86
  }
@@ -48,6 +48,9 @@ import { ITooltip, ITooltipProps } from "../tooltip/types";
48
48
  * Tooltip Group
49
49
  */
50
50
  export interface ITooltipGroup {
51
+ /** Adds a button to the group. */
52
+ add: (props: ITooltipProps, btnTemplate?: string) => void;
53
+
51
54
  /** The element. */
52
55
  el: Element;
53
56