UNPKG

vuestic-ui

Version:
1 lines 1.04 kB
{"version":3,"file":"filter-props.mjs","sources":["../../../../../src/utils/component-options/filter-props.ts"],"sourcesContent":["import { computed, ExtractPropTypes, getCurrentInstance } from 'vue'\n\n/**\n * Filter current component props to much `childProps` param\n *\n * Used to proxy child component props from parent.\n *\n * @param childProps - child component props declaration\n */\nexport const filterComponentProps = <\n ChildProps extends Record<string, unknown>,\n>(childProps: ChildProps) => {\n const { props } = getCurrentInstance()!\n\n return computed(() => {\n return Object\n .keys(childProps)\n .reduce((acc, propName: string) => {\n (acc as any)[propName] = props[propName]\n return acc\n }, {} as ExtractPropTypes<ChildProps>)\n })\n}\n"],"names":[],"mappings":";AASa,MAAA,uBAAuB,CAElC,eAA2B;AACrB,QAAA,EAAE,UAAU;AAElB,SAAO,SAAS,MAAM;AACpB,WAAO,OACJ,KAAK,UAAU,EACf,OAAO,CAAC,KAAK,aAAqB;AAChC,UAAY,QAAQ,IAAI,MAAM,QAAQ;AAChC,aAAA;AAAA,IACT,GAAG,CAAkC,CAAA;AAAA,EAAA,CACxC;AACH;"}