1var Localization = { 2 GetText: function (key) { 3 return key.loc(); 4 } 5} 6 7var BaseCalculator = /** @class */ (function () { 8 function BaseCalculator() { 9 this.NumberFormatter = new Intl.NumberFormat(); 10 } 11 BaseCalculator.prototype.GetElements = function () { 12 this.Elements = []; 13 var _this = this; 14 $("[data-binding]").each(function () { 15 var e = $(this); 16 var propertyName = e.attr("data-binding"); 17 if (typeof (_this[propertyName]) != "undefined") { 18 _this.Elements.push({ 19 Element: e, 20 PropertyName: propertyName, 21 }); 22 } 23 var tagName = e.prop("tagName"); 24 if (tagName == "INPUT" || tagName == "SELECT") { 25 e.change(function () { 26 _this.OnValueChanged(e[0]); 27 }); 28 } 29 }); 30 }; 31 BaseCalculator.prototype.SyncToElements = function () { 32 for (var _i = 0, _a = this.Elements; _i < _a.length; _i++) { 33 var element = _a[_i]; 34 var value = this[element.PropertyName]; 35 switch (element.Element.prop("tagName")) { 36 case "INPUT": 37 element.Element.val(value); 38 break; 39 case "SELECT": 40 element.Element.find("option[value='" + value + "']").prop("selected", true); 41 break; 42 case "SPAN": 43 case "P": 44 case "DIV": 45 if (typeof (value) == "number") { 46 value = this.NumberFormatter.format(value); 47 } 48 element.Element.html(value); 49 break; 50 default: 51 } 52 } 53 }; 54 BaseCalculator.prototype.SyncFromElements = function () { 55 for (var _i = 0, _a = this.Elements; _i < _a.length; _i++) { 56 var element = _a[_i]; 57 var value; 58 switch (element.Element.prop("tagName")) { 59 case "INPUT": 60 value = element.Element.val(); 61 break; 62 case "SELECT": 63 value = element.Element.find(":selected").val(); 64 break; 65 default: 66 continue; 67 } 68 if (!isNaN(value)) { 69 value = Number(value); 70 } 71 this[element.PropertyName] = value; 72 } 73 }; 74 BaseCalculator.prototype.OnValueChanged = function (element) { }; 75 BaseCalculator.prototype.EnsureInRange = function (value, min, max) { 76 if (value < min) { 77 return min; 78 } 79 if (value > max) { 80 return max; 81 } 82 return value; 83 }; 84 return BaseCalculator; 85}()); 86//# sourceMappingURL=calculator-base.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.