1 line
3.0 KiB
JSON
1 line
3.0 KiB
JSON
{"ast":null,"code":"import * as React from 'react';\nexport function useGridApiMethod(apiRef, apiMethods,\n// TODO: Remove `apiName\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\napiName) {\n const apiMethodsRef = React.useRef(apiMethods);\n const [apiMethodsNames] = React.useState(Object.keys(apiMethods));\n const installMethods = React.useCallback(() => {\n if (!apiRef.current) {\n return;\n }\n apiMethodsNames.forEach(methodName => {\n if (!apiRef.current.hasOwnProperty(methodName)) {\n apiRef.current[methodName] = (...args) => apiMethodsRef.current[methodName](...args);\n }\n });\n }, [apiMethodsNames, apiRef]);\n React.useEffect(() => {\n apiMethodsRef.current = apiMethods;\n }, [apiMethods]);\n React.useEffect(() => {\n installMethods();\n }, [installMethods]);\n installMethods();\n}","map":{"version":3,"names":["React","useGridApiMethod","apiRef","apiMethods","apiName","apiMethodsRef","useRef","apiMethodsNames","useState","Object","keys","installMethods","useCallback","current","forEach","methodName","hasOwnProperty","args","useEffect"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/utils/useGridApiMethod.js"],"sourcesContent":["import * as React from 'react';\nexport function useGridApiMethod(apiRef, apiMethods, // TODO: Remove `apiName\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\napiName) {\n const apiMethodsRef = React.useRef(apiMethods);\n const [apiMethodsNames] = React.useState(Object.keys(apiMethods));\n const installMethods = React.useCallback(() => {\n if (!apiRef.current) {\n return;\n }\n\n apiMethodsNames.forEach(methodName => {\n if (!apiRef.current.hasOwnProperty(methodName)) {\n apiRef.current[methodName] = (...args) => apiMethodsRef.current[methodName](...args);\n }\n });\n }, [apiMethodsNames, apiRef]);\n React.useEffect(() => {\n apiMethodsRef.current = apiMethods;\n }, [apiMethods]);\n React.useEffect(() => {\n installMethods();\n }, [installMethods]);\n installMethods();\n}"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAO,SAASC,gBAAgBA,CAACC,MAAM,EAAEC,UAAU;AAAE;AACrD;AACAC,OAAO,EAAE;EACP,MAAMC,aAAa,GAAGL,KAAK,CAACM,MAAM,CAACH,UAAU,CAAC;EAC9C,MAAM,CAACI,eAAe,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAACC,MAAM,CAACC,IAAI,CAACP,UAAU,CAAC,CAAC;EACjE,MAAMQ,cAAc,GAAGX,KAAK,CAACY,WAAW,CAAC,MAAM;IAC7C,IAAI,CAACV,MAAM,CAACW,OAAO,EAAE;MACnB;IACF;IAEAN,eAAe,CAACO,OAAO,CAACC,UAAU,IAAI;MACpC,IAAI,CAACb,MAAM,CAACW,OAAO,CAACG,cAAc,CAACD,UAAU,CAAC,EAAE;QAC9Cb,MAAM,CAACW,OAAO,CAACE,UAAU,CAAC,GAAG,CAAC,GAAGE,IAAI,KAAKZ,aAAa,CAACQ,OAAO,CAACE,UAAU,CAAC,CAAC,GAAGE,IAAI,CAAC;MACtF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACV,eAAe,EAAEL,MAAM,CAAC,CAAC;EAC7BF,KAAK,CAACkB,SAAS,CAAC,MAAM;IACpBb,aAAa,CAACQ,OAAO,GAAGV,UAAU;EACpC,CAAC,EAAE,CAACA,UAAU,CAAC,CAAC;EAChBH,KAAK,CAACkB,SAAS,CAAC,MAAM;IACpBP,cAAc,CAAC,CAAC;EAClB,CAAC,EAAE,CAACA,cAAc,CAAC,CAAC;EACpBA,cAAc,CAAC,CAAC;AAClB","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |