完全跑通1.0版本
This commit is contained in:
12
frontend/node_modules/element-plus/lib/hooks/use-id/index.d.ts
generated
vendored
Normal file
12
frontend/node_modules/element-plus/lib/hooks/use-id/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { InjectionKey, MaybeRef, Ref } from "vue";
|
||||
|
||||
//#region ../../packages/hooks/use-id/index.d.ts
|
||||
type ElIdInjectionContext = {
|
||||
prefix: number;
|
||||
current: number;
|
||||
};
|
||||
declare const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext>;
|
||||
declare const useIdInjection: () => ElIdInjectionContext;
|
||||
declare const useId: (deterministicId?: MaybeRef<string>) => Ref<string>;
|
||||
//#endregion
|
||||
export { ElIdInjectionContext, ID_INJECTION_KEY, useId, useIdInjection };
|
||||
31
frontend/node_modules/element-plus/lib/hooks/use-id/index.js
generated
vendored
Normal file
31
frontend/node_modules/element-plus/lib/hooks/use-id/index.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
require("../../_virtual/_rolldown/runtime.js");
|
||||
const require_error = require("../../utils/error.js");
|
||||
const require_index = require("../use-namespace/index.js");
|
||||
let _vueuse_core = require("@vueuse/core");
|
||||
let vue = require("vue");
|
||||
//#region ../../packages/hooks/use-id/index.ts
|
||||
const defaultIdInjection = {
|
||||
prefix: Math.floor(Math.random() * 1e4),
|
||||
current: 0
|
||||
};
|
||||
const ID_INJECTION_KEY = Symbol("elIdInjection");
|
||||
const useIdInjection = () => {
|
||||
return (0, vue.getCurrentInstance)() ? (0, vue.inject)(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
|
||||
};
|
||||
const useId = (deterministicId) => {
|
||||
const idInjection = useIdInjection();
|
||||
if (!_vueuse_core.isClient && idInjection === defaultIdInjection) require_error.debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
|
||||
usage: app.provide(ID_INJECTION_KEY, {
|
||||
prefix: number,
|
||||
current: number,
|
||||
})`);
|
||||
const namespace = require_index.useGetDerivedNamespace();
|
||||
return (0, _vueuse_core.computedEager)(() => (0, vue.unref)(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
|
||||
};
|
||||
//#endregion
|
||||
exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
|
||||
exports.useId = useId;
|
||||
exports.useIdInjection = useIdInjection;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/element-plus/lib/hooks/use-id/index.js.map
generated
vendored
Normal file
1
frontend/node_modules/element-plus/lib/hooks/use-id/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","names":["isClient","useGetDerivedNamespace"],"sources":["../../../../../packages/hooks/use-id/index.ts"],"sourcesContent":["import { getCurrentInstance, inject, unref } from 'vue'\nimport { computedEager } from '@vueuse/core'\nimport { debugWarn, isClient } from '@element-plus/utils'\nimport { useGetDerivedNamespace } from '../use-namespace'\n\nimport type { InjectionKey, MaybeRef, Ref } from 'vue'\n\nexport type ElIdInjectionContext = {\n prefix: number\n current: number\n}\n\nconst defaultIdInjection = {\n prefix: Math.floor(Math.random() * 10000),\n current: 0,\n}\n\nexport const ID_INJECTION_KEY: InjectionKey<ElIdInjectionContext> =\n Symbol('elIdInjection')\n\nexport const useIdInjection = (): ElIdInjectionContext => {\n return getCurrentInstance()\n ? inject(ID_INJECTION_KEY, defaultIdInjection)\n : defaultIdInjection\n}\n\nexport const useId = (deterministicId?: MaybeRef<string>): Ref<string> => {\n const idInjection = useIdInjection()\n if (!isClient && idInjection === defaultIdInjection) {\n debugWarn(\n 'IdInjection',\n `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed\nusage: app.provide(ID_INJECTION_KEY, {\n prefix: number,\n current: number,\n})`\n )\n }\n\n const namespace = useGetDerivedNamespace()\n\n // NOTE: Here we use `computedEager` to calculate the id value immediately, avoiding inconsistent id generation due to the lazy feature of `computed` when server rendering.\n const idRef = computedEager(\n () =>\n unref(deterministicId) ||\n `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`\n )\n\n return idRef\n}\n"],"mappings":";;;;;;;AAYA,MAAM,qBAAqB;CACzB,QAAQ,KAAK,MAAM,KAAK,QAAQ,GAAG,IAAM;CACzC,SAAS;CACV;AAED,MAAa,mBACX,OAAO,gBAAgB;AAEzB,MAAa,uBAA6C;CACxD,QAAA,GAAA,IAAA,qBAA2B,IAAA,GAAA,IAAA,QAChB,kBAAkB,mBAAmB,GAC5C;;AAGN,MAAa,SAAS,oBAAoD;CACxE,MAAM,cAAc,gBAAgB;CACpC,IAAI,CAACA,aAAAA,YAAY,gBAAgB,oBAC/B,cAAA,UACE,eACA;;;;IAKD;CAGH,MAAM,YAAYC,cAAAA,wBAAwB;CAS1C,QAAA,GAAA,aAAA,sBAAA,GAAA,IAAA,OAJU,gBAAgB,IACtB,GAAG,UAAU,MAAM,MAAM,YAAY,OAAO,GAAG,YAAY,YAGnD"}
|
||||
Reference in New Issue
Block a user