Created
February 6, 2018 21:06
-
-
Save theredpea/53359622f0c41cc7c02af0015d5e07e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //seems like single-object-service returns an object which *only exposes an `init` function* | |
| //and that init calls `i` in the below minification case | |
| // parsed by apis/single-url, convenient | |
| //stored in `k` which is passed into the `i` function; uses the "hasOption" API used on viz's in Qlik | |
| // which correspond to the options that are set for the single-configurator | |
| // 'currsel' | |
| // 'clearselections' | |
| // 'noanimate' | |
| // 'nointeraction' | |
| //notice interaction just passes straight through to ... qvangular? | |
| //k.hasOption("nointeraction") && (a.noInteraction = !0) | |
| //second arg passed in to single-object-service.init is qvangular-config | |
| // first arg passed in to single-object-service.`i` which sets fields , is the app, second is the parsed from URL. | |
| define("js/single/single-object-service", ["qvangular", "core.utils/deferred", "apis/single-url", "jquery", "general.controllers/error-handler-controller"], function(a, b, c, d, e) { | |
| "use strict"; | |
| function f(a, b) { | |
| return a.identity = b.identity, a | |
| } | |
| function g(b, c) { | |
| c.hasOption("debug"), b.setOnError(function(b) { | |
| if (c.callback && window[c.callback].onError) window[c.callback].onError(b.code, b.message); | |
| else { | |
| window.console.log("Error", b); | |
| a.getService("$delayedModal").isOpened || e.showDialog(b) | |
| } | |
| }, function(a) { | |
| "OnAuthenticationInformation" !== a.method && window.console.log("Warning", a) | |
| }) | |
| } | |
| function h(b, c) { | |
| c.hasOption("noanimate") && a.getService("$animate").enabled(!1), c.lang && b.setLanguage(c.lang), c.theme && b.theme.apply(c.theme) | |
| } | |
| function i(a, b) { | |
| b.hasOption("clearselections") && a.clearAll(), b.bookmark && a.bookmark.apply(b.bookmark), b.select.forEach(function(b) { | |
| var c = b.split(","); | |
| if (c.length > 1) { | |
| var d = c.slice(1); | |
| d.forEach(function(a, b) { | |
| isNaN(a) || (d[b] = +a) | |
| }), a.field(c[0]).selectValues(d, !1, !0) | |
| } | |
| }) | |
| } | |
| function j(b, c) { | |
| a.getService("$timeout")(function() { | |
| document.getElementById("content").offsetHeight, window[c.callback].onRendered(b.id) | |
| }, 1e3) | |
| } | |
| function k(a, b) { | |
| window.visualization = b, b.isValid && b.layout.title && (document.title = b.layout.title), b.Validated.bind(function() { | |
| b.layout.title && (document.title = b.layout.title) | |
| }), a.callback && window[a.callback].onValid && (b.isValid && window[a.callback].onValid(b.id), b.Validated.bind(function() { | |
| window[a.callback].onValid(b.id) | |
| })), a.callback && window[a.callback].onRendered && (b.isValid && j(b, a), b.Validated.bind(function() { | |
| j(b, a) | |
| })) | |
| } | |
| function l(a, b, c) { | |
| a.getObject(document.getElementById("content"), b, c.getApiOptions()).then(function(a) { | |
| k(c, a) | |
| }) | |
| } | |
| function m(a, b, c) { | |
| a.getSnapshot(document.getElementById("content"), b).then(function(a) { | |
| k(c, a) | |
| }) | |
| } | |
| function n(a, b, c) { | |
| a.getObject(b).then(function(b) { | |
| var e = b.layout; | |
| e.qMeta.title && (document.title = e.qMeta.title); | |
| var f = '<div style="position:relative;width:100%;height:100%" class="qvt-sheet">', | |
| g = 0, | |
| h = 0; | |
| e.cells.forEach(function(a) { | |
| g = Math.max(g, a.col + a.colspan), h = Math.max(h, a.row + a.rowspan) | |
| }), e.cells.forEach(function(a) { | |
| var b = "position:absolute;"; | |
| b += "left:" + 100 * a.col / g + "%;", b += "top:" + 100 * a.row / h + "%;", b += "width:" + 100 * a.colspan / g + "%;", b += "height:" + 100 * a.rowspan / h + "%;", f += '<div style="' + b + '" data-qid="' + a.name + '"></div>' | |
| }), f += "</div>", d("#content").html(f).find("div").each(function() { | |
| this.dataset.qid && a.getObject(this, this.dataset.qid, c.getApiOptions()) | |
| }) | |
| }) | |
| } | |
| function o(a, e) { | |
| var j = new b, | |
| k = c.parse(window.location); | |
| if (g(a, k), h(a, k), k.isValid()) { | |
| k.feature && (e.featureFlags = k.feature.toUpperCase().split(",")); | |
| var o = a.openApp(k.app, f(e, k)); | |
| o.model.waitForOpen.promise.then(function() { | |
| if (i(o, k), o) { | |
| if (k.hasOption("currsel")) { | |
| d("#CURRSELPANEL").show(); | |
| var a = {}; | |
| k.hasOption("nointeraction") && (a.noInteraction = !0), k.hasOption("noselections") && (a.noSelections = !0), o.getObject("CURRSELPANEL", "CurrentSelections", a) | |
| } else d("#CURRSELPANEL").hide(); | |
| k.object ? l(o, k.object, k) : k.sheet ? n(o, k.sheet, k) : k.snapshot && m(o, k.snapshot, k) | |
| } | |
| j.resolve({ | |
| options: { | |
| currsel: k.hasOption("currsel"), | |
| noInteraction: k.hasOption("nointeraction"), | |
| noAnimate: k.hasOption("noanimate"), | |
| language: k.lang | |
| } | |
| }) | |
| }) | |
| } else { | |
| var p = e.prefix + "dev-hub/single-configurator"; | |
| k.app && (p += "/#app{" + k.app + "}"), location.href = p | |
| } | |
| return j.promise | |
| } | |
| return { | |
| init: o | |
| } | |
| }); | |
| //See next:, in which single-object-service is `c`, called `c.init` with the value of `a`, and `a` represents jsj/qlik itself! | |
| (["js/qlik", "require"], function(a, b) { | |
| b(["angular", "js/single/single-object-service", "assets/qvangular/qvangular-config"], function(b, c, d) { | |
| d.internalOptimizations = !0, b.module("singleApp", []).controller("singleObjectCtrl", ["$scope", "$timeout", function(b, d) { | |
| function e() { | |
| c.init(a, initConfig).then(function(a) { | |
| d(function() { | |
| b.options = a.options | |
| }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment