diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /vendor/assets/javascripts/vue-virtual-scroller/src/index.js | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'vendor/assets/javascripts/vue-virtual-scroller/src/index.js')
-rw-r--r-- | vendor/assets/javascripts/vue-virtual-scroller/src/index.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/vendor/assets/javascripts/vue-virtual-scroller/src/index.js b/vendor/assets/javascripts/vue-virtual-scroller/src/index.js new file mode 100644 index 00000000000..aa9733338f6 --- /dev/null +++ b/vendor/assets/javascripts/vue-virtual-scroller/src/index.js @@ -0,0 +1,60 @@ +/** + * See https://gitlab.com/gitlab-org/gitlab/-/issues/331267 for more information on this vendored + * dependency + */ + +import config from './config' + +import RecycleScroller from './components/RecycleScroller.vue' +import DynamicScroller from './components/DynamicScroller.vue' +import DynamicScrollerItem from './components/DynamicScrollerItem.vue' + +export { default as IdState } from './mixins/IdState' + +export { + RecycleScroller, + DynamicScroller, + DynamicScrollerItem, +} + +function registerComponents (Vue, prefix) { + Vue.component(`${prefix}recycle-scroller`, RecycleScroller) + Vue.component(`${prefix}RecycleScroller`, RecycleScroller) + Vue.component(`${prefix}dynamic-scroller`, DynamicScroller) + Vue.component(`${prefix}DynamicScroller`, DynamicScroller) + Vue.component(`${prefix}dynamic-scroller-item`, DynamicScrollerItem) + Vue.component(`${prefix}DynamicScrollerItem`, DynamicScrollerItem) +} + +const plugin = { + // eslint-disable-next-line no-undef + install (Vue, options) { + const finalOptions = Object.assign({}, { + installComponents: true, + componentsPrefix: '', + }, options) + + for (const key in finalOptions) { + if (typeof finalOptions[key] !== 'undefined') { + config[key] = finalOptions[key] + } + } + + if (finalOptions.installComponents) { + registerComponents(Vue, finalOptions.componentsPrefix) + } + }, +} + +export default plugin + +// Auto-install +let GlobalVue = null +if (typeof window !== 'undefined') { + GlobalVue = window.Vue +} else if (typeof global !== 'undefined') { + GlobalVue = global.Vue +} +if (GlobalVue) { + GlobalVue.use(plugin) +} |