1 line
4.7 KiB
JSON
1 line
4.7 KiB
JSON
{"ast":null,"code":"import * as React from 'react';\nimport { localStorageAvailable } from '../../utils/utils';\nconst forceDebug = localStorageAvailable() && window.localStorage.getItem('DEBUG') != null;\nconst noop = () => {};\nconst noopLogger = {\n debug: noop,\n info: noop,\n warn: noop,\n error: noop\n};\nconst LOG_LEVELS = ['debug', 'info', 'warn', 'error'];\nfunction getAppender(name, logLevel, appender = console) {\n const minLogLevelIdx = LOG_LEVELS.indexOf(logLevel);\n if (minLogLevelIdx === -1) {\n throw new Error(`MUI: Log level ${logLevel} not recognized.`);\n }\n const logger = LOG_LEVELS.reduce((loggerObj, method, idx) => {\n if (idx >= minLogLevelIdx) {\n loggerObj[method] = (...args) => {\n const [message, ...other] = args;\n appender[method](`MUI: ${name} - ${message}`, ...other);\n };\n } else {\n loggerObj[method] = noop;\n }\n return loggerObj;\n }, {});\n return logger;\n}\nexport const useGridLoggerFactory = (apiRef, props) => {\n apiRef.current.getLogger = React.useCallback(name => {\n if (forceDebug) {\n return getAppender(name, 'debug', props.logger);\n }\n if (!props.logLevel) {\n return noopLogger;\n }\n return getAppender(name, props.logLevel.toString(), props.logger);\n }, [props.logLevel, props.logger]);\n};","map":{"version":3,"names":["React","localStorageAvailable","forceDebug","window","localStorage","getItem","noop","noopLogger","debug","info","warn","error","LOG_LEVELS","getAppender","name","logLevel","appender","console","minLogLevelIdx","indexOf","Error","logger","reduce","loggerObj","method","idx","args","message","other","useGridLoggerFactory","apiRef","props","current","getLogger","useCallback","toString"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/hooks/core/useGridLoggerFactory.js"],"sourcesContent":["import * as React from 'react';\nimport { localStorageAvailable } from '../../utils/utils';\nconst forceDebug = localStorageAvailable() && window.localStorage.getItem('DEBUG') != null;\n\nconst noop = () => {};\n\nconst noopLogger = {\n debug: noop,\n info: noop,\n warn: noop,\n error: noop\n};\nconst LOG_LEVELS = ['debug', 'info', 'warn', 'error'];\n\nfunction getAppender(name, logLevel, appender = console) {\n const minLogLevelIdx = LOG_LEVELS.indexOf(logLevel);\n\n if (minLogLevelIdx === -1) {\n throw new Error(`MUI: Log level ${logLevel} not recognized.`);\n }\n\n const logger = LOG_LEVELS.reduce((loggerObj, method, idx) => {\n if (idx >= minLogLevelIdx) {\n loggerObj[method] = (...args) => {\n const [message, ...other] = args;\n appender[method](`MUI: ${name} - ${message}`, ...other);\n };\n } else {\n loggerObj[method] = noop;\n }\n\n return loggerObj;\n }, {});\n return logger;\n}\n\nexport const useGridLoggerFactory = (apiRef, props) => {\n apiRef.current.getLogger = React.useCallback(name => {\n if (forceDebug) {\n return getAppender(name, 'debug', props.logger);\n }\n\n if (!props.logLevel) {\n return noopLogger;\n }\n\n return getAppender(name, props.logLevel.toString(), props.logger);\n }, [props.logLevel, props.logger]);\n};"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,qBAAqB,QAAQ,mBAAmB;AACzD,MAAMC,UAAU,GAAGD,qBAAqB,CAAC,CAAC,IAAIE,MAAM,CAACC,YAAY,CAACC,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI;AAE1F,MAAMC,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAErB,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAEF,IAAI;EACXG,IAAI,EAAEH,IAAI;EACVI,IAAI,EAAEJ,IAAI;EACVK,KAAK,EAAEL;AACT,CAAC;AACD,MAAMM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AAErD,SAASC,WAAWA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,QAAQ,GAAGC,OAAO,EAAE;EACvD,MAAMC,cAAc,GAAGN,UAAU,CAACO,OAAO,CAACJ,QAAQ,CAAC;EAEnD,IAAIG,cAAc,KAAK,CAAC,CAAC,EAAE;IACzB,MAAM,IAAIE,KAAK,CAAC,kBAAkBL,QAAQ,kBAA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