Files
klz-cables.com/.pnpm-store/v10/files/fa/adcfae202193a4618fd05aa7ba050b4f2c8d91f2871e2f00ff1a437d62e42f8b8cd8f2dc6e824d2cc79299dd6557198c5650c864a4269eb9ca8c49a24d9840
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
2.4 KiB
Plaintext

{"version":3,"file":"getDisplayedFieldValue.js","names":["getTranslation","isValidReactElement","getDisplayedFieldValue","cellData","field","i18n","type","Array","isArray","options","selectedOption","find","opt","value","label"],"sources":["../../src/utilities/getDisplayedFieldValue.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { ClientField } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\n\nimport { isValidReactElement } from './isValidReactElement.js'\n\n/**\n * Returns the appropriate display value for a field.\n * - For select and radio fields:\n * - Returns JSX elements as-is.\n * - Translates localized label objects based on the current language.\n * - Returns string labels directly.\n * - Falls back to the option value if no valid label is found.\n * - For all other field types, returns `cellData` unchanged.\n */\nexport const getDisplayedFieldValue = (cellData: any, field: ClientField, i18n: I18nClient) => {\n if ((field?.type === 'select' || field?.type === 'radio') && Array.isArray(field.options)) {\n const selectedOption = field.options.find((opt) =>\n typeof opt === 'object' ? opt.value === cellData : opt === cellData,\n )\n\n if (selectedOption) {\n if (typeof selectedOption === 'object' && 'label' in selectedOption) {\n return isValidReactElement(selectedOption.label)\n ? selectedOption.label // Return JSX directly\n : getTranslation(selectedOption.label, i18n) || selectedOption.value // Use translation or fallback to value\n }\n return selectedOption // If option is a string, return it directly\n }\n }\n return cellData // Default fallback if no match found\n}\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAE/B,SAASC,mBAAmB,QAAQ;AAEpC;;;;;;;;;AASA,OAAO,MAAMC,sBAAA,GAAyBA,CAACC,QAAA,EAAeC,KAAA,EAAoBC,IAAA;EACxE,IAAI,CAACD,KAAA,EAAOE,IAAA,KAAS,YAAYF,KAAA,EAAOE,IAAA,KAAS,OAAM,KAAMC,KAAA,CAAMC,OAAO,CAACJ,KAAA,CAAMK,OAAO,GAAG;IACzF,MAAMC,cAAA,GAAiBN,KAAA,CAAMK,OAAO,CAACE,IAAI,CAAEC,GAAA,IACzC,OAAOA,GAAA,KAAQ,WAAWA,GAAA,CAAIC,KAAK,KAAKV,QAAA,GAAWS,GAAA,KAAQT,QAAA;IAG7D,IAAIO,cAAA,EAAgB;MAClB,IAAI,OAAOA,cAAA,KAAmB,YAAY,WAAWA,cAAA,EAAgB;QACnE,OAAOT,mBAAA,CAAoBS,cAAA,CAAeI,KAAK,IAC3CJ,cAAA,CAAeI,KAAK,CAAC;QAAA,EACrBd,cAAA,CAAeU,cAAA,CAAeI,KAAK,EAAET,IAAA,KAASK,cAAA,CAAeG,KAAK,CAAC;AAAA;MACzE;MACA,OAAOH,cAAA,CAAe;AAAA;IACxB;EACF;EACA,OAAOP,QAAA,CAAS;AAAA;AAClB","ignoreList":[]}