使用VUE重构项目
This commit is contained in:
17
frontend/admin/node_modules/element-plus/lib/components/loading/index.d.ts
generated
vendored
Normal file
17
frontend/admin/node_modules/element-plus/lib/components/loading/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { LoadingOptions, LoadingOptionsResolved, LoadingParentElement } from "./src/types.js";
|
||||
import { LoadingInstance } from "./src/loading.js";
|
||||
import { Loading } from "./src/service.js";
|
||||
import { ElementLoading, LoadingBinding, vLoading } from "./src/directive.js";
|
||||
import { App, AppContext, Directive } from "vue";
|
||||
|
||||
//#region ../../packages/components/loading/index.d.ts
|
||||
declare const ElLoading: {
|
||||
install(app: App): void;
|
||||
directive: Directive<ElementLoading, LoadingBinding>;
|
||||
service: {
|
||||
(options?: LoadingOptions, context?: AppContext | null): LoadingInstance;
|
||||
_context: AppContext | null;
|
||||
};
|
||||
};
|
||||
//#endregion
|
||||
export { ElLoading, ElLoading as default, vLoading as ElLoadingDirective, vLoading, Loading as ElLoadingService, type LoadingInstance, LoadingOptions, LoadingOptionsResolved, LoadingParentElement };
|
||||
23
frontend/admin/node_modules/element-plus/lib/components/loading/index.js
generated
vendored
Normal file
23
frontend/admin/node_modules/element-plus/lib/components/loading/index.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_service = require('./src/service.js');
|
||||
const require_directive = require('./src/directive.js');
|
||||
|
||||
//#region ../../packages/components/loading/index.ts
|
||||
const ElLoading = {
|
||||
install(app) {
|
||||
require_service.default._context = app._context;
|
||||
require_directive.default._context = app._context;
|
||||
app.directive("loading", require_directive.default);
|
||||
app.config.globalProperties.$loading = require_service.default;
|
||||
},
|
||||
directive: require_directive.default,
|
||||
service: require_service.default
|
||||
};
|
||||
|
||||
//#endregion
|
||||
exports.ElLoading = ElLoading;
|
||||
exports.default = ElLoading;
|
||||
exports.ElLoadingDirective = require_directive.default;
|
||||
exports.vLoading = require_directive.default;
|
||||
exports.ElLoadingService = require_service.default;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/admin/node_modules/element-plus/lib/components/loading/index.js.map
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/lib/components/loading/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["vLoading","Loading"],"sources":["../../../../../packages/components/loading/index.ts"],"sourcesContent":["import Loading from './src/service'\nimport vLoading from './src/directive'\n\nimport type { App, AppContext, Directive } from 'vue'\nimport type { ElementLoading, LoadingBinding } from './src/directive'\n\n// installer and everything in all\nexport const ElLoading = {\n install(app: App) {\n Loading._context = app._context\n ;(\n vLoading as Directive<ElementLoading, LoadingBinding> & {\n _context: AppContext | null\n }\n )._context = app._context\n app.directive('loading', vLoading)\n app.config.globalProperties.$loading = Loading\n },\n directive: vLoading,\n service: Loading,\n}\n\nexport default ElLoading\nexport { vLoading, vLoading as ElLoadingDirective, Loading as ElLoadingService }\n\nexport * from './src/types'\nexport type { LoadingInstance } from './src/loading'\n"],"mappings":";;;;;AAOA,MAAa,YAAY;CACvB,QAAQ,KAAU;AAChB,0BAAQ,WAAW,IAAI;AACtB,EACCA,0BAGA,WAAW,IAAI;AACjB,MAAI,UAAU,WAAWA,0BAAS;AAClC,MAAI,OAAO,iBAAiB,WAAWC;;CAEzC,WAAWD;CACX,SAASC;CACV"}
|
||||
16
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.d.ts
generated
vendored
Normal file
16
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { LoadingOptions } from "./types.js";
|
||||
import { LoadingInstance } from "./loading.js";
|
||||
import { Directive, UnwrapRef } from "vue";
|
||||
|
||||
//#region ../../packages/components/loading/src/directive.d.ts
|
||||
declare const INSTANCE_KEY: unique symbol;
|
||||
type LoadingBinding = boolean | UnwrapRef<LoadingOptions>;
|
||||
interface ElementLoading extends HTMLElement {
|
||||
[INSTANCE_KEY]?: {
|
||||
instance: LoadingInstance;
|
||||
options: LoadingOptions;
|
||||
};
|
||||
}
|
||||
declare const vLoading: Directive<ElementLoading, LoadingBinding>;
|
||||
//#endregion
|
||||
export { ElementLoading, LoadingBinding, vLoading };
|
||||
72
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.js
generated
vendored
Normal file
72
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
||||
const require_service = require('./service.js');
|
||||
let vue = require("vue");
|
||||
let _vue_shared = require("@vue/shared");
|
||||
|
||||
//#region ../../packages/components/loading/src/directive.ts
|
||||
const INSTANCE_KEY = Symbol("ElLoading");
|
||||
const getAttributeName = (name) => {
|
||||
return `element-loading-${(0, _vue_shared.hyphenate)(name)}`;
|
||||
};
|
||||
const createInstance = (el, binding) => {
|
||||
const vm = binding.instance;
|
||||
const getBindingProp = (key) => (0, _vue_shared.isObject)(binding.value) ? binding.value[key] : void 0;
|
||||
const resolveExpression = (key) => {
|
||||
return (0, vue.ref)((0, _vue_shared.isString)(key) && vm?.[key] || key);
|
||||
};
|
||||
const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(getAttributeName(name)));
|
||||
const fullscreen = getBindingProp("fullscreen") ?? binding.modifiers.fullscreen;
|
||||
const options = {
|
||||
text: getProp("text"),
|
||||
svg: getProp("svg"),
|
||||
svgViewBox: getProp("svgViewBox"),
|
||||
spinner: getProp("spinner"),
|
||||
background: getProp("background"),
|
||||
customClass: getProp("customClass"),
|
||||
fullscreen,
|
||||
target: getBindingProp("target") ?? (fullscreen ? void 0 : el),
|
||||
body: getBindingProp("body") ?? binding.modifiers.body,
|
||||
lock: getBindingProp("lock") ?? binding.modifiers.lock
|
||||
};
|
||||
const instance = require_service.default(options);
|
||||
instance._context = vLoading._context;
|
||||
el[INSTANCE_KEY] = {
|
||||
options,
|
||||
instance
|
||||
};
|
||||
};
|
||||
const updateOptions = (originalOptions, newOptions) => {
|
||||
for (const key of Object.keys(originalOptions)) if ((0, vue.isRef)(originalOptions[key])) originalOptions[key].value = newOptions[key];
|
||||
};
|
||||
const vLoading = {
|
||||
mounted(el, binding) {
|
||||
if (binding.value) createInstance(el, binding);
|
||||
},
|
||||
updated(el, binding) {
|
||||
const instance = el[INSTANCE_KEY];
|
||||
if (!binding.value) {
|
||||
instance?.instance.close();
|
||||
el[INSTANCE_KEY] = null;
|
||||
return;
|
||||
}
|
||||
if (!instance) createInstance(el, binding);
|
||||
else updateOptions(instance.options, (0, _vue_shared.isObject)(binding.value) ? binding.value : {
|
||||
text: el.getAttribute(getAttributeName("text")),
|
||||
svg: el.getAttribute(getAttributeName("svg")),
|
||||
svgViewBox: el.getAttribute(getAttributeName("svgViewBox")),
|
||||
spinner: el.getAttribute(getAttributeName("spinner")),
|
||||
background: el.getAttribute(getAttributeName("background")),
|
||||
customClass: el.getAttribute(getAttributeName("customClass"))
|
||||
});
|
||||
},
|
||||
unmounted(el) {
|
||||
el[INSTANCE_KEY]?.instance.close();
|
||||
el[INSTANCE_KEY] = null;
|
||||
}
|
||||
};
|
||||
vLoading._context = null;
|
||||
|
||||
//#endregion
|
||||
exports.default = vLoading;
|
||||
//# sourceMappingURL=directive.js.map
|
||||
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.js.map
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/directive.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"directive.js","names":["Loading"],"sources":["../../../../../../packages/components/loading/src/directive.ts"],"sourcesContent":["// @ts-nocheck\nimport { isRef, ref } from 'vue'\nimport { hyphenate, isObject, isString } from '@element-plus/utils'\nimport Loading from './service'\n\nimport type { Directive, DirectiveBinding, UnwrapRef } from 'vue'\nimport type { LoadingOptions } from './types'\nimport type { LoadingInstance } from './loading'\n\nconst INSTANCE_KEY = Symbol('ElLoading')\nconst getAttributeName = (name: string) => {\n return `element-loading-${hyphenate(name)}`\n}\n\nexport type LoadingBinding = boolean | UnwrapRef<LoadingOptions>\nexport interface ElementLoading extends HTMLElement {\n [INSTANCE_KEY]?: {\n instance: LoadingInstance\n options: LoadingOptions\n }\n}\n\nconst createInstance = (\n el: ElementLoading,\n binding: DirectiveBinding<LoadingBinding>\n) => {\n const vm = binding.instance\n\n const getBindingProp = <K extends keyof LoadingOptions>(\n key: K\n ): LoadingOptions[K] =>\n isObject(binding.value) ? binding.value[key] : undefined\n\n const resolveExpression = (key: any) => {\n const data = (isString(key) && vm?.[key]) || key\n return ref(data)\n }\n\n const getProp = <K extends keyof LoadingOptions>(name: K) =>\n resolveExpression(\n getBindingProp(name) || el.getAttribute(getAttributeName(name))\n )\n\n const fullscreen =\n getBindingProp('fullscreen') ?? binding.modifiers.fullscreen\n\n const options: LoadingOptions = {\n text: getProp('text'),\n svg: getProp('svg'),\n svgViewBox: getProp('svgViewBox'),\n spinner: getProp('spinner'),\n background: getProp('background'),\n customClass: getProp('customClass'),\n fullscreen,\n target: getBindingProp('target') ?? (fullscreen ? undefined : el),\n body: getBindingProp('body') ?? binding.modifiers.body,\n lock: getBindingProp('lock') ?? binding.modifiers.lock,\n }\n const instance = Loading(options)\n instance._context = vLoading._context\n el[INSTANCE_KEY] = {\n options,\n instance,\n }\n}\n\nconst updateOptions = (\n originalOptions: LoadingOptions,\n newOptions: UnwrapRef<LoadingOptions>\n) => {\n for (const key of Object.keys(originalOptions)) {\n if (isRef(originalOptions[key]))\n originalOptions[key].value = newOptions[key]\n }\n}\n\nconst vLoading: Directive<ElementLoading, LoadingBinding> = {\n mounted(el, binding) {\n if (binding.value) {\n createInstance(el, binding)\n }\n },\n updated(el, binding) {\n const instance = el[INSTANCE_KEY]\n if (!binding.value) {\n instance?.instance.close()\n el[INSTANCE_KEY] = null\n return\n }\n\n if (!instance) createInstance(el, binding)\n else {\n updateOptions(\n instance.options,\n isObject(binding.value)\n ? binding.value\n : {\n text: el.getAttribute(getAttributeName('text')),\n svg: el.getAttribute(getAttributeName('svg')),\n svgViewBox: el.getAttribute(getAttributeName('svgViewBox')),\n spinner: el.getAttribute(getAttributeName('spinner')),\n background: el.getAttribute(getAttributeName('background')),\n customClass: el.getAttribute(getAttributeName('customClass')),\n }\n )\n }\n },\n unmounted(el) {\n el[INSTANCE_KEY]?.instance.close()\n el[INSTANCE_KEY] = null\n },\n}\n\nvLoading._context = null\nexport default vLoading\n"],"mappings":";;;;;;;AASA,MAAM,eAAe,OAAO,YAAY;AACxC,MAAM,oBAAoB,SAAiB;AACzC,QAAO,8CAA6B,KAAK;;AAW3C,MAAM,kBACJ,IACA,YACG;CACH,MAAM,KAAK,QAAQ;CAEnB,MAAM,kBACJ,kCAES,QAAQ,MAAM,GAAG,QAAQ,MAAM,OAAO;CAEjD,MAAM,qBAAqB,QAAa;AAEtC,gDADuB,IAAI,IAAI,KAAK,QAAS,IAC7B;;CAGlB,MAAM,WAA2C,SAC/C,kBACE,eAAe,KAAK,IAAI,GAAG,aAAa,iBAAiB,KAAK,CAAC,CAChE;CAEH,MAAM,aACJ,eAAe,aAAa,IAAI,QAAQ,UAAU;CAEpD,MAAM,UAA0B;EAC9B,MAAM,QAAQ,OAAO;EACrB,KAAK,QAAQ,MAAM;EACnB,YAAY,QAAQ,aAAa;EACjC,SAAS,QAAQ,UAAU;EAC3B,YAAY,QAAQ,aAAa;EACjC,aAAa,QAAQ,cAAc;EACnC;EACA,QAAQ,eAAe,SAAS,KAAK,aAAa,SAAY;EAC9D,MAAM,eAAe,OAAO,IAAI,QAAQ,UAAU;EAClD,MAAM,eAAe,OAAO,IAAI,QAAQ,UAAU;EACnD;CACD,MAAM,WAAWA,wBAAQ,QAAQ;AACjC,UAAS,WAAW,SAAS;AAC7B,IAAG,gBAAgB;EACjB;EACA;EACD;;AAGH,MAAM,iBACJ,iBACA,eACG;AACH,MAAK,MAAM,OAAO,OAAO,KAAK,gBAAgB,CAC5C,oBAAU,gBAAgB,KAAK,CAC7B,iBAAgB,KAAK,QAAQ,WAAW;;AAI9C,MAAM,WAAsD;CAC1D,QAAQ,IAAI,SAAS;AACnB,MAAI,QAAQ,MACV,gBAAe,IAAI,QAAQ;;CAG/B,QAAQ,IAAI,SAAS;EACnB,MAAM,WAAW,GAAG;AACpB,MAAI,CAAC,QAAQ,OAAO;AAClB,aAAU,SAAS,OAAO;AAC1B,MAAG,gBAAgB;AACnB;;AAGF,MAAI,CAAC,SAAU,gBAAe,IAAI,QAAQ;MAExC,eACE,SAAS,mCACA,QAAQ,MAAM,GACnB,QAAQ,QACR;GACE,MAAM,GAAG,aAAa,iBAAiB,OAAO,CAAC;GAC/C,KAAK,GAAG,aAAa,iBAAiB,MAAM,CAAC;GAC7C,YAAY,GAAG,aAAa,iBAAiB,aAAa,CAAC;GAC3D,SAAS,GAAG,aAAa,iBAAiB,UAAU,CAAC;GACrD,YAAY,GAAG,aAAa,iBAAiB,aAAa,CAAC;GAC3D,aAAa,GAAG,aAAa,iBAAiB,cAAc,CAAC;GAC9D,CACN;;CAGL,UAAU,IAAI;AACZ,KAAG,eAAe,SAAS,OAAO;AAClC,KAAG,gBAAgB;;CAEtB;AAED,SAAS,WAAW"}
|
||||
39
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.d.ts
generated
vendored
Normal file
39
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { LoadingOptionsResolved, LoadingParentElement } from "./types.js";
|
||||
import * as vue from "vue";
|
||||
import { AppContext, VNode } from "vue";
|
||||
|
||||
//#region ../../packages/components/loading/src/loading.d.ts
|
||||
declare function createLoadingComponent(options: LoadingOptionsResolved, appContext: AppContext | null): {
|
||||
setText: (text: string | VNode | VNode[]) => void;
|
||||
removeElLoadingChild: () => void;
|
||||
close: () => void;
|
||||
handleAfterLeave: () => void;
|
||||
vm: vue.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, vue.ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, vue.ComponentProvideOptions>, {}, {}, "", {}, any>;
|
||||
$el: HTMLElement;
|
||||
originalPosition: vue.Ref<string, string>;
|
||||
originalOverflow: vue.Ref<string, string>;
|
||||
visible: vue.Ref<boolean, boolean>;
|
||||
parent: vue.Ref<LoadingParentElement, LoadingParentElement>;
|
||||
background: vue.Ref<string, string>;
|
||||
svg: vue.Ref<string, string>;
|
||||
svgViewBox: vue.Ref<string, string>;
|
||||
spinner: vue.Ref<string | boolean, string | boolean>;
|
||||
text: vue.Ref<string | VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[], string | VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | VNode<vue.RendererNode, vue.RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[]>;
|
||||
fullscreen: vue.Ref<boolean, boolean>;
|
||||
lock: vue.Ref<boolean, boolean>;
|
||||
customClass: vue.Ref<string, string>;
|
||||
target: vue.Ref<HTMLElement, HTMLElement>;
|
||||
beforeClose?: vue.Ref<(() => boolean) | undefined, (() => boolean) | undefined> | undefined;
|
||||
closed?: vue.Ref<(() => void) | undefined, (() => void) | undefined> | undefined;
|
||||
};
|
||||
type LoadingInstance = ReturnType<typeof createLoadingComponent>;
|
||||
//#endregion
|
||||
export { LoadingInstance };
|
||||
106
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.js
generated
vendored
Normal file
106
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.js
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
||||
const require_style = require('../../../utils/dom/style.js');
|
||||
const require_use_global_config = require('../../config-provider/src/hooks/use-global-config.js');
|
||||
let vue = require("vue");
|
||||
|
||||
//#region ../../packages/components/loading/src/loading.ts
|
||||
function createLoadingComponent(options, appContext) {
|
||||
let afterLeaveTimer;
|
||||
const afterLeaveFlag = (0, vue.ref)(false);
|
||||
const data = (0, vue.reactive)({
|
||||
...options,
|
||||
originalPosition: "",
|
||||
originalOverflow: "",
|
||||
visible: false
|
||||
});
|
||||
function setText(text) {
|
||||
data.text = text;
|
||||
}
|
||||
function destroySelf() {
|
||||
const target = data.parent;
|
||||
const ns = vm.ns;
|
||||
if (!target.vLoadingAddClassList) {
|
||||
let loadingNumber = target.getAttribute("loading-number");
|
||||
loadingNumber = Number.parseInt(loadingNumber) - 1;
|
||||
if (!loadingNumber) {
|
||||
require_style.removeClass(target, ns.bm("parent", "relative"));
|
||||
target.removeAttribute("loading-number");
|
||||
} else target.setAttribute("loading-number", loadingNumber.toString());
|
||||
require_style.removeClass(target, ns.bm("parent", "hidden"));
|
||||
}
|
||||
removeElLoadingChild();
|
||||
loadingInstance.unmount();
|
||||
}
|
||||
function removeElLoadingChild() {
|
||||
vm.$el?.parentNode?.removeChild(vm.$el);
|
||||
}
|
||||
function close() {
|
||||
if (options.beforeClose && !options.beforeClose()) return;
|
||||
afterLeaveFlag.value = true;
|
||||
clearTimeout(afterLeaveTimer);
|
||||
afterLeaveTimer = setTimeout(handleAfterLeave, 400);
|
||||
data.visible = false;
|
||||
options.closed?.();
|
||||
}
|
||||
function handleAfterLeave() {
|
||||
if (!afterLeaveFlag.value) return;
|
||||
const target = data.parent;
|
||||
afterLeaveFlag.value = false;
|
||||
target.vLoadingAddClassList = void 0;
|
||||
destroySelf();
|
||||
}
|
||||
const loadingInstance = (0, vue.createApp)((0, vue.defineComponent)({
|
||||
name: "ElLoading",
|
||||
setup(_, { expose }) {
|
||||
const { ns, zIndex } = require_use_global_config.useGlobalComponentSettings("loading");
|
||||
expose({
|
||||
ns,
|
||||
zIndex
|
||||
});
|
||||
return () => {
|
||||
const svg = data.spinner || data.svg;
|
||||
const spinner = (0, vue.h)("svg", {
|
||||
class: "circular",
|
||||
viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
|
||||
...svg ? { innerHTML: svg } : {}
|
||||
}, [(0, vue.h)("circle", {
|
||||
class: "path",
|
||||
cx: "25",
|
||||
cy: "25",
|
||||
r: "20",
|
||||
fill: "none"
|
||||
})]);
|
||||
const spinnerText = data.text ? (0, vue.h)("p", { class: ns.b("text") }, [data.text]) : void 0;
|
||||
return (0, vue.h)(vue.Transition, {
|
||||
name: ns.b("fade"),
|
||||
onAfterLeave: handleAfterLeave
|
||||
}, { default: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createVNode)("div", {
|
||||
style: { backgroundColor: data.background || "" },
|
||||
class: [
|
||||
ns.b("mask"),
|
||||
data.customClass,
|
||||
ns.is("fullscreen", data.fullscreen)
|
||||
]
|
||||
}, [(0, vue.h)("div", { class: ns.b("spinner") }, [spinner, spinnerText])]), [[vue.vShow, data.visible]])]) });
|
||||
};
|
||||
}
|
||||
}));
|
||||
Object.assign(loadingInstance._context, appContext ?? {});
|
||||
const vm = loadingInstance.mount(document.createElement("div"));
|
||||
return {
|
||||
...(0, vue.toRefs)(data),
|
||||
setText,
|
||||
removeElLoadingChild,
|
||||
close,
|
||||
handleAfterLeave,
|
||||
vm,
|
||||
get $el() {
|
||||
return vm.$el;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//#endregion
|
||||
exports.createLoadingComponent = createLoadingComponent;
|
||||
//# sourceMappingURL=loading.js.map
|
||||
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.js.map
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/loading.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.d.ts
generated
vendored
Normal file
11
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { LoadingOptions } from "./types.js";
|
||||
import { LoadingInstance } from "./loading.js";
|
||||
import { AppContext } from "vue";
|
||||
|
||||
//#region ../../packages/components/loading/src/service.d.ts
|
||||
declare const Loading: {
|
||||
(options?: LoadingOptions, context?: AppContext | null): LoadingInstance;
|
||||
_context: AppContext | null;
|
||||
};
|
||||
//#endregion
|
||||
export { Loading };
|
||||
100
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.js
generated
vendored
Normal file
100
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
||||
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
||||
const require_style = require('../../../utils/dom/style.js');
|
||||
const require_loading = require('./loading.js');
|
||||
let vue = require("vue");
|
||||
let _vueuse_core = require("@vueuse/core");
|
||||
let _vue_shared = require("@vue/shared");
|
||||
|
||||
//#region ../../packages/components/loading/src/service.ts
|
||||
let fullscreenInstance = void 0;
|
||||
const Loading = function(options = {}, context) {
|
||||
if (!_vueuse_core.isClient) return void 0;
|
||||
const resolved = resolveOptions(options);
|
||||
if (resolved.fullscreen && fullscreenInstance) return fullscreenInstance;
|
||||
const instance = require_loading.createLoadingComponent({
|
||||
...resolved,
|
||||
closed: () => {
|
||||
resolved.closed?.();
|
||||
if (resolved.fullscreen) fullscreenInstance = void 0;
|
||||
}
|
||||
}, context ?? Loading._context);
|
||||
addStyle(resolved, resolved.parent, instance);
|
||||
addClassList(resolved, resolved.parent, instance);
|
||||
resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
|
||||
/**
|
||||
* add loading-number to parent.
|
||||
* because if a fullscreen loading is triggered when somewhere
|
||||
* a v-loading.body was triggered before and it's parent is
|
||||
* document.body which with a margin , the fullscreen loading's
|
||||
* destroySelf function will remove 'el-loading-parent--relative',
|
||||
* and then the position of v-loading.body will be error.
|
||||
*/
|
||||
let loadingNumber = resolved.parent.getAttribute("loading-number");
|
||||
if (!loadingNumber) loadingNumber = "1";
|
||||
else loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
|
||||
resolved.parent.setAttribute("loading-number", loadingNumber);
|
||||
resolved.parent.appendChild(instance.$el);
|
||||
(0, vue.nextTick)(() => instance.visible.value = resolved.visible);
|
||||
if (resolved.fullscreen) fullscreenInstance = instance;
|
||||
return instance;
|
||||
};
|
||||
const resolveOptions = (options) => {
|
||||
let target;
|
||||
if ((0, _vue_shared.isString)(options.target)) target = document.querySelector(options.target) ?? document.body;
|
||||
else target = options.target || document.body;
|
||||
return {
|
||||
parent: target === document.body || options.body ? document.body : target,
|
||||
background: options.background || "",
|
||||
svg: options.svg || "",
|
||||
svgViewBox: options.svgViewBox || "",
|
||||
spinner: options.spinner || false,
|
||||
text: options.text || "",
|
||||
fullscreen: target === document.body && (options.fullscreen ?? true),
|
||||
lock: options.lock ?? false,
|
||||
customClass: options.customClass || "",
|
||||
visible: options.visible ?? true,
|
||||
beforeClose: options.beforeClose,
|
||||
closed: options.closed,
|
||||
target
|
||||
};
|
||||
};
|
||||
const addStyle = async (options, parent, instance) => {
|
||||
const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
|
||||
const maskStyle = {};
|
||||
if (options.fullscreen) {
|
||||
instance.originalPosition.value = require_style.getStyle(document.body, "position");
|
||||
instance.originalOverflow.value = require_style.getStyle(document.body, "overflow");
|
||||
maskStyle.zIndex = nextZIndex();
|
||||
} else if (options.parent === document.body) {
|
||||
instance.originalPosition.value = require_style.getStyle(document.body, "position");
|
||||
/**
|
||||
* await dom render when visible is true in init,
|
||||
* because some component's height maybe 0.
|
||||
* e.g. el-table.
|
||||
*/
|
||||
await (0, vue.nextTick)();
|
||||
for (const property of ["top", "left"]) {
|
||||
const scroll = property === "top" ? "scrollTop" : "scrollLeft";
|
||||
maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(require_style.getStyle(document.body, `margin-${property}`), 10)}px`;
|
||||
}
|
||||
for (const property of ["height", "width"]) maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
|
||||
} else instance.originalPosition.value = require_style.getStyle(parent, "position");
|
||||
for (const [key, value] of Object.entries(maskStyle)) instance.$el.style[key] = value;
|
||||
};
|
||||
const addClassList = (options, parent, instance) => {
|
||||
const ns = instance.vm.ns || instance.vm._.exposed.ns;
|
||||
if (![
|
||||
"absolute",
|
||||
"fixed",
|
||||
"sticky"
|
||||
].includes(instance.originalPosition.value)) require_style.addClass(parent, ns.bm("parent", "relative"));
|
||||
else require_style.removeClass(parent, ns.bm("parent", "relative"));
|
||||
if (options.fullscreen && options.lock) require_style.addClass(parent, ns.bm("parent", "hidden"));
|
||||
else require_style.removeClass(parent, ns.bm("parent", "hidden"));
|
||||
};
|
||||
Loading._context = null;
|
||||
|
||||
//#endregion
|
||||
exports.default = Loading;
|
||||
//# sourceMappingURL=service.js.map
|
||||
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.js.map
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/service.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
frontend/admin/node_modules/element-plus/lib/components/loading/src/types.d.ts
generated
vendored
Normal file
52
frontend/admin/node_modules/element-plus/lib/components/loading/src/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import { VNode } from "vue";
|
||||
import { MaybeRef } from "@vueuse/core";
|
||||
|
||||
//#region ../../packages/components/loading/src/types.d.ts
|
||||
type LoadingOptionsResolved = {
|
||||
parent: LoadingParentElement;
|
||||
/**
|
||||
* @description background color of the mask
|
||||
*/
|
||||
background: MaybeRef<string>;
|
||||
svg: MaybeRef<string>;
|
||||
svgViewBox: MaybeRef<string>;
|
||||
/**
|
||||
* @description class name of the custom spinner
|
||||
*/
|
||||
spinner: MaybeRef<boolean | string>;
|
||||
/**
|
||||
* @description loading text that displays under the spinner
|
||||
*/
|
||||
text: MaybeRef<string | VNode | VNode[]>;
|
||||
/**
|
||||
* @description same as the `fullscreen` modifier of `v-loading`
|
||||
*/
|
||||
fullscreen: boolean;
|
||||
/**
|
||||
* @description same as the `lock` modifier of `v-loading`
|
||||
*/
|
||||
lock: boolean;
|
||||
/**
|
||||
* @description custom class name for Loading
|
||||
*/
|
||||
customClass: MaybeRef<string>;
|
||||
visible: boolean;
|
||||
target: HTMLElement;
|
||||
beforeClose?: () => boolean;
|
||||
closed?: () => void;
|
||||
};
|
||||
type LoadingOptions = Partial<Omit<LoadingOptionsResolved, 'parent' | 'target'> & {
|
||||
/**
|
||||
* @description the DOM node Loading needs to cover. Accepts a DOM object or a string. If it's a string, it will be passed to `document.querySelector` to get the corresponding DOM node
|
||||
*/
|
||||
target: HTMLElement | string;
|
||||
/**
|
||||
* @description same as the `body` modifier of `v-loading`
|
||||
*/
|
||||
body: boolean;
|
||||
}>;
|
||||
interface LoadingParentElement extends HTMLElement {
|
||||
vLoadingAddClassList?: () => void;
|
||||
}
|
||||
//#endregion
|
||||
export { LoadingOptions, LoadingOptionsResolved, LoadingParentElement };
|
||||
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/types.js
generated
vendored
Normal file
1
frontend/admin/node_modules/element-plus/lib/components/loading/src/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
3
frontend/admin/node_modules/element-plus/lib/components/loading/style/css.js
generated
vendored
Normal file
3
frontend/admin/node_modules/element-plus/lib/components/loading/style/css.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/css.js');
|
||||
require("element-plus/theme-chalk/el-loading.css");
|
||||
3
frontend/admin/node_modules/element-plus/lib/components/loading/style/index.js
generated
vendored
Normal file
3
frontend/admin/node_modules/element-plus/lib/components/loading/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
require('../../base/style/index.js');
|
||||
require("element-plus/theme-chalk/src/loading.scss");
|
||||
Reference in New Issue
Block a user