gd-bs 5.3.3 → 5.3.6
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/form/control.js +20 -0
- package/build/components/tooltipGroup/index.js +28 -19
- package/dist/gd-bs-icons.js +3 -3
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +6 -0
- package/dist/gd-bs.js +3 -3
- 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/src/components/form/control.ts +18 -0
- package/src/components/tooltipGroup/index.ts +29 -19
- package/src/components/tooltipGroup/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); }
|
|
@@ -632,6 +632,15 @@ export class FormControl implements IFormControl {
|
|
|
632
632
|
|
|
633
633
|
// Update the display
|
|
634
634
|
elMessage.style.display = validation.isValid ? "" : "block";
|
|
635
|
+
} else {
|
|
636
|
+
// See if there is valid feedback
|
|
637
|
+
let validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
|
|
638
|
+
let elMessage = elFormControl.parentNode.querySelector("." + validClassName) as HTMLElement;
|
|
639
|
+
if (elMessage) {
|
|
640
|
+
// Clear the message
|
|
641
|
+
elMessage.innerHTML = "";
|
|
642
|
+
elMessage.style.display = "";
|
|
643
|
+
}
|
|
635
644
|
}
|
|
636
645
|
|
|
637
646
|
// See if there is valid feedback
|
|
@@ -651,6 +660,15 @@ export class FormControl implements IFormControl {
|
|
|
651
660
|
|
|
652
661
|
// Update the display
|
|
653
662
|
elMessage.style.display = validation.isValid ? "block" : "";
|
|
663
|
+
} else {
|
|
664
|
+
// See if there is invalid feedback
|
|
665
|
+
let invalidClassName = useTooltip ? "invalid-tooltip" : "invalid-feedback";
|
|
666
|
+
let elMessage = elFormControl.parentNode.querySelector("." + invalidClassName) as HTMLElement;
|
|
667
|
+
if (elMessage) {
|
|
668
|
+
// Clear the message
|
|
669
|
+
elMessage.innerHTML = "";
|
|
670
|
+
elMessage.style.display = "";
|
|
671
|
+
}
|
|
654
672
|
}
|
|
655
673
|
}
|
|
656
674
|
}
|
|
@@ -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
|
|