Files
ETB/ETB-FrontEnd/node_modules/.cache/babel-loader/c7681440249b66bcd5055b2a3a9196472a4273d9f2ea0e2fe784b4058019df94.json
Iliyan Angelov 306b20e24a Frontend start
2025-09-14 00:54:48 +03:00

1 line
17 KiB
JSON

{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"item\", \"applyValue\", \"type\", \"apiRef\", \"focusElementRef\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { unstable_useId as useId } from '@mui/material/utils';\nimport MenuItem from '@mui/material/MenuItem';\nimport { useGridRootProps } from '../../../hooks/utils/useGridRootProps';\nimport { getValueFromValueOptions } from './filterPanelUtils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst renderSingleSelectOptions = ({\n valueOptions,\n valueFormatter,\n field\n}, api, OptionComponent) => {\n const iterableColumnValues = typeof valueOptions === 'function' ? ['', ...valueOptions({\n field\n })] : ['', ...(valueOptions || [])];\n return iterableColumnValues.map(option => {\n const isOptionTypeObject = typeof option === 'object';\n const key = isOptionTypeObject ? option.value : option;\n const value = isOptionTypeObject ? option.value : option;\n const formattedValue = valueFormatter && option !== '' ? valueFormatter({\n value: option,\n field,\n api\n }) : option;\n const content = isOptionTypeObject ? option.label : formattedValue;\n return /*#__PURE__*/_jsx(OptionComponent, {\n value: value,\n children: content\n }, key);\n });\n};\nfunction GridFilterInputSingleSelect(props) {\n var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;\n const {\n item,\n applyValue,\n type,\n apiRef,\n focusElementRef\n } = props,\n others = _objectWithoutPropertiesLoose(props, _excluded);\n const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');\n const id = useId();\n const rootProps = useGridRootProps();\n const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};\n const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;\n const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;\n const currentValueOptions = React.useMemo(() => {\n if (currentColumn === null) {\n return undefined;\n }\n return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({\n field: currentColumn.field\n }) : currentColumn.valueOptions;\n }, [currentColumn]);\n const onFilterChange = React.useCallback(event => {\n let value = event.target.value; // NativeSelect casts the value to a string.\n\n value = getValueFromValueOptions(value, currentValueOptions);\n setFilterValueState(String(value));\n applyValue(_extends({}, item, {\n value\n }));\n }, [applyValue, item, currentValueOptions]);\n React.useEffect(() => {\n var _itemValue;\n let itemValue;\n if (currentValueOptions !== undefined) {\n // sanitize if valueOptions are provided\n itemValue = getValueFromValueOptions(item.value, currentValueOptions);\n if (itemValue !== item.value) {\n applyValue(_extends({}, item, {\n value: itemValue\n }));\n return;\n }\n } else {\n itemValue = item.value;\n }\n itemValue = (_itemValue = itemValue) != null ? _itemValue : '';\n setFilterValueState(String(itemValue));\n }, [item, currentValueOptions, applyValue]);\n return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({\n id: id,\n label: apiRef.current.getLocaleText('filterPanelInputLabel'),\n placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),\n value: filterValueState,\n onChange: onFilterChange,\n variant: \"standard\",\n type: type || 'text',\n InputLabelProps: {\n shrink: true\n },\n inputRef: focusElementRef,\n select: true,\n SelectProps: _extends({\n native: isSelectNative\n }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect)\n }, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {\n children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)\n }));\n}\nprocess.env.NODE_ENV !== \"production\" ? GridFilterInputSingleSelect.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the TypeScript types and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n apiRef: PropTypes.shape({\n current: PropTypes.object.isRequired\n }).isRequired,\n applyValue: PropTypes.func.isRequired,\n focusElementRef: PropTypes\n /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),\n item: PropTypes.shape({\n columnField: PropTypes.string.isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n operatorValue: PropTypes.string,\n value: PropTypes.any\n }).isRequired\n} : void 0;\nexport { GridFilterInputSingleSelect };","map":{"version":3,"names":["_extends","_objectWithoutPropertiesLoose","_excluded","React","PropTypes","unstable_useId","useId","MenuItem","useGridRootProps","getValueFromValueOptions","jsx","_jsx","renderSingleSelectOptions","valueOptions","valueFormatter","field","api","OptionComponent","iterableColumnValues","map","option","isOptionTypeObject","key","value","formattedValue","content","label","children","GridFilterInputSingleSelect","props","_item$value","_rootProps$components","_baseSelectProps$nati","_rootProps$components2","_rootProps$components3","item","applyValue","type","apiRef","focusElementRef","others","filterValueState","setFilterValueState","useState","id","rootProps","baseSelectProps","componentsProps","baseSelect","isSelectNative","native","currentColumn","columnField","current","getColumn","currentValueOptions","useMemo","undefined","onFilterChange","useCallback","event","target","String","useEffect","_itemValue","itemValue","components","BaseTextField","getLocaleText","placeholder","onChange","variant","InputLabelProps","shrink","inputRef","select","SelectProps","baseTextField","process","env","NODE_ENV","propTypes","shape","object","isRequired","func","oneOfType","string","number","operatorValue","any"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/x-data-grid/components/panel/filterPanel/GridFilterInputSingleSelect.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"item\", \"applyValue\", \"type\", \"apiRef\", \"focusElementRef\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { unstable_useId as useId } from '@mui/material/utils';\nimport MenuItem from '@mui/material/MenuItem';\nimport { useGridRootProps } from '../../../hooks/utils/useGridRootProps';\nimport { getValueFromValueOptions } from './filterPanelUtils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n\nconst renderSingleSelectOptions = ({\n valueOptions,\n valueFormatter,\n field\n}, api, OptionComponent) => {\n const iterableColumnValues = typeof valueOptions === 'function' ? ['', ...valueOptions({\n field\n })] : ['', ...(valueOptions || [])];\n return iterableColumnValues.map(option => {\n const isOptionTypeObject = typeof option === 'object';\n const key = isOptionTypeObject ? option.value : option;\n const value = isOptionTypeObject ? option.value : option;\n const formattedValue = valueFormatter && option !== '' ? valueFormatter({\n value: option,\n field,\n api\n }) : option;\n const content = isOptionTypeObject ? option.label : formattedValue;\n return /*#__PURE__*/_jsx(OptionComponent, {\n value: value,\n children: content\n }, key);\n });\n};\n\nfunction GridFilterInputSingleSelect(props) {\n var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;\n\n const {\n item,\n applyValue,\n type,\n apiRef,\n focusElementRef\n } = props,\n others = _objectWithoutPropertiesLoose(props, _excluded);\n\n const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');\n const id = useId();\n const rootProps = useGridRootProps();\n const baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};\n const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;\n const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;\n const currentValueOptions = React.useMemo(() => {\n if (currentColumn === null) {\n return undefined;\n }\n\n return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({\n field: currentColumn.field\n }) : currentColumn.valueOptions;\n }, [currentColumn]);\n const onFilterChange = React.useCallback(event => {\n let value = event.target.value; // NativeSelect casts the value to a string.\n\n value = getValueFromValueOptions(value, currentValueOptions);\n setFilterValueState(String(value));\n applyValue(_extends({}, item, {\n value\n }));\n }, [applyValue, item, currentValueOptions]);\n React.useEffect(() => {\n var _itemValue;\n\n let itemValue;\n\n if (currentValueOptions !== undefined) {\n // sanitize if valueOptions are provided\n itemValue = getValueFromValueOptions(item.value, currentValueOptions);\n\n if (itemValue !== item.value) {\n applyValue(_extends({}, item, {\n value: itemValue\n }));\n return;\n }\n } else {\n itemValue = item.value;\n }\n\n itemValue = (_itemValue = itemValue) != null ? _itemValue : '';\n setFilterValueState(String(itemValue));\n }, [item, currentValueOptions, applyValue]);\n return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({\n id: id,\n label: apiRef.current.getLocaleText('filterPanelInputLabel'),\n placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),\n value: filterValueState,\n onChange: onFilterChange,\n variant: \"standard\",\n type: type || 'text',\n InputLabelProps: {\n shrink: true\n },\n inputRef: focusElementRef,\n select: true,\n SelectProps: _extends({\n native: isSelectNative\n }, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect)\n }, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {\n children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)\n }));\n}\n\nprocess.env.NODE_ENV !== \"production\" ? GridFilterInputSingleSelect.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the TypeScript types and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n apiRef: PropTypes.shape({\n current: PropTypes.object.isRequired\n }).isRequired,\n applyValue: PropTypes.func.isRequired,\n focusElementRef: PropTypes\n /* @typescript-to-proptypes-ignore */\n .oneOfType([PropTypes.func, PropTypes.object]),\n item: PropTypes.shape({\n columnField: PropTypes.string.isRequired,\n id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n operatorValue: PropTypes.string,\n value: PropTypes.any\n }).isRequired\n}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