gd-bs 5.5.5 → 5.5.8
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/form/control.js +6 -0
- package/build/components/nav/index.js +10 -3
- package/build/components/navbar/index.js +2 -0
- package/dist/gd-bs-icons.js +3 -3
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +4 -0
- package/dist/gd-bs.js +3 -3
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/form/control.ts +6 -0
- package/src/components/form/controlTypes.d.ts +2 -0
- package/src/components/nav/index.ts +12 -3
- package/src/components/nav/types.d.ts +1 -0
- package/src/components/navbar/index.ts +3 -0
- package/src/components/navbar/types.d.ts +1 -0
|
@@ -104,6 +104,7 @@ var FormControl = /** @class */ (function () {
|
|
|
104
104
|
// Add the checkbox group
|
|
105
105
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
106
106
|
className: className,
|
|
107
|
+
colSize: cbProps.colSize,
|
|
107
108
|
hideLabel: true,
|
|
108
109
|
isInline: cbProps.isInline,
|
|
109
110
|
isReadonly: this._props.isReadonly,
|
|
@@ -204,6 +205,7 @@ var FormControl = /** @class */ (function () {
|
|
|
204
205
|
// Add the checkbox group
|
|
205
206
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
206
207
|
className: className,
|
|
208
|
+
colSize: cbMultiProps.colSize,
|
|
207
209
|
hideLabel: true,
|
|
208
210
|
isInline: cbMultiProps.isInline,
|
|
209
211
|
isReadonly: this._props.isReadonly,
|
|
@@ -249,6 +251,7 @@ var FormControl = /** @class */ (function () {
|
|
|
249
251
|
// Add the checkbox group
|
|
250
252
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
251
253
|
className: className,
|
|
254
|
+
colSize: this._props.colSize,
|
|
252
255
|
hideLabel: true,
|
|
253
256
|
isReadonly: this._props.isReadonly,
|
|
254
257
|
items: this._props.items,
|
|
@@ -264,6 +267,7 @@ var FormControl = /** @class */ (function () {
|
|
|
264
267
|
// Add the checkbox group
|
|
265
268
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
266
269
|
className: className,
|
|
270
|
+
colSize: this._props.colSize,
|
|
267
271
|
hideLabel: true,
|
|
268
272
|
isReadonly: this._props.isReadonly,
|
|
269
273
|
items: this._props.items,
|
|
@@ -293,6 +297,7 @@ var FormControl = /** @class */ (function () {
|
|
|
293
297
|
// Add the checkbox group
|
|
294
298
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
295
299
|
className: className,
|
|
300
|
+
colSize: this._props.colSize,
|
|
296
301
|
hideLabel: true,
|
|
297
302
|
isReadonly: this._props.isReadonly,
|
|
298
303
|
items: this._props.items,
|
|
@@ -338,6 +343,7 @@ var FormControl = /** @class */ (function () {
|
|
|
338
343
|
// Add the checkbox group
|
|
339
344
|
this._cb = checkboxGroup_1.CheckboxGroup({
|
|
340
345
|
className: className,
|
|
346
|
+
colSize: this._props.colSize,
|
|
341
347
|
hideLabel: true,
|
|
342
348
|
isReadonly: this._props.isReadonly,
|
|
343
349
|
items: this._props.items,
|
|
@@ -30,6 +30,8 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
30
30
|
_this._links = null;
|
|
31
31
|
// Configure the collapse
|
|
32
32
|
_this.configure(itemTemplate);
|
|
33
|
+
// Configure the events
|
|
34
|
+
_this.configureEvents();
|
|
33
35
|
// Configure the parent
|
|
34
36
|
_this.configureParent();
|
|
35
37
|
return _this;
|
|
@@ -49,8 +51,13 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
49
51
|
// Render the nav links
|
|
50
52
|
this.renderItems(itemTemplate);
|
|
51
53
|
};
|
|
52
|
-
//
|
|
53
|
-
_Nav.prototype.configureEvents = function (
|
|
54
|
+
// Configure the events
|
|
55
|
+
_Nav.prototype.configureEvents = function () {
|
|
56
|
+
// Execute the event(s)
|
|
57
|
+
this.props.onRendered ? this.props.onRendered(this.el) : null;
|
|
58
|
+
};
|
|
59
|
+
// Configures the tab link event
|
|
60
|
+
_Nav.prototype.configureTabEvents = function (tab) {
|
|
54
61
|
var _this = this;
|
|
55
62
|
// Add a click event
|
|
56
63
|
tab.el.addEventListener("click", function () {
|
|
@@ -91,7 +98,7 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
91
98
|
// See if we are rendering tabs
|
|
92
99
|
if (tabs) {
|
|
93
100
|
// Configure the events
|
|
94
|
-
this.
|
|
101
|
+
this.configureTabEvents(link);
|
|
95
102
|
// Add the tab content
|
|
96
103
|
tabs.appendChild(link.elTabContent);
|
|
97
104
|
// See if the fade option is enabled
|
package/dist/gd-bs-icons.js
CHANGED
|
@@ -1028,7 +1028,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
1028
1028
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1029
1029
|
|
|
1030
1030
|
"use strict";
|
|
1031
|
-
eval("\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.FormControl = void 0;\n\nvar checkboxGroup_1 = __webpack_require__(/*! ../checkboxGroup */ \"./src/components/checkboxGroup/index.ts\");\n\nvar custom_1 = __webpack_require__(/*! ./custom */ \"./src/components/form/custom.ts\");\n\nvar dropdown_1 = __webpack_require__(/*! ../dropdown */ \"./src/components/dropdown/index.ts\");\n\nvar inputGroup_1 = __webpack_require__(/*! ../inputGroup */ \"./src/components/inputGroup/index.ts\");\n\nvar listBox_1 = __webpack_require__(/*! ../listBox */ \"./src/components/listBox/index.ts\");\n\nvar _1 = __webpack_require__(/*! . */ \"./src/components/form/index.ts\");\n/**\r\n * Form Control\r\n */\n\n\nvar FormControl =\n/** @class */\nfunction () {\n // Constructor\n function FormControl(props, formProps, elLabel) {\n var _this = this;\n\n this._cb = null;\n this._custom = null;\n this._el = null;\n this._elLabel = null;\n this._formProps = null;\n this._ddl = null;\n this._isRendered = false;\n this._lb = null;\n this._tb = null; // Save the parameters\n\n this._formProps = formProps;\n this._props = props;\n this._elLabel = elLabel; // See if there is a rendering event\n\n if (typeof this._props.onControlRendering === \"function\") {\n // Call the event and see if a promise is returned\n var returnVal = this._props.onControlRendering(Object.assign({}, this._props));\n\n if (returnVal && typeof returnVal[\"then\"] === \"function\") {\n // Wait for it to complete\n returnVal[\"then\"](function (newProps) {\n // Update the properties\n _this._props = newProps || _this._props; // Create the control\n\n _this.create();\n });\n } else {\n // Create the control\n this.create();\n }\n } else {\n // Create the control\n this.create();\n }\n } // Configure the control\n\n\n FormControl.prototype.configure = function () {\n // Ensure a control was created\n if (this.control) {\n // Set the element\n this._el = this.control.el; // See if an error message exists\n\n if (this._props.errorMessage) {\n // Get the group\n var elGroup = this._el.querySelector(\".input-group\") || this._el.querySelector(\".form-check:last-child\");\n\n if (elGroup) {\n // Add the error message\n var elErrorMessage = document.createElement(\"div\");\n elErrorMessage.className = \"invalid-feedback\";\n elErrorMessage.innerHTML = this._props.errorMessage;\n elGroup.appendChild(elErrorMessage);\n }\n } // See if an element was defined to render to\n\n\n if (this._props.el) {\n // Append the control to the element\n this._props.el.appendChild(this._el);\n } // See if the label is set\n\n\n if (this._elLabel && this._formProps.isFloating && this._el.id) {\n // Set the attributes\n this._elLabel.setAttribute(\"for\", this._el.id);\n }\n }\n }; // Creates the control\n\n\n FormControl.prototype.create = function () {\n var _this = this; // Parse the custom classes to add\n\n\n var className = [this._props.className || \"\", this._props.controlClassName || \"\"].join(\" \").trim(); // Render the control based on the type\n\n switch (this._props.type) {\n // Checkbox\n case _1.FormControlTypes.Checkbox:\n var cbProps = this._props; // Add the checkbox group\n\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isInline: cbProps.isInline,\n isReadonly: this._props.isReadonly,\n items: cbProps.items,\n onChange: cbProps.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Checkbox,\n value: this._props.value\n });\n break;\n // Color Picker\n\n case _1.FormControlTypes.ColorPicker:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.ColorPicker,\n value: this._props.value\n });\n break;\n // Datalist\n\n case _1.FormControlTypes.Datalist:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isDatalist: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Dropdown\n\n case _1.FormControlTypes.Dropdown:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n onMenuRendering: this._props.onMenuRendering,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Email\n\n case _1.FormControlTypes.Email:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Email,\n value: this._props.value\n });\n break;\n // File\n\n case _1.FormControlTypes.File:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.File,\n value: this._props.value\n });\n break;\n // List Box\n\n case _1.FormControlTypes.ListBox:\n // Add the list box\n this._lb = listBox_1.ListBox({\n id: this._props.name,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n value: this._props.value\n });\n break;\n // Multi-Checkbox\n\n case _1.FormControlTypes.MultiCheckbox:\n var cbMultiProps = this._props; // Add the checkbox group\n\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isInline: cbMultiProps.isInline,\n isReadonly: this._props.isReadonly,\n items: cbMultiProps.items,\n multi: true,\n onChange: cbMultiProps.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Checkbox,\n value: this._props.value\n });\n break;\n // Multi-Dropdown\n\n case _1.FormControlTypes.MultiDropdown:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n onMenuRendering: this._props.onMenuRendering,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Multi-List Box\n\n case _1.FormControlTypes.MultiListBox:\n // Add the list box\n this._lb = listBox_1.ListBox({\n id: this._props.name,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n value: this._props.value\n });\n break;\n // Multi-Radio\n\n case _1.FormControlTypes.MultiRadio:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Radio,\n value: this._props.value\n });\n break;\n // Multi-Switch\n\n case _1.FormControlTypes.MultiSwitch:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Switch,\n value: this._props.value\n });\n break;\n // Password\n\n case _1.FormControlTypes.Password:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Password,\n value: this._props.value\n });\n break;\n // Radio\n\n case _1.FormControlTypes.Radio:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Radio,\n value: this._props.value\n });\n break;\n // Range\n\n case _1.FormControlTypes.Range:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n min: this._props.min || 0,\n max: this._props.max || 100,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n step: this._props.step,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Range,\n value: this._props.value\n });\n break;\n // Read Only\n\n case _1.FormControlTypes.Readonly:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: true,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextField,\n value: this._props.value\n });\n break;\n // Switch\n\n case _1.FormControlTypes.Switch:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Switch,\n value: this._props.value\n });\n break;\n // Text Area\n\n case _1.FormControlTypes.TextArea:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n rows: this._props.rows,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextArea,\n value: this._props.value\n });\n break;\n // Text Field\n\n case _1.FormControlTypes.TextField:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextField,\n value: this._props.value\n });\n break;\n // Custom Type\n\n default:\n // Create the default element\n this._el = document.createElement(\"div\");\n this._el.className = className; // See if there is a custom type\n\n var custom = custom_1.CustomControls.getByType(this._props.type);\n\n if (custom && typeof custom === \"function\") {\n // Execute the event\n this._custom = custom(this._props);\n }\n\n break;\n } // See if a checkbox was rendered and an id was set\n\n\n if (this.control && this._props.id) {\n // Set the id\n this.control.el.id = this._props.id;\n } // Configure the control\n\n\n this.configure(); // Wait before executing the rendered event, otherwise the controls will be null\n\n setTimeout(function () {\n // Execute the events\n _this._props.onControlRendered ? _this._props.onControlRendered(_this) : null;\n _this._formProps.onControlRendered ? _this._formProps.onControlRendered(_this) : null; // Set the flag\n\n _this._isRendered = true;\n }, 10);\n };\n\n Object.defineProperty(FormControl.prototype, \"el\", {\n /**\r\n * Public Interface\r\n */\n get: function get() {\n return this._el;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"checkbox\", {\n // The checkbox control\n get: function get() {\n return this._cb;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"dropdown\", {\n // The dropdown control\n get: function get() {\n return this._ddl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"control\", {\n // The textbox control\n get: function get() {\n return this._cb || this._ddl || this._lb || this._tb || this._custom;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"label\", {\n // The control label\n get: function get() {\n return this._elLabel;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"listbox\", {\n // The listbox control\n get: function get() {\n return this._lb;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"textbox\", {\n // The textbox control\n get: function get() {\n return this._tb;\n },\n enumerable: false,\n configurable: true\n }); // Method to get the form control value\n\n FormControl.prototype.getValue = function () {\n // See if there is an override event\n if (this._props.onGetValue) {\n return this._props.onGetValue(this._props);\n } // See if this is a checkbox\n\n\n if (this._cb) {\n // See if the items were defined\n if (this._props.items) {\n // Return the value(s)\n return this._cb.getValue();\n } // Return the value\n\n\n return this._cb.getValue() ? true : false;\n } // See if this is a dropdown\n\n\n if (this._ddl) {\n // Return the value\n return this._ddl.getValue();\n } // See if this is a list box\n\n\n if (this._lb) {\n // Return the value\n return this._lb.getValue();\n } // See if this is a textbox\n\n\n if (this._tb) {\n // Return the value\n return this._tb.getValue();\n }\n }; // Is loaded\n\n\n FormControl.prototype.isLoaded = function () {\n var _this = this; // Return a promise\n\n\n return new Promise(function (resolve) {\n // Wait for the control to be created\n var id = setInterval(function () {\n // See if the control has been rendered\n if (_this.isRendered) {\n // Stop the loop\n clearInterval(id); // Resolve the promise\n\n resolve();\n }\n }, 10);\n });\n };\n\n Object.defineProperty(FormControl.prototype, \"isRendered\", {\n // Flag indicating the control is loaded\n get: function get() {\n return this._isRendered;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"isValid\", {\n // Validates the control\n get: function get() {\n var validation = {\n isValid: true\n }; // Get the element and value\n\n var elControl = this._cb || this._ddl || this._lb || this._tb ? (this._cb || this._ddl || this._lb || this._tb).el : this._el;\n var value = this.getValue(); // See if this control is required\n\n if (this._props.required) {\n // See if a value doesn't exists\n if (value == null) {\n // Set the flag\n validation.isValid = false;\n } // Else, see if the value is an array\n else if (typeof value.length === \"number\") {\n // Set the flag\n validation.isValid = value.length > 0;\n }\n } // See if an event exists\n\n\n if (this._props.onValidate) {\n // Call the event\n var returnValue = this._props.onValidate(this._props, {\n value: value\n });\n\n if (typeof returnValue === \"boolean\") {\n // Set the flag\n validation.isValid = returnValue;\n } // Else, ensure it exists\n else if (returnValue) {\n // Set the validation\n validation = __assign(__assign({}, validation), returnValue);\n }\n } // Update the validation\n\n\n this.updateValidation(elControl, validation); // Return the flag\n\n return validation.isValid;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"props\", {\n // The form control properties\n get: function get() {\n return this._props;\n },\n enumerable: false,\n configurable: true\n }); // Sets the form control label\n\n FormControl.prototype.setLabel = function (value) {\n // Update the label\n this._elLabel ? this._elLabel.innerHTML = value || \"\" : null;\n }; // Sets the custom control\n\n\n FormControl.prototype.setControl = function (control) {\n // Set the custom control\n this._custom = control;\n }; // Sets the form control value\n\n\n FormControl.prototype.setValue = function (value) {\n // Set the value\n this.control ? this.control.setValue(value) : null;\n }; // Updates the control validation\n\n\n FormControl.prototype.updateValidation = function (elControl, validation) {\n // Get the form control\n var elFormControl = elControl.querySelector(\".form-control\") || elControl.querySelector(\".form-select\");\n\n if (elFormControl) {\n // Clear the invalid/valid classes\n elFormControl.classList.remove(\"is-invalid\");\n elFormControl.classList.remove(\"is-valid\"); // Set the class\n\n elFormControl.classList.add(validation.isValid ? \"is-valid\" : \"is-invalid\");\n } else {\n var validateControls = function validateControls(controls) {\n // Parse the controls\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i]; // Clear the invalid/valid classes\n\n control.classList.remove(\"is-invalid\");\n control.classList.remove(\"is-valid\"); // Set the class\n\n control.classList.add(validation.isValid ? \"is-valid\" : \"is-invalid\");\n }\n }; // Get the checkboxes\n\n\n var elCheckboxes = elControl.querySelectorAll(\".form-check-input\");\n\n if (elCheckboxes.length > 0) {\n // Validate the controls\n validateControls(elCheckboxes); // Set the form control\n\n elFormControl = elCheckboxes.length > 0 ? elCheckboxes[elCheckboxes.length - 1] : elFormControl;\n } // Get the custom controls\n\n\n var elCustomControls = elControl.querySelectorAll(\".custom-control-input\");\n\n if (elCustomControls.length > 0) {\n // Validate the controls\n validateControls(elCustomControls); // Set the form control\n\n elFormControl = elCustomControls.length > 0 ? elCustomControls[elCustomControls.length - 1] : elFormControl;\n }\n } // Ensure the form control exists\n\n\n if (elFormControl) {\n var useTooltip = this._formProps.validationType == _1.FormValidationTypes.Tooltip; // Clear the old valid message if it exists\n\n var validClassName = useTooltip ? \"valid-tooltip\" : \"valid-feedback\";\n var elMessage = elFormControl.parentNode.querySelector(\".\" + validClassName);\n\n if (elMessage) {\n // Clear the message\n elMessage.innerHTML = \"\";\n elMessage.style.display = \"\";\n } // Clear the old valid message if it exists\n\n\n var invalidClassName = useTooltip ? \"invalid-tooltip\" : \"invalid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + invalidClassName);\n\n if (elMessage) {\n // Clear the message\n elMessage.innerHTML = \"\";\n elMessage.style.display = \"\";\n } // See if there is invalid feedback\n\n\n if (validation.invalidMessage || this._props.errorMessage) {\n // Get the element\n var invalidClassName_1 = useTooltip ? \"invalid-tooltip\" : \"invalid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + invalidClassName_1);\n\n if (elMessage == null) {\n // Create the element\n elMessage = document.createElement(\"div\");\n elMessage.className = invalidClassName_1;\n elFormControl.parentNode.appendChild(elMessage);\n } // Set the message\n\n\n elMessage.innerHTML = validation.invalidMessage || this._props.errorMessage; // Update the display\n\n elMessage.style.display = validation.isValid ? \"\" : \"block\";\n } // See if there is valid feedback\n\n\n if (validation.validMessage) {\n // Get the element\n var validClassName_1 = useTooltip ? \"valid-tooltip\" : \"valid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + validClassName_1);\n\n if (elMessage == null) {\n // Create the element\n elMessage = document.createElement(\"div\");\n elMessage.className = validClassName_1;\n elFormControl.parentNode.appendChild(elMessage);\n } // Set the message\n\n\n elMessage.innerHTML = validation.validMessage; // Update the display\n\n elMessage.style.display = validation.isValid ? \"block\" : \"\";\n }\n }\n };\n\n return FormControl;\n}();\n\nexports.FormControl = FormControl;\n\n//# sourceURL=webpack://gd-bs/./src/components/form/control.ts?");
|
|
1031
|
+
eval("\n\nvar __assign = this && this.__assign || function () {\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.FormControl = void 0;\n\nvar checkboxGroup_1 = __webpack_require__(/*! ../checkboxGroup */ \"./src/components/checkboxGroup/index.ts\");\n\nvar custom_1 = __webpack_require__(/*! ./custom */ \"./src/components/form/custom.ts\");\n\nvar dropdown_1 = __webpack_require__(/*! ../dropdown */ \"./src/components/dropdown/index.ts\");\n\nvar inputGroup_1 = __webpack_require__(/*! ../inputGroup */ \"./src/components/inputGroup/index.ts\");\n\nvar listBox_1 = __webpack_require__(/*! ../listBox */ \"./src/components/listBox/index.ts\");\n\nvar _1 = __webpack_require__(/*! . */ \"./src/components/form/index.ts\");\n/**\r\n * Form Control\r\n */\n\n\nvar FormControl =\n/** @class */\nfunction () {\n // Constructor\n function FormControl(props, formProps, elLabel) {\n var _this = this;\n\n this._cb = null;\n this._custom = null;\n this._el = null;\n this._elLabel = null;\n this._formProps = null;\n this._ddl = null;\n this._isRendered = false;\n this._lb = null;\n this._tb = null; // Save the parameters\n\n this._formProps = formProps;\n this._props = props;\n this._elLabel = elLabel; // See if there is a rendering event\n\n if (typeof this._props.onControlRendering === \"function\") {\n // Call the event and see if a promise is returned\n var returnVal = this._props.onControlRendering(Object.assign({}, this._props));\n\n if (returnVal && typeof returnVal[\"then\"] === \"function\") {\n // Wait for it to complete\n returnVal[\"then\"](function (newProps) {\n // Update the properties\n _this._props = newProps || _this._props; // Create the control\n\n _this.create();\n });\n } else {\n // Create the control\n this.create();\n }\n } else {\n // Create the control\n this.create();\n }\n } // Configure the control\n\n\n FormControl.prototype.configure = function () {\n // Ensure a control was created\n if (this.control) {\n // Set the element\n this._el = this.control.el; // See if an error message exists\n\n if (this._props.errorMessage) {\n // Get the group\n var elGroup = this._el.querySelector(\".input-group\") || this._el.querySelector(\".form-check:last-child\");\n\n if (elGroup) {\n // Add the error message\n var elErrorMessage = document.createElement(\"div\");\n elErrorMessage.className = \"invalid-feedback\";\n elErrorMessage.innerHTML = this._props.errorMessage;\n elGroup.appendChild(elErrorMessage);\n }\n } // See if an element was defined to render to\n\n\n if (this._props.el) {\n // Append the control to the element\n this._props.el.appendChild(this._el);\n } // See if the label is set\n\n\n if (this._elLabel && this._formProps.isFloating && this._el.id) {\n // Set the attributes\n this._elLabel.setAttribute(\"for\", this._el.id);\n }\n }\n }; // Creates the control\n\n\n FormControl.prototype.create = function () {\n var _this = this; // Parse the custom classes to add\n\n\n var className = [this._props.className || \"\", this._props.controlClassName || \"\"].join(\" \").trim(); // Render the control based on the type\n\n switch (this._props.type) {\n // Checkbox\n case _1.FormControlTypes.Checkbox:\n var cbProps = this._props; // Add the checkbox group\n\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: cbProps.colSize,\n hideLabel: true,\n isInline: cbProps.isInline,\n isReadonly: this._props.isReadonly,\n items: cbProps.items,\n onChange: cbProps.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Checkbox,\n value: this._props.value\n });\n break;\n // Color Picker\n\n case _1.FormControlTypes.ColorPicker:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.ColorPicker,\n value: this._props.value\n });\n break;\n // Datalist\n\n case _1.FormControlTypes.Datalist:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isDatalist: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Dropdown\n\n case _1.FormControlTypes.Dropdown:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n onMenuRendering: this._props.onMenuRendering,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Email\n\n case _1.FormControlTypes.Email:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Email,\n value: this._props.value\n });\n break;\n // File\n\n case _1.FormControlTypes.File:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.File,\n value: this._props.value\n });\n break;\n // List Box\n\n case _1.FormControlTypes.ListBox:\n // Add the list box\n this._lb = listBox_1.ListBox({\n id: this._props.name,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n value: this._props.value\n });\n break;\n // Multi-Checkbox\n\n case _1.FormControlTypes.MultiCheckbox:\n var cbMultiProps = this._props; // Add the checkbox group\n\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: cbMultiProps.colSize,\n hideLabel: true,\n isInline: cbMultiProps.isInline,\n isReadonly: this._props.isReadonly,\n items: cbMultiProps.items,\n multi: true,\n onChange: cbMultiProps.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Checkbox,\n value: this._props.value\n });\n break;\n // Multi-Dropdown\n\n case _1.FormControlTypes.MultiDropdown:\n // Add the dropdown\n this._ddl = dropdown_1.Dropdown({\n className: className,\n formFl: true,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n onMenuRendering: this._props.onMenuRendering,\n title: this._props.title,\n value: this._props.value\n });\n break;\n // Multi-List Box\n\n case _1.FormControlTypes.MultiListBox:\n // Add the list box\n this._lb = listBox_1.ListBox({\n id: this._props.name,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n value: this._props.value\n });\n break;\n // Multi-Radio\n\n case _1.FormControlTypes.MultiRadio:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: this._props.colSize,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Radio,\n value: this._props.value\n });\n break;\n // Multi-Switch\n\n case _1.FormControlTypes.MultiSwitch:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: this._props.colSize,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n multi: true,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Switch,\n value: this._props.value\n });\n break;\n // Password\n\n case _1.FormControlTypes.Password:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Password,\n value: this._props.value\n });\n break;\n // Radio\n\n case _1.FormControlTypes.Radio:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: this._props.colSize,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Radio,\n value: this._props.value\n });\n break;\n // Range\n\n case _1.FormControlTypes.Range:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n min: this._props.min || 0,\n max: this._props.max || 100,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n step: this._props.step,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.Range,\n value: this._props.value\n });\n break;\n // Read Only\n\n case _1.FormControlTypes.Readonly:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: true,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextField,\n value: this._props.value\n });\n break;\n // Switch\n\n case _1.FormControlTypes.Switch:\n // Add the checkbox group\n this._cb = checkboxGroup_1.CheckboxGroup({\n className: className,\n colSize: this._props.colSize,\n hideLabel: true,\n isReadonly: this._props.isReadonly,\n items: this._props.items,\n onChange: this._props.onChange,\n title: this._props.title,\n type: checkboxGroup_1.CheckboxGroupTypes.Switch,\n value: this._props.value\n });\n break;\n // Text Area\n\n case _1.FormControlTypes.TextArea:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n rows: this._props.rows,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextArea,\n value: this._props.value\n });\n break;\n // Text Field\n\n case _1.FormControlTypes.TextField:\n // Add the input\n this._tb = inputGroup_1.InputGroup({\n className: className,\n id: this._props.id,\n isReadonly: this._props.isReadonly,\n onChange: this._props.onChange,\n placeholder: this._props.placeholder,\n title: this._props.title,\n type: inputGroup_1.InputGroupTypes.TextField,\n value: this._props.value\n });\n break;\n // Custom Type\n\n default:\n // Create the default element\n this._el = document.createElement(\"div\");\n this._el.className = className; // See if there is a custom type\n\n var custom = custom_1.CustomControls.getByType(this._props.type);\n\n if (custom && typeof custom === \"function\") {\n // Execute the event\n this._custom = custom(this._props);\n }\n\n break;\n } // See if a checkbox was rendered and an id was set\n\n\n if (this.control && this._props.id) {\n // Set the id\n this.control.el.id = this._props.id;\n } // Configure the control\n\n\n this.configure(); // Wait before executing the rendered event, otherwise the controls will be null\n\n setTimeout(function () {\n // Execute the events\n _this._props.onControlRendered ? _this._props.onControlRendered(_this) : null;\n _this._formProps.onControlRendered ? _this._formProps.onControlRendered(_this) : null; // Set the flag\n\n _this._isRendered = true;\n }, 10);\n };\n\n Object.defineProperty(FormControl.prototype, \"el\", {\n /**\r\n * Public Interface\r\n */\n get: function get() {\n return this._el;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"checkbox\", {\n // The checkbox control\n get: function get() {\n return this._cb;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"dropdown\", {\n // The dropdown control\n get: function get() {\n return this._ddl;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"control\", {\n // The textbox control\n get: function get() {\n return this._cb || this._ddl || this._lb || this._tb || this._custom;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"label\", {\n // The control label\n get: function get() {\n return this._elLabel;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"listbox\", {\n // The listbox control\n get: function get() {\n return this._lb;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"textbox\", {\n // The textbox control\n get: function get() {\n return this._tb;\n },\n enumerable: false,\n configurable: true\n }); // Method to get the form control value\n\n FormControl.prototype.getValue = function () {\n // See if there is an override event\n if (this._props.onGetValue) {\n return this._props.onGetValue(this._props);\n } // See if this is a checkbox\n\n\n if (this._cb) {\n // See if the items were defined\n if (this._props.items) {\n // Return the value(s)\n return this._cb.getValue();\n } // Return the value\n\n\n return this._cb.getValue() ? true : false;\n } // See if this is a dropdown\n\n\n if (this._ddl) {\n // Return the value\n return this._ddl.getValue();\n } // See if this is a list box\n\n\n if (this._lb) {\n // Return the value\n return this._lb.getValue();\n } // See if this is a textbox\n\n\n if (this._tb) {\n // Return the value\n return this._tb.getValue();\n }\n }; // Is loaded\n\n\n FormControl.prototype.isLoaded = function () {\n var _this = this; // Return a promise\n\n\n return new Promise(function (resolve) {\n // Wait for the control to be created\n var id = setInterval(function () {\n // See if the control has been rendered\n if (_this.isRendered) {\n // Stop the loop\n clearInterval(id); // Resolve the promise\n\n resolve();\n }\n }, 10);\n });\n };\n\n Object.defineProperty(FormControl.prototype, \"isRendered\", {\n // Flag indicating the control is loaded\n get: function get() {\n return this._isRendered;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"isValid\", {\n // Validates the control\n get: function get() {\n var validation = {\n isValid: true\n }; // Get the element and value\n\n var elControl = this._cb || this._ddl || this._lb || this._tb ? (this._cb || this._ddl || this._lb || this._tb).el : this._el;\n var value = this.getValue(); // See if this control is required\n\n if (this._props.required) {\n // See if a value doesn't exists\n if (value == null) {\n // Set the flag\n validation.isValid = false;\n } // Else, see if the value is an array\n else if (typeof value.length === \"number\") {\n // Set the flag\n validation.isValid = value.length > 0;\n }\n } // See if an event exists\n\n\n if (this._props.onValidate) {\n // Call the event\n var returnValue = this._props.onValidate(this._props, {\n value: value\n });\n\n if (typeof returnValue === \"boolean\") {\n // Set the flag\n validation.isValid = returnValue;\n } // Else, ensure it exists\n else if (returnValue) {\n // Set the validation\n validation = __assign(__assign({}, validation), returnValue);\n }\n } // Update the validation\n\n\n this.updateValidation(elControl, validation); // Return the flag\n\n return validation.isValid;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FormControl.prototype, \"props\", {\n // The form control properties\n get: function get() {\n return this._props;\n },\n enumerable: false,\n configurable: true\n }); // Sets the form control label\n\n FormControl.prototype.setLabel = function (value) {\n // Update the label\n this._elLabel ? this._elLabel.innerHTML = value || \"\" : null;\n }; // Sets the custom control\n\n\n FormControl.prototype.setControl = function (control) {\n // Set the custom control\n this._custom = control;\n }; // Sets the form control value\n\n\n FormControl.prototype.setValue = function (value) {\n // Set the value\n this.control ? this.control.setValue(value) : null;\n }; // Updates the control validation\n\n\n FormControl.prototype.updateValidation = function (elControl, validation) {\n // Get the form control\n var elFormControl = elControl.querySelector(\".form-control\") || elControl.querySelector(\".form-select\");\n\n if (elFormControl) {\n // Clear the invalid/valid classes\n elFormControl.classList.remove(\"is-invalid\");\n elFormControl.classList.remove(\"is-valid\"); // Set the class\n\n elFormControl.classList.add(validation.isValid ? \"is-valid\" : \"is-invalid\");\n } else {\n var validateControls = function validateControls(controls) {\n // Parse the controls\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i]; // Clear the invalid/valid classes\n\n control.classList.remove(\"is-invalid\");\n control.classList.remove(\"is-valid\"); // Set the class\n\n control.classList.add(validation.isValid ? \"is-valid\" : \"is-invalid\");\n }\n }; // Get the checkboxes\n\n\n var elCheckboxes = elControl.querySelectorAll(\".form-check-input\");\n\n if (elCheckboxes.length > 0) {\n // Validate the controls\n validateControls(elCheckboxes); // Set the form control\n\n elFormControl = elCheckboxes.length > 0 ? elCheckboxes[elCheckboxes.length - 1] : elFormControl;\n } // Get the custom controls\n\n\n var elCustomControls = elControl.querySelectorAll(\".custom-control-input\");\n\n if (elCustomControls.length > 0) {\n // Validate the controls\n validateControls(elCustomControls); // Set the form control\n\n elFormControl = elCustomControls.length > 0 ? elCustomControls[elCustomControls.length - 1] : elFormControl;\n }\n } // Ensure the form control exists\n\n\n if (elFormControl) {\n var useTooltip = this._formProps.validationType == _1.FormValidationTypes.Tooltip; // Clear the old valid message if it exists\n\n var validClassName = useTooltip ? \"valid-tooltip\" : \"valid-feedback\";\n var elMessage = elFormControl.parentNode.querySelector(\".\" + validClassName);\n\n if (elMessage) {\n // Clear the message\n elMessage.innerHTML = \"\";\n elMessage.style.display = \"\";\n } // Clear the old valid message if it exists\n\n\n var invalidClassName = useTooltip ? \"invalid-tooltip\" : \"invalid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + invalidClassName);\n\n if (elMessage) {\n // Clear the message\n elMessage.innerHTML = \"\";\n elMessage.style.display = \"\";\n } // See if there is invalid feedback\n\n\n if (validation.invalidMessage || this._props.errorMessage) {\n // Get the element\n var invalidClassName_1 = useTooltip ? \"invalid-tooltip\" : \"invalid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + invalidClassName_1);\n\n if (elMessage == null) {\n // Create the element\n elMessage = document.createElement(\"div\");\n elMessage.className = invalidClassName_1;\n elFormControl.parentNode.appendChild(elMessage);\n } // Set the message\n\n\n elMessage.innerHTML = validation.invalidMessage || this._props.errorMessage; // Update the display\n\n elMessage.style.display = validation.isValid ? \"\" : \"block\";\n } // See if there is valid feedback\n\n\n if (validation.validMessage) {\n // Get the element\n var validClassName_1 = useTooltip ? \"valid-tooltip\" : \"valid-feedback\";\n elMessage = elFormControl.parentNode.querySelector(\".\" + validClassName_1);\n\n if (elMessage == null) {\n // Create the element\n elMessage = document.createElement(\"div\");\n elMessage.className = validClassName_1;\n elFormControl.parentNode.appendChild(elMessage);\n } // Set the message\n\n\n elMessage.innerHTML = validation.validMessage; // Update the display\n\n elMessage.style.display = validation.isValid ? \"block\" : \"\";\n }\n }\n };\n\n return FormControl;\n}();\n\nexports.FormControl = FormControl;\n\n//# sourceURL=webpack://gd-bs/./src/components/form/control.ts?");
|
|
1032
1032
|
|
|
1033
1033
|
/***/ }),
|
|
1034
1034
|
|
|
@@ -1237,7 +1237,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
1237
1237
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1238
1238
|
|
|
1239
1239
|
"use strict";
|
|
1240
|
-
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Nav = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar link_1 = __webpack_require__(/*! ./link */ \"./src/components/nav/link.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/nav/templates.ts\");\n/**\r\n * Navigation\r\n * @param props - The navigation properties.\r\n */\n\n\nvar _Nav =\n/** @class */\nfunction (_super) {\n __extends(_Nav, _super); // Constructor\n\n\n function _Nav(props, template, itemTemplate) {\n if (template === void 0) {\n template = props.isTabs ? props.isVertical ? templates_1.HTMLVerticalTabs : templates_1.HTMLTabs : templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._links = null; // Configure the collapse\n\n _this.configure(itemTemplate); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the card group\n\n\n _Nav.prototype.configure = function (itemTemplate) {\n // Update the navigation\n var nav = this.el.querySelector(\".nav\");\n\n if (nav) {\n this.props.id ? nav.id = this.props.id : null;\n this.props.enableFill ? this.el.classList.add(\"nav-fill\") : null;\n this.props.isJustified ? this.el.classList.add(\"nav-justified\") : null;\n this.props.isPills ? this.el.classList.add(\"nav-pills\") : null;\n this.props.isTabs ? this.el.classList.add(\"nav-tabs\") : null;\n this.props.isVertical ? this.el.classList.add(\"flex-column\") : null;\n } // Render the nav links\n\n\n this.renderItems(itemTemplate);\n }; // Configures the link event\n\n\n _Nav.prototype.
|
|
1240
|
+
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Nav = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar link_1 = __webpack_require__(/*! ./link */ \"./src/components/nav/link.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/nav/templates.ts\");\n/**\r\n * Navigation\r\n * @param props - The navigation properties.\r\n */\n\n\nvar _Nav =\n/** @class */\nfunction (_super) {\n __extends(_Nav, _super); // Constructor\n\n\n function _Nav(props, template, itemTemplate) {\n if (template === void 0) {\n template = props.isTabs ? props.isVertical ? templates_1.HTMLVerticalTabs : templates_1.HTMLTabs : templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._links = null; // Configure the collapse\n\n _this.configure(itemTemplate); // Configure the events\n\n\n _this.configureEvents(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the card group\n\n\n _Nav.prototype.configure = function (itemTemplate) {\n // Update the navigation\n var nav = this.el.querySelector(\".nav\");\n\n if (nav) {\n this.props.id ? nav.id = this.props.id : null;\n this.props.enableFill ? this.el.classList.add(\"nav-fill\") : null;\n this.props.isJustified ? this.el.classList.add(\"nav-justified\") : null;\n this.props.isPills ? this.el.classList.add(\"nav-pills\") : null;\n this.props.isTabs ? this.el.classList.add(\"nav-tabs\") : null;\n this.props.isVertical ? this.el.classList.add(\"flex-column\") : null;\n } // Render the nav links\n\n\n this.renderItems(itemTemplate);\n }; // Configure the events\n\n\n _Nav.prototype.configureEvents = function () {\n // Execute the event(s)\n this.props.onRendered ? this.props.onRendered(this.el) : null;\n }; // Configures the tab link event\n\n\n _Nav.prototype.configureTabEvents = function (tab) {\n var _this = this; // Add a click event\n\n\n tab.el.addEventListener(\"click\", function () {\n var prevTab = null;\n var newTab = tab; // Parse the links\n\n for (var i = 0; i < _this._links.length; i++) {\n var link = _this._links[i]; // See if it's active\n\n if (link.isActive) {\n // Set the old tab\n prevTab = link; // Toggle it\n\n link.toggle(_this.props.fadeTabs);\n }\n } // Toggle the link\n\n\n tab.toggle(_this.props.fadeTabs); // Call the click event\n\n _this.props.onClick ? _this.props.onClick(newTab, prevTab) : null;\n });\n }; // Renders the links\n\n\n _Nav.prototype.renderItems = function (itemTemplate) {\n // Clear the links\n this._links = []; // Get the nav and tab elements\n\n var nav = this.el.querySelector(\".nav\") || this.el;\n\n if (nav) {\n var tabs = this.el.querySelector(\".tab-content\"); // Parse the navigation items\n\n var links = this.props.items || [];\n\n for (var i = 0; i < links.length; i++) {\n // Create the link\n var link = new link_1.NavLink(links[i], tabs ? true : false, itemTemplate);\n nav.appendChild(link.el);\n\n this._links.push(link); // See if we are rendering tabs\n\n\n if (tabs) {\n // Configure the events\n this.configureTabEvents(link); // Add the tab content\n\n tabs.appendChild(link.elTabContent); // See if the fade option is enabled\n\n if (this.props.fadeTabs) {\n // Set the class name\n link.elTabContent.classList.add(\"fade\"); // See if the tab is active\n\n if (link.props.isActive) {\n // Set the class name\n link.elTabContent.classList.add(\"show\");\n }\n }\n } // Call the render events\n\n\n this.props.onLinkRendered ? this.props.onLinkRendered(link.elTab, links[i]) : null;\n this.props.onTabRendered ? this.props.onTabRendered(link.elTabContent, links[i]) : null;\n }\n }\n };\n\n Object.defineProperty(_Nav.prototype, \"activeTab\", {\n /**\r\n * Public Interface\r\n */\n // The active tab\n get: function get() {\n // Parse the links\n for (var i = 0; i < this._links.length; i++) {\n var link = this._links[i]; // See if it's active\n\n if (link.isActive) {\n // Return the link\n return link;\n }\n } // Active tab not found\n\n\n return null;\n },\n enumerable: false,\n configurable: true\n }); // Shows a tab\n\n _Nav.prototype.showTab = function (tabId) {\n // Ensure tabs exist\n if (this.props.isTabs) {\n // Parse the tabs\n for (var i = 0; i < this._links.length; i++) {\n var link = this._links[i]; // See if this is the target tab\n\n if (tabId === i + 1 || link.elTabContent.getAttribute(\"data-title\") == tabId) {\n // Toggle it if it's not active\n link.isActive ? null : link.toggle(this.props.fadeTabs);\n } // Else, see if it's active\n else if (link.isActive) {\n // Toggle it\n link.toggle(this.props.fadeTabs);\n }\n }\n }\n };\n\n return _Nav;\n}(base_1.Base);\n\nexports.Nav = function (props, template, itemTemplate) {\n return new _Nav(props, template, itemTemplate);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/nav/index.ts?");
|
|
1241
1241
|
|
|
1242
1242
|
/***/ }),
|
|
1243
1243
|
|
|
@@ -1270,7 +1270,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
|
|
|
1270
1270
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
1271
1271
|
|
|
1272
1272
|
"use strict";
|
|
1273
|
-
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Navbar = exports.NavbarTypes = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar button_1 = __webpack_require__(/*! ../button */ \"./src/components/button/index.ts\");\n\nvar common_1 = __webpack_require__(/*! ../common */ \"./src/components/common.ts\");\n\nvar item_1 = __webpack_require__(/*! ./item */ \"./src/components/navbar/item.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/navbar/templates.ts\");\n/**\r\n * Navbar Types\r\n */\n\n\nvar NavbarTypes;\n\n(function (NavbarTypes) {\n NavbarTypes[NavbarTypes[\"Dark\"] = 1] = \"Dark\";\n NavbarTypes[NavbarTypes[\"Light\"] = 2] = \"Light\";\n NavbarTypes[NavbarTypes[\"Primary\"] = 3] = \"Primary\";\n})(NavbarTypes = exports.NavbarTypes || (exports.NavbarTypes = {}));\n/**\r\n * Navbar\r\n */\n\n\nvar _Navbar =\n/** @class */\nfunction (_super) {\n __extends(_Navbar, _super); // Constructor\n\n\n function _Navbar(props, template, itemTemplate) {\n if (template === void 0) {\n template = templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._items = null; // Configure the collapse\n\n _this.configure(itemTemplate); // Configure search\n\n\n _this.configureSearch(); // Configure the events\n\n\n _this.configureEvents(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the card group\n\n\n _Navbar.prototype.configure = function (itemTemplate) {\n // See if there is a brand\n var brand = this.el.querySelector(\".navbar-brand\");\n\n if (brand) {\n if (this.props.brand) {\n // Update the brand\n this.props.brandUrl ? brand.href = this.props.brandUrl : null; // Append the content\n\n common_1.appendContent(brand, this.props.brand);\n } else {\n // Remove the brand\n brand.parentNode.removeChild(brand);\n }\n } // Update the nav bar\n\n\n var navbar = this.el.querySelector(\".navbar-collapse\");\n\n if (navbar) {\n navbar.id = this.props.id || \"navbar_content\";\n } // Set the toggle\n\n\n var toggler = this.el.querySelector(\".navbar-toggler\");\n\n if (toggler) {\n toggler.setAttribute(\"aria-controls\", navbar.id);\n toggler.setAttribute(\"data-bs-target\", \"#\" + navbar.id);\n } // Set the scroll\n\n\n var nav = this.el.querySelector(\".navbar-nav\");\n\n if (nav && this.props.enableScrolling) {\n // Add the class\n nav.classList.add(\"navbar-nav-scroll\");\n } // Add the classes based on the type\n\n\n this._btnSearch = this.el.querySelector(\"button[type='submit']\"); // Set the type\n\n this.setType(this.props.type); // Render the items\n\n this.renderItems(itemTemplate);\n }; // Configure the events\n\n\n _Navbar.prototype.configureEvents = function () {\n var _this = this;\n\n var props = this.props.searchBox || {}; // See if search events exist\n\n var searchbox = this.el.querySelector(\"form input\");\n\n if (searchbox) {\n // Set a keydown event to catch the \"Enter\" key being pressed\n searchbox.addEventListener(\"keydown\", function (ev) {\n // See if the \"Enter\" key was pressed\n if (ev.code == \"13\") {\n // Disable the postback\n ev.preventDefault(); // See if there is a search event\n\n if (props.onSearch) {\n // Call the event\n props.onSearch(searchbox.value, ev);\n }\n }\n }); // See if a change event exists\n\n if (props.onChange) {\n // Add an input event\n searchbox.addEventListener(\"input\", function (ev) {\n // Call the event\n props.onChange(searchbox.value, ev);\n }); // Add a clear event\n\n searchbox.addEventListener(\"clear\", function (ev) {\n // Call the event\n props.onChange(searchbox.value, ev);\n }); // Edge has a bug where the clear event isn't triggered\n // See if this is the Edge browser\n\n if (window.navigator.userAgent.indexOf(\"Edge\") > 0) {\n // Detect the mouse click event\n searchbox.addEventListener(\"mouseup\", function () {\n var currentValue = searchbox.value; // Set a timeout to see if the value is cleared\n\n setTimeout(function () {\n // Compare the values\n if (currentValue != searchbox.value) {\n // Call the event\n props.onChange(searchbox.value);\n }\n }, 1);\n });\n }\n }\n } // See if a search event exists\n\n\n var button = this.el.querySelector(\"form button\");\n\n if (button && props.onSearch) {\n // Add a click event\n button.addEventListener(\"click\", function (ev) {\n // Prevent the page from moving to the top\n ev.preventDefault(); // Call the event\n\n props.onSearch(searchbox.value);\n });\n } // See if the toggle exists\n\n\n var btnToggle = this.el.querySelector(\".navbar-toggler\");\n\n if (btnToggle) {\n // Add a click event\n btnToggle.addEventListener(\"click\", function (ev) {\n var elNav = _this.el.querySelector(\".navbar-collapse\"); // See if it's visible\n\n\n if (!btnToggle.classList.contains(\"collapsed\") && elNav.classList.contains(\"show\")) {\n // Start the animation\n elNav.style.height = elNav.getBoundingClientRect()[\"height\"] + \"px\";\n setTimeout(function () {\n elNav.classList.add(\"collapsing\");\n elNav.classList.remove(\"collapse\");\n elNav.classList.remove(\"show\");\n elNav.style.height = \"\";\n btnToggle.classList.add(\"collapsed\");\n }, 10); // Wait for the animation to complete\n\n setTimeout(function () {\n elNav.classList.remove(\"collapsing\");\n elNav.classList.add(\"collapse\");\n }, 250);\n } else {\n // Start the animation\n elNav.classList.remove(\"collapse\");\n elNav.classList.add(\"collapsing\");\n elNav.style.height = _this.el.scrollHeight + \"px\";\n btnToggle.classList.remove(\"collapsed\"); // Wait for the animation to complete\n\n setTimeout(function () {\n elNav.classList.remove(\"collapsing\");\n elNav.classList.add(\"collapse\");\n elNav.classList.add(\"show\");\n elNav.style.height = \"\";\n }, 250);\n }\n });\n }\n }; // Configures search\n\n\n _Navbar.prototype.configureSearch = function () {\n // See if we are rendering a search box\n var search = this.el.querySelector(\"form\");\n\n if (search) {\n if (this.props.enableSearch != false && this.props.searchBox) {\n var props = this.props.searchBox || {}; // Update the searchbox\n\n var searchbox = search.querySelector(\"input\");\n searchbox.placeholder = props.placeholder || searchbox.placeholder;\n searchbox.value = props.value || \"\";\n props.btnText ? searchbox.setAttribute(\"aria-label\", props.btnText) : null; // See if we are rendering a button\n\n var button = search.querySelector(\"button\");\n\n if (props.hideButton == true) {\n // Remove the button\n search.removeChild(button);\n } else {\n // Set the button type class name\n var className = button_1.ButtonClassNames.getByType(props.btnType);\n className ? button.classList.add(className) : null;\n }\n } else {\n // Remove the searchbox\n search.parentNode.removeChild(search);\n }\n }\n }; // Render the items\n\n\n _Navbar.prototype.renderItems = function (itemTemplate) {\n // Clear the list\n this._items = []; // Create the navbar list\n\n var list = this.el.querySelector(\"ul.navbar-nav\");\n\n if (list) {\n // Parse the items\n var items = this.props.items || [];\n\n for (var i = 0; i < items.length; i++) {\n // Create the item\n var item = new item_1.NavbarItem(items[i], this.props, itemTemplate);\n\n this._items.push(item);\n\n list.appendChild(item.el); // Call the render events\n\n this.props.onItemRendered ? this.props.onItemRendered(item.el, items[i]) : null;\n }\n } // Create the navbar right list\n\n\n list = this.el.querySelectorAll(\"ul.navbar-nav\")[1];\n\n if (list) {\n // See if no items exist\n var items = this.props.itemsEnd || [];\n\n if (items.length == 0) {\n // Remove the element\n list.remove();\n } else {\n // Parse the items\n for (var i = 0; i < items.length; i++) {\n // Create the item\n var item = new item_1.NavbarItem(items[i], this.props, itemTemplate);\n\n this._items.push(item);\n\n list.appendChild(item.el);\n }\n }\n }\n };\n /**\r\n * Public Methods\r\n */\n // Updates the navbar template type\n\n\n _Navbar.prototype.setType = function (navbarType) {\n // Remove the classes\n this.el.classList.remove(\"navbar-dark\");\n this.el.classList.remove(\"navbar-light\");\n this.el.classList.remove(\"bg-dark\");\n this.el.classList.remove(\"bg-light\");\n this.el.classList.remove(\"bg-primary\");\n\n this._btnSearch.classList.remove(\"btn-outline-info\");\n\n this._btnSearch.classList.remove(\"btn-outline-light\");\n\n this._btnSearch.classList.remove(\"btn-outline-primary\"); // See which classes to add\n\n\n switch (navbarType) {\n // Dark\n case NavbarTypes.Dark:\n // Add the class\n this.el.classList.add(\"navbar-dark\");\n this.el.classList.add(\"bg-dark\");\n\n this._btnSearch.classList.add(\"btn-outline-info\");\n\n break;\n // Primary\n\n case NavbarTypes.Primary:\n // Add the class\n this.el.classList.add(\"navbar-dark\");\n this.el.classList.add(\"bg-primary\");\n\n this._btnSearch.classList.add(\"btn-outline-light\");\n\n break;\n // Default - Light\n\n default:\n // Add the class\n this.el.classList.add(\"navbar-light\");\n this.el.classList.add(\"bg-light\");\n\n this._btnSearch.classList.add(\"btn-outline-primary\");\n\n break;\n }\n };\n\n return _Navbar;\n}(base_1.Base);\n\nexports.Navbar = function (props, template, itemTemplate) {\n return new _Navbar(props, template, itemTemplate);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/navbar/index.ts?");
|
|
1273
|
+
eval("\n\nvar __extends = this && this.__extends || function () {\n var _extendStatics = function extendStatics(d, b) {\n _extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n }\n };\n\n return _extendStatics(d, b);\n };\n\n return function (d, b) {\n _extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.Navbar = exports.NavbarTypes = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./src/components/base.ts\");\n\nvar button_1 = __webpack_require__(/*! ../button */ \"./src/components/button/index.ts\");\n\nvar common_1 = __webpack_require__(/*! ../common */ \"./src/components/common.ts\");\n\nvar item_1 = __webpack_require__(/*! ./item */ \"./src/components/navbar/item.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/navbar/templates.ts\");\n/**\r\n * Navbar Types\r\n */\n\n\nvar NavbarTypes;\n\n(function (NavbarTypes) {\n NavbarTypes[NavbarTypes[\"Dark\"] = 1] = \"Dark\";\n NavbarTypes[NavbarTypes[\"Light\"] = 2] = \"Light\";\n NavbarTypes[NavbarTypes[\"Primary\"] = 3] = \"Primary\";\n})(NavbarTypes = exports.NavbarTypes || (exports.NavbarTypes = {}));\n/**\r\n * Navbar\r\n */\n\n\nvar _Navbar =\n/** @class */\nfunction (_super) {\n __extends(_Navbar, _super); // Constructor\n\n\n function _Navbar(props, template, itemTemplate) {\n if (template === void 0) {\n template = templates_1.HTML;\n }\n\n var _this = _super.call(this, template, props) || this;\n\n _this._items = null; // Configure the collapse\n\n _this.configure(itemTemplate); // Configure search\n\n\n _this.configureSearch(); // Configure the events\n\n\n _this.configureEvents(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the card group\n\n\n _Navbar.prototype.configure = function (itemTemplate) {\n // See if there is a brand\n var brand = this.el.querySelector(\".navbar-brand\");\n\n if (brand) {\n if (this.props.brand) {\n // Update the brand\n this.props.brandUrl ? brand.href = this.props.brandUrl : null; // Append the content\n\n common_1.appendContent(brand, this.props.brand);\n } else {\n // Remove the brand\n brand.parentNode.removeChild(brand);\n }\n } // Update the nav bar\n\n\n var navbar = this.el.querySelector(\".navbar-collapse\");\n\n if (navbar) {\n navbar.id = this.props.id || \"navbar_content\";\n } // Set the toggle\n\n\n var toggler = this.el.querySelector(\".navbar-toggler\");\n\n if (toggler) {\n toggler.setAttribute(\"aria-controls\", navbar.id);\n toggler.setAttribute(\"data-bs-target\", \"#\" + navbar.id);\n } // Set the scroll\n\n\n var nav = this.el.querySelector(\".navbar-nav\");\n\n if (nav && this.props.enableScrolling) {\n // Add the class\n nav.classList.add(\"navbar-nav-scroll\");\n } // Add the classes based on the type\n\n\n this._btnSearch = this.el.querySelector(\"button[type='submit']\"); // Set the type\n\n this.setType(this.props.type); // Render the items\n\n this.renderItems(itemTemplate);\n }; // Configure the events\n\n\n _Navbar.prototype.configureEvents = function () {\n var _this = this;\n\n var props = this.props.searchBox || {}; // See if search events exist\n\n var searchbox = this.el.querySelector(\"form input\");\n\n if (searchbox) {\n // Set a keydown event to catch the \"Enter\" key being pressed\n searchbox.addEventListener(\"keydown\", function (ev) {\n // See if the \"Enter\" key was pressed\n if (ev.code == \"13\") {\n // Disable the postback\n ev.preventDefault(); // See if there is a search event\n\n if (props.onSearch) {\n // Call the event\n props.onSearch(searchbox.value, ev);\n }\n }\n }); // See if a change event exists\n\n if (props.onChange) {\n // Add an input event\n searchbox.addEventListener(\"input\", function (ev) {\n // Call the event\n props.onChange(searchbox.value, ev);\n }); // Add a clear event\n\n searchbox.addEventListener(\"clear\", function (ev) {\n // Call the event\n props.onChange(searchbox.value, ev);\n }); // Edge has a bug where the clear event isn't triggered\n // See if this is the Edge browser\n\n if (window.navigator.userAgent.indexOf(\"Edge\") > 0) {\n // Detect the mouse click event\n searchbox.addEventListener(\"mouseup\", function () {\n var currentValue = searchbox.value; // Set a timeout to see if the value is cleared\n\n setTimeout(function () {\n // Compare the values\n if (currentValue != searchbox.value) {\n // Call the event\n props.onChange(searchbox.value);\n }\n }, 1);\n });\n }\n }\n } // See if a search event exists\n\n\n var button = this.el.querySelector(\"form button\");\n\n if (button && props.onSearch) {\n // Add a click event\n button.addEventListener(\"click\", function (ev) {\n // Prevent the page from moving to the top\n ev.preventDefault(); // Call the event\n\n props.onSearch(searchbox.value);\n });\n } // See if the toggle exists\n\n\n var btnToggle = this.el.querySelector(\".navbar-toggler\");\n\n if (btnToggle) {\n // Add a click event\n btnToggle.addEventListener(\"click\", function (ev) {\n var elNav = _this.el.querySelector(\".navbar-collapse\"); // See if it's visible\n\n\n if (!btnToggle.classList.contains(\"collapsed\") && elNav.classList.contains(\"show\")) {\n // Start the animation\n elNav.style.height = elNav.getBoundingClientRect()[\"height\"] + \"px\";\n setTimeout(function () {\n elNav.classList.add(\"collapsing\");\n elNav.classList.remove(\"collapse\");\n elNav.classList.remove(\"show\");\n elNav.style.height = \"\";\n btnToggle.classList.add(\"collapsed\");\n }, 10); // Wait for the animation to complete\n\n setTimeout(function () {\n elNav.classList.remove(\"collapsing\");\n elNav.classList.add(\"collapse\");\n }, 250);\n } else {\n // Start the animation\n elNav.classList.remove(\"collapse\");\n elNav.classList.add(\"collapsing\");\n elNav.style.height = _this.el.scrollHeight + \"px\";\n btnToggle.classList.remove(\"collapsed\"); // Wait for the animation to complete\n\n setTimeout(function () {\n elNav.classList.remove(\"collapsing\");\n elNav.classList.add(\"collapse\");\n elNav.classList.add(\"show\");\n elNav.style.height = \"\";\n }, 250);\n }\n });\n } // Execute the event(s)\n\n\n this.props.onRendered ? this.props.onRendered(this.el) : null;\n }; // Configures search\n\n\n _Navbar.prototype.configureSearch = function () {\n // See if we are rendering a search box\n var search = this.el.querySelector(\"form\");\n\n if (search) {\n if (this.props.enableSearch != false && this.props.searchBox) {\n var props = this.props.searchBox || {}; // Update the searchbox\n\n var searchbox = search.querySelector(\"input\");\n searchbox.placeholder = props.placeholder || searchbox.placeholder;\n searchbox.value = props.value || \"\";\n props.btnText ? searchbox.setAttribute(\"aria-label\", props.btnText) : null; // See if we are rendering a button\n\n var button = search.querySelector(\"button\");\n\n if (props.hideButton == true) {\n // Remove the button\n search.removeChild(button);\n } else {\n // Set the button type class name\n var className = button_1.ButtonClassNames.getByType(props.btnType);\n className ? button.classList.add(className) : null;\n }\n } else {\n // Remove the searchbox\n search.parentNode.removeChild(search);\n }\n }\n }; // Render the items\n\n\n _Navbar.prototype.renderItems = function (itemTemplate) {\n // Clear the list\n this._items = []; // Create the navbar list\n\n var list = this.el.querySelector(\"ul.navbar-nav\");\n\n if (list) {\n // Parse the items\n var items = this.props.items || [];\n\n for (var i = 0; i < items.length; i++) {\n // Create the item\n var item = new item_1.NavbarItem(items[i], this.props, itemTemplate);\n\n this._items.push(item);\n\n list.appendChild(item.el); // Call the render events\n\n this.props.onItemRendered ? this.props.onItemRendered(item.el, items[i]) : null;\n }\n } // Create the navbar right list\n\n\n list = this.el.querySelectorAll(\"ul.navbar-nav\")[1];\n\n if (list) {\n // See if no items exist\n var items = this.props.itemsEnd || [];\n\n if (items.length == 0) {\n // Remove the element\n list.remove();\n } else {\n // Parse the items\n for (var i = 0; i < items.length; i++) {\n // Create the item\n var item = new item_1.NavbarItem(items[i], this.props, itemTemplate);\n\n this._items.push(item);\n\n list.appendChild(item.el);\n }\n }\n }\n };\n /**\r\n * Public Methods\r\n */\n // Updates the navbar template type\n\n\n _Navbar.prototype.setType = function (navbarType) {\n // Remove the classes\n this.el.classList.remove(\"navbar-dark\");\n this.el.classList.remove(\"navbar-light\");\n this.el.classList.remove(\"bg-dark\");\n this.el.classList.remove(\"bg-light\");\n this.el.classList.remove(\"bg-primary\");\n\n this._btnSearch.classList.remove(\"btn-outline-info\");\n\n this._btnSearch.classList.remove(\"btn-outline-light\");\n\n this._btnSearch.classList.remove(\"btn-outline-primary\"); // See which classes to add\n\n\n switch (navbarType) {\n // Dark\n case NavbarTypes.Dark:\n // Add the class\n this.el.classList.add(\"navbar-dark\");\n this.el.classList.add(\"bg-dark\");\n\n this._btnSearch.classList.add(\"btn-outline-info\");\n\n break;\n // Primary\n\n case NavbarTypes.Primary:\n // Add the class\n this.el.classList.add(\"navbar-dark\");\n this.el.classList.add(\"bg-primary\");\n\n this._btnSearch.classList.add(\"btn-outline-light\");\n\n break;\n // Default - Light\n\n default:\n // Add the class\n this.el.classList.add(\"navbar-light\");\n this.el.classList.add(\"bg-light\");\n\n this._btnSearch.classList.add(\"btn-outline-primary\");\n\n break;\n }\n };\n\n return _Navbar;\n}(base_1.Base);\n\nexports.Navbar = function (props, template, itemTemplate) {\n return new _Navbar(props, template, itemTemplate);\n};\n\n//# sourceURL=webpack://gd-bs/./src/components/navbar/index.ts?");
|
|
1274
1274
|
|
|
1275
1275
|
/***/ }),
|
|
1276
1276
|
|