{"version":3,"sources":["webpack:///./src/main/web/components/ui/page-loader.ts"],"names":["props","shouldComponentUpdate","nextProps","isEqual","this","render","iri","length","createElement","Alert","alert","AlertType","DANGER","message","Rdf","context","getCurrentResource","noScroll","params","getCurrentUrl","search","NavigationUtils","extractParams","Component","component","PageLoaderComponent","factory","createFactory"],"mappings":"4IAmBA,OACA,QAEA,QACA,QAEA,SACA,SAuBA,cAKE,6BAAYA,G,OACV,YAAMA,IAAM,KAkBhB,OAxBkC,mCACzB,8BAAAC,sBAAP,SAA6BC,GAC3B,OAAQ,EAAAC,QAAQC,KAAKJ,MAAOE,IAOvB,8BAAAG,OAAP,WACE,OAAKD,KAAKJ,MAAMM,KAAOF,KAAKJ,MAAMM,IAAIC,OAAS,EACtC,EAAAC,cAAc,EAAAC,MAAO,CAC1BC,MAAO,EAAAC,UAAUC,OACjBC,QAAS,wEAGJ,UAAW,CAChBP,IAAK,EAAAQ,IAAIR,IAAIF,KAAKJ,MAAMM,KACxBS,QAASX,KAAKJ,MAAMe,QAAU,EAAAD,IAAIR,IAAIF,KAAKJ,MAAMe,SAAW,EAAAC,qBAC5DC,UAAU,EACVC,OAAQ,EAAF,uBAAO,EAAAC,gBAAgBC,QAAO,IAAU,EAAAC,gBAAgBC,cAAclB,KAAKJ,WAIzF,oBAxBA,CAAkC,EAAAuB,WA2BrB,EAAAC,UAAYC,EACZ,EAAAC,QAAU,EAAAC,cAAc,EAAAH,WACrC,UAAe,EAAAA","file":"mp-page-loader-0b24e5d4e255f56cfea3.js","sourcesContent":["/**\n * ResearchSpace\n * Copyright (C) 2020, © Trustees of the British Museum\n * Copyright (C) 2015-2019, metaphacts GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\nimport { Component, createFactory, createElement } from 'react';\nimport { isEqual } from 'lodash';\n\nimport { Rdf } from 'platform/api/rdf';\nimport { NavigationUtils, getCurrentResource, getCurrentUrl } from 'platform/api/navigation';\n\nimport PageViewer from '../../app/page/PageViewer';\nimport { Alert, AlertType } from 'platform/components/ui/alert';\n\n/**\n * Simple wrapper around {@PageViewer} component to be invoked from HTML code.\n * Takes a simple iri string as input parameter and passes it on as {@Rdf.Iri} to the {@PageViewer}\n * in order to load and render the requested page.\n *\n * The context of the requested page will be set to the current {@ResourceContext.resource}.\n * By design the context is not supposed to be re-written to a different resource\n * (i.e. by providing an additional input parameter to this component).\n *\n * Component inherits all query parameters from the current page.\n *\n * @example\n * \t\n *\n * @example\n * \tWith additional URL parameter(s).\n * \t\n */\nclass PageLoaderComponent extends Component<{ iri: string, context?: string }, {}> {\n public shouldComponentUpdate(nextProps) {\n return !isEqual(this.props, nextProps);\n }\n\n constructor(props) {\n super(props);\n }\n\n public render() {\n if (!this.props.iri || this.props.iri.length < 1) {\n return createElement(Alert, {\n alert: AlertType.DANGER,\n message: 'Page loader component requires an non empty iri parameter as input.',\n });\n } else {\n return PageViewer({\n iri: Rdf.iri(this.props.iri),\n context: this.props.context ? Rdf.iri(this.props.context) : getCurrentResource(),\n noScroll: true,\n params: { ...getCurrentUrl().search(true), ...NavigationUtils.extractParams(this.props) },\n });\n }\n }\n}\n\nexport type component = PageLoaderComponent;\nexport const component = PageLoaderComponent;\nexport const factory = createFactory(component);\nexport default component;\n"],"sourceRoot":""}