UNPKG

graphdb-workbench

Version:
3 lines 16.4 kB
/*! For license information please see 49694.4e3c2f5c9d0382004d46.bundle.js.LICENSE.txt */ export const __webpack_id__=49694;export const __webpack_ids__=[664,24087,45574,49694];export const __webpack_modules__={664:()=>{function e(e){return{restrict:"A",scope:{min:"=",max:"="},link:function(t,n,r){const l={debounce:_.debounce,delay:100,loadDelay:10,compressor:1,min:r.fitTextMin||"inherit",max:r.fitTextMax||"inherit",calcSize:10,lines:1},i=n.parent(),o=n[0],a=o.style,u=window.getComputedStyle(n[0],null),s=n.children().length||l.lines,c="inherit"===l.min?u["font-size"]:l.min,d="inherit"===l.max?u["font-size"]:l.max,g=u["line-height"],p=u.display;let h;function f(){h&&e.cancel(h),h=e(function(){o.offsetHeight*o.offsetWidth!==0&&(a.fontSize=l.calcSize+"px",a.lineHeight="1",a.display="inline-block",a.fontSize=function(){const e=l.calcSize*s/o.offsetWidth/s;return Math.max(Math.min(function(e){const t=parseFloat(getComputedStyle(i[0]).paddingLeft),n=parseFloat(getComputedStyle(i[0]).paddingRight);return(i[0].offsetWidth-(t+n))*e*l.compressor}(e),parseFloat(d)),parseFloat(c))}()+"px",a.lineHeight=g,a.display=p)},l.loadDelay)}t.$watch(function(){return[i[0].offsetWidth,n[0].offsetWidth].join("_")},function(){f()}),$(window).on("resize",l.debounce(function(){t.$apply(f)},l.delay)),t.$on("$destroy",function(){h&&e.cancel(h),$(window).off("resize")})}}}angular.module("graphdb.framework.core.directives.fittext",[]).directive("fitText",e),e.$inject=["$timeout"]},24087:(e,t,n)=>{n.r(t),n(85369),angular.module("graphdb.framework.explore.directives",["graphdb.framework.utils.uriutils"]).directive("uri",["UriUtils",function(e){return{require:"ngModel",link:function(t,n,r,l){l.$parsers.unshift(function(t){if(!angular.isUndefined(t)&&t.length>0){const n=e.validateRdfUri(t);return l.$setValidity("searchStr",n),n?t:void 0}return l.$setValidity("searchStr",!0),t}),l.$formatters.unshift(function(t){return angular.isUndefined(t)||l.$setValidity("searchStr",e.validateRdfUri),t})}}}])},45574:()=>{function e(){return{transformToTrig:function(e){let t="";const n={};for(let t=0;t<e.length;t++){const r=e[t];if(void 0===r.context?r.context="":r.context=_.trim(r.context),angular.isUndefined(n[r.context])){const e=[];e.push(r),n[r.context]=e}else n[r.context].push(r)}const r=Object.keys(n);for(let e=0;e<r.length;e++){const l=r[e];t+=""===l?"\n{":"\n<"+l+"> {";const i=n[l];for(let e=0;e<i.length;e++){const n=i[e];t+="\n\t<"+n.subject+"> <"+n.predicate+"> ";let r=n.object.value;"uri"===n.object.type?t+="<"+r+"> .":r.toString().includes('"')?("'"===r[0]&&(r='"'+r.slice(1,r.length)),r[r.length-1]&&(r=r.slice(0,-1)+'"'),t+="'''"+r+"'''"+(n.object.datatype?"^^<"+n.object.datatype+">":n.object.lang?"@"+n.object.lang:"")+" ."):t+='"""'+r+'"""'+(n.object.datatype?"^^<"+n.object.datatype+">":n.object.lang?"@"+n.object.lang:"")+" ."}t+="\n}"}return t},buildStatements:function(e,t){const n=[];if(!_.isEmpty(e.data)){const r=e.data[t],l=Object.keys(r);for(let e=0;e<l.length;e++){const i=l[e],o=r[i];for(let e=0;e<o.length;e++){const r=o[e];for(let e=0;e<r.graphs.length;e++){let l=r.graphs[e];"http://www.ontotext.com/explicit"===l&&(l=""),r.lang&&(r.datatype=""),r.datatype||(r.datatype=""),n.push({subject:t,predicate:i,object:{value:r.value,type:r.type,datatype:r.datatype,lang:r.lang},context:l})}}}}return n},getDatatypeOptions:function(){return[{value:"",label:"string"},{value:"http://www.w3.org/2001/XMLSchema#boolean",label:"boolean"},{value:"http://www.w3.org/2001/XMLSchema#decimal",label:"decimal"},{value:"http://www.w3.org/2001/XMLSchema#integer",label:"integer"},{value:"http://www.w3.org/2001/XMLSchema#double",label:"double"},{value:"http://www.w3.org/2001/XMLSchema#float",label:"float"},{value:"http://www.w3.org/2001/XMLSchema#date",label:"date"},{value:"http://www.w3.org/2001/XMLSchema#time",label:"time"},{value:"http://www.w3.org/2001/XMLSchema#dateTime",label:"date time"},{value:"http://www.w3.org/2001/XMLSchema#byte",label:"byte"},{value:"http://www.w3.org/2001/XMLSchema#short",label:"short"},{value:"http://www.w3.org/2001/XMLSchema#int",label:"int"},{value:"http://www.w3.org/2001/XMLSchema#long",label:"long"},{value:"http://www.w3.org/2001/XMLSchema#unsignedByte",label:"unsigned byte"},{value:"http://www.w3.org/2001/XMLSchema#unsignedShort",label:"unsigned short"},{value:"http://www.w3.org/2001/XMLSchema#unsignedInt",label:"unsigned int"},{value:"http://www.w3.org/2001/XMLSchema#unsignedLong",label:"unsigned long"},{value:"http://www.w3.org/2001/XMLSchema#positoveInteger",label:"positive integer"},{value:"http://www.w3.org/2001/XMLSchema#nonNegativeInteger",label:"non-negative integer"},{value:"http://www.w3.org/2001/XMLSchema#negativeInteger",label:"negative integer"},{value:"http://www.w3.org/2001/XMLSchema#nonPositiveInteger",label:"non-positive integer"},{value:"http://www.w3.org/2001/XMLSchema#gYear",label:"gYear"},{value:"http://www.w3.org/2001/XMLSchema#gMonth",label:"gMonth"},{value:"http://www.w3.org/2001/XMLSchema#gDay",label:"gDay"},{value:"http://www.w3.org/2001/XMLSchema#gYearMonth",label:"gYearMonth"},{value:"http://www.w3.org/2001/XMLSchema#gMonthDay",label:"gMonthDay"},{value:"http://www.w3.org/2001/XMLSchema#duration",label:"duration"},{value:"http://www.w3.org/2001/XMLSchema#hexBinary",label:"hex binary"},{value:"http://www.w3.org/2001/XMLSchema#base64Binary",label:"base64 binary"}]}}}angular.module("graphdb.framework.explore.services",[]).factory("StatementsService",e),e.$inject=[]},49694:(e,t,n)=>{n.r(t),n(82493),n(5687),n(45574),n(74036),n(24087),n(35596),n(85276),n(664),n(93098),angular.module("graphdb.framework.explore",["ngRoute","toastr","xeditable","angucomplete-alt-onto","graphdb.framework.explore.services","graphdb.framework.explore.controllers","graphdb.framework.explore.directives","graphdb.framework.core.directives.fittext","graphdb.framework.core.directives.yasgui-component"])},85276:()=>{window.angular.module("angucomplete-alt-onto",[]).directive("angucompleteAltOnto",["$q","$parse","$http","$sce","$timeout","$templateCache","$interpolate","$rootScope",function(e,t,n,r,l,i,o,a){var u="/angucomplete-alt/index.html";function s(t,i,o,a){var u,s,c,d,g,p,h=i.find("input"),f=3,m=null,w="autocomplete-required",v=null,b=null,x=i[0].querySelector(".angucomplete-dropdown"),y=!1,S=null;function C(e,n){e&&("object"==typeof e?(t.uri=R(e),M({originalObject:e})):"string"==typeof e&&e.length>0?t.uri=e:console&&console.error&&console.error("Tried to set "+(n?"initial":"")+" value of angucomplete to",e,"which is an invalid value"),j(!0))}function I(e){S=null,t.hideResults(e),document.body.removeEventListener("click",I)}function $(e){return e.which?e.which:e.keyCode}function M(e){"function"==typeof t.selectedObject?t.selectedObject(e):t.selectedObject=e,j(!!e)}function R(e){return t.titleField.split(",").map(function(t){return L(e,t)}).join(" ")}function L(e,t){var n,r;if(t){n=t.split("."),r=e;for(var l=0;l<n.length;l++)r=r[n[l]]}else r=e;return r}function D(e,n){var l,i,o;if(o=new RegExp(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"i"),e)return e.match&&e.replace||(e=e.toString()),l=(i=e.match(o))?e.replace(o,'<span class="'+t.matchClass+'">'+i[0]+"</span>"):e,r.trustAsHtml(l)}function j(e){t.notEmpty=e,v=t.uri,t.fieldRequired&&a&&t.inputName&&a[t.inputName].$setValidity(w,e)}function F(e){!t.overrideSuggestions||t.selectedObject&&t.selectedObject.originalObject===t.uri||(e&&e.preventDefault(),l.cancel(m),q(),M({originalObject:t.uri}),t.clearSelected&&(t.uri=null),N())}function X(){return i[0].querySelectorAll(".angucomplete-row")[t.currentIndex]}function k(e){x.scrollTop=x.scrollTop+e}function U(){var e=t.results[t.currentIndex];if(t.matchClass){var n=R(e.originalObject);n=n.replace(/<b>|<\/b>/g,""),h.val(n)}else h.val(e.title)}function _(e){return function(n,r,l,i){r||l||i||!n.data||(n=n.data),t.searching=!1,A(L(s(n),t.remoteUrlDataField),e)}}function O(e,n,r,l){0!==n&&-1!==n&&(n||r||l||(n=e.status),t.remoteUrlErrorCallback?t.remoteUrlErrorCallback(e,n,r,l):console&&console.error&&console.error("http error"))}function q(){b&&b.resolve()}function H(r){var l={},i=t.remoteUrl+encodeuriComponent(r);t.remoteUrlRequestFormatter&&(l={params:t.remoteUrlRequestFormatter(r)},i=t.remoteUrl),t.remoteUrlRequestWithCredentials&&(l.withCredentials=!0),q(),b=e.defer(),l.timeout=b.promise,n.get(i,l).success(_(r)).error(O)}function T(n){q(),b=e.defer(),t.remoteApiHandler(n,b.promise).then(_(n)).catch(O)}function N(){t.showDropdown=!1,t.results=[],x&&(x.scrollTop=0)}function z(){t.showDropdown=d,t.currentIndex=t.focusFirst?0:-1,t.results=[]}function E(e){!e||e.length<f||(t.localData?t.$apply(function(){var n;n=void 0!==t.localSearch()?t.localSearch()(e):function(e){var n,r,l,i,o=t.searchFields.split(","),a=[];for(void 0!==t.parseInput()&&(e=t.parseInput()(e)),n=0;n<t.localData.length;n++){for(r=!1,l=0;l<o.length;l++)i=L(t.localData[n],o[l])||"",r=r||i.toString().toLowerCase().indexOf(e.toString().toLowerCase())>=0;r&&(a[a.length]=t.localData[n])}return a}(e),t.searching=!1,A(n,e)}):t.remoteApiHandler?T(e):H(e))}function A(e,n){var r,l,i,o,a,u;if(e&&e.length>0)for(t.results=[],r=0;r<e.length;r++)t.titleField&&""!==t.titleField&&(o=a=R(e[r])),l="",t.descriptionField&&(l=u=L(e[r],t.descriptionField)),i="",t.imageField&&(i=L(e[r],t.imageField)),t.matchClass&&(a=D(o,n),u=D(l,n)),t.results[t.results.length]={title:a,description:u,image:i,originalObject:e[r]};else t.results=[];t.autoMatch&&1===t.results.length&&function(e,n,r){if(!r)return!1;for(var l in n)if(n[l].toLowerCase()===r.toLowerCase())return t.selectResult(e),!0;return!1}(t.results[0],{title:o,desc:l||""},t.uri)?t.showDropdown=!1:0!==t.results.length||g?t.showDropdown=!0:t.showDropdown=!1}function B(){t.localData?A(t.localData,""):t.remoteApiHandler?T(""):H("")}i.on("mousedown",function(e){e.target.id?(S=e.target.id)===t.id+"_dropdown"&&document.body.addEventListener("click",I):S=e.target.className}),t.currentIndex=t.focusFirst?0:null,t.searching=!1,c=t.$watch("initialValue",function(e){e&&(c(),C(e,!0))}),t.$watch("fieldRequired",function(e,n){e!==n&&(e?v&&-1!==t.currentIndex?j(!0):j(!1):a[t.inputName].$setValidity(w,!0))}),t.$on("angucomplete-alt:clearInput",function(e,n){n&&n!==t.id||(t.uri=null,M(),j(!1),N())}),t.$on("angucomplete-alt:changeInput",function(e,n,r){n&&n===t.id&&C(r)}),t.onFocusHandler=function(){t.focusIn&&t.focusIn(),0!==f||t.uri&&0!==t.uri.length||(t.currentIndex=t.focusFirst?0:t.currentIndex,t.showDropdown=!0,B())},t.hideResults=function(){S&&(S===t.id+"_dropdown"||S.indexOf("angucomplete")>=0)?S=null:(u=l(function(){N(),t.$apply(function(){t.uri&&t.uri.length>0&&h.val(t.uri)})},200),q(),t.focusOut&&t.focusOut(),t.overrideSuggestions&&t.uri&&t.uri.length>0&&-1===t.currentIndex&&F())},t.resetHideResults=function(){u&&l.cancel(u)},t.hoverRow=function(e){t.currentIndex=e},t.selectResult=function(e){t.matchClass&&(e.title=R(e.originalObject),"string"==typeof e.title&&(e.title=e.title.replace(/<b>|<\/b>/g,"")),e.description=L(e.originalObject,t.descriptionField)),t.clearSelected?t.uri=null:t.uri=e.title,M(e),N()},t.inputChangeHandler=function(e){return e.length<f?(q(),N()):0===e.length&&0===f&&(t.searching=!1,B()),t.inputChanged&&(e=t.inputChanged(e)),e},t.fieldRequiredClass&&""!==t.fieldRequiredClass&&(w=t.fieldRequiredClass),t.minlength&&""!==t.minlength&&(f=parseInt(t.minlength,10)),t.pause||(t.pause=500),t.clearSelected||(t.clearSelected=!1),t.overrideSuggestions||(t.overrideSuggestions=!1),t.fieldRequired&&a&&(t.initialValue?j(!0):j(!1)),t.inputType=o.type?o.type:"text",t.textSearching=o.textSearching?o.textSearching:"Searching...",t.textNoResults=o.textNoResults?o.textNoResults:"No results found",d="false"!==t.textSearching,g="false"!==t.textNoResults,t.maxlength=o.maxlength?o.maxlength:524288,h.on("keydown",function(e){var n=$(e),r=null,l=null;13===n&&t.results?(t.currentIndex>=0&&t.currentIndex<t.results.length?(e.preventDefault(),t.selectResult(t.results[t.currentIndex])):(F(e),N()),t.$apply()):40===n&&t.results?(e.preventDefault(),t.currentIndex+1<t.results.length&&t.showDropdown&&(t.$apply(function(){t.currentIndex++,U()}),y&&(r=X(),x.getBoundingClientRect().top+parseInt(getComputedStyle(x).maxHeight,10)<r.getBoundingClientRect().bottom&&k(function(e){var t=getComputedStyle(e);return e.offsetHeight+parseInt(t.marginTop,10)+parseInt(t.marginBottom,10)}(r))))):38===n&&t.results?(e.preventDefault(),t.currentIndex>=1?(t.$apply(function(){t.currentIndex--,U()}),y&&(l=X().getBoundingClientRect().top-(x.getBoundingClientRect().top+parseInt(getComputedStyle(x).paddingTop,10)))<0&&k(l-1)):0===t.currentIndex&&t.$apply(function(){t.currentIndex=-1,h.val(t.uri)})):9===n?t.results&&t.results.length>0&&t.showDropdown?-1===t.currentIndex&&t.overrideSuggestions?F():(-1===t.currentIndex&&(t.currentIndex=0),t.selectResult(t.results[t.currentIndex]),t.$digest()):t.uri&&t.uri.length>0&&F():27===n&&e.preventDefault()}),h.on("keyup",function(e){var n=$(e);if(37!==n&&39!==n)if(38===n||13===n)e.preventDefault();else if(40===n)e.preventDefault(),!t.showDropdown&&t.uri&&t.uri.length>=f&&(z(),t.searching=!0,E(t.uri));else if(27===n)N(),t.$apply(function(){h.val(t.uri)});else{if(0===f&&!t.uri)return;t.uri&&""!==t.uri?t.uri.length>=f&&(z(),m&&l.cancel(m),t.searching=!0,m=l(function(){E(t.uri)},t.pause)):t.showDropdown=!1,v&&v!==t.uri&&!t.clearSelected&&t.$apply(function(){M()})}}),p="remoteUrlResponseFormatter",s=function(e){return t[p]?t[p](e):e},l(function(){var e=getComputedStyle(x);y=e.maxHeight&&"auto"===e.overflowY})}return i.put(u,'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}"> <input id="{{id}}_value" name="{{inputName}}" tabindex="{{fieldTabindex}}" ng-class="{\'angucomplete-input-not-empty\': notEmpty}" ng-model="uri" ng-disabled="disableInput" type="{{inputType}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(uri)" style="overflow: hidden; padding-right: .5em;"/> <div id="{{id}}_dropdown" class="angucomplete-dropdown" ng-show="disableSuggestions && showDropdown"> <div class="angucomplete-searching" ng-show="searching" ng-bind="textSearching"></div> <div class="angucomplete-searching" ng-show="!searching && (!results || results.length == 0)" ng-bind="textNoResults"></div> <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}"> <div ng-if="imageField" class="angucomplete-image-holder"> <img ng-if="result.image && result.image != \'\'" ng-src="{{result.image}}" class="angucomplete-image"/> <div ng-if="!result.image && result.image != \'\'" class="angucomplete-image-default"></div> </div> <div class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title"></div> <div class="angucomplete-title" ng-if="!matchClass">{{ result.title }}</div> <div ng-if="matchClass && result.description && result.description != \'\'" class="angucomplete-description" ng-bind-html="result.description"></div> <div ng-if="!matchClass && result.description && result.description != \'\'" class="angucomplete-description">{{result.description}}</div> </div> </div></div>'),{restrict:"EA",require:"^?form",scope:{selectedObject:"=",disableInput:"=",disableSuggestions:"=",initialValue:"=",localData:"=",localSearch:"&",remoteUrlRequestFormatter:"=",remoteUrlRequestWithCredentials:"@",remoteUrlResponseFormatter:"=",remoteUrlErrorCallback:"=",remoteApiHandler:"=",id:"@",type:"@",placeholder:"@",remoteUrl:"@",remoteUrlDataField:"@",titleField:"@",descriptionField:"@",imageField:"@",inputClass:"@",pause:"@",searchFields:"@",minlength:"@",matchClass:"@",clearSelected:"@",overrideSuggestions:"@",fieldRequired:"=",fieldRequiredClass:"@",inputChanged:"=",autoMatch:"@",focusOut:"&",focusIn:"&",fieldTabindex:"@",inputName:"@",focusFirst:"@",parseInput:"&"},templateUrl:function(e,t){return t.templateUrl||u},compile:function(e){var t=o.startSymbol(),n=o.endSymbol();if("{{"!==t||"}}"!==n){var r=e.html().replace(/\{\{/g,t).replace(/\}\}/g,n);e.html(r)}return s}}}])}}; //# sourceMappingURL=49694.4e3c2f5c9d0382004d46.bundle.js.map