/* filename: angular.integralui.checkbox.min.js version : 1.4.5 Copyright � 2014-2018 Lidor Systems. All rights reserved. This file is part of the "IntegralUI" Library. The contents of this file are subject to the IntegralUI Studio for Web License, and may not be used except in compliance with the License. A copy of the License should have been installed in the product's root installation directory or it can be found at http://www.lidorsystems.com/products/web/studio/license-agreement.aspx. This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws. */ angular .module("integralui") .factory("IntegralUICheckBoxService", [ "$rootScope", "IntegralUIPublicService", function(c, l) { return { refresh: function(d) { c.$broadcast(d + "-refresh"); }, resumeLayout: function(d) { c.$broadcast(d + "-resume-layout"); }, suspendLayout: function(d) { c.$broadcast(d + "-suspend-layout"); }, updateLayout: function(d) { c.$broadcast(d + "-update-layout"); } }; } ]) .controller("IntegralUICheckBoxController", [ "$scope", "$element", "IntegralUIInternalService", function(c, l, d) { var b = this; b.defaultStyle = { general: "iui-checkbox", box: { general: "iui-checkbox-box", disabled: "iui-checkbox-box-disabled", checked: "iui-checkbox-checked", indeterminate: "iui-checkbox-indeterminate", unchecked: "iui-checkbox-unchecked" }, content: { general: "iui-checkbox-content", disabled: "iui-checkbox-content-disabled" } }; b.options = {}; this.updateOptions = function(a) { a ? ((b.options = { autoCheck: d.isFieldAvailable(a.autoCheck, !0), checked: d.isFieldAvailable(a.checked, !1), checkState: d.isFieldAvailable(a.checkState, "unchecked"), controlStyle: b.defaultStyle, enabled: d.isFieldAvailable(a.enabled, !0), rtl: d.isFieldAvailable(a.rtl, !1), text: d.isFieldAvailable(a.text, ""), threeState: d.isFieldAvailable(a.threeState, !1) }), b.updateControlStyle(a.controlStyle)) : (b.options = { autoCheck: !0, checked: !1, checkState: "unchecked", controlStyle: b.defaultStyle, enabled: !0, rtl: !1, text: "", threeState: !1 }); }; b.updateOptions(); this.getCheckValue = function(a) { return "checked" == a ? "checked" : 1 == b.options.threeState && "indeterminate" == a ? "indeterminate" : "unchecked"; }; this.setCheckValue = function(a) { !1 !== (1 == b.options.threeState ? b.callCheckStateChanging(a) : b.callCheckedChanging(a)) && ((b.options.checkState = "unchecked" == a ? 1 == b.options.threeState ? "indeterminate" : "checked" : "indeterminate" == a ? "checked" : "unchecked"), (b.options.checked = "checked" == b.options.checkState ? !0 : !1), angular.isDefined(c.checked) && (c.checked = b.options.checked), angular.isDefined(c.checkState) && (c.checkState = b.options.checkState), angular.isDefined(c.checkState) || 1 != b.options.threeState ? angular.isDefined(c.checked) || 0 != b.options.threeState || b.callCheckedChanged(b.options.checkState) : b.callCheckStateChanged(b.options.checkState)); }; this.callCheckedChanging = function(a) { a = b.getCheckValue(a); var d = "checked" == a ? !0 : !1; return angular.isDefined(c.events) && c.events.checkedChanging ? c.events.checkedChanging({ checked: d, checkState: a }) : c.checkedChanging({ e: { checked: d, checkState: a } }); }; this.callCheckedChanged = function(a) { a = b.getCheckValue(a); var d = "checked" == a ? !0 : !1; angular.isDefined(c.events) && c.events.checkedChanged ? c.events.checkedChanged({ checked: d, checkState: a }) : c.checkedChanged({ e: { checked: d, checkState: a } }); }; this.callCheckStateChanging = function(a) { a = b.getCheckValue(a); var d = "checked" == a ? !0 : !1; return angular.isDefined(c.events) && c.events.checkstateChanging ? c.events.checkstateChanging({ checked: d, checkState: a }) : c.checkstateChanging({ e: { checked: d, checkState: a } }); }; this.callCheckStateChanged = function(a) { a = b.getCheckValue(a); var d = "checked" == a ? !0 : !1; angular.isDefined(c.events) && c.events.checkstateChanged ? c.events.checkstateChanged({ checked: d, checkState: a }) : c.checkstateChanged({ e: { checked: d, checkState: a } }); }; this.callClick = function(a) { a = b.getCheckValue(a); var d = "checked" == a ? !0 : !1; angular.isDefined(c.events) && c.events.click ? c.events.click({ checked: d, checkState: a }) : c.click({ e: { checked: d, checkState: a } }); }; this.callEnabledChanged = function(a) { angular.isDefined(c.events) && c.events.enabledChanged ? c.events.enabledChanged({ enabled: a }) : c.enabledChanged({ e: { enabled: a } }); }; this.callStyleChanged = function(a) { angular.isDefined(c.events) && c.events.styleChanged ? c.events.styleChanged({ style: a }) : c.styleChanged({ e: { style: a } }); }; b.allowUpdate = !0; this.suspendLayout = function() { b.allowUpdate = !1; }; this.resumeLayout = function() { b.allowUpdate = !0; b.updateLayout(); }; c.$on(c.name + "-refresh", function(a) { b.refresh(); }); c.$on(c.name + "-resume-layout", function(a) { b.resumeLayout(); }); c.$on(c.name + "-suspend-layout", function(a) { b.suspendLayout(); }); c.$on(c.name + "-update-layout", function(a) { b.updateLayout(); }); c.$watch("autoCheck", function(a, c) { a !== c && (b.options.autoCheck = a); }); c.$watch("checked", function(a, c) { a !== c && ((b.options.checked = 1 == a ? !0 : !1), (b.options.checkState = b.options.checked ? "checked" : "unchecked"), b.updateCheckMark(), b.callCheckedChanged(b.options.checkState)); }); c.$watch("checkState", function(a, c) { a !== c && ((b.options.checkState = b.getCheckValue(a)), (b.options.checked = "checked" == b.options.checkState ? !0 : !1), b.updateCheckMark(), b.callCheckStateChanged(b.options.checkState)); }); c.$watch("controlStyle", function(a, c) { a !== c && ((b.options.controlStyle = a), b.refresh(), b.callStyleChanged(a)); }); c.$watch("enabled", function(a, c) { a !== c && ((b.options.enabled = a), b.refresh(), b.updateCheckMark(), b.callEnabledChanged(a)); }); c.$watch( "options", function(a, c) { a !== c && (b.updateOptions(a), b.updateLayout()); }, !0 ); c.$watch("rtl", function(a, c) { a !== c && ((b.options.rtl = a), b.updateLayout()); }); c.$watch("text", function(a, c) { a !== c && (b.options.text = a); }); c.$watch("threeState", function(a, c) { a !== c && ((b.options.threeState = a), 0 == b.options.threeState && "indeterminate" == b.options.checkState && b.setCheckValue("checked")); }); var f = function(a) { return a ? { general: d.isFieldAvailable(a.general, "iui-checkbox-box"), disabled: d.isFieldAvailable( a.disabled, "iui-checkbox-disabled" ), checked: d.isFieldAvailable(a.checked, "iui-checkbox-checked"), indeterminate: d.isFieldAvailable( a.indeterminate, "iui-checkbox-indeterminate" ), unchecked: d.isFieldAvailable( a.unchecked, "iui-checkbox-unchecked" ) } : b.defaultStyle.box; }, m = function(a) { return a ? { general: d.isFieldAvailable(a.general, "iui-checkbox-content"), disabled: d.isFieldAvailable( a.disabled, "iui-checkbox-content-disabled" ) } : b.defaultStyle.content; }; this.updateControlStyle = function(a) { b.options.controlStyle = a ? { general: d.isFieldAvailable(a.general, "iui-checkbox"), box: f(a.box), content: m(a.content) } : { general: d.isFieldAvailable( b.defaultStyle.general, "iui-checkbox" ), box: f(b.defaultStyle.box), content: m(b.defaultStyle.content) }; }; } ]) .directive("iuiCheckbox", [ "$timeout", "$interval", "IntegralUIInternalService", function(c, l, d) { return { restrict: "EA", controller: "IntegralUICheckBoxController", transclude: !0, replace: !0, template: '