完全跑通1.0版本
This commit is contained in:
11
frontend/node_modules/element-plus/es/hooks/use-throttle-render/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/element-plus/es/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 };
|
||||
33
frontend/node_modules/element-plus/es/hooks/use-throttle-render/index.mjs
generated
vendored
Normal file
33
frontend/node_modules/element-plus/es/hooks/use-throttle-render/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { isNumber, isObject, isUndefined } from "../../utils/types.mjs";
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
//#region ../../packages/hooks/use-throttle-render/index.ts
|
||||
const useThrottleRender = (loading, throttle = 0) => {
|
||||
if (throttle === 0) return loading;
|
||||
const throttled = ref(isObject(throttle) && Boolean(throttle.initVal));
|
||||
let timeoutHandle = null;
|
||||
const dispatchThrottling = (timer) => {
|
||||
if (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 (isNumber(throttle)) dispatchThrottling(throttle);
|
||||
else dispatchThrottling(throttle.leading);
|
||||
else if (isObject(throttle)) dispatchThrottling(throttle.trailing);
|
||||
else throttled.value = false;
|
||||
};
|
||||
onMounted(() => dispatcher("leading"));
|
||||
watch(() => loading.value, (val) => {
|
||||
dispatcher(val ? "leading" : "trailing");
|
||||
});
|
||||
return throttled;
|
||||
};
|
||||
//#endregion
|
||||
export { useThrottleRender };
|
||||
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
frontend/node_modules/element-plus/es/hooks/use-throttle-render/index.mjs.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/es/hooks/use-throttle-render/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","names":[],"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,YAAY,IADF,SAAS,SAAS,IAAI,QAAQ,SAAS,QAAQ,CACjC;CAC9B,IAAI,gBAAsD;CAE1D,MAAM,sBAAsB,UAA8B;EACxD,IAAI,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,IAAI,SAAS,SAAS,EACpB,mBAAmB,SAAS;OAE5B,mBAAmB,SAAS,QAAQ;OAGtC,IAAI,SAAS,SAAS,EACpB,mBAAmB,SAAS,SAAS;OAErC,UAAU,QAAQ;;CAKxB,gBAAgB,WAAW,UAAU,CAAC;CAEtC,YACQ,QAAQ,QACb,QAAQ;EACP,WAAW,MAAM,YAAY,WAAW;GAE3C;CAED,OAAO"}
|
||||
Reference in New Issue
Block a user