tav-ui
Version:
1 lines • 1.12 kB
Source Map (JSON)
{"version":3,"file":"useTableContext2.mjs","sources":["../../../../../../../../packages/components/table/src/hooks/useTableContext.ts"],"sourcesContent":["import { inject, provide } from 'vue'\nimport type { ComputedRef, Ref } from 'vue'\nimport type { BasicTableProps, TableActionType } from '../types/table'\n\nconst key = Symbol('basic-table')\ntype Nullable<T> = T | null\ntype Recordable<T = any> = Record<string, T>\ntype Instance = TableActionType & {\n wrapRef: Ref<Nullable<HTMLElement>>\n getBindValues: ComputedRef<Recordable>\n setCacheActionWidths: (...args: any) => void\n}\n\ntype RetInstance = Omit<Instance, 'getBindValues'> & {\n getBindValues: ComputedRef<BasicTableProps>\n}\n\nexport function createTableContext(instance: Instance) {\n provide(key, instance)\n}\n\nexport function useTableContext(): RetInstance {\n return inject(key) as RetInstance\n}\n"],"names":[],"mappings":";;AACA,MAAM,GAAG,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAC3B,SAAS,kBAAkB,CAAC,QAAQ,EAAE;AAC7C,EAAE,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AACzB,CAAC;AACM,SAAS,eAAe,GAAG;AAClC,EAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB;;;;"}