gd-bs 5.4.5 → 5.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gd-bs.d.ts CHANGED
@@ -1390,10 +1390,10 @@ declare module 'gd-bs/components/form/formTypes' {
1390
1390
  */
1391
1391
  export interface IForm {
1392
1392
  /** Appends controls to the form */
1393
- appendControls: (controls: Array<IFormControlProps>) => void;
1393
+ appendControls: (controls: Array<IFormControlProps>) => Array<IFormControl>;
1394
1394
 
1395
1395
  /** Appends rows to the form */
1396
- appendRows: (rows: Array<IFormRow>) => void;
1396
+ appendRows: (rows: Array<IFormRow>) => Array<IFormControl>;
1397
1397
 
1398
1398
  /** The form controls */
1399
1399
  controls: Array<IFormControl>;
package/dist/gd-bs.js CHANGED
@@ -1071,7 +1071,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
1071
1071
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1072
1072
 
1073
1073
  "use strict";
1074
- 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\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.FormControl = exports.Form = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./build/components/base.js\");\n\nvar control_1 = __webpack_require__(/*! ./control */ \"./build/components/form/control.js\");\n\nvar group_1 = __webpack_require__(/*! ./group */ \"./build/components/form/group.js\");\n\nvar row_1 = __webpack_require__(/*! ./row */ \"./build/components/form/row.js\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./build/components/form/templates.js\");\n\nvar types_1 = __webpack_require__(/*! ./types */ \"./build/components/form/types.js\");\n\n__exportStar(__webpack_require__(/*! ./custom */ \"./build/components/form/custom.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./types */ \"./build/components/form/types.js\"), exports);\n/**\r\n * Form\r\n * @property props - The form properties.\r\n */\n\n\nvar _Form =\n/** @class */\nfunction (_super) {\n __extends(_Form, _super); // Constructor\n\n\n function _Form(props) {\n var _this = _super.call(this, templates_1.HTML, props) || this;\n\n _this._groups = null;\n _this._rows = null; // Configure the form\n\n _this.configure(); // Configure the events\n\n\n _this.configureEvents(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the form\n\n\n _Form.prototype.configure = function () {\n // Clear the groups and rows\n this._groups = [];\n this._rows = []; // Add the class name\n\n var classNames = (this.props.className || \"\").split(\" \");\n\n for (var i = 0; i < classNames.length; i++) {\n var className = classNames[i]; // Append the class name\n\n className ? this.el.classList.add(className) : null;\n } // Set the floating class\n\n\n this.props.isFloating ? this.el.classList.add(\"form-floating\") : null; // Append the controls\n\n this.appendControls(this.props.controls); // Append the rows\n\n this.appendRows(this.props.rows);\n }; // Configure the events\n\n\n _Form.prototype.configureEvents = function () {\n var _this = this; // See if an onrendered event exists\n\n\n if (this.props.onRendered) {\n // Wait before executing the rendered event, otherwise the controls will be null\n var intervalId_1 = setInterval(function () {\n var isLoaded = true; // Parse the controls\n\n for (var i = 0; i < _this.controls.length; i++) {\n var control = _this.controls[i]; // Set the flag\n\n isLoaded = isLoaded && control && control.isRendered;\n } // See if the form is loaded\n\n\n if (isLoaded) {\n // Clear the interval\n clearInterval(intervalId_1); // Execute the event\n\n _this.props.onRendered(_this.controls);\n }\n }, 10);\n }\n };\n /**\r\n * Public Interface\r\n */\n // Append controls to the form\n\n\n _Form.prototype.appendControls = function (controls) {\n if (controls === void 0) {\n controls = [];\n } // Parse the controls\n\n\n for (var i = 0; i < controls.length; i++) {\n // Create the group\n var group = new group_1.FormGroup(controls[i], this.props);\n\n this._groups.push(group);\n\n this.el.appendChild(group.el);\n }\n }; // Append rows to the form\n\n\n _Form.prototype.appendRows = function (rows) {\n if (rows === void 0) {\n rows = [];\n } // Parse the rows\n\n\n for (var i = 0; i < rows.length; i++) {\n // Create the row\n var row = new row_1.FormRow(rows[i], this.props);\n\n this._rows.push(row);\n\n this.el.appendChild(row.el);\n }\n };\n\n Object.defineProperty(_Form.prototype, \"controls\", {\n // The forms controls\n get: function get() {\n var controls = []; // Parse the groups\n\n for (var i = 0; i < this._groups.length; i++) {\n // Add the control\n controls.push(this._groups[i].control);\n } // Parse the rows\n\n\n for (var i = 0; i < this._rows.length; i++) {\n // Add the controls\n controls = controls.concat(this._rows[i].controls);\n } // Return the controls\n\n\n return controls;\n },\n enumerable: false,\n configurable: true\n }); // Gets a form control by its name\n\n _Form.prototype.getControl = function (name) {\n // Parse the controls\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i]; // See if this is the control we are looking for\n\n if (control && control.props && control.props.name == name) {\n // Return the control\n return control;\n }\n } // Control not found\n\n\n return null;\n }; // Gets the form values\n\n\n _Form.prototype.getValues = function () {\n var values = {}; // Parse the controls\n\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i];\n\n if (control.props.name) {\n // Set the value\n values[control.props.name] = control.getValue();\n }\n } // Return the values\n\n\n return values;\n }; // Validates the form\n\n\n _Form.prototype.isValid = function () {\n var isValid = true; // Parse the controls\n\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n // See if this control is valid\n if (controls[i].isValid == false) {\n // Set the flag\n isValid = false;\n }\n } // Update the classes\n\n\n this.el.classList.remove(\"needs-validation\");\n this.el.classList.add(\"was-validated\"); // Return the flag\n\n return isValid;\n };\n\n return _Form;\n}(base_1.Base);\n\nexports.Form = function (props) {\n return new _Form(props);\n};\n/**\r\n * Form Control\r\n */\n\n\nexports.FormControl = function (props) {\n // Create a base object\n var base = new base_1.Base(\"\", props); // Create the control\n\n var control = new control_1.FormControl(props, {\n validationType: types_1.FormValidationTypes.Default\n }); // Wait for the control to be loaded\n\n control.isLoaded().then(function () {\n // Set the element\n base.el = control.el; // Configure the parent\n\n base.configureParent();\n }); // Return the control\n\n return control;\n};\n\n//# sourceURL=webpack://gd-bs/./build/components/form/index.js?");
1074
+ 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\nvar __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, {\n enumerable: true,\n get: function get() {\n return m[k];\n }\n });\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nvar __exportStar = this && this.__exportStar || function (m, exports) {\n for (var p in m) {\n if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n }\n};\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.FormControl = exports.Form = void 0;\n\nvar base_1 = __webpack_require__(/*! ../base */ \"./build/components/base.js\");\n\nvar control_1 = __webpack_require__(/*! ./control */ \"./build/components/form/control.js\");\n\nvar group_1 = __webpack_require__(/*! ./group */ \"./build/components/form/group.js\");\n\nvar row_1 = __webpack_require__(/*! ./row */ \"./build/components/form/row.js\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./build/components/form/templates.js\");\n\nvar types_1 = __webpack_require__(/*! ./types */ \"./build/components/form/types.js\");\n\n__exportStar(__webpack_require__(/*! ./custom */ \"./build/components/form/custom.js\"), exports);\n\n__exportStar(__webpack_require__(/*! ./types */ \"./build/components/form/types.js\"), exports);\n/**\r\n * Form\r\n * @property props - The form properties.\r\n */\n\n\nvar _Form =\n/** @class */\nfunction (_super) {\n __extends(_Form, _super); // Constructor\n\n\n function _Form(props) {\n var _this = _super.call(this, templates_1.HTML, props) || this;\n\n _this._groups = null;\n _this._rows = null; // Configure the form\n\n _this.configure(); // Configure the events\n\n\n _this.configureEvents(); // Configure the parent\n\n\n _this.configureParent();\n\n return _this;\n } // Configure the form\n\n\n _Form.prototype.configure = function () {\n // Clear the groups and rows\n this._groups = [];\n this._rows = []; // Add the class name\n\n var classNames = (this.props.className || \"\").split(\" \");\n\n for (var i = 0; i < classNames.length; i++) {\n var className = classNames[i]; // Append the class name\n\n className ? this.el.classList.add(className) : null;\n } // Set the floating class\n\n\n this.props.isFloating ? this.el.classList.add(\"form-floating\") : null; // Append the controls\n\n this.appendControls(this.props.controls); // Append the rows\n\n this.appendRows(this.props.rows);\n }; // Configure the events\n\n\n _Form.prototype.configureEvents = function () {\n var _this = this; // See if an onrendered event exists\n\n\n if (this.props.onRendered) {\n // Wait before executing the rendered event, otherwise the controls will be null\n var intervalId_1 = setInterval(function () {\n var isLoaded = true; // Parse the controls\n\n for (var i = 0; i < _this.controls.length; i++) {\n var control = _this.controls[i]; // Set the flag\n\n isLoaded = isLoaded && control && control.isRendered;\n } // See if the form is loaded\n\n\n if (isLoaded) {\n // Clear the interval\n clearInterval(intervalId_1); // Execute the event\n\n _this.props.onRendered(_this.controls);\n }\n }, 10);\n }\n };\n /**\r\n * Public Interface\r\n */\n // Append controls to the form\n\n\n _Form.prototype.appendControls = function (controls) {\n if (controls === void 0) {\n controls = [];\n }\n\n var addedControls = []; // Parse the controls\n\n for (var i = 0; i < controls.length; i++) {\n // Create the group\n var group = new group_1.FormGroup(controls[i], this.props);\n\n this._groups.push(group);\n\n this.el.appendChild(group.el); // Append the control\n\n addedControls.push(group.control);\n } // Return the controls\n\n\n return addedControls;\n }; // Append rows to the form\n\n\n _Form.prototype.appendRows = function (rows) {\n if (rows === void 0) {\n rows = [];\n }\n\n var addedControls = []; // Parse the rows\n\n for (var i = 0; i < rows.length; i++) {\n // Create the row\n var row = new row_1.FormRow(rows[i], this.props);\n\n this._rows.push(row);\n\n this.el.appendChild(row.el); // Append the control\n\n addedControls = addedControls.concat(row.controls);\n } // Return the controls\n\n\n return addedControls;\n };\n\n Object.defineProperty(_Form.prototype, \"controls\", {\n // The forms controls\n get: function get() {\n var controls = []; // Parse the groups\n\n for (var i = 0; i < this._groups.length; i++) {\n // Add the control\n controls.push(this._groups[i].control);\n } // Parse the rows\n\n\n for (var i = 0; i < this._rows.length; i++) {\n // Add the controls\n controls = controls.concat(this._rows[i].controls);\n } // Return the controls\n\n\n return controls;\n },\n enumerable: false,\n configurable: true\n }); // Gets a form control by its name\n\n _Form.prototype.getControl = function (name) {\n // Parse the controls\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i]; // See if this is the control we are looking for\n\n if (control && control.props && control.props.name == name) {\n // Return the control\n return control;\n }\n } // Control not found\n\n\n return null;\n }; // Gets the form values\n\n\n _Form.prototype.getValues = function () {\n var values = {}; // Parse the controls\n\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n var control = controls[i];\n\n if (control.props.name) {\n // Set the value\n values[control.props.name] = control.getValue();\n }\n } // Return the values\n\n\n return values;\n }; // Validates the form\n\n\n _Form.prototype.isValid = function () {\n var isValid = true; // Parse the controls\n\n var controls = this.controls;\n\n for (var i = 0; i < controls.length; i++) {\n // See if this control is valid\n if (controls[i].isValid == false) {\n // Set the flag\n isValid = false;\n }\n } // Update the classes\n\n\n this.el.classList.remove(\"needs-validation\");\n this.el.classList.add(\"was-validated\"); // Return the flag\n\n return isValid;\n };\n\n return _Form;\n}(base_1.Base);\n\nexports.Form = function (props) {\n return new _Form(props);\n};\n/**\r\n * Form Control\r\n */\n\n\nexports.FormControl = function (props) {\n // Create a base object\n var base = new base_1.Base(\"\", props); // Create the control\n\n var control = new control_1.FormControl(props, {\n validationType: types_1.FormValidationTypes.Default\n }); // Wait for the control to be loaded\n\n control.isLoaded().then(function () {\n // Set the element\n base.el = control.el; // Configure the parent\n\n base.configureParent();\n }); // Return the control\n\n return control;\n};\n\n//# sourceURL=webpack://gd-bs/./build/components/form/index.js?");
1075
1075
 
1076
1076
  /***/ }),
1077
1077