gd-bs 5.4.6 → 5.4.7

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.
@@ -100,34 +100,24 @@ var _Form = /** @class */ (function (_super) {
100
100
  // Append controls to the form
101
101
  _Form.prototype.appendControls = function (controls) {
102
102
  if (controls === void 0) { controls = []; }
103
- var addedControls = [];
104
103
  // Parse the controls
105
104
  for (var i = 0; i < controls.length; i++) {
106
105
  // Create the group
107
106
  var group = new group_1.FormGroup(controls[i], this.props);
108
107
  this._groups.push(group);
109
108
  this.el.appendChild(group.el);
110
- // Append the control
111
- addedControls.push(group.control);
112
109
  }
113
- // Return the controls
114
- return addedControls;
115
110
  };
116
111
  // Append rows to the form
117
112
  _Form.prototype.appendRows = function (rows) {
118
113
  if (rows === void 0) { rows = []; }
119
- var addedControls = [];
120
114
  // Parse the rows
121
115
  for (var i = 0; i < rows.length; i++) {
122
116
  // Create the row
123
117
  var row = new row_1.FormRow(rows[i], this.props);
124
118
  this._rows.push(row);
125
119
  this.el.appendChild(row.el);
126
- // Append the control
127
- addedControls = addedControls.concat(row.controls);
128
120
  }
129
- // Return the controls
130
- return addedControls;
131
121
  };
132
122
  Object.defineProperty(_Form.prototype, "controls", {
133
123
  // The forms controls
@@ -1061,7 +1061,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));
1061
1061
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1062
1062
 
1063
1063
  "use strict";
1064
- 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 */ \"./src/components/base.ts\");\n\nvar control_1 = __webpack_require__(/*! ./control */ \"./src/components/form/control.ts\");\n\nvar group_1 = __webpack_require__(/*! ./group */ \"./src/components/form/group.ts\");\n\nvar row_1 = __webpack_require__(/*! ./row */ \"./src/components/form/row.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/form/templates.ts\");\n\nvar types_1 = __webpack_require__(/*! ./types */ \"./src/components/form/types.ts\");\n\n__exportStar(__webpack_require__(/*! ./custom */ \"./src/components/form/custom.ts\"), exports);\n\n__exportStar(__webpack_require__(/*! ./types */ \"./src/components/form/types.ts\"), 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/./src/components/form/index.ts?");
1064
+ 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 */ \"./src/components/base.ts\");\n\nvar control_1 = __webpack_require__(/*! ./control */ \"./src/components/form/control.ts\");\n\nvar group_1 = __webpack_require__(/*! ./group */ \"./src/components/form/group.ts\");\n\nvar row_1 = __webpack_require__(/*! ./row */ \"./src/components/form/row.ts\");\n\nvar templates_1 = __webpack_require__(/*! ./templates */ \"./src/components/form/templates.ts\");\n\nvar types_1 = __webpack_require__(/*! ./types */ \"./src/components/form/types.ts\");\n\n__exportStar(__webpack_require__(/*! ./custom */ \"./src/components/form/custom.ts\"), exports);\n\n__exportStar(__webpack_require__(/*! ./types */ \"./src/components/form/types.ts\"), 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/./src/components/form/index.ts?");
1065
1065
 
1066
1066
  /***/ }),
1067
1067