angular-st-components
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -1,1 +0,1 @@ | ||
!function(t){var e={};function s(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)s.d(i,n,function(e){return t[e]}.bind(null,n));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=20)}([function(t,e,s){"use strict";s.d(e,"a",function(){return c});var i=s(9),n=s.n(i),a=s(10),r=s.n(a),o=s(11),l=s.n(o);class c{static injectNg(t,e,s){for(let i=0,n=t.length;i<n;i++)s[e[i]]=t[i]}static setTranslation(t){if(angular.isDefined(t)){if(angular.isString(t))return{translationId:t};if(angular.isObject(t))return t}}static setTranslations(t){if(angular.isObject(t))for(let e in t)t[e]=this.setTranslation(t[e]);return t}static removeFromArray(t,e,s){if(!t||!t.length)return;let{length:i}=t;for(;i--;)t[i][e]===s&&t.splice(i,1)}static isEmpty(t){return!t||!t.length}static generateId(){let t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}static pushWith(t,e,s,i){let a=n()(s,i,e);return r()(t,a,e)}static throttle(t,e=150){if(this.thrs[t]){let s=(new Date).getTime();return!(s-this.thrs[t]<e)&&(this.thrs[t]=s,!0)}return this.thrs[t]=(new Date).getTime(),!0}static isObjectEmpty(t){for(let e in t)return!1;return!0}static exists(t,e,...s){if(!t||this.isObjectEmpty(t))return!1;let i="and";e.includes(":")&&"or"===e.substr(e.indexOf(":")+1)&&(i="or");let n=l()(t,e);return!!n&&(s?"and"===i?!s.some(t=>!t(n)):s.some(t=>!t(n)):!!n)}static deleteIfExists(t,e){let s=angular.copy(t);return e in s&&delete s[e],s}}c.thrs={}},function(t,e,s){"use strict";const i={backdrop:!0,keyboard:!0,windowClass:"dialogs-default",backdropClass:"dialogs-backdrop-default",copy:!0,windowTemplate:null,size:"lg",animation:!0},n={closeOnSelect:!0,visibleOptions:8,id:null,comparator:angular.equals,delayAutoSelect:50,orderBy:[],clearSearch:!0,checkForSimilarity:!0,similarityPerc:33,similarity:"similarity",autoSelectSimilarity:90};s.d(e,"a",function(){return i}),s.d(e,"b",function(){return n})},function(t,e){function s(t,e){if(t=t.replace(/\s+/g,""),e=e.replace(/\s+/g,""),!t.length&&!e.length)return 1;if(!t.length||!e.length)return 0;if(t===e)return 1;if(1===t.length&&1===e.length)return 0;if(t.length<2||e.length<2)return 0;let s=new Map;for(let e=0;e<t.length-1;e++){const i=t.substr(e,2),n=s.has(i)?s.get(i)+1:1;s.set(i,n)}let i=0;for(let t=0;t<e.length-1;t++){const n=e.substr(t,2),a=s.has(n)?s.get(n):0;a>0&&(s.set(n,a-1),i++)}return 2*i/(t.length+e.length-2)}t.exports={compareTwoStrings:s,findBestMatch:function(t,e){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find(t=>"string"!=typeof t)}(t,e))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const i=[];let n=0;for(let a=0;a<e.length;a++){const r=e[a],o=s(t,r);i.push({target:r,rating:o}),o>i[n].rating&&(n=a)}const a=i[n];return{ratings:i,bestMatch:a,bestMatchIndex:n}}}},function(t,e){t.exports=require("lodash/orderBy")},function(t,e,s){var i,n,a={},r=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===n&&(n=i.apply(this,arguments)),n}),o=function(t){var e={};return function(t,s){if("function"==typeof t)return t();if(void 0===e[t]){var i=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,s);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}}(),l=null,c=0,h=[],d=s(16);function u(t,e){for(var s=0;s<t.length;s++){var i=t[s],n=a[i.id];if(n){n.refs++;for(var r=0;r<n.parts.length;r++)n.parts[r](i.parts[r]);for(;r<i.parts.length;r++)n.parts.push(y(i.parts[r],e))}else{var o=[];for(r=0;r<i.parts.length;r++)o.push(y(i.parts[r],e));a[i.id]={id:i.id,refs:1,parts:o}}}}function p(t,e){for(var s=[],i={},n=0;n<t.length;n++){var a=t[n],r=e.base?a[0]+e.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};i[r]?i[r].parts.push(o):s.push(i[r]={id:r,parts:[o]})}return s}function g(t,e){var s=o(t.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?s.insertBefore(e,i.nextSibling):s.appendChild(e):s.insertBefore(e,s.firstChild),h.push(e);else if("bottom"===t.insertAt)s.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var n=o(t.insertAt.before,s);s.insertBefore(e,n)}}function f(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function m(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return s.nc}();i&&(t.attrs.nonce=i)}return b(e,t.attrs),g(t,e),e}function b(t,e){Object.keys(e).forEach(function(s){t.setAttribute(s,e[s])})}function y(t,e){var s,i,n,a;if(e.transform&&t.css){if(!(a="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=a}if(e.singleton){var r=c++;s=l||(l=m(e)),i=S.bind(null,s,r,!1),n=S.bind(null,s,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),g(t,e),e}(e),i=function(t,e,s){var i=s.css,n=s.sourceMap,a=void 0===e.convertToAbsoluteUrls&&n;(e.convertToAbsoluteUrls||a)&&(i=d(i));n&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var r=new Blob([i],{type:"text/css"}),o=t.href;t.href=URL.createObjectURL(r),o&&URL.revokeObjectURL(o)}.bind(null,s,e),n=function(){f(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(e),i=function(t,e){var s=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=s;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(s))}}.bind(null,s),n=function(){f(s)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else n()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var s=p(t,e);return u(s,e),function(t){for(var i=[],n=0;n<s.length;n++){var r=s[n];(o=a[r.id]).refs--,i.push(o)}t&&u(p(t,e),e);for(n=0;n<i.length;n++){var o;if(0===(o=i[n]).refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete a[o.id]}}}};var v,$=(v=[],function(t,e){return v[t]=e,v.filter(Boolean).join("\n")});function S(t,e,s,i){var n=s?"":i.css;if(t.styleSheet)t.styleSheet.cssText=$(e,n);else{var a=document.createTextNode(n),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(a,r[e]):t.appendChild(a)}}},function(t,e){t.exports='<div class=modal-header ng-class=$ctrl.classes.header> <button type=button class=close ng-click=$ctrl.close()>×</button> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class="modal-body text-{{$ctrl.classes.text}}" bind-html-compile=$ctrl.msg></div> <div class=modal-footer> <button type=button class=btn ng-class=$ctrl.classes.btnClose ng-click=$ctrl.close() translate={{$ctrl.btnText.close}}></button> </div>'},function(t,e){t.exports="<div class=modal-header ng-class=$ctrl.classes.header> <button class=close ng-click=$ctrl.no() type=button>×</button> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body bind-html-compile=$ctrl.msg></div> <div class=modal-footer> <button class=btn ng-class=$ctrl.classes.btnAccept ng-click=$ctrl.yes() type=button translate={{$ctrl.btnText.accept}}></button> <button class=btn ng-class=$ctrl.classes.btnClose ng-click=$ctrl.no() type=button translate={{$ctrl.btnText.close}}></button> </div>"},function(t,e){t.exports='<div class="dialog-header-confirm modal-header"> <button class=close ng-click=$ctrl.no() type=button>×</button> <h4 class=modal-title> <span class="fas fa-question-circle"></span> <span translate=ui-grid-st-confirm-deletion translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body> <ul class=list-group> <li class="list-group-item list-group-item-action ui-grid-st-deletion-animation" ng-repeat="row in $ctrl.data" ng-class="{\'not-removable\': row.notRemovable}" tooltip-enable=row.notRemovable tooltip-popup-delay=378 uib-tooltip="{{$ctrl.config.verify.msg | translate}}"> <span ng-if=!$ctrl.config.noLabel translate="{{$ctrl.config.label || $ctrl.config.confirmDeletion}}"></span>: <span ng-bind="$ctrl._get(row, $ctrl.config.confirmDeletion)"></span> <div class="loading-bar-spinner-list pull-right" ng-if=$ctrl.config.loading> <div class=spinner-icon></div> </div> <a class="badge badge-danger" ng-if=$ctrl.config.deleteFromList> <span class="fas fa-times" ng-click=$ctrl.remove(row)></span> </a> </li></ul> </div> <div class=modal-footer> <button class="btn btn-primary" ng-click=$ctrl.yes() type=button ng-disabled=!$ctrl.hasRemovables translate=DIALOGS_YES></button> <button class="btn btn-default" ng-click=$ctrl.no() type=button translate=DIALOGS_NO></button> </div>'},function(t,e){t.exports='<div class=modal-header ng-class=$ctrl.classes.header> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body> <span bind-html-compile=$ctrl.msg></span> <div class="active progress progress-striped"> <div class="progress-bar progress-bar-info" ng-style=$ctrl.getProgress></div> <span class=sr-only> <span ng-bind=$ctrl.progress></span> <span translate=DIALOGS_PERCENT_COMPLETE></span> </span> </div> </div>'},function(t,e){t.exports=require("lodash/pullAllWith")},function(t,e){t.exports=require("lodash/unionWith")},function(t,e){t.exports=require("lodash/get")},function(t,e){t.exports=require("lodash/maxBy")},function(t,e){t.exports='<div id={{$ctrl.containerId}} class="st-typeahead-container {{$ctrl.addClass}}" click-outside=$ctrl.close() ng-click="$ctrl._setModel(\'Touched\')" ng-class="{\'st-typeahead-choices-open\': $ctrl.isOpen}" ng-disabled=$ctrl.ngDisabled> <div class=st-typeahead-match> <div class=st-typeahead-selected ng-if="$ctrl.modelValue && $ctrl.modelValue.length"> <span ng-repeat="item in $ctrl.modelValue" ng-dblclick="$ctrl.remove($event, item, $index)" ng-click="$ctrl.selectMatch($event, item, $index)" click-outside="$ctrl.matchSelected = {}" class="btn btn-default btn-xs st-typeahead-selected-item" ng-class="{\'btn-primary\': $ctrl.isMatch(item)}" ng-disabled="$ctrl.ngDisabled || $ctrl.selectedDisabled(item)"> <span ng-bind="$ctrl.getter(item) | truncate: $ctrl.config.truncate"></span> <span class=st-typeahead-selected-item-remove ng-click="$ctrl.remove($event, item, $index)">×</span> </span> </div> <div class=st-typeahead-search> <input id={{$ctrl.inputId}} ng-model=$ctrl.search ng-model-options="{debounce: 499}" class=form-control ng-keypress=$ctrl.keypress($event) ng-keyup=$ctrl.keyup($event) ng-keydown=$ctrl.keydown($event) ng-disabled=$ctrl.ngDisabled translate-attr="{placeholder: $ctrl.trs.placeholder.translationId}" translate-values=$ctrl.trs.placeholder.values autocapitalize=off autocomplete=off autocorrect=off role=combobox spellcheck=false type=search ondrop=return!1 /> <span class=spinner-icon ng-show=$ctrl.loading></span> </div> </div> <div class=st-typeahead-choices ng-show=$ctrl.isChoicesVisible> <ul class=st-typeahead-choices-list ng-style=$ctrl.visibleOptions ui-scroll-viewport> <li class=st-typeahead-choices-messages ng-if=!$ctrl.options.length> <span class=st-typeahead-choices-msg-item ng-show=$ctrl.loading style=display:flex> <span class=spinner-icon style=position:initial></span> </span> <span class=st-typeahead-choices-msg-item ng-if=$ctrl.trs.noDataFound ng-hide=$ctrl.loading translate={{$ctrl.trs.noDataFound.translationId}} translate-values=$ctrl.trs.noDataFound.values></span> </li> <li ng-repeat="item in $ctrl.options track by $index" class=st-typeahead-choices-item ng-bind-html=$ctrl.getter(item) ng-click="$ctrl.select($event, item, $index)" ng-disabled=$ctrl.optionDisabled(item) ng-class="{\'st-typeahead-choices-item-match\': $ctrl.isOptionSelected(item)}" id="{{\'item-\'+$index}}"> </li> </ul> </div> </div>'},function(t,e,s){var i=s(15);"string"==typeof i&&(i=[[t.i,i,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};s(4)(i,n);i.locals&&(t.exports=i.locals)},function(t,e,s){},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var s=e.protocol+"//"+e.host,i=s+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var n,a=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?t:(n=0===a.indexOf("//")?a:0===a.indexOf("/")?s+a:i+a.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")})}},function(t,e,s){var i=s(18);"string"==typeof i&&(i=[[t.i,i,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};s(4)(i,n);i.locals&&(t.exports=i.locals)},function(t,e,s){},function(t,e,s){"use strict";s.r(e);var i=s(1);class n{constructor(t){this.StDialogsDefaults=t}set all(t){angular.isObject(t)&&angular.merge(this.StDialogsDefaults,t)}$get(){return this}}n.$inject=["StDialogsDefaults"];var a=s(0);let r=["$uibModalInstance","data","texts","classes","btnText"];class o{static get $inject(){return r}constructor(...t){a.a.injectNg(t,r,this)}close(){this.$uibModalInstance.close()}$onInit(){this.msg=this.texts.msg;let{icon:t}=this.classes;this.classes.icon=angular.isDefined(t)&&angular.isString(t)?t:"fas fa-exclamation-triangle",this.header=a.a.setTranslation(this.texts.header)}}let l=["$uibModalInstance","texts","data","classes"];class c{static get $inject(){return l}constructor(...t){a.a.injectNg(t,l,this)}$onInit(){this.msg=this.texts.msg;let{icon:t}=this.classes;this.classes.icon=angular.isDefined(t)&&angular.isString(t)?t:"fas fa-question-circle",this.header=a.a.setTranslation(this.texts.header)}no(){this.$uibModalInstance.dismiss("no")}yes(){this.$uibModalInstance.close("yes")}}let h=["$uibModalInstance","data","config"];class d{static get $inject(){return h}constructor(...t){a.a.injectNg(t,h,this)}remove(t){a.a.removeFromArray(this.data,"$$hashKey",t.$$hashKey),a.a.isEmpty(this.data)&&this.$uibModalInstance.dismiss("no-data")}_get(t,e){return getSafe(t,e)}get hasRemovables(){return this.data.some(t=>!t.notRemovable)&&!this.config.loading}no(){this.$uibModalInstance.dismiss("no")}yes(){this.$uibModalInstance.close(this.data.filter(t=>!t.notRemovable))}}let u=["$uibModalInstance","$timeout","texts","classes","progressInfo"];class p{static get $inject(){return u}constructor(...t){a.a.injectNg(t,u,this)}close(){this.$uibModalInstance.close()}get getProgress(){let t=this.progressInfo.progress/this.progressInfo.total*100;return t===this.progressInfo.total&&this.$timeout(()=>this.close(),250),{width:"".concat(t,"%")}}$onInit(){this.msg=this.texts.msg;let{total:t,progress:e}=this.progressInfo;this.progressInfo.total=angular.isDefined(t)?t:200,this.progressInfo.progress=angular.isDefined(e)?e:0;let{icon:s}=this.classes;this.classes.icon=angular.isDefined(s)&&angular.isString(s)?s:"fas fa-clock",this.header=a.a.setTranslation(this.texts.header)}}var g=s(5),f=s.n(g),m=s(6),b=s.n(m),y=s(7),v=s.n(y),$=s(8),S=s.n($);let O=["StDialogsDefaults","$uibModal","$templateCache","$uibModalStack","$window","$timeout"];angular.module("st.dialogs",["ui.bootstrap.modal","ngAnimate"]).constant("StDialogsDefaults",i.a).provider("StDialogsConfig",n).service("StDialogs",class{static get $inject(){return O}constructor(...t){a.a.injectNg(t,O,this)}mergeConfig(t,e){return e||(e="dialogs"),angular.isObject(t)||(t={}),angular.merge({},this.StDialogsDefaults[e],t)}getBaseConfig(t,e,s,i){let n={};angular.isObject(i)?angular.forEach(i,(t,e)=>{n[e]=()=>t}):n={data:()=>i};let a={controller:s,controllerAs:"$ctrl",resolve:n};return e.isUrl?a.templateUrl=e.template:a.template=e.template,Object.assign({},t,a)}_applyRendered(t,e){if(e.rendered)if(angular.isFunction(e.rendered))e.rendered.apply(e.rendered.this,e.rendered.values);else if(isPlainObject(e.rendered)){let{rendered:s}=e;t.rendered.then(()=>{let t=this.$uibModalStack.getTop().value.modalDomEl,e=angular.element(t[0].querySelectorAll(s.selector));s.apply in e&&e[s.apply].apply(e,s.values)})}return t}error(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-error",text:"danger",icon:s.icon||"fas fa-exclamation-triangle",btnClose:"btn-danger"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}wait(t,e,s,i){i=this.mergeConfig(i);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},progressInfo:s,classes:{header:"dialog-header-wait",icon:i.icon||"fas fa-clock"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(i,{template:S.a},p,n)),i)}notify(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-notify",text:"info",icon:s.icon||"fas fa-info-circle",btnClose:"btn-primary"},btnText:{close:"DIALOGS_OK"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}success(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-success",text:"success",icon:s.icon||"fas fa-check-circle",btnClose:"btn-success"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}infoModule(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-notify",text:"dark",icon:s.icon||"fas fa-info-circle",btnClose:"btn-primary"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}confirm(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-confirm",icon:s.icon||"fas fa-question-circle",btnClose:"btn-default",btnAccept:"btn-primary"},btnText:{accept:"DIALOGS_YES",close:"DIALOGS_NO"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:b.a},c,n)),s)}confirmDeletion(t,e={},s={}){s=this.mergeConfig(s),isPlainObject(e)||(e={});let i={data:t,config:e},n={};n=e.templateUrl?{template:e.templateUrl,isUrl:!0}:{template:v.a};let a=this.getBaseConfig(s,n,d,i);return this._applyRendered(this.$uibModal.open(a),e)}create(t,e,s){if(s=this.mergeConfig(s),angular.isString(t))t={component:t};else{if(!isPlainObject(t))throw new Error("Needs to be an Object | string");if(!(t.template||t.templateUrl||t.controller||t.component))throw new Error("Needs a component or controller/template")}let i=Object.assign({},s,t,{resolve:{data:()=>t.copy?angular.copy(e):e}});return this._applyRendered(this.$uibModal.open(i),t)}})},function(t,e,s){"use strict";s.r(e);s(14),s(17);s(19),s(21);function i(t,e,s){return{restrict:"A",link:function(i,n,a){s(function(){var r=void 0!==a.outsideIfNot?a.outsideIfNot.split(/[ ,]+/):[];function o(t){var o,l,c,h,d,u;if(!angular.element(n).hasClass("ng-hide")&&t&&t.target){for(l=t.target;l;l=l.parentNode){if(l===n[0])return;if(h=l.id,d=l.className,u=r.length,d&&void 0!==d.baseVal&&(d=d.baseVal),d||h)for(o=0;o<u;o++)if(c=new RegExp("\\b"+r[o]+"\\b"),void 0!==h&&h===r[o]||d&&c.test(d))return}s(function(){e(a.clickOutside)(i,{event:t})})}}function l(){return"ontouchstart"in window||navigator.maxTouchPoints}l()&&t.on("touchstart",o),t.on("click",o),i.$on("$destroy",function(){l()&&t.off("touchstart",o),t.off("click",o)})})}}}i.$inject=["$document","$parse","$timeout"],angular.module("st.components",["st.dialogs","st.typeahead"]).directive("clickOutside",i).filter("truncate",function(){return(t,e)=>!e||e<0?t:t&&t.length>e?t.substr(0,e)+"...":t})},function(t,e,s){"use strict";s.r(e);var i=s(1),n=s(2),a=s(0),r=s(3),o=s.n(r),l=s(12),c=s.n(l);let h=["StTypeaheadDefaults","$http","$scope","$timeout","$element","$attrs"];var d=s(13);const u={require:{ngModel:"^"},bindings:{data:"<?",rest:"@?",restParams:"<?",config:"<?",onSelect:"&?",onRemove:"&?",onRefresh:"&?",inputId:"@?",addClass:"@?",ngDisabled:"<?",ngRequired:"<?",translations:"<?",api:"=?",isOptionDisabled:"&?",isSelectedDisabled:"&?",limit:"<?"},controller:class{static get $inject(){return h}constructor(...t){this.bestMatch={},this.lastSelected=[],this.allOptionsDisabled=!1,a.a.injectNg(t,h,this)}optionDisabled(t){return!!this.allOptionsDisabled||!!(this.isOptionDisabled&&this.options.length&&this.isOptionDisabled({$item:t}))}selectedDisabled(t){return!(!this.isSelectedDisabled||!this.modelValue.length)&&this.isSelectedDisabled({$item:t})}get modelValue(){return this.ngModel.$viewValue}get hasAnySelectable(){return!!this.rest||!!this.options.length}get showNoDataFound(){return this.isOpen&&this.translations.noDataFound&&!this.options.length}get showLoading(){return this.isOpen&&this.loading&&!this.options.length}get isChoicesVisible(){return this.isOpen&&this.hasAnySelectable||this.showLoading||this.showNoDataFound}get visibleOptions(){return{height:"".concat(this.options.length?28*Math.min(this.config.visibleOptions,this.options.length)+8:28,"px")}}isMatch(t){return t&&!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(t,this.matchSelected)}isOptionSelected(t){return t&&!a.a.isObjectEmpty(this.optionSelected)&&this.config.comparator(t,this.optionSelected)}open(){this.isOpen||(this.isOpen=!0)}close(){this.isOpen&&(this.isOpen=!1)}_setModel(t){t="$set".concat(t),this.ngModel[t]()}_setValidity(t,e){switch(t){case"required":(angular.isDefined(this.ngRequired)||angular.isDefined(this.$attrs.required))&&(e=!!this.modelValue.length,this.ngModel.$setValidity(t,e));break;case"limit":this.ngModel.$setValidity(t,e)}}checkForLimit(){if(this.limit){let t=this.modelValue.length>this.limit.limit,e=this.modelValue.length===this.limit.limit;"validator"===this.limit.type?this._setValidity("limit",!t):this.allOptionsDisabled=e}}select(t,e,s){if(t&&t.stopPropagation(),this.ngDisabled||this.optionDisabled(e))return;let i=a.a.deleteIfExists(e,"similarity");this.ngModel.$viewValue.push(i),this.lastSelected.push(e),this.options.splice(s,1),this.config.closeOnSelect&&this.close(),this._setModel("Dirty"),this._setValidity("required"),this.$searchElement[0].focus(),this.checkForLimit(),this.config.clearSearch&&(this.search=""),this.onSelect&&this.onSelect({$item:i})}remove(t,e,s){if(t.stopPropagation(),this.ngDisabled||this.selectedDisabled(e))return;let i=a.a.deleteIfExists(e,"similarity");angular.isUndefined(s)&&(s=this.modelValue.findIndex(t=>this.config.comparator(t,e))),this.ngModel.$viewValue.splice(s,1),this.options.unshift(e),this._setModel("Dirty"),this._setValidity("required"),this.checkForLimit(),this.onRemove&&this.onRemove({$item:i})}getter(t){return this.config.label?t[this.config.label]:t}getOptionsApi(){this.loading=!0;let t={url:this.rest,method:"GET"};angular.isObject(this.rest)&&(t=this.rest),this.restParams&&(t.params=this.restParams),this.$http(t).then(t=>{let e=t.data?t.data:t;if(a.a.exists(this.api,"rest.result",angular.isFunction)&&this.api.rest.result({response:angular.copy(t)}),(e=e.filter(t=>!this.modelValue.some(e=>this.config.comparator(t,e)))).length||(this.restBlocked=this.config.keepRefreshing),this.hadError=!1,this.config.checkForSimilarity){let t=this.search.toLowerCase();this.options=e.filter((s,i)=>{let a=Object(n.compareTwoStrings)(s[this.config.label].toLowerCase(),t);return e[i].similarity=a,a>this.config.similarityPerc/100}),this.options=o()(this.options,"similarity","desc").slice(0,this.config.visibleOptions),this.findBestMatch()}else this.options=e.slice(0,this.config.visibleOptions),this.config.similarity&&this.findBestMatch()}).finally(()=>{this.loading=!1}).catch(t=>{a.a.exists(this.api,"rest.error",angular.isFunction)&&this.api.rest.error({response:angular.copy(t)})})}getOptionsLocal(){if(angular.isArray(this.data))if(this.config.checkForSimilarity){let t=this.search.toLowerCase();this.options=o()(angular.copy(this.data).map(e=>(e.similarity=Object(n.compareTwoStrings)(e[this.config.label].toLowerCase(),t),e)).filter(t=>t.similarity>this.config.similarityPerc/100),"similarity","desc").slice(0,this.config.visibleOptions),this.findBestMatch()}else this.options=angular.copy(this.data).slice(0,this.config.visibleOptions),this.config.similarity&&this.findBestMatch()}findBestMatch(){this.$timeout(()=>{1===this.options.length&&this.options[0][this.config.similarity]>this.config.autoSelectSimilarity/100?this.select(null,this.options[0],0):0!==this.options.length&&(this.optionSelected=c()(this.options,this.config.similarity))},this.config.delayAutoSelect)}selectMatch(t,e,s){t.stopPropagation(),this._setModel("Touched"),a.a.throttle("stTypeaheadSelectMatch")&&(this.ngDisabled||this.selectedDisabled(e)||(!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(this.matchSelected,e)?this.matchSelected={}:this.matchSelected=e))}keyup(t){if(a.a.throttle("stTypeaheadKeyup"))switch(t.which){case 8:this.handleBackspace(t)}}handleBackspace(t){let e=this.modelValue.length;!this.search&&e&&(!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(this.matchSelected,this.modelValue[e-1])?this.remove(t,this.matchSelected,e-1):this.matchSelected=this.modelValue[e-1])}handleCtrlZ(t){if(!t.ctrlKey&&a.a.isEmpty(this.lastSelected)||!this.modelValue.length)return;t.preventDefault();let e=this.lastSelected.length-1;this.remove(t,this.lastSelected[e]),this.lastSelected.pop()}handleDown(t){if(a.a.isObjectEmpty(this.optionSelected))this.optionSelected=this.options[0];else{let t=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(t)&&t<this.options.length-1?this.optionSelected=this.options[t+1]:this.optionSelected=this.options[0]}}handleUp(t){if(a.a.isObjectEmpty(this.optionSelected))return;let e=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(e)&&e>0?this.optionSelected=this.options[e-1]:0===e&&(this.optionSelected=this.options[this.options.length-1])}handleUpDown(t){if(t.preventDefault(),this.isOpen&&this.options.length&&a.a.throttle("stTypeaheadHandleUpDown",100))switch(t.which){case 38:this.handleUp(t);break;case 40:this.handleDown(t)}}handleEnterTab(t){if(t.preventDefault(),this.isOpen||!this.search){if(!a.a.isObjectEmpty(this.optionSelected)){let e=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(e)&&(this.select(t,this.optionSelected,e),this.optionSelected=this.options[e]?this.options[e]:this.options[e-1])}}else this.open()}keydown(t){switch(t.which){case 90:this.handleCtrlZ(t);break;case 38:case 40:this.handleUpDown(t);break;case 13:case 9:this.handleEnterTab(t)}}_setApi(){this.api&&this.data&&(this.api.refreshLocal=this.getOptionsLocal)}$postLink(){this.$searchElement=this.$element.find("input")}$onInit(){if(this.containerId=a.a.generateId(),!this.data&&!this.rest)throw new Error("Need REST or ARRAY");if(this.data&&this.rest)throw new Error("Cant't have both REST and OPTIONS");this.options=[],this.config?this.config=angular.merge({},this.StTypeaheadDefaults,this.config):this.config=this.StTypeaheadDefaults,angular.isString(this.config.id)&&(this.config.comparator=(t,e)=>t[this.config.id]===e[this.config.id]),this.modelValue||this.ngModel.$setViewValue([]),this._setModel("Pristine"),this.modelValue.length||this._setValidity("required",!1),this.trs=a.a.setTranslations(this.translations),angular.isNumber(this.limit)&&(this.limit={limit:this.limit,type:"block"}),this.$scope.$watch(()=>this.search,(t,e)=>{this.ngDisabled||t!==e&&(this.open(),this.optionSelected={},this.rest?(this.onRefresh&&this.onRefresh({$search:this.search}),this.$timeout(()=>{this.getOptionsApi()})):this.$timeout(()=>{this.getOptionsLocal()}))})}},template:s.n(d).a};angular.module("st.typeahead",[]).constant("StTypeaheadDefaults",i.b).component("stTypeaheadMultiple",u)}]); | ||
!function(t){var e={};function s(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)s.d(i,n,function(e){return t[e]}.bind(null,n));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=20)}([function(t,e,s){"use strict";s.d(e,"a",function(){return c});var i=s(9),n=s.n(i),a=s(10),r=s.n(a),o=s(11),l=s.n(o);class c{static injectNg(t,e,s){for(let i=0,n=t.length;i<n;i++)s[e[i]]=t[i]}static setTranslation(t){if(angular.isDefined(t)){if(angular.isString(t))return{translationId:t};if(angular.isObject(t))return t}}static setTranslations(t){if(angular.isObject(t))for(let e in t)t[e]=this.setTranslation(t[e]);return t}static removeFromArray(t,e,s){if(!t||!t.length)return;let{length:i}=t;for(;i--;)t[i][e]===s&&t.splice(i,1)}static isEmpty(t){return!t||!t.length}static generateId(){let t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}static pushWith(t,e,s,i){let a=n()(s,i,e);return r()(t,a,e)}static throttle(t,e=150){if(this.thrs[t]){let s=(new Date).getTime();return!(s-this.thrs[t]<e)&&(this.thrs[t]=s,!0)}return this.thrs[t]=(new Date).getTime(),!0}static isObjectEmpty(t){for(let e in t)return!1;return!0}static exists(t,e,...s){if(!t||this.isObjectEmpty(t))return!1;let i="and";e.includes(":")&&"or"===e.substr(e.indexOf(":")+1)&&(i="or");let n=l()(t,e);return!!n&&(s?"and"===i?!s.some(t=>!t(n)):s.some(t=>!t(n)):!!n)}static deleteIfExists(t,e){let s=angular.copy(t);return e in s&&delete s[e],s}}c.thrs={}},function(t,e,s){"use strict";const i={backdrop:!0,keyboard:!0,windowClass:"dialogs-default",backdropClass:"dialogs-backdrop-default",copy:!0,windowTemplate:null,size:"lg",animation:!0},n={closeOnSelect:!0,visibleOptions:8,id:null,comparator:angular.equals,delayAutoSelect:50,orderBy:[],clearSearch:!0,checkForSimilarity:!0,similarityPerc:33,similarity:"similarity",autoSelectSimilarity:90};s.d(e,"a",function(){return i}),s.d(e,"b",function(){return n})},function(t,e){function s(t,e){if(t=t.replace(/\s+/g,""),e=e.replace(/\s+/g,""),!t.length&&!e.length)return 1;if(!t.length||!e.length)return 0;if(t===e)return 1;if(1===t.length&&1===e.length)return 0;if(t.length<2||e.length<2)return 0;let s=new Map;for(let e=0;e<t.length-1;e++){const i=t.substr(e,2),n=s.has(i)?s.get(i)+1:1;s.set(i,n)}let i=0;for(let t=0;t<e.length-1;t++){const n=e.substr(t,2),a=s.has(n)?s.get(n):0;a>0&&(s.set(n,a-1),i++)}return 2*i/(t.length+e.length-2)}t.exports={compareTwoStrings:s,findBestMatch:function(t,e){if(!function(t,e){return"string"==typeof t&&!!Array.isArray(e)&&!!e.length&&!e.find(t=>"string"!=typeof t)}(t,e))throw new Error("Bad arguments: First argument should be a string, second should be an array of strings");const i=[];let n=0;for(let a=0;a<e.length;a++){const r=e[a],o=s(t,r);i.push({target:r,rating:o}),o>i[n].rating&&(n=a)}const a=i[n];return{ratings:i,bestMatch:a,bestMatchIndex:n}}}},function(t,e){t.exports=require("lodash/orderBy")},function(t,e,s){var i,n,a={},r=(i=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===n&&(n=i.apply(this,arguments)),n}),o=function(t){var e={};return function(t,s){if("function"==typeof t)return t();if(void 0===e[t]){var i=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,s);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}}(),l=null,c=0,h=[],d=s(16);function u(t,e){for(var s=0;s<t.length;s++){var i=t[s],n=a[i.id];if(n){n.refs++;for(var r=0;r<n.parts.length;r++)n.parts[r](i.parts[r]);for(;r<i.parts.length;r++)n.parts.push(y(i.parts[r],e))}else{var o=[];for(r=0;r<i.parts.length;r++)o.push(y(i.parts[r],e));a[i.id]={id:i.id,refs:1,parts:o}}}}function p(t,e){for(var s=[],i={},n=0;n<t.length;n++){var a=t[n],r=e.base?a[0]+e.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};i[r]?i[r].parts.push(o):s.push(i[r]={id:r,parts:[o]})}return s}function g(t,e){var s=o(t.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var i=h[h.length-1];if("top"===t.insertAt)i?i.nextSibling?s.insertBefore(e,i.nextSibling):s.appendChild(e):s.insertBefore(e,s.firstChild),h.push(e);else if("bottom"===t.insertAt)s.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var n=o(t.insertAt.before,s);s.insertBefore(e,n)}}function f(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=h.indexOf(t);e>=0&&h.splice(e,1)}function m(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var i=function(){0;return s.nc}();i&&(t.attrs.nonce=i)}return b(e,t.attrs),g(t,e),e}function b(t,e){Object.keys(e).forEach(function(s){t.setAttribute(s,e[s])})}function y(t,e){var s,i,n,a;if(e.transform&&t.css){if(!(a="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=a}if(e.singleton){var r=c++;s=l||(l=m(e)),i=S.bind(null,s,r,!1),n=S.bind(null,s,r,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),g(t,e),e}(e),i=function(t,e,s){var i=s.css,n=s.sourceMap,a=void 0===e.convertToAbsoluteUrls&&n;(e.convertToAbsoluteUrls||a)&&(i=d(i));n&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var r=new Blob([i],{type:"text/css"}),o=t.href;t.href=URL.createObjectURL(r),o&&URL.revokeObjectURL(o)}.bind(null,s,e),n=function(){f(s),s.href&&URL.revokeObjectURL(s.href)}):(s=m(e),i=function(t,e){var s=e.css,i=e.media;i&&t.setAttribute("media",i);if(t.styleSheet)t.styleSheet.cssText=s;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(s))}}.bind(null,s),n=function(){f(s)});return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else n()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var s=p(t,e);return u(s,e),function(t){for(var i=[],n=0;n<s.length;n++){var r=s[n];(o=a[r.id]).refs--,i.push(o)}t&&u(p(t,e),e);for(n=0;n<i.length;n++){var o;if(0===(o=i[n]).refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete a[o.id]}}}};var v,$=(v=[],function(t,e){return v[t]=e,v.filter(Boolean).join("\n")});function S(t,e,s,i){var n=s?"":i.css;if(t.styleSheet)t.styleSheet.cssText=$(e,n);else{var a=document.createTextNode(n),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(a,r[e]):t.appendChild(a)}}},function(t,e){t.exports='<div class=modal-header ng-class=$ctrl.classes.header> <button type=button class=close ng-click=$ctrl.close()>×</button> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class="modal-body text-{{$ctrl.classes.text}}" bind-html-compile=$ctrl.msg></div> <div class=modal-footer> <button type=button class=btn ng-class=$ctrl.classes.btnClose ng-click=$ctrl.close() translate={{$ctrl.btnText.close}}></button> </div>'},function(t,e){t.exports="<div class=modal-header ng-class=$ctrl.classes.header> <button class=close ng-click=$ctrl.no() type=button>×</button> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body bind-html-compile=$ctrl.msg></div> <div class=modal-footer> <button class=btn ng-class=$ctrl.classes.btnAccept ng-click=$ctrl.yes() type=button translate={{$ctrl.btnText.accept}}></button> <button class=btn ng-class=$ctrl.classes.btnClose ng-click=$ctrl.no() type=button translate={{$ctrl.btnText.close}}></button> </div>"},function(t,e){t.exports='<div class="dialog-header-confirm modal-header"> <button class=close ng-click=$ctrl.no() type=button>×</button> <h4 class=modal-title> <span class="fas fa-question-circle"></span> <span translate=ui-grid-st-confirm-deletion translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body> <ul class=list-group> <li class="list-group-item list-group-item-action ui-grid-st-deletion-animation" ng-repeat="row in $ctrl.data" ng-class="{\'not-removable\': row.notRemovable}" tooltip-enable=row.notRemovable tooltip-popup-delay=378 uib-tooltip="{{$ctrl.config.verify.msg | translate}}"> <span ng-if=!$ctrl.config.noLabel translate="{{$ctrl.config.label || $ctrl.config.confirmDeletion}}"></span>: <span ng-bind="$ctrl._get(row, $ctrl.config.confirmDeletion)"></span> <div class="loading-bar-spinner-list pull-right" ng-if=$ctrl.config.loading> <div class=spinner-icon></div> </div> <a class="badge badge-danger" ng-if=$ctrl.config.deleteFromList> <span class="fas fa-times" ng-click=$ctrl.remove(row)></span> </a> </li></ul> </div> <div class=modal-footer> <button class="btn btn-primary" ng-click=$ctrl.yes() type=button ng-disabled=!$ctrl.hasRemovables translate=DIALOGS_YES></button> <button class="btn btn-default" ng-click=$ctrl.no() type=button translate=DIALOGS_NO></button> </div>'},function(t,e){t.exports='<div class=modal-header ng-class=$ctrl.classes.header> <h4 class=modal-title> <span ng-class=$ctrl.classes.icon></span> <span translate={{$ctrl.header.translationId}} translate-values={{$ctrl.header.values}}></span> </h4> </div> <div class=modal-body> <span bind-html-compile=$ctrl.msg></span> <div class="active progress progress-striped"> <div class="progress-bar progress-bar-info" ng-style=$ctrl.getProgress></div> <span class=sr-only> <span ng-bind=$ctrl.progress></span> <span translate=DIALOGS_PERCENT_COMPLETE></span> </span> </div> </div>'},function(t,e){t.exports=require("lodash/pullAllWith")},function(t,e){t.exports=require("lodash/unionWith")},function(t,e){t.exports=require("lodash/get")},function(t,e){t.exports=require("lodash/maxBy")},function(t,e){t.exports='<div id={{$ctrl.containerId}} class="st-typeahead-container {{$ctrl.addClass}}" click-outside=$ctrl.close() ng-click="$ctrl._setModel(\'Touched\')" ng-class="{\'st-typeahead-choices-open\': $ctrl.isOpen}" ng-disabled=$ctrl.ngDisabled> <div class=st-typeahead-match> <div class=st-typeahead-selected ng-if="$ctrl.modelValue && $ctrl.modelValue.length"> <span ng-repeat="item in $ctrl.modelValue" ng-dblclick="$ctrl.remove($event, item, $index)" ng-click="$ctrl.selectMatch($event, item, $index)" click-outside="$ctrl.matchSelected = {}" class="btn btn-default btn-xs st-typeahead-selected-item" ng-class="{\'btn-primary\': $ctrl.isMatch(item)}" ng-disabled="$ctrl.ngDisabled || $ctrl.selectedDisabled(item)"> <span ng-bind="$ctrl.getter(item) | truncate: $ctrl.config.truncate"></span> <span class=st-typeahead-selected-item-remove ng-click="$ctrl.remove($event, item, $index)">×</span> </span> </div> <div class=st-typeahead-search> <input id={{$ctrl.inputId}} ng-model=$ctrl.search ng-model-options="{debounce: 499}" class=form-control ng-keypress=$ctrl.keypress($event) ng-keyup=$ctrl.keyup($event) ng-keydown=$ctrl.keydown($event) ng-disabled=$ctrl.ngDisabled translate-attr="{placeholder: $ctrl.trs.placeholder.translationId}" translate-values=$ctrl.trs.placeholder.values autocapitalize=off autocomplete=off autocorrect=off role=combobox spellcheck=false type=search ondrop=return!1 /> <span class=spinner-icon ng-show=$ctrl.loading></span> </div> </div> <div class=st-typeahead-choices ng-show=$ctrl.isChoicesVisible> <ul class=st-typeahead-choices-list ng-style=$ctrl.visibleOptions ui-scroll-viewport> <li class=st-typeahead-choices-messages ng-if=!$ctrl.options.length> <span class=st-typeahead-choices-msg-item ng-show=$ctrl.loading style=display:flex> <span class=spinner-icon style=position:initial></span> </span> <span class=st-typeahead-choices-msg-item ng-if=$ctrl.trs.noDataFound ng-hide=$ctrl.loading translate={{$ctrl.trs.noDataFound.translationId}} translate-values=$ctrl.trs.noDataFound.values></span> </li> <li ng-repeat="item in $ctrl.options track by $index" class=st-typeahead-choices-item ng-bind-html=$ctrl.getter(item) ng-click="$ctrl.select($event, item, $index)" ng-disabled=$ctrl.optionDisabled(item) ng-class="{\'st-typeahead-choices-item-match\': $ctrl.isOptionSelected(item)}" id="{{\'item-\'+$index}}"> </li> </ul> </div> </div>'},function(t,e,s){var i=s(15);"string"==typeof i&&(i=[[t.i,i,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};s(4)(i,n);i.locals&&(t.exports=i.locals)},function(t,e,s){},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var s=e.protocol+"//"+e.host,i=s+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var n,a=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?t:(n=0===a.indexOf("//")?a:0===a.indexOf("/")?s+a:i+a.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")})}},function(t,e,s){var i=s(18);"string"==typeof i&&(i=[[t.i,i,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};s(4)(i,n);i.locals&&(t.exports=i.locals)},function(t,e,s){},function(t,e,s){"use strict";s.r(e);var i=s(1);class n{constructor(t){this.StDialogsDefaults=t}set all(t){angular.isObject(t)&&angular.merge(this.StDialogsDefaults,t)}$get(){return this}}n.$inject=["StDialogsDefaults"];var a=s(0);let r=["$uibModalInstance","data","texts","classes","btnText"];class o{static get $inject(){return r}constructor(...t){a.a.injectNg(t,r,this)}close(){this.$uibModalInstance.close()}$onInit(){this.msg=this.texts.msg;let{icon:t}=this.classes;this.classes.icon=angular.isDefined(t)&&angular.isString(t)?t:"fas fa-exclamation-triangle",this.header=a.a.setTranslation(this.texts.header)}}let l=["$uibModalInstance","texts","data","classes"];class c{static get $inject(){return l}constructor(...t){a.a.injectNg(t,l,this)}$onInit(){this.msg=this.texts.msg;let{icon:t}=this.classes;this.classes.icon=angular.isDefined(t)&&angular.isString(t)?t:"fas fa-question-circle",this.header=a.a.setTranslation(this.texts.header)}no(){this.$uibModalInstance.dismiss("no")}yes(){this.$uibModalInstance.close("yes")}}let h=["$uibModalInstance","data","config"];class d{static get $inject(){return h}constructor(...t){a.a.injectNg(t,h,this)}remove(t){a.a.removeFromArray(this.data,"$$hashKey",t.$$hashKey),a.a.isEmpty(this.data)&&this.$uibModalInstance.dismiss("no-data")}_get(t,e){return getSafe(t,e)}get hasRemovables(){return this.data.some(t=>!t.notRemovable)&&!this.config.loading}no(){this.$uibModalInstance.dismiss("no")}yes(){this.$uibModalInstance.close(this.data.filter(t=>!t.notRemovable))}}let u=["$uibModalInstance","$timeout","texts","classes","progressInfo"];class p{static get $inject(){return u}constructor(...t){a.a.injectNg(t,u,this)}close(){this.$uibModalInstance.close()}get getProgress(){let t=this.progressInfo.progress/this.progressInfo.total*100;return t===this.progressInfo.total&&this.$timeout(()=>this.close(),250),{width:"".concat(t,"%")}}$onInit(){this.msg=this.texts.msg;let{total:t,progress:e}=this.progressInfo;this.progressInfo.total=angular.isDefined(t)?t:200,this.progressInfo.progress=angular.isDefined(e)?e:0;let{icon:s}=this.classes;this.classes.icon=angular.isDefined(s)&&angular.isString(s)?s:"fas fa-clock",this.header=a.a.setTranslation(this.texts.header)}}var g=s(5),f=s.n(g),m=s(6),b=s.n(m),y=s(7),v=s.n(y),$=s(8),S=s.n($);let O=["StDialogsDefaults","$uibModal","$templateCache","$uibModalStack","$window","$timeout"];angular.module("st.dialogs",["ui.bootstrap.modal","ngAnimate"]).constant("StDialogsDefaults",i.a).provider("StDialogsConfig",n).service("StDialogs",class{static get $inject(){return O}constructor(...t){a.a.injectNg(t,O,this)}mergeConfig(t,e){return e||(e="dialogs"),angular.isObject(t)||(t={}),angular.merge({},this.StDialogsDefaults[e],t)}getBaseConfig(t,e,s,i){let n={};angular.isObject(i)?angular.forEach(i,(t,e)=>{n[e]=()=>t}):n={data:()=>i};let a={controller:s,controllerAs:"$ctrl",resolve:n};return e.isUrl?a.templateUrl=e.template:a.template=e.template,Object.assign({},t,a)}_applyRendered(t,e){if(e.rendered)if(angular.isFunction(e.rendered))e.rendered.apply(e.rendered.this,e.rendered.values);else if(isPlainObject(e.rendered)){let{rendered:s}=e;t.rendered.then(()=>{let t=this.$uibModalStack.getTop().value.modalDomEl,e=angular.element(t[0].querySelectorAll(s.selector));s.apply in e&&e[s.apply].apply(e,s.values)})}return t}error(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-error",text:"danger",icon:s.icon||"fas fa-exclamation-triangle",btnClose:"btn-danger"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}wait(t,e,s,i){i=this.mergeConfig(i);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},progressInfo:s,classes:{header:"dialog-header-wait",icon:i.icon||"fas fa-clock"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(i,{template:S.a},p,n)),i)}notify(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-notify",text:"info",icon:s.icon||"fas fa-info-circle",btnClose:"btn-primary"},btnText:{close:"DIALOGS_OK"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}success(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-success",text:"success",icon:s.icon||"fas fa-check-circle",btnClose:"btn-success"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}infoModule(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-notify",text:"dark",icon:s.icon||"fas fa-info-circle",btnClose:"btn-primary"},btnText:{close:"DIALOGS_CLOSE"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:f.a},o,n)),s)}confirm(t,e,s,i={}){s=this.mergeConfig(s);let n={texts:{header:angular.copy(t),msg:angular.copy(e)},data:s.copy?angular.copy(i):i,classes:{header:"dialog-header-confirm",icon:s.icon||"fas fa-question-circle",btnClose:"btn-default",btnAccept:"btn-primary"},btnText:{accept:"DIALOGS_YES",close:"DIALOGS_NO"}};return this._applyRendered(this.$uibModal.open(this.getBaseConfig(s,{template:b.a},c,n)),s)}confirmDeletion(t,e={},s={}){s=this.mergeConfig(s),isPlainObject(e)||(e={});let i={data:t,config:e},n={};n=e.templateUrl?{template:e.templateUrl,isUrl:!0}:{template:v.a};let a=this.getBaseConfig(s,n,d,i);return this._applyRendered(this.$uibModal.open(a),e)}create(t,e,s){if(s=this.mergeConfig(s),angular.isString(t))t={component:t};else{if(!isPlainObject(t))throw new Error("Needs to be an Object | string");if(!(t.template||t.templateUrl||t.controller||t.component))throw new Error("Needs a component or controller/template")}let i=Object.assign({},s,t,{resolve:{data:()=>t.copy?angular.copy(e):e}});return this._applyRendered(this.$uibModal.open(i),t)}})},function(t,e,s){"use strict";s.r(e);s(14),s(17);s(19),s(21);function i(t,e,s){return{restrict:"A",link:function(i,n,a){s(function(){var r=void 0!==a.outsideIfNot?a.outsideIfNot.split(/[ ,]+/):[];function o(t){var o,l,c,h,d,u;if(!angular.element(n).hasClass("ng-hide")&&t&&t.target){for(l=t.target;l;l=l.parentNode){if(l===n[0])return;if(h=l.id,d=l.className,u=r.length,d&&void 0!==d.baseVal&&(d=d.baseVal),d||h)for(o=0;o<u;o++)if(c=new RegExp("\\b"+r[o]+"\\b"),void 0!==h&&h===r[o]||d&&c.test(d))return}s(function(){e(a.clickOutside)(i,{event:t})})}}function l(){return"ontouchstart"in window||navigator.maxTouchPoints}l()&&t.on("touchstart",o),t.on("click",o),i.$on("$destroy",function(){l()&&t.off("touchstart",o),t.off("click",o)})})}}}i.$inject=["$document","$parse","$timeout"],angular.module("st.components",["st.dialogs","st.typeahead"]).directive("clickOutside",i).filter("truncate",function(){return(t,e)=>!e||e<0?t:t&&t.length>e?t.substr(0,e)+"...":t})},function(t,e,s){"use strict";s.r(e);var i=s(1),n=s(2),a=s(0),r=s(3),o=s.n(r),l=s(12),c=s.n(l);let h=["StTypeaheadDefaults","$http","$scope","$timeout","$element","$attrs"];var d=s(13);const u={require:{ngModel:"^"},bindings:{data:"<?",rest:"@?",restParams:"<?",config:"<?",onSelect:"&?",onRemove:"&?",onRefresh:"&?",inputId:"@?",addClass:"@?",ngDisabled:"<?",ngRequired:"<?",translations:"<?",api:"=?",isOptionDisabled:"&?",isSelectedDisabled:"&?",limit:"<?"},controller:class{static get $inject(){return h}constructor(...t){this.bestMatch={},this.lastSelected=[],this.allOptionsDisabled=!1,a.a.injectNg(t,h,this)}optionDisabled(t){return!!this.allOptionsDisabled||!!(this.isOptionDisabled&&this.options.length&&this.isOptionDisabled({$item:t}))}selectedDisabled(t){return!(!this.isSelectedDisabled||!this.modelValue.length)&&this.isSelectedDisabled({$item:t})}get modelValue(){return this.ngModel.$viewValue}get hasAnySelectable(){return!!this.rest||!!this.options.length}get showNoDataFound(){return this.isOpen&&this.translations.noDataFound&&!this.options.length}get showLoading(){return this.isOpen&&this.loading&&!this.options.length}get isChoicesVisible(){return this.isOpen&&this.hasAnySelectable||this.showLoading||this.showNoDataFound}get visibleOptions(){return{height:"".concat(this.options.length?28*Math.min(this.config.visibleOptions,this.options.length)+8:28,"px")}}isMatch(t){return t&&!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(t,this.matchSelected)}isOptionSelected(t){return t&&!a.a.isObjectEmpty(this.optionSelected)&&this.config.comparator(t,this.optionSelected)}open(){this.isOpen||(this.isOpen=!0)}close(){this.isOpen&&(this.isOpen=!1)}_setModel(t){t="$set".concat(t),this.ngModel[t]()}_setValidity(t,e){switch(t){case"required":(angular.isDefined(this.ngRequired)||angular.isDefined(this.$attrs.required))&&(e=!!this.modelValue.length,this.ngModel.$setValidity(t,e));break;case"limit":this.ngModel.$setValidity(t,e)}}checkForLimit(){if(this.limit){let t=this.modelValue.length>this.limit.limit,e=this.modelValue.length===this.limit.limit;"validator"===this.limit.type?this._setValidity("limit",!t):this.allOptionsDisabled=e}}select(t,e,s){if(t&&t.stopPropagation(),this.ngDisabled||this.optionDisabled(e))return;let i=a.a.deleteIfExists(e,"similarity");this.ngModel.$viewValue.push(i),this.lastSelected.push(e),this.options.splice(s,1),this.config.closeOnSelect&&this.close(),this._setModel("Dirty"),this._setValidity("required"),this.$searchElement[0].focus(),this.checkForLimit(),this.config.clearSearch&&(this.search=""),this.onSelect&&this.onSelect({$item:i})}remove(t,e,s){if(t.stopPropagation(),this.ngDisabled||this.selectedDisabled(e))return;let i=a.a.deleteIfExists(e,"similarity");angular.isUndefined(s)&&(s=this.modelValue.findIndex(t=>this.config.comparator(t,e))),this.ngModel.$viewValue.splice(s,1),this.options.unshift(e),this._setModel("Dirty"),this._setValidity("required"),this.checkForLimit(),this.onRemove&&this.onRemove({$item:i})}getter(t){return this.config.label?t[this.config.label]:t}getOptionsApi(){this.loading=!0;let t={url:this.rest,method:"GET"};angular.isObject(this.rest)&&(t=this.rest),this.restParams&&(t.params=this.restParams),this.$http(t).then(t=>{let e=t.data?t.data:t;if(a.a.exists(this.api,"rest.result",angular.isFunction)&&this.api.rest.result({response:angular.copy(t)}),(e=e.filter(t=>!this.modelValue.some(e=>this.config.comparator(t,e)))).length||(this.restBlocked=this.config.keepRefreshing),this.hadError=!1,this.config.checkForSimilarity){let t=this.search.toLowerCase();this.options=e.filter((s,i)=>{let a=Object(n.compareTwoStrings)(s[this.config.label].toLowerCase(),t);return e[i].similarity=a,a>this.config.similarityPerc/100}),this.options=o()(this.options,"similarity","desc").slice(0,this.config.visibleOptions),this.findBestMatch()}else this.options=e.slice(0,this.config.visibleOptions),this.config.similarity&&this.findBestMatch()}).finally(()=>{this.loading=!1}).catch(t=>{a.a.exists(this.api,"rest.error",angular.isFunction)&&this.api.rest.error({response:angular.copy(t)})})}getOptionsLocal(){if(angular.isArray(this.data))if(this.config.checkForSimilarity){let t=this.search.toLowerCase();this.options=o()(angular.copy(this.data).map(e=>(e.similarity=Object(n.compareTwoStrings)(e[this.config.label].toLowerCase(),t),e)).filter(t=>t.similarity>this.config.similarityPerc/100),"similarity","desc").slice(0,this.config.visibleOptions),this.findBestMatch()}else this.options=angular.copy(this.data).slice(0,this.config.visibleOptions),this.config.similarity&&this.findBestMatch()}findBestMatch(){this.$timeout(()=>{1===this.options.length&&this.options[0][this.config.similarity]>this.config.autoSelectSimilarity/100?this.select(null,this.options[0],0):0!==this.options.length&&(this.optionSelected=c()(this.options,this.config.similarity))},this.config.delayAutoSelect)}selectMatch(t,e,s){t.stopPropagation(),this._setModel("Touched"),a.a.throttle("stTypeaheadSelectMatch")&&(this.ngDisabled||this.selectedDisabled(e)||(!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(this.matchSelected,e)?this.matchSelected={}:this.matchSelected=e))}keyup(t){if(a.a.throttle("stTypeaheadKeyup"))switch(t.which){case 8:this.handleBackspace(t)}}handleBackspace(t){let e=this.modelValue.length;!this.search&&e&&(!a.a.isObjectEmpty(this.matchSelected)&&this.config.comparator(this.matchSelected,this.modelValue[e-1])?this.remove(t,this.matchSelected,e-1):this.matchSelected=this.modelValue[e-1])}handleCtrlZ(t){if(!t.ctrlKey&&a.a.isEmpty(this.lastSelected)||!this.modelValue.length)return;t.preventDefault();let e=this.lastSelected.length-1;this.remove(t,this.lastSelected[e]),this.lastSelected.pop()}handleDown(t){if(a.a.isObjectEmpty(this.optionSelected))this.optionSelected=this.options[0];else{let t=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(t)&&t<this.options.length-1?this.optionSelected=this.options[t+1]:this.optionSelected=this.options[0]}}handleUp(t){if(a.a.isObjectEmpty(this.optionSelected))return;let e=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(e)&&e>0?this.optionSelected=this.options[e-1]:0===e&&(this.optionSelected=this.options[this.options.length-1])}handleUpDown(t){if(t.preventDefault(),this.isOpen&&this.options.length&&a.a.throttle("stTypeaheadHandleUpDown",100))switch(t.which){case 38:this.handleUp(t);break;case 40:this.handleDown(t)}}handleEnterTab(t){if(!this.isOpen&&this.search)return t.preventDefault(),void this.open();if((this.search||9!==t.which)&&!a.a.isObjectEmpty(this.optionSelected)){t.preventDefault();let e=this.options.findIndex(t=>this.config.comparator(t,this.optionSelected));angular.isDefined(e)&&(this.select(t,this.optionSelected,e),this.optionSelected=this.options[e]?this.options[e]:this.options[e-1])}}keydown(t){switch(t.which){case 90:this.handleCtrlZ(t);break;case 38:case 40:this.handleUpDown(t);break;case 13:case 9:this.handleEnterTab(t)}}_setApi(){this.api&&this.data&&(this.api.refreshLocal=this.getOptionsLocal)}$postLink(){this.$searchElement=this.$element.find("input")}$onInit(){if(this.containerId=a.a.generateId(),!this.data&&!this.rest)throw new Error("Need REST or ARRAY");if(this.data&&this.rest)throw new Error("Cant't have both REST and OPTIONS");this.options=[],this.config?this.config=angular.merge({},this.StTypeaheadDefaults,this.config):this.config=this.StTypeaheadDefaults,angular.isString(this.config.id)&&(this.config.comparator=(t,e)=>t[this.config.id]===e[this.config.id]),this.modelValue||this.ngModel.$setViewValue([]),this._setModel("Pristine"),this.modelValue.length||this._setValidity("required",!1),this.trs=a.a.setTranslations(this.translations),angular.isNumber(this.limit)&&(this.limit={limit:this.limit,type:"block"}),this.$scope.$watch(()=>this.search,(t,e)=>{this.ngDisabled||t!==e&&(this.open(),this.optionSelected={},this.rest?(this.onRefresh&&this.onRefresh({$search:this.search}),this.$timeout(()=>{this.getOptionsApi()})):this.$timeout(()=>{this.getOptionsLocal()}))})}},template:s.n(d).a};angular.module("st.typeahead",[]).constant("StTypeaheadDefaults",i.b).component("stTypeaheadMultiple",u)}]); |
{ | ||
"name": "angular-st-components", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Components made by stLmpp for AngularJS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -239,7 +239,10 @@ import { compareTwoStrings } from 'string-similarity'; | ||
handleEnterTab($event){ | ||
$event.preventDefault(); | ||
if (!this.isOpen && this.search) { | ||
$event.preventDefault(); | ||
this.open(); | ||
return; | ||
} else if (!this.search && $event.which === 9) { | ||
return; | ||
} else if (!Util.isObjectEmpty(this.optionSelected)){ | ||
$event.preventDefault(); | ||
let index = this.options.findIndex(o => this.config.comparator(o, this.optionSelected)); | ||
@@ -249,4 +252,3 @@ if (angular.isDefined(index)){ | ||
this.optionSelected = this.options[index] ? this.options[index] : this.options[index-1]; | ||
} | ||
} | ||
} | ||
@@ -253,0 +255,0 @@ |
5296041
76714