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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "5.3.3",
3
+ "version": "5.3.6",
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
 
@@ -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(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