@oruga-ui/oruga-next
Version:
UI components for Vue.js and CSS framework agnostic
61 lines (60 loc) • 2.12 kB
JavaScript
/*! Oruga v0.11.0 | MIT License | github.com/oruga-ui/oruga */
import { _ as _sfc_main } from "./Loading.vue_vue_type_script_setup_true_lang-kC76qSMD.mjs";
import "vue";
import { I as InstanceRegistry, C as ComponentProgrammatic } from "./useProgrammatic-B50-6K60.mjs";
import { b as registerComponent, a as registerComponentProgrammatic } from "./config-Dl7tu_Ly.mjs";
const registry = new InstanceRegistry();
const LoadingProgrammatic = {
/** Returns the number of registered active instances. */
count: registry.count,
/**
* Create a new programmatic loading component instance.
* @param options loading label string or loading component props object
* @param target specify a target the component get rendered into
* @returns ProgrammaticExpose
*/
open(options, target) {
const _options = typeof options === "string" ? { label: options } : options;
const componentProps = {
active: true,
// set the active default state to true
fullPage: false,
// set the full page default state to false
..._options
};
return ComponentProgrammatic.open(_sfc_main, {
registry,
// custom programmatic instance registry
target,
// target the component get rendered into
props: componentProps,
// component specific props
onClose: _options.onClose
// on close event handler
});
},
/** Close the last registred instance in the loading programmatic instance registry. */
close(...args) {
var _a, _b;
(_b = (_a = registry.last()) == null ? void 0 : _a.exposed) == null ? void 0 : _b.close(...args);
},
/** Close all instances in the programmatic loading instance registry. */
closeAll(...args) {
registry.walk((entry) => {
var _a;
return (_a = entry.exposed) == null ? void 0 : _a.close(...args);
});
}
};
const index = {
install(app) {
registerComponent(app, _sfc_main);
registerComponentProgrammatic(app, "loading", LoadingProgrammatic);
}
};
export {
LoadingProgrammatic,
_sfc_main as OLoading,
index as default
};
//# sourceMappingURL=loading.mjs.map