gd-bs 6.1.4 → 6.1.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.
@@ -647,94 +647,98 @@ var FormControl = /** @class */ (function () {
647
647
  };
648
648
  // Updates the control validation
649
649
  FormControl.prototype.updateValidation = function (elControl, validation) {
650
- // Get the form control
651
- var elFormControl = elControl.querySelector(".form-control") || elControl.querySelector(".form-select");
652
- if (elFormControl) {
653
- // Clear the invalid/valid classes
654
- elFormControl.classList.remove("is-invalid");
655
- elFormControl.classList.remove("is-valid");
656
- // Set the class
657
- elFormControl.classList.add(validation.isValid ? "is-valid" : "is-invalid");
658
- }
659
- else {
660
- var validateControls = function (controls) {
661
- // Parse the controls
662
- for (var i = 0; i < controls.length; i++) {
663
- var control = controls[i];
664
- // Clear the invalid/valid classes
665
- control.classList.remove("is-invalid");
666
- control.classList.remove("is-valid");
667
- // Set the class
668
- control.classList.add(validation.isValid ? "is-valid" : "is-invalid");
669
- }
670
- };
671
- // Get the checkboxes
672
- var elCheckboxes = elControl.querySelectorAll(".form-check-input");
673
- if (elCheckboxes.length > 0) {
674
- // Validate the controls
675
- validateControls(elCheckboxes);
676
- // Set the form control
677
- elFormControl = elCheckboxes.length > 0 ? elCheckboxes[elCheckboxes.length - 1] : elFormControl;
678
- }
679
- // Get the custom controls
680
- var elCustomControls = elControl.querySelectorAll(".custom-control-input");
681
- if (elCustomControls.length > 0) {
682
- // Validate the controls
683
- validateControls(elCustomControls);
684
- // Set the form control
685
- elFormControl = elCustomControls.length > 0 ? elCustomControls[elCustomControls.length - 1] : elFormControl;
686
- }
687
- }
688
- // Ensure the form control exists
689
- if (elFormControl) {
690
- var useTooltip = this._formProps.validationType == _1.FormValidationTypes.Tooltip;
691
- // Clear the old valid message if it exists
692
- var validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
693
- var elMessage = elFormControl.parentNode.querySelector("." + validClassName);
694
- if (elMessage) {
695
- // Clear the message
696
- elMessage.innerHTML = "";
697
- elMessage.style.display = "";
650
+ // Get the form controls
651
+ var elFormControls = elControl.querySelectorAll(".form-control") || elControl.querySelectorAll(".form-select");
652
+ for (var i = 0; i < elFormControls.length; i++) {
653
+ // Ensure the control exists
654
+ var elFormControl = elFormControls[i];
655
+ if (elFormControl) {
656
+ // Clear the invalid/valid classes
657
+ elFormControl.classList.remove("is-invalid");
658
+ elFormControl.classList.remove("is-valid");
659
+ // Set the class
660
+ elFormControl.classList.add(validation.isValid ? "is-valid" : "is-invalid");
698
661
  }
699
- // Clear the old valid message if it exists
700
- var invalidClassName = useTooltip ? "invalid-tooltip" : "invalid-feedback";
701
- elMessage = elFormControl.parentNode.querySelector("." + invalidClassName);
702
- if (elMessage) {
703
- // Clear the message
704
- elMessage.innerHTML = "";
705
- elMessage.style.display = "";
706
- }
707
- // See if there is invalid feedback
708
- if (validation.invalidMessage || this._props.errorMessage) {
709
- // Get the element
710
- var invalidClassName_1 = useTooltip ? "invalid-tooltip" : "invalid-feedback";
711
- elMessage = elFormControl.parentNode.querySelector("." + invalidClassName_1);
712
- if (elMessage == null) {
713
- // Create the element
714
- elMessage = document.createElement("div");
715
- elMessage.className = invalidClassName_1;
716
- elFormControl.parentNode.appendChild(elMessage);
662
+ else {
663
+ var validateControls = function (controls) {
664
+ // Parse the controls
665
+ for (var i_1 = 0; i_1 < controls.length; i_1++) {
666
+ var control = controls[i_1];
667
+ // Clear the invalid/valid classes
668
+ control.classList.remove("is-invalid");
669
+ control.classList.remove("is-valid");
670
+ // Set the class
671
+ control.classList.add(validation.isValid ? "is-valid" : "is-invalid");
672
+ }
673
+ };
674
+ // Get the checkboxes
675
+ var elCheckboxes = elControl.querySelectorAll(".form-check-input");
676
+ if (elCheckboxes.length > 0) {
677
+ // Validate the controls
678
+ validateControls(elCheckboxes);
679
+ // Set the form control
680
+ elFormControl = elCheckboxes.length > 0 ? elCheckboxes[elCheckboxes.length - 1] : elFormControl;
681
+ }
682
+ // Get the custom controls
683
+ var elCustomControls = elControl.querySelectorAll(".custom-control-input");
684
+ if (elCustomControls.length > 0) {
685
+ // Validate the controls
686
+ validateControls(elCustomControls);
687
+ // Set the form control
688
+ elFormControl = elCustomControls.length > 0 ? elCustomControls[elCustomControls.length - 1] : elFormControl;
717
689
  }
718
- // Set the message
719
- elMessage.innerHTML = validation.invalidMessage || this._props.errorMessage;
720
- // Update the display
721
- elMessage.style.display = validation.isValid ? "" : "block";
722
690
  }
723
- // See if there is valid feedback
724
- if (validation.validMessage) {
725
- // Get the element
726
- var validClassName_1 = useTooltip ? "valid-tooltip" : "valid-feedback";
727
- elMessage = elFormControl.parentNode.querySelector("." + validClassName_1);
728
- if (elMessage == null) {
729
- // Create the element
730
- elMessage = document.createElement("div");
731
- elMessage.className = validClassName_1;
732
- elFormControl.parentNode.appendChild(elMessage);
691
+ // Ensure the form control exists
692
+ if (elFormControl) {
693
+ var useTooltip = this._formProps.validationType == _1.FormValidationTypes.Tooltip;
694
+ // Clear the old valid message if it exists
695
+ var validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
696
+ var elMessage = elFormControl.parentNode.querySelector("." + validClassName);
697
+ if (elMessage) {
698
+ // Clear the message
699
+ elMessage.innerHTML = "";
700
+ elMessage.style.display = "";
701
+ }
702
+ // Clear the old valid message if it exists
703
+ var invalidClassName = useTooltip ? "invalid-tooltip" : "invalid-feedback";
704
+ elMessage = elFormControl.parentNode.querySelector("." + invalidClassName);
705
+ if (elMessage) {
706
+ // Clear the message
707
+ elMessage.innerHTML = "";
708
+ elMessage.style.display = "";
709
+ }
710
+ // See if there is invalid feedback
711
+ if (validation.invalidMessage || this._props.errorMessage) {
712
+ // Get the element
713
+ var invalidClassName_1 = useTooltip ? "invalid-tooltip" : "invalid-feedback";
714
+ elMessage = elFormControl.parentNode.querySelector("." + invalidClassName_1);
715
+ if (elMessage == null) {
716
+ // Create the element
717
+ elMessage = document.createElement("div");
718
+ elMessage.className = invalidClassName_1;
719
+ elFormControl.parentNode.appendChild(elMessage);
720
+ }
721
+ // Set the message
722
+ elMessage.innerHTML = validation.invalidMessage || this._props.errorMessage;
723
+ // Update the display
724
+ elMessage.style.display = validation.isValid ? "" : "block";
725
+ }
726
+ // See if there is valid feedback
727
+ if (validation.validMessage) {
728
+ // Get the element
729
+ var validClassName_1 = useTooltip ? "valid-tooltip" : "valid-feedback";
730
+ elMessage = elFormControl.parentNode.querySelector("." + validClassName_1);
731
+ if (elMessage == null) {
732
+ // Create the element
733
+ elMessage = document.createElement("div");
734
+ elMessage.className = validClassName_1;
735
+ elFormControl.parentNode.appendChild(elMessage);
736
+ }
737
+ // Set the message
738
+ elMessage.innerHTML = validation.validMessage;
739
+ // Update the display
740
+ elMessage.style.display = validation.isValid ? "block" : "";
733
741
  }
734
- // Set the message
735
- elMessage.innerHTML = validation.validMessage;
736
- // Update the display
737
- elMessage.style.display = validation.isValid ? "block" : "";
738
742
  }
739
743
  }
740
744
  };
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.IconLink = exports.IconLinkTypes = void 0;
19
+ var base_1 = require("../base");
20
+ var common_1 = require("../common");
21
+ var templates_1 = require("./templates");
22
+ /**
23
+ * Icon Link Types
24
+ */
25
+ var IconLinkTypes;
26
+ (function (IconLinkTypes) {
27
+ IconLinkTypes[IconLinkTypes["AfterText"] = 1] = "AfterText";
28
+ IconLinkTypes[IconLinkTypes["BeforeText"] = 2] = "BeforeText";
29
+ })(IconLinkTypes = exports.IconLinkTypes || (exports.IconLinkTypes = {}));
30
+ /**
31
+ * Icon Link
32
+ * @property props - The list box properties.
33
+ */
34
+ var _IconLink = /** @class */ (function (_super) {
35
+ __extends(_IconLink, _super);
36
+ // Constructor
37
+ function _IconLink(props, template) {
38
+ if (template === void 0) { template = templates_1.HTML; }
39
+ var _this = _super.call(this, template, props) || this;
40
+ _this._elIcon = null;
41
+ // Configure the list box
42
+ _this.configure();
43
+ // Configure the events
44
+ _this.configureEvents();
45
+ // Configure the parent
46
+ _this.configureParent();
47
+ return _this;
48
+ }
49
+ // Configures the list box
50
+ _IconLink.prototype.configure = function () {
51
+ // Render the content
52
+ (0, common_1.appendContent)(this.el, this.props.content);
53
+ // Set the icon if it exists
54
+ if (this.props.iconType) {
55
+ if (typeof (this.props.iconType) === "function") {
56
+ // Set the icon
57
+ this._elIcon = this.props.iconType(this.props.iconSize, this.props.iconSize, this.props.iconClassName);
58
+ }
59
+ // Else, it's an element
60
+ else if (typeof (this.props.iconType === "object")) {
61
+ // Set the icon
62
+ this._elIcon = this.props.iconType;
63
+ }
64
+ else {
65
+ return;
66
+ }
67
+ // See if we are rendering the content first
68
+ if (this.props.type == IconLinkTypes.AfterText) {
69
+ // Append the icon
70
+ this.el.appendChild(this._elIcon);
71
+ }
72
+ else {
73
+ // Prepend the icon
74
+ this.el.prepend(this._elIcon);
75
+ }
76
+ }
77
+ };
78
+ // Configures the events
79
+ _IconLink.prototype.configureEvents = function () {
80
+ };
81
+ return _IconLink;
82
+ }(base_1.Base));
83
+ var IconLink = function (props, template) { return new _IconLink(props, template); };
84
+ exports.IconLink = IconLink;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HTML = void 0;
4
+ // Form
5
+ exports.HTML = "<a class=\"icon-link\" href=\"#\"></a>".trim();
@@ -27,6 +27,7 @@ __exportStar(require("./checkboxGroup"), exports);
27
27
  __exportStar(require("./collapse"), exports);
28
28
  __exportStar(require("./dropdown"), exports);
29
29
  __exportStar(require("./form"), exports);
30
+ __exportStar(require("./iconLink"), exports);
30
31
  __exportStar(require("./inputGroup"), exports);
31
32
  __exportStar(require("./jumbotron"), exports);
32
33
  __exportStar(require("./listBox"), exports);
@@ -41,13 +41,14 @@ var _Nav = /** @class */ (function (_super) {
41
41
  // Configure the card group
42
42
  _Nav.prototype.configure = function (itemTemplate) {
43
43
  // Update the navigation
44
- var nav = this.el.querySelector(".nav");
44
+ var nav = this.el.classList.contains("nav") ? this.el : this.el.querySelector(".nav");
45
45
  if (nav) {
46
46
  this.props.id ? nav.id = this.props.id : null;
47
47
  this.props.enableFill ? this.el.classList.add("nav-fill") : null;
48
48
  this.props.isJustified ? this.el.classList.add("nav-justified") : null;
49
49
  this.props.isPills ? this.el.classList.add("nav-pills") : null;
50
50
  this.props.isTabs ? this.el.classList.add("nav-tabs") : null;
51
+ this.props.isUnderline ? this.el.classList.add("nav-underline") : null;
51
52
  this.props.isVertical ? this.el.classList.add("flex-column") : null;
52
53
  }
53
54
  // Render the nav links
@@ -59,25 +60,25 @@ var _Nav = /** @class */ (function (_super) {
59
60
  this.props.onRendered ? this.props.onRendered(this.el) : null;
60
61
  };
61
62
  // Configures the tab link event
62
- _Nav.prototype.configureTabEvents = function (tab) {
63
+ _Nav.prototype.configureLinkEvents = function (link) {
63
64
  var _this = this;
64
65
  // Add a click event
65
- tab.el.addEventListener("click", function () {
66
+ link.el.addEventListener("click", function () {
66
67
  var prevTab = null;
67
- var newTab = tab;
68
+ var newTab = link;
68
69
  // Parse the links
69
70
  for (var i = 0; i < _this._links.length; i++) {
70
- var link = _this._links[i];
71
+ var link_2 = _this._links[i];
71
72
  // See if it's active
72
- if (link.isActive) {
73
+ if (link_2.isActive) {
73
74
  // Set the old tab
74
- prevTab = link;
75
+ prevTab = link_2;
75
76
  // Toggle it
76
- link.toggle(_this.props.fadeTabs);
77
+ link_2.toggle(_this.props.fadeTabs);
77
78
  }
78
79
  }
79
80
  // Toggle the link
80
- tab.toggle(_this.props.fadeTabs);
81
+ link.toggle(_this.props.fadeTabs);
81
82
  // Call the click event
82
83
  _this.props.onClick ? _this.props.onClick(newTab, prevTab) : null;
83
84
  });
@@ -87,7 +88,7 @@ var _Nav = /** @class */ (function (_super) {
87
88
  // Clear the links
88
89
  this._links = [];
89
90
  // Get the nav and tab elements
90
- var nav = this.el.querySelector(".nav") || this.el;
91
+ var nav = this.el.classList.contains("nav") ? this.el : this.el.querySelector(".nav");
91
92
  if (nav) {
92
93
  var tabs = this.el.querySelector(".tab-content");
93
94
  // Parse the navigation items
@@ -97,10 +98,10 @@ var _Nav = /** @class */ (function (_super) {
97
98
  var link = new link_1.NavLink(links[i], tabs ? true : false, itemTemplate);
98
99
  nav.appendChild(link.el);
99
100
  this._links.push(link);
101
+ // Configure the link event
102
+ this.configureLinkEvents(link);
100
103
  // See if we are rendering tabs
101
104
  if (tabs) {
102
- // Configure the events
103
- this.configureTabEvents(link);
104
105
  // Add the tab content
105
106
  tabs.appendChild(link.elTabContent);
106
107
  // See if the fade option is enabled
@@ -129,14 +129,14 @@ var NavLink = /** @class */ (function (_super) {
129
129
  if (this.isActive) {
130
130
  // Hide this link and tab
131
131
  this._elLink.classList.remove("active");
132
- this._elTab.classList.remove("active");
133
- this._elTab.classList.remove("show");
132
+ this._elTab ? this._elTab.classList.remove("active") : null;
133
+ this._elTab ? this._elTab.classList.remove("show") : null;
134
134
  }
135
135
  else {
136
136
  // Show this link and tab
137
137
  this._elLink.classList.add("active");
138
- this._elTab.classList.add("active");
139
- fadeTabs ? this._elTab.classList.add("show") : null;
138
+ this._elTab ? this._elTab.classList.add("active") : null;
139
+ this._elTab && fadeTabs ? this._elTab.classList.add("show") : null;
140
140
  }
141
141
  };
142
142
  return NavLink;