1var __extends = (this && this.__extends) || (function () { 2 var extendStatics = function (d, b) { 3 extendStatics = Object.setPrototypeOf || 4 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 return extendStatics(d, b); 7 }; 8 return function (d, b) { 9 extendStatics(d, b); 10 function __() { this.constructor = d; } 11 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12 }; 13})(); 14var SmartFormsModules; 15(function (SmartFormsModules) { 16 SmartFormsModules.animationSpeed = 300; 17 var mod = SmartFormsModules; 18 var ContainerManager = /** @class */ (function () { 19 function ContainerManager() { 20 } 21 ContainerManager.GetFormDictionary = function (formId) { 22 var item = SmartFormsModules.ContainerManager.ContainerDictionary[formId]; 23 if (item == null) { 24 item = { 25 LastId: 0, 26 Containers: {} 27 }; 28 mod.ContainerManager.ContainerDictionary[formId] = item; 29 } 30 return item; 31 }; 32 ContainerManager.GetNextContainerId = function (formId) { 33 return ++mod.ContainerManager.GetFormDictionary(formId).LastId; 34 }; 35 ContainerManager.ClearContainer = function (formId) { 36 SmartFormsModules.ContainerManager.ContainerDictionary[formId] = null; 37 }; 38 ContainerManager.DeleteContainerOfField = function (field) { 39 var dictionary = mod.ContainerManager.GetFormDictionary(field.GetFormId()); 40 var containerOptions = field.Options.ContainerOptions; 41 if (typeof dictionary.Containers[containerOptions.Id] != 'undefined') 42 delete dictionary.Containers[containerOptions.Id]; 43 }; 44 ContainerManager.CreateOrUpdateContainer = function (field) { 45 var dictionary = mod.ContainerManager.GetFormDictionary(field.GetFormId()); 46 var containerOptions = field.Options.ContainerOptions; 47 var id = containerOptions.Id; 48 if (containerOptions.Id == '0') { 49 id = (++dictionary.LastId).toString(); 50 containerOptions.Id = id; 51 } 52 else { 53 var id_1 = parseInt(containerOptions.Id); 54 if (id_1 > dictionary.LastId) 55 dictionary.LastId = id_1; 56 } 57 var container = dictionary.Containers[id]; 58 if (container == null) { 59 container = mod.ContainerManager.CreateContainer(field); 60 dictionary.Containers[id] = container; 61 } 62 container.IncludeField(field); 63 return container; 64 }; 65 ContainerManager.CreateContainer = function (field) { 66 if (field.Options.ContainerOptions.Type == "single") { 67 if (typeof smartFormsDesignMode != 'undefined' && smartFormsDesignMode) 68 return new SmartFormsModules.ContainerBaseDesigner(new ContainerBase()); 69 return new ContainerBase(); 70 } 71 if (typeof smartFormsDesignMode != 'undefined' && smartFormsDesignMode) 72 return new SmartFormsModules.MultipleElementsContainerDesigner(new MultipleElementsContainer()); 73 return new MultipleElementsContainer(); 74 }; 75 ContainerManager.ContainerDictionary = {}; 76 return ContainerManager; 77 }()); 78 SmartFormsModules.ContainerManager = ContainerManager; 79 /*---------------------------------------------------------------------------------------------------------------------------------------------------*/ 80 var Container = /** @class */ (function () { 81 function Container() { 82 } 83 return Container; 84 }()); 85 SmartFormsModules.Container = Container; 86 var ContainerBase = /** @class */ (function (_super) { 87 __extends(ContainerBase, _super); 88 function ContainerBase() { 89 var _this = _super.call(this) || this; 90 _this.ContainerAddedCallback = null; 91 _this.fields = []; 92 return _this; 93 } 94 Object.defineProperty(ContainerBase.prototype, "Options", { 95 get: function () { 96 return this.fields[0].Options.ContainerOptions; 97 }, 98 enumerable: true, 99 configurable: true 100 }); 101 ContainerBase.prototype.GetContainerId = function () { 102 return this.Options.Id; 103 }; 104 ContainerBase.prototype.IncludeField = function (field) { 105 this.fields.push(field); 106 }; 107 ContainerBase.prototype.AppendJQueryElementToUI = function (elementToAdd, jQueryContainer, animate) { 108 if (elementToAdd.FieldContainer != null && !jQueryContainer.hasClass('fieldContainerOfFields')) 109 return elementToAdd.JQueryElement; 110 this.$container = rnJQuery('<div class="' + this.fields[0].GetElementClasses() + '" id="' + this.fields[0].Id + '">' + this.fields[0].GenerateInlineElement() + '</div>'); 111 jQueryContainer.append(this.$container); 112 if (this.ContainerAddedCallback != null) 113 this.ContainerAddedCallback(); 114 if (elementToAdd.IsFieldContainer && (!elementToAdd.HandleFieldsInternally || smartFormsDesignMode)) //at runtime the fields are handled manually by the field 115 for (var _i = 0, _a = elementToAdd.Fields; _i < _a.length; _i++) { 116 var field = _a[_i]; 117 field.AppendElementToContainer(this.$container.find('.fieldContainerOfFields'), animate); 118 } 119 return this.$container; 120 }; 121 ContainerBase.prototype.GetJQueryContent = function () { 122 var $element = rnJQuery('<div class="' + this.fields[0].GetElementClasses() + '" id="' + this.fields[0].Id + '" >' + this.fields[0].GenerateInlineElement() + '</div>'); 123 if (this.fields[0].IsFieldContainer) { 124 for (var _i = 0, _a = this.fields[0].Fields; _i < _a.length; _i++) { 125 var field = _a[_i]; 126 field.JQueryElement = field.GetContainer().AppendJQueryElementToUI(field, $element.find('.fieldContainerOfFields'), true); 127 /*var $childElement:JQuery=rnJQuery('<div class="'+field.GetElementClasses()+'" id="'+field.Id+'" >'+field.GenerateInlineElement()+'</div>'); 128 129 $element.find('.fieldContainerOfFields').append($childElement); 130 field.JQueryElement=$childElement;*/ 131 } 132 } 133 this.fields[0].JQueryElement = $element; 134 return $element; 135 }; 136 ContainerBase.prototype.ReplaceWithJQueryElement = function (jQueryContainer, animate) { 137 var _this = this; 138 this.$container = this.GetJQueryContent(); 139 if (animate) { 140 this.$container.addClass('rnTemporalHidden'); 141 jQueryContainer.replaceWith(this.$container); 142 var height = this.$container.height(); 143 var width = this.$container.parent().width(); 144 this.$container.width(0); 145 this.$container.height(0); 146 this.$container.removeClass('rnTemporalHidden'); 147 this.$container.css('overflow', 'hidden'); 148 this.$container.velocity({ 'width': width, 'height': height }, SmartFormsModules.animationSpeed, "easeInExp", function () { 149 _this.$container.removeAttr('style'); 150 }); 151 } 152 else { 153 jQueryContainer.replaceWith(this.$container); 154 } 155 if (this.ContainerAddedCallback != null) 156 this.ContainerAddedCallback(); 157 return this.$container; 158 }; 159 ContainerBase.prototype.GetWidth = function (field) { 160 }; 161 return ContainerBase; 162 }(Container));
163 SmartFormsModules.ContainerBase = ContainerBase; 164 /*---------------------------------------------------------------------------------------------------------------------------------------------------*/ 165 var MultipleElementsContainer = /** @class */ (function (_super) { 166 __extends(MultipleElementsContainer, _super); 167 function MultipleElementsContainer() { 168 return _super !== null && _super.apply(this, arguments) || this; 169 } 170 MultipleElementsContainer.prototype.GetJQueryContent = function () { 171 var $content = rnJQuery('<div class="row sfContainer col-sm-12"></div>'); 172 for (var _i = 0, _a = this.fields; _i < _a.length; _i++) { 173 var field = _a[_i]; 174 var $element = this.GenerateItemContent(field); 175 $content.append($element); 176 } 177 return $content; 178 }; 179 MultipleElementsContainer.prototype.AppendJQueryElementToUI = function (elementToAdd, jQueryContainer, animate) { 180 if (elementToAdd.FieldContainer != null && !jQueryContainer.hasClass('fieldContainerOfFields')) 181 return elementToAdd.JQueryElement; 182 if (elementToAdd == this.fields[0]) { 183 this.$container = rnJQuery('<div class="row sfContainer col-sm-12"></div>'); 184 jQueryContainer.append(this.$container); 185 if (this.ContainerAddedCallback != null) 186 this.ContainerAddedCallback(); 187 } 188 var $element = this.GenerateItemContent(elementToAdd); 189 this.$container.append($element); 190 return $element; 191 }; 192 MultipleElementsContainer.prototype.GenerateItemContent = function (field) { 193 var $element = rnJQuery('<div class="' + field.GetElementClasses() + '" id="' + field.Id + '" >' + field.GenerateInlineElement() + '</div>'); 194 if (field.IsFieldContainer) { 195 for (var _i = 0, _a = field.Fields; _i < _a.length; _i++) { 196 var childField = _a[_i]; 197 //childField.JQueryElement=childField.GetContainer().AppendJQueryElementToUI(childField,$element.find('.fieldContainerOfFields'),true); 198 childField.AppendElementToContainer($element.find('.fieldContainerOfFields'), true); 199 } 200 } 201 field.JQueryElement = $element; 202 return $element; 203 }; 204 return MultipleElementsContainer; 205 }(ContainerBase)); 206 SmartFormsModules.MultipleElementsContainer = MultipleElementsContainer; 207})(SmartFormsModules || (SmartFormsModules = {})); 208//# sourceMappingURL=Container.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.