init component
This commit is contained in:
93
node_modules/buetify/lib/components/loading/BLoading.d.ts
generated
vendored
Executable file
93
node_modules/buetify/lib/components/loading/BLoading.d.ts
generated
vendored
Executable file
@@ -0,0 +1,93 @@
|
||||
import './loading.sass';
|
||||
import { IO } from 'fp-ts/lib/IO';
|
||||
import { VNode, ExtractPropTypes } from 'vue';
|
||||
export declare const BLoadingPropsDefinition: {
|
||||
isFullscreen: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
canCancel: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onToggle: {
|
||||
type: import("vue").PropType<import("fp-ts/lib/function").FunctionN<[boolean], void>>;
|
||||
required: false;
|
||||
};
|
||||
onSetOn: {
|
||||
type: import("vue").PropType<IO<void>>;
|
||||
required: false;
|
||||
};
|
||||
onSetOff: {
|
||||
type: import("vue").PropType<IO<void>>;
|
||||
required: false;
|
||||
};
|
||||
isActive: {
|
||||
type: import("vue").PropType<boolean>;
|
||||
default: boolean;
|
||||
};
|
||||
hasPopup: {
|
||||
type: import("vue").PropType<boolean>;
|
||||
default: boolean;
|
||||
};
|
||||
transition: {
|
||||
type: import("vue").PropType<import("../..").Transition>;
|
||||
default: import("fp-ts/lib/function").Lazy<import("../..").Transition>;
|
||||
};
|
||||
};
|
||||
export declare type BLoadingProps = ExtractPropTypes<typeof BLoadingPropsDefinition>;
|
||||
declare const _default: import("vue").DefineComponent<{
|
||||
isFullscreen: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
canCancel: {
|
||||
type: BooleanConstructor;
|
||||
default: boolean;
|
||||
};
|
||||
onToggle: {
|
||||
type: import("vue").PropType<import("fp-ts/lib/function").FunctionN<[boolean], void>>;
|
||||
required: false;
|
||||
};
|
||||
onSetOn: {
|
||||
type: import("vue").PropType<IO<void>>;
|
||||
required: false;
|
||||
};
|
||||
onSetOff: {
|
||||
type: import("vue").PropType<IO<void>>;
|
||||
required: false;
|
||||
};
|
||||
isActive: {
|
||||
type: import("vue").PropType<boolean>;
|
||||
default: boolean;
|
||||
};
|
||||
hasPopup: {
|
||||
type: import("vue").PropType<boolean>;
|
||||
default: boolean;
|
||||
};
|
||||
transition: {
|
||||
type: import("vue").PropType<import("../..").Transition>;
|
||||
default: import("fp-ts/lib/function").Lazy<import("../..").Transition>;
|
||||
};
|
||||
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
||||
hasPopup: boolean;
|
||||
transition: import("../..").Transition;
|
||||
isActive: boolean;
|
||||
isFullscreen: boolean;
|
||||
canCancel: boolean;
|
||||
} & {
|
||||
onToggle?: import("fp-ts/lib/function").FunctionN<[boolean], void> | undefined;
|
||||
onSetOn?: IO<void> | undefined;
|
||||
onSetOff?: IO<void> | undefined;
|
||||
}>, {
|
||||
hasPopup: boolean;
|
||||
transition: import("../..").Transition;
|
||||
isActive: boolean;
|
||||
isFullscreen: boolean;
|
||||
canCancel: boolean;
|
||||
}>;
|
||||
export default _default;
|
||||
86
node_modules/buetify/lib/components/loading/BLoading.js
generated
vendored
Executable file
86
node_modules/buetify/lib/components/loading/BLoading.js
generated
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
import "../../../src/components/loading/loading.sass";
|
||||
import { usePopupController, UsePopupControllerPropsDefinition } from '../../composables/popupController';
|
||||
import { isEscEvent } from '../../utils/eventHelpers';
|
||||
import { h, defineComponent, shallowRef, Transition, onUnmounted, toRef, toRefs, reactive, computed, watchEffect } from 'vue';
|
||||
import { constEmptyArray } from '../../utils/helpers';
|
||||
export const BLoadingPropsDefinition = { ...UsePopupControllerPropsDefinition,
|
||||
isFullscreen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
canCancel: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
};
|
||||
|
||||
function getGenerateModal(onClick, slots, isFullscreen) {
|
||||
return () => [h('div', {
|
||||
class: ['b-loading-overlay is-active', {
|
||||
'is-fullscreen': isFullscreen.value
|
||||
}]
|
||||
}, [h('div', {
|
||||
class: 'loading-background',
|
||||
onClick
|
||||
}), slots.default ? slots.default({
|
||||
close: onClick
|
||||
}) : h('div', {
|
||||
class: 'loading-icon'
|
||||
})])];
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: 'b-loading',
|
||||
props: BLoadingPropsDefinition,
|
||||
|
||||
setup(props, {
|
||||
slots
|
||||
}) {
|
||||
const isFullscreen = toRef(props, 'isFullscreen');
|
||||
const isActive = computed(() => props.isFullscreen && props.isActive);
|
||||
const render = shallowRef(constEmptyArray);
|
||||
const popup = usePopupController(reactive({ ...toRefs(props),
|
||||
isActive
|
||||
}), render);
|
||||
|
||||
function onClick() {
|
||||
if (props.canCancel && props.isFullscreen ? popup.isOpen.value : props.isActive) {
|
||||
popup.close();
|
||||
}
|
||||
}
|
||||
|
||||
render.value = getGenerateModal(onClick, slots, isFullscreen);
|
||||
|
||||
function onKeyup(e) {
|
||||
if (isEscEvent(e)) {
|
||||
onClick();
|
||||
}
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
if (window === undefined) return;
|
||||
|
||||
if (popup.isOpen.value && props.canCancel) {
|
||||
document.addEventListener('keyup', onKeyup);
|
||||
} else {
|
||||
document.removeEventListener('keyup', onKeyup);
|
||||
}
|
||||
});
|
||||
onUnmounted(() => {
|
||||
window && window.removeEventListener('keyup', onKeyup);
|
||||
});
|
||||
return () => {
|
||||
if (slots.trigger && props.isFullscreen) {
|
||||
return slots.trigger(popup);
|
||||
} else if (props.isFullscreen) {
|
||||
return undefined;
|
||||
} else {
|
||||
return h(Transition, {
|
||||
name: props.transition
|
||||
}, () => props.isActive ? render.value() : undefined);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
//# sourceMappingURL=BLoading.js.map
|
||||
1
node_modules/buetify/lib/components/loading/BLoading.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/components/loading/BLoading.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
3
node_modules/buetify/lib/components/loading/index.d.ts
generated
vendored
Executable file
3
node_modules/buetify/lib/components/loading/index.d.ts
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
import BLoading from './BLoading';
|
||||
export { BLoading };
|
||||
export default BLoading;
|
||||
4
node_modules/buetify/lib/components/loading/index.js
generated
vendored
Executable file
4
node_modules/buetify/lib/components/loading/index.js
generated
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
import BLoading from './BLoading';
|
||||
export { BLoading };
|
||||
export default BLoading;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/buetify/lib/components/loading/index.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/components/loading/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/components/loading/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAP,MAAqB,YAArB;AAEA,SAAS,QAAT;AAEA,eAAe,QAAf","sourcesContent":["import BLoading from './BLoading';\n\nexport { BLoading };\n\nexport default BLoading;\n"],"sourceRoot":"","file":"index.js"}
|
||||
Reference in New Issue
Block a user