Created
May 21, 2018 21:33
-
-
Save theredpea/d9a69e60b651fa04702ad5189995708e 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
b.directive("qvObject", function() { | |
return { | |
restrict: "E", | |
replace: !0, | |
template: g, | |
scope: { | |
options: "=", | |
model: "=", | |
object: "=?", | |
navMenu: "=", | |
snapshot: "=?" | |
}, | |
controller: ["$scope", "qvDefaultViewSelectionService", function(a, b) { | |
var d = c(); | |
this.updateContent = function(b) { | |
var e = a.object; | |
return e && e.content !== b && (void 0 !== e.content && (d = c()), | |
e.content = b), | |
d.promise | |
} | |
, | |
this.contentLoaded = function() { | |
return d.promise | |
} | |
, | |
a.onInit = function(a, c, e) { | |
a instanceof p || (a = new (q.extend(a))(c,e,b)), | |
d.resolve(a) | |
} | |
} | |
], | |
link: function(c, d, e, g) { | |
function h(a, b, d) { | |
var e = l && c.ext && !(c.model && !c.model.isValid && !c.model.isValidating); | |
return b || (e = e && a !== m), | |
d || (e = e && a !== n), | |
e | |
} | |
function i(a) { | |
var b = c.ext && c.ext.support[a]; | |
if ("function" == typeof b) | |
return b.call(null, c.layout); | |
if ("boolean" == typeof b) | |
return b; | |
throw "Unknown 'support' property name/type" + a | |
} | |
function j() { | |
l.update() | |
} | |
var l = c.object = {}; | |
c.options || (c.options = {}), | |
c.options.zoomEnabled = !!e.zoomObject, | |
c.resetOptions = k.extend({}, c.options), | |
Object.defineProperties(l, { | |
hasFrame: { | |
get: function() { | |
return !c.options.isPopover && !l.isInvalid | |
} | |
}, | |
isReadonly: { | |
get: function() { | |
return !l || l.isLink || l.isInvalid || c.options.isReadonly | |
} | |
}, | |
isInteractive: { | |
get: function() { | |
return !!l && c.options.interactionState !== r.STATIC | |
} | |
}, | |
hasSoftProperties: { | |
get: function() { | |
return !!this.ext && !!this.ext.mappedSoftDefinition | |
} | |
} | |
}), | |
l.getCreatePropertyHandler = function() { | |
var a = l.model.app; | |
return l.ext.getCreatePropertyHandler(a) | |
} | |
, | |
l.getPropertyPanelContent = function() { | |
return l.loaded.then(function() { | |
var a = l.getCreatePropertyHandler(); | |
return { | |
definition: l.ext.mappedDefinition || l.ext.definition, | |
globalChangeListeners: l.ext.globalChangeListeners, | |
type: l.type, | |
app: l.model.app, | |
backendApi: l.backendApi, | |
handler: a, | |
iconClass: l.ext.libraryInfo.templateIconClassName, | |
titleRef: "title", | |
ext: l.ext | |
} | |
}) | |
} | |
, | |
l.getSoftPropertyContent = function() { | |
return l.loaded.then(function() { | |
return { | |
definition: l.ext.mappedSoftDefinition || l.ext.softDefinition, | |
type: l.type, | |
backendApi: l.backendApi | |
} | |
}) | |
} | |
, | |
l.toggleExploreMenu = function(a) { | |
l.showExploreMenu = void 0 !== a ? a : !l.showExploreMenu | |
} | |
, | |
l.setSnapshotData = function(a, b) { | |
return g.contentLoaded().then(function(c) { | |
return c.setSnapshotData(a, b) | |
}) | |
} | |
, | |
l.getViewState = function() { | |
return g.contentLoaded().then(function(a) { | |
return a.getViewState ? a.getViewState() : void 0 | |
}) | |
} | |
, | |
l.getPreferredSize = function() { | |
return g.contentLoaded().then(function(a) { | |
var b = a.getPreferredSize(); | |
return b ? b.then(function(a) { | |
var b = d.find("footer") | |
, c = d.find("header"); | |
return { | |
w: a.w, | |
h: a.h + (b.height() || 0) + (c.height() || 0) + 35 + d[0].offsetTop | |
} | |
}) : void 0 | |
}) | |
} | |
, | |
l.getDropOptions = function(a, b) { | |
return l.loaded.then(function() { | |
return g.contentLoaded().then(function() { | |
return l.ext.getDropOptions(l, a, b) | |
}) | |
}) | |
} | |
, | |
l.getContextMenu = function(a) { | |
return g.contentLoaded().then(function(b) { | |
return b.getContextMenu(l, a) | |
}) | |
} | |
, | |
l.getObjectMenu = function(a) { | |
return g.contentLoaded().then(function(b) { | |
return b.getObjectMenu(l, a) | |
}) | |
} | |
, | |
l.getSelectionToolbar = function() { | |
return l.loaded.then(function() { | |
return g.contentLoaded().then(function(a) { | |
return a.getSelectionToolbar() | |
}) | |
}) | |
} | |
, | |
l.reloadContent = function() { | |
c.ext = l.ext = a.extend({}, l.ext), | |
l.loadContent(), | |
l.update() | |
} | |
, | |
l.canShowExploreMenu = function() { | |
var a = this.content === m || this.content === n; | |
return !this.isInvalid && this.hasSoftProperties && !a | |
} | |
, | |
l.supportCssScaling = function() { | |
return h(this.content) && i("cssScaling") | |
} | |
, | |
l.supportSnapshot = function() { | |
if (!h(this.content)) | |
return !1; | |
var a = c.ext && c.ext.snapshot && c.ext.snapshot.canTakeSnapshot; | |
return void 0 === a ? i("snapshot") : "function" == typeof a ? a.call(null, c.layout) : "boolean" == typeof a && a | |
} | |
, | |
l.supportObjectInfo = function() { | |
return !!h(this.content) && (!l.isInvalid && this.layout.showDetails) | |
} | |
, | |
l.supportExportData = function() { | |
return h(this.content, !1, !0) && i("exportData") | |
} | |
, | |
l.supportExport = function() { | |
return h(this.content) && i("export") | |
} | |
, | |
l.supportSharing = function() { | |
return h(this.content) && i("sharing") | |
} | |
, | |
l.setRenderState = function(a) { | |
l && l.renderState !== a && (l.renderState = a, | |
c.$emit("objectRenderStateChange", a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment