1 line
12 KiB
JSON
1 line
12 KiB
JSON
{"ast":null,"code":"import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _toPropertyKey from \"@babel/runtime/helpers/esm/toPropertyKey\";\nimport * as React from 'react';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\n\n/**\n * Implement the Pipeline Pattern\n *\n * More information and detailed example in (TODO add link to technical doc when ready)\n *\n * Some plugins contains custom logic to enrich data provided by other plugins or components.\n * For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.\n *\n * =====================================================================================================================\n *\n * The plugin containing the custom logic must use:\n *\n * - `useGridRegisterPipeProcessor` to register their processor.\n *\n * - `apiRef.current.unstable_requestPipeProcessorsApplication` to imperatively re-apply a group.\n * This method should be used in last resort.\n * Most of the time, the application should be triggered by an update on the deps of the processor.\n *\n * =====================================================================================================================\n *\n * The plugin or component that needs to enrich its data must use:\n *\n * - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.\n *\n * - `useGridRegisterPipeApplier` to re-apply the whole pipe when requested.\n * The applier will be called when:\n * * a processor is registered.\n * * `apiRef.current.unstable_requestPipeProcessorsApplication` is called for the given group.\n */\nexport const useGridPipeProcessing = apiRef => {\n const processorsCache = React.useRef({});\n const runAppliers = React.useCallback(groupCache => {\n if (!groupCache) {\n return;\n }\n Object.values(groupCache.appliers).forEach(callback => {\n callback();\n });\n }, []);\n const registerPipeProcessor = React.useCallback((group, id, processor) => {\n if (!processorsCache.current[group]) {\n processorsCache.current[group] = {\n processors: new Map(),\n appliers: {}\n };\n }\n const groupCache = processorsCache.current[group];\n const oldProcessor = groupCache.processors.get(id);\n if (oldProcessor !== processor) {\n groupCache.processors.set(id, processor);\n runAppliers(groupCache);\n }\n return () => {\n processorsCache.current[group].processors.set(id, null);\n };\n }, [runAppliers]);\n const registerPipeApplier = React.useCallback((group, id, applier) => {\n if (!processorsCache.current[group]) {\n processorsCache.current[group] = {\n processors: new Map(),\n appliers: {}\n };\n }\n processorsCache.current[group].appliers[id] = applier;\n return () => {\n const _appliers = processorsCache.current[group].appliers,\n otherAppliers = _objectWithoutPropertiesLoose(_appliers, [id].map(_toPropertyKey));\n processorsCache.current[group].appliers = otherAppliers;\n };\n }, []);\n const requestPipeProcessorsApplication = React.useCallback(group => {\n const groupCache = processorsCache.current[group];\n runAppliers(groupCache);\n }, [runAppliers]);\n const applyPipeProcessors = React.useCallback((...args) => {\n const [group, value, context] = args;\n if (!processorsCache.current[group]) {\n return value;\n }\n const preProcessors = Array.from(processorsCache.current[group].processors.values());\n return preProcessors.reduce((acc, preProcessor) => {\n if (!preProcessor) {\n return acc;\n }\n return preProcessor(acc, context);\n }, value);\n }, []);\n const preProcessingApi = {\n unstable_registerPipeProcessor: registerPipeProcessor,\n unstable_registerPipeApplier: registerPipeApplier,\n unstable_requestPipeProcessorsApplication: requestPipeProcessorsApplication,\n unstable_applyPipeProcessors: applyPipeProcessors\n };\n useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');\n};","map":{"version":3,"names":["_objectWithoutPropertiesLoose","_toPropertyKey","React","useGridApiMethod","useGridPipeProcessing","apiRef","processorsCache","useRef","runAppliers","useCallback","groupCache","Object","values","appliers","forEach","callback","registerPipeProcessor","group","id","processor","current","processors","Map","oldProcessor","get","set","registerPipeApplier","applier","_appliers","otherAppliers","map","requestPipeProcessorsApplication","applyPipeProcessors","args","value","context","preProcessors","Array","from","reduce","acc","preProcessor","preProcessingApi","unstable_registerPipeProcessor","unstable_registerPipeApplier","unstable_requestPipeProcessorsApplication","unstable_applyPipeProcessors"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/core/pipeProcessing/useGridPipeProcessing.js"],"sourcesContent":["import _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _toPropertyKey from \"@babel/runtime/helpers/esm/toPropertyKey\";\nimport * as React from 'react';\nimport { useGridApiMethod } from '../../utils/useGridApiMethod';\n\n/**\n * Implement the Pipeline Pattern\n *\n * More information and detailed example in (TODO add link to technical doc when ready)\n *\n * Some plugins contains custom logic to enrich data provided by other plugins or components.\n * For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.\n *\n * =====================================================================================================================\n *\n * The plugin containing the custom logic must use:\n *\n * - `useGridRegisterPipeProcessor` to register their processor.\n *\n * - `apiRef.current.unstable_requestPipeProcessorsApplication` to imperatively re-apply a group.\n * This method should be used in last resort.\n * Most of the time, the application should be triggered by an update on the deps of the processor.\n *\n * =====================================================================================================================\n *\n * The plugin or component that needs to enrich its data must use:\n *\n * - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.\n *\n * - `useGridRegisterPipeApplier` to re-apply the whole pipe when requested.\n * The applier will be called when:\n * * a processor is registered.\n * * `apiRef.current.unstable_requestPipeProcessorsApplication` is called for the given group.\n */\nexport const useGridPipeProcessing = apiRef => {\n const processorsCache = React.useRef({});\n const runAppliers = React.useCallback(groupCache => {\n if (!groupCache) {\n return;\n }\n\n Object.values(groupCache.appliers).forEach(callback => {\n callback();\n });\n }, []);\n const registerPipeProcessor = React.useCallback((group, id, processor) => {\n if (!processorsCache.current[group]) {\n processorsCache.current[group] = {\n processors: new Map(),\n appliers: {}\n };\n }\n\n const groupCache = processorsCache.current[group];\n const oldProcessor = groupCache.processors.get(id);\n\n if (oldProcessor !== processor) {\n groupCache.processors.set(id, processor);\n runAppliers(groupCache);\n }\n\n return () => {\n processorsCache.current[group].processors.set(id, null);\n };\n }, [runAppliers]);\n const registerPipeApplier = React.useCallback((group, id, applier) => {\n if (!processorsCache.current[group]) {\n processorsCache.current[group] = {\n processors: new Map(),\n appliers: {}\n };\n }\n\n processorsCache.current[group].appliers[id] = applier;\n return () => {\n const _appliers = processorsCache.current[group].appliers,\n otherAppliers = _objectWithoutPropertiesLoose(_appliers, [id].map(_toPropertyKey));\n\n processorsCache.current[group].appliers = otherAppliers;\n };\n }, []);\n const requestPipeProcessorsApplication = React.useCallback(group => {\n const groupCache = processorsCache.current[group];\n runAppliers(groupCache);\n }, [runAppliers]);\n const applyPipeProcessors = React.useCallback((...args) => {\n const [group, value, context] = args;\n\n if (!processorsCache.current[group]) {\n return value;\n }\n\n const preProcessors = Array.from(processorsCache.current[group].processors.values());\n return preProcessors.reduce((acc, preProcessor) => {\n if (!preProcessor) {\n return acc;\n }\n\n return preProcessor(acc, context);\n }, value);\n }, []);\n const preProcessingApi = {\n unstable_registerPipeProcessor: registerPipeProcessor,\n unstable_registerPipeApplier: registerPipeApplier,\n unstable_requestPipeProcessorsApplication: requestPipeProcessorsApplication,\n unstable_applyPipeProcessors: applyPipeProcessors\n };\n useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');\n};"],"mappings":"AAAA,OAAOA,6BAA6B,MAAM,yDAAyD;AACnG,OAAOC,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,8BAA8B;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAGC,MAAM,IAAI;EAC7C,MAAMC,eAAe,GAAGJ,KAAK,CAACK,MAAM,CAAC,CAAC,CAAC,CAAC;EACxC,MAAMC,WAAW,GAAGN,KAAK,CAACO,WAAW,CAACC,UAAU,IAAI;IAClD,IAAI,CAACA,UAAU,EAAE;MACf;IACF;IAEAC,MAAM,CAACC,MAAM,CAACF,UAAU,CAACG,QAAQ,CAAC,CAACC,OAAO,CAACC,QAAQ,IAAI;MACrDA,QAAQ,CAAC,CAAC;IACZ,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EACN,MAAMC,qBAAqB,GAAGd,KAAK,CAACO,WAAW,CAAC,CAACQ,KAAK,EAA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