import { merge } from "lodash";
export { LightboxConfig }
/**
* Lightbox configuration class that handles the configuration parameter.
* @author ckraemme <ckraemme@awi.de>
*/
class LightboxConfig {
/**
* Create the lightbox configuration and set default parameter if not defined.
* @param {Object} config - Lightbox configuration dictionary.
* @param {string|HTMLElement} config.targetElement - Target HTML element, serves as anchor for the lightbox.
* @param {Number|undefined} config.slideOnStartIndex - Open lightbox after loading and show a specific slide (starts at zero). Is skipped when undefined.
* @param {Boolean} config.showShareButton - Hide or show lightbox's sharing feature.
*/
constructor(config) {
const defaultParams = {
'targetElement': undefined,
'slideOnStartIndex': undefined,
'showShareButton': false
}
/* lodash is used instead of Object.assign() to handle undefined values:
"Source properties that resolve to undefined are skipped if a destination value exists." [https://lodash.com/docs/#merge]
*/
merge(this, defaultParams, config)
}
}