gd-bs 5.3.2 → 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/build/components/buttonGroup/index.js +17 -8
- package/build/components/tooltipGroup/index.js +28 -19
- package/dist/gd-bs-icons.js +2 -2
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +6 -0
- package/dist/gd-bs.js +2 -2
- package/dist/gd-bs.min.js +1 -1
- package/package.json +2 -1
- package/src/components/buttonGroup/index.ts +20 -9
- package/src/components/buttonGroup/types.d.ts +3 -0
- package/src/components/tooltipGroup/index.ts +29 -19
- package/src/components/tooltipGroup/types.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gd-bs",
|
|
3
|
-
"version": "5.3.
|
|
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",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://dattabase.com/extras/bs",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@popperjs/core": "^2.11.2",
|
|
35
36
|
"bootstrap": "^5.1.3",
|
|
36
37
|
"bootstrap-icons": "^1.8.0",
|
|
37
38
|
"core-js": "^3.21.0",
|
|
@@ -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); }
|
|
@@ -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(
|
|
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
|
-
|
|
48
|
+
// Render the tooltip
|
|
49
|
+
this.renderTooltip(tooltips[i], btnTemplate);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
// Create the tooltip
|
|
67
|
+
let tooltip = Tooltip(props, btnTemplate);
|
|
68
|
+
this._tooltips.push(tooltip);
|
|
64
69
|
|
|
65
|
-
|
|
66
|
-
|
|
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
|
|