gd-bs 5.3.3 → 5.3.4

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.3",
3
+ "version": "5.3.4",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -3,6 +3,7 @@ import { IButtonGroup, IButtonGroupProps } from "./types";
3
3
  import { Base } from "../base";
4
4
  import { Button } from "../button";
5
5
  import { HTML } from "./templates";
6
+ import { IButtonProps } from "../components";
6
7
 
7
8
  /**
8
9
  * Button Group
@@ -45,18 +46,22 @@ class _ButtonGroup extends Base<IButtonGroupProps> implements IButtonGroup {
45
46
  // Parse the buttons
46
47
  let buttons = this.props.buttons || [];
47
48
  for (let i = 0; i < buttons.length; i++) {
48
- let buttonProps = buttons[i];
49
+ // Render the button
50
+ this.renderButton(buttons[i], btnTemplate);
51
+ }
52
+ }
49
53
 
50
- // Set the property
51
- buttonProps.type = buttonProps.type || this.props.buttonType;
54
+ // Renders a button
55
+ private renderButton(props: IButtonProps, template) {
56
+ // Set the property
57
+ props.type = props.type || this.props.buttonType;
52
58
 
53
- // Create the button
54
- let button = Button(buttonProps, btnTemplate);
55
- this._buttons.push(button);
59
+ // Create the button
60
+ let button = Button(props, template);
61
+ this._buttons.push(button);
56
62
 
57
- // Append the button to the group
58
- this.el.appendChild(button.el);
59
- }
63
+ // Append the button to the group
64
+ this.el.appendChild(button.el);
60
65
  }
61
66
 
62
67
  /**
@@ -65,5 +70,11 @@ class _ButtonGroup extends Base<IButtonGroupProps> implements IButtonGroup {
65
70
 
66
71
  // Reference to the buttons
67
72
  get buttons(): Array<IButton> { return this._buttons; }
73
+
74
+ // Adds a button to the group
75
+ add(props: IButtonProps, btnTemplate?: string) {
76
+ // Render the button
77
+ this.renderButton(props, btnTemplate);
78
+ }
68
79
  }
69
80
  export const ButtonGroup = (props: IButtonGroupProps, template?: string, btnTemplate?: string): IButtonGroup => { return new _ButtonGroup(props, template, btnTemplate); }
@@ -49,6 +49,9 @@ export interface IButtonGroup {
49
49
  /** The element. */
50
50
  el: Element;
51
51
 
52
+ /** Adds a button to the group. */
53
+ add: (props: IButtonProps, btnTemplate?: string) => void;
54
+
52
55
  /** The buttons. */
53
56
  buttons: Array<IButton>;
54
57