完全跑通1.0版本
This commit is contained in:
11
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Ref } from "vue";
|
||||
|
||||
//#region ../../packages/hooks/use-throttle-render/index.d.ts
|
||||
type ThrottleType = {
|
||||
leading?: number;
|
||||
trailing?: number;
|
||||
initVal?: boolean;
|
||||
} | number;
|
||||
declare const useThrottleRender: (loading: Ref<boolean>, throttle?: ThrottleType) => Ref<boolean, boolean>;
|
||||
//#endregion
|
||||
export { ThrottleType, useThrottleRender };
|
||||
36
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.js
generated
vendored
Normal file
36
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
require("../../_virtual/_rolldown/runtime.js");
|
||||
const require_types = require("../../utils/types.js");
|
||||
let vue = require("vue");
|
||||
let _vue_shared = require("@vue/shared");
|
||||
//#region ../../packages/hooks/use-throttle-render/index.ts
|
||||
const useThrottleRender = (loading, throttle = 0) => {
|
||||
if (throttle === 0) return loading;
|
||||
const throttled = (0, vue.ref)((0, _vue_shared.isObject)(throttle) && Boolean(throttle.initVal));
|
||||
let timeoutHandle = null;
|
||||
const dispatchThrottling = (timer) => {
|
||||
if (require_types.isUndefined(timer)) {
|
||||
throttled.value = loading.value;
|
||||
return;
|
||||
}
|
||||
if (timeoutHandle) clearTimeout(timeoutHandle);
|
||||
timeoutHandle = setTimeout(() => {
|
||||
throttled.value = loading.value;
|
||||
}, timer);
|
||||
};
|
||||
const dispatcher = (type) => {
|
||||
if (type === "leading") if (require_types.isNumber(throttle)) dispatchThrottling(throttle);
|
||||
else dispatchThrottling(throttle.leading);
|
||||
else if ((0, _vue_shared.isObject)(throttle)) dispatchThrottling(throttle.trailing);
|
||||
else throttled.value = false;
|
||||
};
|
||||
(0, vue.onMounted)(() => dispatcher("leading"));
|
||||
(0, vue.watch)(() => loading.value, (val) => {
|
||||
dispatcher(val ? "leading" : "trailing");
|
||||
});
|
||||
return throttled;
|
||||
};
|
||||
//#endregion
|
||||
exports.useThrottleRender = useThrottleRender;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/hooks/use-throttle-render/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["isUndefined","isNumber"],"sources":["../../../../../packages/hooks/use-throttle-render/index.ts"],"sourcesContent":["import { onMounted, ref, watch } from 'vue'\nimport { isNumber, isObject, isUndefined } from '@element-plus/utils'\n\nimport type { Ref } from 'vue'\n\nexport type ThrottleType =\n | { leading?: number; trailing?: number; initVal?: boolean }\n | number\n\nexport const useThrottleRender = (\n loading: Ref<boolean>,\n throttle: ThrottleType = 0\n) => {\n if (throttle === 0) return loading\n const initVal = isObject(throttle) && Boolean(throttle.initVal)\n const throttled = ref(initVal)\n let timeoutHandle: ReturnType<typeof setTimeout> | null = null\n\n const dispatchThrottling = (timer: number | undefined) => {\n if (isUndefined(timer)) {\n throttled.value = loading.value\n return\n }\n if (timeoutHandle) {\n clearTimeout(timeoutHandle)\n }\n timeoutHandle = setTimeout(() => {\n throttled.value = loading.value\n }, timer)\n }\n\n const dispatcher = (type: 'leading' | 'trailing') => {\n if (type === 'leading') {\n if (isNumber(throttle)) {\n dispatchThrottling(throttle)\n } else {\n dispatchThrottling(throttle.leading)\n }\n } else {\n if (isObject(throttle)) {\n dispatchThrottling(throttle.trailing)\n } else {\n throttled.value = false\n }\n }\n }\n\n onMounted(() => dispatcher('leading'))\n\n watch(\n () => loading.value,\n (val) => {\n dispatcher(val ? 'leading' : 'trailing')\n }\n )\n\n return throttled\n}\n"],"mappings":";;;;;;AASA,MAAa,qBACX,SACA,WAAyB,MACtB;CACH,IAAI,aAAa,GAAG,OAAO;CAE3B,MAAM,aAAA,GAAA,IAAA,MAAA,GAAA,YAAA,UADmB,SAAS,IAAI,QAAQ,SAAS,QAAQ,CACjC;CAC9B,IAAI,gBAAsD;CAE1D,MAAM,sBAAsB,UAA8B;EACxD,IAAIA,cAAAA,YAAY,MAAM,EAAE;GACtB,UAAU,QAAQ,QAAQ;GAC1B;;EAEF,IAAI,eACF,aAAa,cAAc;EAE7B,gBAAgB,iBAAiB;GAC/B,UAAU,QAAQ,QAAQ;KACzB,MAAM;;CAGX,MAAM,cAAc,SAAiC;EACnD,IAAI,SAAS,WACX,IAAIC,cAAAA,SAAS,SAAS,EACpB,mBAAmB,SAAS;OAE5B,mBAAmB,SAAS,QAAQ;OAGtC,KAAA,GAAA,YAAA,UAAa,SAAS,EACpB,mBAAmB,SAAS,SAAS;OAErC,UAAU,QAAQ;;CAKxB,CAAA,GAAA,IAAA,iBAAgB,WAAW,UAAU,CAAC;CAEtC,CAAA,GAAA,IAAA,aACQ,QAAQ,QACb,QAAQ;EACP,WAAW,MAAM,YAAY,WAAW;GAE3C;CAED,OAAO"}
|
||||
Reference in New Issue
Block a user