UNPKG

7.23 kBSource Map (JSON)View Raw
1{"version":3,"sources":["layouts/pl-layout-sidebars.js"],"names":["window","Ractive","controller","component","data","el","config","done","_fireContentResize","waiting","LayoutSidebars","fire","width","_$el","get","height","content","outerHeight","_refreshDirContent","dir","expended","updateContentExpended","freezeSet","$dirContent","layout","find","$bar","set","setTimeout","DIRECTIONS","$","each","i","partials","plName","parentPlatform","findParent","on","args","observe","newValue","parseInt","event","name","require","then"],"mappings":"CAAA,WACE,YAEAA,QAAOC,QAAQC,WAAW,qBAAsB,SAASC,EAAWC,EAAMC,EAAIC,EAAQC,GAmCpF,QAASC,GAAmBC,GAC1BC,EAAeC,KAAK,iBAClBC,MAAOC,EAAKb,OAAOY,QAAUF,EAAeI,IAAI,wBAA0BJ,EAAeI,IAAI,yBAC7FC,OAAQF,EAAKG,QAAQC,cACrBR,QAA2B,mBAAXA,GAAyB,IAAMA,IAInD,QAASS,GAAmBC,EAAKC,EAAUC,GACzC,IAAIC,EAAJ,CAIAD,EAAwBA,KAA0B,GAAQ,GAAQ,EAElEC,GAAY,CAEZ,IAAIC,GAAcV,EAAKW,OAAOC,KAAK,cAAgBN,EAAM,cACrDO,EAAOH,EAAYE,KAAK,cAAgBN,EAAM,iBAE9CE,IACFX,EAAeiB,IAAIR,EAAM,oBAAqBC,GAGhDV,EAAeiB,IAAIR,EAAM,kBAAmBC,GAC5CV,EAAeiB,IAAIR,EAAM,mBAAoBC,EAAWG,EAAYX,QAAUc,EAAKd,SACnFF,EAAeiB,IAAIR,EAAM,aAAcC,EAAW,GAAKG,EAAYX,QAAUc,EAAKd,SAElFJ,IAEIY,EACFV,EAAeiB,IAAIR,EAAM,yBAAyB,GAE3CE,GACPO,WAAW,WACTlB,EAAeiB,IAAIR,EAAM,yBAAyB,IACjD,KAGLG,GAAY,GAzEd,GAAIO,IAAc,OAAQ,SAEtBP,GAAY,CAEhBQ,GAAEC,KAAKF,EAAY,SAASG,EAAGb,GAC7Bf,EAAKe,EAAM,eAAiBb,G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iB,IAAIR,EAAM,cAAgBC,GAAkB,GAAP,GAEpDV,EAAeiB,IAAIR,EAAM,eAAgBqB,EAAWC,SAASD,EAAU,IAAM,GAE7EtB,EAAmBC,EAAKC,GAExBV,EAAeiB,IAAIR,EAAM,eAAe,QAI5CT,EAAe2B,GAAG,+BAAgC,SAASK,GACzD,GAAIvB,GAAoB,iBAAduB,EAAMC,KAA0B,OAAS,QAC/CvB,GAAYV,EAAeI,IAAIK,EAAM,kBAEzCD,GAAmBC,EAAKC,KAG1BV,EAAekC,UAAUC,KAAKtC","file":"layouts/pl-layout-sidebars.min.js","sourcesContent":["(function() {\n 'use strict';\n\n window.Ractive.controller('pl-layout-sidebars', function(component, data, el, config, done) {\n var DIRECTIONS = ['left', 'right'],\n\n freezeSet = false;\n\n $.each(DIRECTIONS, function(i, dir) {\n data[dir + 'ContentUsed'] = config && config.partials && config.partials[dir + '-content'];\n data[dir + 'ContentPos'] = 0;\n data[dir + 'ContentCollapsedAfter'] = false;\n data[dir + 'ContentWidth'] = typeof data[dir + '-content-width'] != 'undefined' ? data[dir + '-content-width'] : 300;\n data[dir + 'ContentAreaWidth'] = data[dir + 'ContentUsed'] ? data[dir + 'ContentWidth'] : 30;\n data[dir + 'ContentExpended'] = false;\n });\n\n var LayoutSidebars = component({\n plName: 'pl-layout-sidebars',\n data: data\n }),\n parentPlatform = LayoutSidebars.findParent('name', 'pl-layout-platform'),\n _$el = {\n window: $(window),\n layout: $(LayoutSidebars.el),\n content: $(LayoutSidebars.el).find('.pl-layout-content')\n };\n\n if (parentPlatform) {\n parentPlatform.on('titleAreaHeightChanged', function(args) {\n LayoutSidebars.set('titleAreaHeight', args.height);\n\n _fireContentResize(args.waiting);\n });\n\n LayoutSidebars.set('titleAreaHeight', parentPlatform.get('titleAreaHeight'));\n }\n\n function _fireContentResize(waiting) {\n LayoutSidebars.fire('contentResize', {\n width: _$el.window.width() - LayoutSidebars.get('leftContentAreaWidth') - LayoutSidebars.get('rightContentAreaWidth'),\n height: _$el.content.outerHeight(),\n waiting: typeof waiting == 'undefined' ? 550 : waiting\n });\n }\n\n function _refreshDirContent(dir, expended, updateContentExpended) {\n if (freezeSet) {\n return;\n }\n\n updateContentExpended = updateContentExpended === false ? false : true;\n\n freezeSet = true;\n\n var $dirContent = _$el.layout.find('.pl-layout-' + dir + '-container'),\n $bar = $dirContent.find('.pl-layout-' + dir + '-bar-container');\n\n if (updateContentExpended) {\n LayoutSidebars.set(dir + '-content-expended', expended);\n }\n\n LayoutSidebars.set(dir + 'ContentExpended', expended);\n LayoutSidebars.set(dir + 'ContentAreaWidth', expended ? $dirContent.width() : $bar.width());\n LayoutSidebars.set(dir + 'ContentPos', expended ? 0 : -$dirContent.width() + $bar.width());\n\n _fireContentResize();\n\n if (expended) {\n LayoutSidebars.set(dir + 'ContentCollapsedAfter', false);\n }\n else if (updateContentExpended) {\n setTimeout(function() {\n LayoutSidebars.set(dir + 'ContentCollapsedAfter', true);\n }, 550);\n }\n\n freezeSet = false;\n }\n\n $.each(DIRECTIONS, function(i, dir) {\n LayoutSidebars.set(dir + 'NoAnimation', true);\n _refreshDirContent(dir, data[dir + 'ContentExpended'], false);\n LayoutSidebars.set(dir + 'NoAnimation', false);\n\n LayoutSidebars.observe(dir + '-content-expended', function(newValue) {\n if (freezeSet) {\n return;\n }\n\n var expended = newValue === false || (newValue && newValue == 'false') ? false : true;\n\n _refreshDirContent(dir, expended);\n });\n\n LayoutSidebars.observe(dir + '-content-title', function(newValue) {\n if (freezeSet) {\n return;\n }\n\n LayoutSidebars.set(dir + 'ContentTitle', newValue || null);\n });\n\n LayoutSidebars.observe(dir + '-content-width', function(newValue) {\n if (freezeSet) {\n return;\n }\n\n newValue = typeof newValue == 'undefined' ? 300 : newValue;\n\n var expended = !!LayoutSidebars.get(dir + 'ContentExpended');\n\n LayoutSidebars.set(dir + 'NoAnimation', !expended ? true : false);\n\n LayoutSidebars.set(dir + 'ContentWidth', newValue ? parseInt(newValue, 10) : 0);\n\n _refreshDirContent(dir, expended);\n\n LayoutSidebars.set(dir + 'NoAnimation', false);\n });\n });\n\n LayoutSidebars.on('toggleLeftBar toggleRightBar', function(event) {\n var dir = event.name == 'toggleLeftBar' ? 'left' : 'right',\n expended = !LayoutSidebars.get(dir + 'ContentExpended');\n\n _refreshDirContent(dir, expended);\n });\n\n LayoutSidebars.require().then(done);\n });\n\n})();\n"],"sourceRoot":"/source/"}
\No newline at end of file