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/build/components/buttonGroup/index.js +17 -8
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +3 -0
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/buttonGroup/index.ts +20 -9
- package/src/components/buttonGroup/types.d.ts +3 -0
package/package.json
CHANGED
|
@@ -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
|
-
|
|
49
|
+
// Render the button
|
|
50
|
+
this.renderButton(buttons[i], btnTemplate);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
// Create the button
|
|
60
|
+
let button = Button(props, template);
|
|
61
|
+
this._buttons.push(button);
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
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); }
|