{"version":3,"sources":["webpack:///../WCC.UI/App/components/slidingContainer/slidingContainer.html?e772","webpack:///../WCC.UI/App/components/slidingContainer/slidingContainer.scss?6a82","webpack:///../WCC.UI/App/components/slidingContainer/slidingContainer.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/slidingContainer/slidingContainer.scss","webpack:///../WCC.UI/App/components/slidingContainer/slidingContainer.html"],"names":["content","expose","__esModule","default","api","module","i","options","exports","locals","SlidingContainerVM","constructor","config","info","effects","isBodyNeeded","ko","observable","contentNode","bodyHeight","contentOffset","isExpanded","flattenComputed","expand","animationDuration","animateInitial","renderOnExpand","height","contentHeight","Tracker","node","this","isInitialExpand","isBodyRendered","pureComputed","register","GenericAnimator","duration","state","frame","_ref","progress","_","extend","heightDiff","offsetDiff","skipAnimation","applyBindingsToNode","element","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","system","SystemHelpers","html","getTemplatesAndResources","forEach","document","head","appendChild","___CSS_LOADER_API_IMPORT___","push"],"mappings":"qJAAA,UAAO,CACC,qHACA,wDAIC,KAJyC,EAAF,SAAYA,EAASC,GAGzD,OADAA,EADAD,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,GAE1CA,GACV,4B,kFCNT,IAAII,EAAM,EAAQ,gFACFJ,EAAU,EAAQ,gKAIC,iBAFvBA,EAAUA,EAAQE,WAAaF,EAAQG,QAAUH,KAG/CA,EAAU,CAAC,CAACK,EAAOC,EAAIN,EAAS,MAG9C,IAAIO,EAAU,CAEd,OAAiB,OACjB,WAAoB,GAEPH,EAAIJ,EAASO,GAI1BF,EAAOG,QAAUR,EAAQS,QAAU,I,q4BCMnC,IAAqBC,EAArB,MAWIC,YACwCC,EACFC,EACNC,GAZxB,KAAAC,aAAeC,EAAGC,YAAW,GAErC,KAAAC,YAAcF,EAAGC,aAEjB,KAAAE,WAAaH,EAAGC,WAAW,GAC3B,KAAAG,cAAgBJ,EAAGC,WAAW,GAS1B,MAAMI,EA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B,oBAAoBlC,EAAKmC,QAAS,CACjC,IAAO,CACH,qBAAqB,OA9EhBtC,EAAkBuC,EAAA,CADtCC,cAaQC,EAAA,EAAAC,YAAOC,IAAWC,kBAClBH,EAAA,EAAAC,YAAOC,IAAWE,gBAClBJ,EAAA,EAAAC,YAAOC,IAAWvC,WAdNJ,gB,yLCxBrB,WAOC,KAPD,aACI,MAAM8C,EAAS,EAAQ,mCAAkBC,cAEzC,OAAO,SAAUC,GACbF,EAAOG,yBAAyBD,GAC3BE,SAAQ,SAAU9B,GAAQ+B,SAASC,KAAKC,YAAYjC,QAEhE,+B,gLCLDtB,EADkC,EAAQ,wDAChCwD,EAA4B,IAE9BC,KAAK,CAAC5D,EAAOC,EAAI,gIAAiI,KAE1JD,EAAOG,QAAUA,G,gICHjBH,EAAOG,QAFI","file":"313.8dbadf6f86f14e072db5.js","sourcesContent":["define([\n        \"!!../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./slidingContainer.html\", \n        \"!../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n            content = content.__esModule ? content.default : content;\n            expose(content);\n            return content;\n        });","var api = require(\"!../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n            var content = require(\"!!../../../node_modules/css-loader/dist/cjs.js!../../../node_modules/sass-loader/dist/cjs.js!./slidingContainer.scss\");\n\n            content = content.__esModule ? content.default : content;\n\n            if (typeof content === 'string') {\n              content = [[module.id, content, '']];\n            }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { Observable, PureComputed, SubscribableOrNullableValue } from 'knockout';\r\nimport { GenericAnimator } from 'managers/genericAnimator';\r\nimport { NodeTracker as Tracker } from 'managers/nodes/tracker';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport './slidingContainer.html';\r\nimport './slidingContainer.scss';\r\n\r\nexport interface SlidingContainerVMConfig {\n    expand: SubscribableOrNullableValue<boolean>\n    animationDuration: SubscribableOrNullableValue<number>\n    animateInitial: SubscribableOrNullableValue<boolean>\n    renderOnExpand: SubscribableOrNullableValue<boolean>\n}\n\ninterface SlidingContainerVMFrameState {\n    contentHeight: number\r\n    contentOffset?: number\r\n    bodyHeight?: number\r\n    isExpanded: boolean\r\n}\n\n@injectable()\nexport default class SlidingContainerVM{\n    private isInitialExpand: Observable<boolean>\n    private isBodyNeeded = ko.observable(false);\n\n    contentNode = ko.observable<HTMLElement>();\n\n    bodyHeight = ko.observable(0);\n    contentOffset = ko.observable(0);\n\n    isBodyRendered: PureComputed<boolean>\n\n    constructor(\n        @inject(wccModules.componentConfig) config: SlidingContainerVMConfig,\r\n        @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\n        @inject(wccModules.effects) effects: EffectsContainer\n    ) {\n        const isExpanded = ko.flattenComputed(config.expand, false);\n        const animationDuration = ko.flattenComputed(config.animationDuration, 450);\n        const animateInitial = ko.flattenComputed(config.animateInitial, false);\n        const renderOnExpand = ko.flattenComputed(config.renderOnExpand, false);\n\n        const { height: contentHeight } = new Tracker({ node: this.contentNode });\n\n        this.isInitialExpand = ko.observable(<boolean>true);\n        this.isBodyRendered = ko.pureComputed(() => !renderOnExpand() || this.isBodyNeeded());\n\n        effects.register(height => {\n            if (height == 0)\r\n                this.isInitialExpand(true);\r\n        }, [contentHeight]);\n\n        effects.register(new GenericAnimator<SlidingContainerVMFrameState>({\n            duration: animationDuration,\n\n            state: ko.pureComputed(() => ({\n                contentHeight: contentHeight(),\r\n                isExpanded: isExpanded()\r\n            })),\n\n            frame: ({ state, progress }) => {\r\n                if (progress == 0) {\r\n                    _(state).extend({\r\n                        contentOffset: this.contentOffset(),\r\n                        bodyHeight: this.bodyHeight()\r\n                    });\r\n                }\r\n\r\n                const { contentHeight, isExpanded } = state;\r\n                const contentOffset = <number>state.contentOffset;\r\n                const bodyHeight = <number>state.bodyHeight;\r\n\r\n                if (progress == 0 && isExpanded)\r\n                    this.isBodyNeeded(true);\r\n\r\n                const heightDiff = isExpanded ? contentHeight - bodyHeight : -bodyHeight;\r\n                const offsetDiff = isExpanded ? -contentOffset : -bodyHeight - contentOffset\r\n\r\n                const skipAnimation = this.isInitialExpand() && !animateInitial() ||\r\n                    heightDiff == 0 && offsetDiff == 0;\r\n\r\n                if (skipAnimation)\r\n                    progress = 100;\r\n\r\n                if (isExpanded && this.isInitialExpand() && contentHeight > 0 && progress == 100)\r\n                    this.isInitialExpand(false);\r\n\r\n                this.bodyHeight(bodyHeight + heightDiff * progress / 100);\r\n                this.contentOffset(contentOffset + offsetDiff * progress / 100);                \r\n\r\n                if (progress == 100 && !isExpanded)\r\n                    this.isBodyNeeded(false);\r\n\r\n                return skipAnimation;\r\n            }            \r\n        }));\n\n        ko.applyBindingsToNode(info.element, {\n            'css': {\n                'sliding-container': true\n            }\n        });\n    }\n}","define(function () {\r\n    const system = require('helpers/system').SystemHelpers;\r\n\r\n    return function (html) {\r\n        system.getTemplatesAndResources(html)\r\n            .forEach(function (node) { document.head.appendChild(node) });\r\n    }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".sliding-container{display:block}.sliding-container__body{overflow:hidden}.sliding-container__content__inner{overflow:hidden}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"<script id=\\\"wcc-components-sliding-container\\\" type=\\\"text/template\\\">\\r\\n    <!-- ko if: isBodyRendered -->\\r\\n    <div class=\\\"sliding-container__body\\\" data-bind=\\\"style: { 'height': bodyHeight.toPx() }\\\">\\r\\n        <div class=\\\"sliding-container__content\\\" data-bind=\\\"style: { 'margin-top': contentOffset.toPx() }\\\">\\r\\n            <div class=\\\"sliding-container__content__inner\\\" data-bind=\\\"dom: contentNode\\\">\\r\\n                <!-- ko hideContext: { toContext: $parentContext, store: { '$containerNodes': $componentTemplateNodes } } -->\\r\\n                <!-- ko template: { nodes: $containerNodes } --><!-- /ko -->\\r\\n                <!-- /ko -->\\r\\n            </div>\\r\\n        </div>\\r\\n    </div>\\r\\n    <!-- /ko -->\\r\\n</script>\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}