emsApplication/applications/WebConfigure/web/js/lib/select.min.js

1 line
12 KiB
JavaScript
Raw Permalink Normal View History

2024-05-24 12:19:45 +08:00
angular.module("oi.select",[]),angular.module("oi.select").provider("oiSelect",function(){return{options:{debounce:500,searchFilter:"oiSelectCloseIcon",dropdownFilter:"oiSelectHighlight",listFilter:"oiSelectAscSort",editItem:!1,newItem:!1,closeList:!0,saveTrigger:"enter tab blur"},version:{full:"0.2.18",major:0,minor:2,dot:18},$get:function(){return{options:this.options,version:this.version}}}}).factory("oiSelectEscape",function(){var e=/[-\/\\^$*+?.()|[\]{}]/g,t="\\$&";return function(n){return String(n).replace(e,t)}}).factory("oiSelectEditItem",function(){return function(e,t,n,r){return r?"":n(e)}}).factory("oiUtils",["$document","$timeout",function(e,t){function n(e,t,n){for(var r=t;r&&r.ownerDocument&&11!==r.nodeType;){if(n){if(r===e)return!1;if(r.className.indexOf(n)>=0)return!0}else if(r===e)return!0;r=r.parentNode}return!1}function r(r,o){function i(e){return e&&"INPUT"!==e.target.nodeName?void 0:(d=!1,c?void(d=!0):void t(function(){r.triggerHandler("blur")}))}function u(){a||(a=!0,t(function(){r.triggerHandler("focus")}))}function s(){c=!0}function l(e){c=!1;var u=e.target,s=n(r[0],u);d&&!s&&i(),s&&"INPUT"!==u.nodeName&&t(function(){o[0].focus()}),!s&&a&&(a=!1)}var a,c,d;return e[0].addEventListener("click",l,!0),r[0].addEventListener("mousedown",s,!0),r[0].addEventListener("blur",i,!0),o.on("focus",u),function(){e[0].removeEventListener("click",l),r[0].removeEventListener("mousedown",s,!0),r[0].removeEventListener("blur",i,!0),o.off("focus",u)}}function o(e,t){var n,r,o,i,s,a;t&&(r=e.offsetHeight,o=l(t,"height","margin"),i=e.scrollTop||0,n=u(t).top-u(e).top+i,s=n,a=n-r+o,n+o>r+i?e.scrollTop=a:i>n&&(e.scrollTop=s))}function i(e,t,n,r,o){function i(e){return parseFloat(o[e])}for(var u=n===(r?"border":"content")?4:"width"===t?1:0,s=0,l=["Top","Right","Bottom","Left"];4>u;u+=2)"margin"===n&&(s+=i(n+l[u])),r?("content"===n&&(s-=i("padding"+l[u])),"margin"!==n&&(s-=i("border"+l[u]+"Width"))):(s+=i("padding"+l[u]),"padding"!==n&&(s+=i("border"+l[u]+"Width")));return s}function u(e){var t,n,r=e.getBoundingClientRect(),o=e&&e.ownerDocument;if(o)return t=o.documentElement,n=s(o),{top:r.top+n.pageYOffset-t.clientTop,left:r.left+n.pageXOffset-t.clientLeft}}function s(e){return null!=e&&e===e.window?e:9===e.nodeType&&e.defaultView}function l(e,t,n){var r=!0,o="width"===t?e.offsetWidth:e.offsetHeight,u=window.getComputedStyle(e,null),s=!1;if(0>=o||null==o){if(o=u[t],(0>o||null==o)&&(o=e.style[t]),g.test(o))return o;o=parseFloat(o)||0}return o+i(e,t,n||(s?"border":"content"),r,u)}function a(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t].length)return!1;return!0}function c(e){var t=[];return angular.forEach(e,function(e,n){"$"!==n.toString().charAt(0)&&t.push(e)}),t}function d(e,t,n,r,o){var i,u,s,l,a,c=o?[].concat(e):[];for(i=0,s=e.length;i<e.length;i++)for(l=n?n(e[i]):e[i],u=0;u<t.length;u++)if(a=r?r(t[u]):t[u],angular.equals(l,a,e,t,i,u)){o?c.splice(i+c.length-s,1):c.push(t[u]);break}return c}function f(e,t,n,r){var o={};return e.split(".").reduce(function(e,n,r,o){return e[n]=r<o.length-1?{}:t},o),r(n,o)}var p=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,g=new RegExp("^("+p+")(?!px)[a-z%]+$","i");return{contains:n,bindFocusBlur:r,scrollActiveOption:o,groupsIsEmpty:a,objToArr:c,getValue:f,intersection:d}}]),angular.module("oi.select").directive("oiSelect",["$document","$q","$timeout","$parse","$interpolate","$injector","$filter","$animate","oiUtils","oiSelect",function(e,t,n,r,o,i,u,s,l,a){var c=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,d=/([^\(\)\s\|\s]*)\s*(\(.*\))?\s*(\|?\s*.+)?/;return{restrict:"AE",templateUrl:"src/template.html",require:"ngModel",scope:{},compile:function(e,f){var p=f.oiOptions,g=p?p.match(c):["","i","","","","i","","",""];if(!g)throw new Error("Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_'");var m,h,v,$,w,b,y,S,I=/ as /.test(g[0])&&g[1],F=g[2]||g[1],k=g[5]||g[7],