first commit
This commit is contained in:
8
node_modules/element-plus/es/hooks/use-ordered-children/index.d.ts
generated
vendored
Normal file
8
node_modules/element-plus/es/hooks/use-ordered-children/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { ComponentInternalInstance } from 'vue';
|
||||
export declare const useOrderedChildren: <T extends {
|
||||
uid: number;
|
||||
}>(vm: ComponentInternalInstance, childComponentName: string) => {
|
||||
children: import("vue").ShallowRef<T[]>;
|
||||
addChild: (child: T) => void;
|
||||
removeChild: (uid: number) => void;
|
||||
};
|
||||
31
node_modules/element-plus/es/hooks/use-ordered-children/index.mjs
generated
vendored
Normal file
31
node_modules/element-plus/es/hooks/use-ordered-children/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { shallowRef, isVNode } from 'vue';
|
||||
import { flattedChildren } from '../../utils/vue/vnode.mjs';
|
||||
|
||||
const getOrderedChildren = (vm, childComponentName, children) => {
|
||||
const nodes = flattedChildren(vm.subTree).filter((n) => {
|
||||
var _a;
|
||||
return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
|
||||
});
|
||||
const uids = nodes.map((n) => n.component.uid);
|
||||
return uids.map((uid) => children[uid]).filter((p) => !!p);
|
||||
};
|
||||
const useOrderedChildren = (vm, childComponentName) => {
|
||||
const children = {};
|
||||
const orderedChildren = shallowRef([]);
|
||||
const addChild = (child) => {
|
||||
children[child.uid] = child;
|
||||
orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
|
||||
};
|
||||
const removeChild = (uid) => {
|
||||
delete children[uid];
|
||||
orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
|
||||
};
|
||||
return {
|
||||
children: orderedChildren,
|
||||
addChild,
|
||||
removeChild
|
||||
};
|
||||
};
|
||||
|
||||
export { useOrderedChildren };
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
node_modules/element-plus/es/hooks/use-ordered-children/index.mjs.map
generated
vendored
Normal file
1
node_modules/element-plus/es/hooks/use-ordered-children/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":["../../../../../packages/hooks/use-ordered-children/index.ts"],"sourcesContent":["import { isVNode, shallowRef } from 'vue'\nimport { flattedChildren } from '@element-plus/utils'\n\nimport type { ComponentInternalInstance, VNode } from 'vue'\n\nconst getOrderedChildren = <T>(\n vm: ComponentInternalInstance,\n childComponentName: string,\n children: Record<number, T>\n): T[] => {\n const nodes = flattedChildren(vm.subTree).filter(\n (n): n is VNode =>\n isVNode(n) &&\n (n.type as any)?.name === childComponentName &&\n !!n.component\n )\n const uids = nodes.map((n) => n.component!.uid)\n return uids.map((uid) => children[uid]).filter((p) => !!p)\n}\n\nexport const useOrderedChildren = <T extends { uid: number }>(\n vm: ComponentInternalInstance,\n childComponentName: string\n) => {\n const children: Record<number, T> = {}\n const orderedChildren = shallowRef<T[]>([])\n\n // TODO: split into two functions: addChild and sortChildren\n const addChild = (child: T) => {\n children[child.uid] = child\n orderedChildren.value = getOrderedChildren(vm, childComponentName, children)\n }\n const removeChild = (uid: number) => {\n delete children[uid]\n orderedChildren.value = orderedChildren.value.filter(\n (children) => children.uid !== uid\n )\n }\n\n return {\n children: orderedChildren,\n addChild,\n removeChild,\n }\n}\n"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG,CAAC,EAAE,EAAE,kBAAkB,EAAE,QAAQ,KAAK;AACjE,EAAE,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK;AAC1D,IAAI,IAAI,EAAE,CAAC;AACX,IAAI,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,MAAM,kBAAkB,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5G,GA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