gd-bs 6.1.3 → 6.1.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/.github/workflows/build.yml +1 -1
- package/build/bs.js +1 -1
- package/build/components/form/control.js +88 -84
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.js.LICENSE.txt +255 -223
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.js.LICENSE.txt +228 -208
- package/dist/gd-bs.min.js +1 -1
- package/package.json +15 -16
- package/pnpm-lock.yaml +388 -388
- package/src/components/form/control.ts +92 -88
- package/src/styles/_core.scss +1 -0
- package/src/styles/_custom.scss +12 -2
|
@@ -651,109 +651,113 @@ export class FormControl implements IFormControl {
|
|
|
651
651
|
|
|
652
652
|
// Updates the control validation
|
|
653
653
|
updateValidation(elControl: Element, validation: IFormControlValidationResult) {
|
|
654
|
-
// Get the form
|
|
655
|
-
let
|
|
656
|
-
|
|
657
|
-
//
|
|
658
|
-
elFormControl
|
|
659
|
-
elFormControl
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
654
|
+
// Get the form controls
|
|
655
|
+
let elFormControls = elControl.querySelectorAll(".form-control") || elControl.querySelectorAll(".form-select");
|
|
656
|
+
for (let i = 0; i < elFormControls.length; i++) {
|
|
657
|
+
// Ensure the control exists
|
|
658
|
+
let elFormControl = elFormControls[i] as HTMLElement;
|
|
659
|
+
if (elFormControl) {
|
|
660
|
+
// Clear the invalid/valid classes
|
|
661
|
+
elFormControl.classList.remove("is-invalid");
|
|
662
|
+
elFormControl.classList.remove("is-valid");
|
|
663
|
+
|
|
664
|
+
// Set the class
|
|
665
|
+
elFormControl.classList.add(validation.isValid ? "is-valid" : "is-invalid");
|
|
666
|
+
} else {
|
|
667
|
+
let validateControls = (controls: Array<HTMLElement>) => {
|
|
668
|
+
// Parse the controls
|
|
669
|
+
for (let i = 0; i < controls.length; i++) {
|
|
670
|
+
let control = controls[i];
|
|
671
|
+
|
|
672
|
+
// Clear the invalid/valid classes
|
|
673
|
+
control.classList.remove("is-invalid");
|
|
674
|
+
control.classList.remove("is-valid");
|
|
675
|
+
|
|
676
|
+
// Set the class
|
|
677
|
+
control.classList.add(validation.isValid ? "is-valid" : "is-invalid");
|
|
678
|
+
}
|
|
675
679
|
}
|
|
676
|
-
}
|
|
677
680
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
681
|
+
// Get the checkboxes
|
|
682
|
+
let elCheckboxes = elControl.querySelectorAll(".form-check-input");
|
|
683
|
+
if (elCheckboxes.length > 0) {
|
|
684
|
+
// Validate the controls
|
|
685
|
+
validateControls(elCheckboxes as any);
|
|
683
686
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
+
// Set the form control
|
|
688
|
+
elFormControl = elCheckboxes.length > 0 ? elCheckboxes[elCheckboxes.length - 1] as any : elFormControl;
|
|
689
|
+
}
|
|
687
690
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
691
|
+
// Get the custom controls
|
|
692
|
+
let elCustomControls = elControl.querySelectorAll(".custom-control-input");
|
|
693
|
+
if (elCustomControls.length > 0) {
|
|
694
|
+
// Validate the controls
|
|
695
|
+
validateControls(elCustomControls as any);
|
|
693
696
|
|
|
694
|
-
|
|
695
|
-
|
|
697
|
+
// Set the form control
|
|
698
|
+
elFormControl = elCustomControls.length > 0 ? elCustomControls[elCustomControls.length - 1] as any : elFormControl;
|
|
699
|
+
}
|
|
696
700
|
}
|
|
697
|
-
}
|
|
698
701
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
// Clear the old valid message if it exists
|
|
704
|
-
let validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
|
|
705
|
-
let elMessage = elFormControl.parentNode.querySelector("." + validClassName) as HTMLElement;
|
|
706
|
-
if (elMessage) {
|
|
707
|
-
// Clear the message
|
|
708
|
-
elMessage.innerHTML = "";
|
|
709
|
-
elMessage.style.display = "";
|
|
710
|
-
}
|
|
702
|
+
// Ensure the form control exists
|
|
703
|
+
if (elFormControl) {
|
|
704
|
+
let useTooltip = this._formProps.validationType == FormValidationTypes.Tooltip;
|
|
711
705
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
706
|
+
// Clear the old valid message if it exists
|
|
707
|
+
let validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
|
|
708
|
+
let elMessage = elFormControl.parentNode.querySelector("." + validClassName) as HTMLElement;
|
|
709
|
+
if (elMessage) {
|
|
710
|
+
// Clear the message
|
|
711
|
+
elMessage.innerHTML = "";
|
|
712
|
+
elMessage.style.display = "";
|
|
713
|
+
}
|
|
720
714
|
|
|
721
|
-
|
|
722
|
-
if (validation.invalidMessage || this._props.errorMessage) {
|
|
723
|
-
// Get the element
|
|
715
|
+
// Clear the old valid message if it exists
|
|
724
716
|
let invalidClassName = useTooltip ? "invalid-tooltip" : "invalid-feedback";
|
|
725
717
|
elMessage = elFormControl.parentNode.querySelector("." + invalidClassName) as HTMLElement;
|
|
726
|
-
if (elMessage
|
|
727
|
-
//
|
|
728
|
-
elMessage =
|
|
729
|
-
elMessage.
|
|
730
|
-
elFormControl.parentNode.appendChild(elMessage);
|
|
718
|
+
if (elMessage) {
|
|
719
|
+
// Clear the message
|
|
720
|
+
elMessage.innerHTML = "";
|
|
721
|
+
elMessage.style.display = "";
|
|
731
722
|
}
|
|
732
723
|
|
|
733
|
-
//
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
724
|
+
// See if there is invalid feedback
|
|
725
|
+
if (validation.invalidMessage || this._props.errorMessage) {
|
|
726
|
+
// Get the element
|
|
727
|
+
let invalidClassName = useTooltip ? "invalid-tooltip" : "invalid-feedback";
|
|
728
|
+
elMessage = elFormControl.parentNode.querySelector("." + invalidClassName) as HTMLElement;
|
|
729
|
+
if (elMessage == null) {
|
|
730
|
+
// Create the element
|
|
731
|
+
elMessage = document.createElement("div");
|
|
732
|
+
elMessage.className = invalidClassName;
|
|
733
|
+
elFormControl.parentNode.appendChild(elMessage);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// Set the message
|
|
737
|
+
elMessage.innerHTML = validation.invalidMessage || this._props.errorMessage;
|
|
738
|
+
|
|
739
|
+
// Update the display
|
|
740
|
+
elMessage.style.display = validation.isValid ? "" : "block";
|
|
750
741
|
}
|
|
751
742
|
|
|
752
|
-
//
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
743
|
+
// See if there is valid feedback
|
|
744
|
+
if (validation.validMessage) {
|
|
745
|
+
// Get the element
|
|
746
|
+
let validClassName = useTooltip ? "valid-tooltip" : "valid-feedback";
|
|
747
|
+
elMessage = elFormControl.parentNode.querySelector("." + validClassName) as HTMLElement;
|
|
748
|
+
if (elMessage == null) {
|
|
749
|
+
// Create the element
|
|
750
|
+
elMessage = document.createElement("div");
|
|
751
|
+
elMessage.className = validClassName;
|
|
752
|
+
elFormControl.parentNode.appendChild(elMessage);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// Set the message
|
|
756
|
+
elMessage.innerHTML = validation.validMessage;
|
|
757
|
+
|
|
758
|
+
// Update the display
|
|
759
|
+
elMessage.style.display = validation.isValid ? "block" : "";
|
|
760
|
+
}
|
|
757
761
|
}
|
|
758
762
|
}
|
|
759
763
|
}
|
package/src/styles/_core.scss
CHANGED
package/src/styles/_custom.scss
CHANGED
|
@@ -185,6 +185,7 @@
|
|
|
185
185
|
/* Color match form elements */
|
|
186
186
|
.form-control {
|
|
187
187
|
border-color: #6c757d;
|
|
188
|
+
border-radius: var(--bs-border-radius);
|
|
188
189
|
}
|
|
189
190
|
/* Color match disabled form elements */
|
|
190
191
|
.form-control:disabled,
|
|
@@ -393,6 +394,15 @@
|
|
|
393
394
|
.popover-body>* {
|
|
394
395
|
position: relative !important;
|
|
395
396
|
}
|
|
397
|
+
/* Fix Rich Textbox rounded corners */
|
|
398
|
+
.rich-textbox {
|
|
399
|
+
.editor-container {
|
|
400
|
+
border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius) !important;
|
|
401
|
+
}
|
|
402
|
+
.toolbar-container {
|
|
403
|
+
border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0 !important;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
396
406
|
/* Fix extra top margin in Firefox */
|
|
397
407
|
table.dataTable {
|
|
398
408
|
margin-top: 0rem !important;
|
|
@@ -423,11 +433,11 @@
|
|
|
423
433
|
}
|
|
424
434
|
/* Fix validation styling */
|
|
425
435
|
.form-control.is-invalid {
|
|
426
|
-
border-color: #dc3545;
|
|
436
|
+
border-color: #dc3545 !important;
|
|
427
437
|
background-image: url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 12 12%27 width=%2712%27 height=%2712%27 fill=%27none%27 stroke=%27%23dc3545%27%3e%3ccircle cx=%276%27 cy=%276%27 r=%274.5%27/%3e%3cpath stroke-linejoin=%27round%27 d=%27M5.8 3.6h.4L6 6.5z%27/%3e%3ccircle cx=%276%27 cy=%278.2%27 r=%27.6%27 fill=%27%23dc3545%27 stroke=%27none%27/></svg>");
|
|
428
438
|
}
|
|
429
439
|
.form-control.is-valid {
|
|
430
|
-
border-color: #198754;
|
|
440
|
+
border-color: #198754 !important;
|
|
431
441
|
background-image: url("data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 8 8%27%3e%3cpath fill=%27%23198754%27 d=%27M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z%27/></svg>");
|
|
432
442
|
}
|
|
433
443
|
.form-select.is-invalid:not([multiple]):not([size]), .form-select.is-invalid:not([multiple])[size="1"] {
|