Files
klz-cables.com/.pnpm-store/v10/files/85/6d938fac5b9e631bb0630e4d001b2e83758d86f2d240d08992c5c7c628082e28431e9cff51a107346898011b02ba5e4b916c99bc629c91fcb4b0d3b7bf8add
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
1.9 KiB
Plaintext

{"version":3,"sources":["../../src/utilities/stripUnselectedFields.ts"],"sourcesContent":["import type { Data } from '../admin/types.js'\nimport type { Field, TabAsField } from '../fields/config/types.js'\nimport type { SelectMode, SelectType } from '../types/index.js'\n\nimport { fieldAffectsData } from '../fields/config/types.js'\n\n/**\n * This is used for the Select API to strip out fields that are not selected.\n * It will mutate the given data object and determine if your recursive function should continue to run.\n * It is used within the `afterRead` hook as well as `getFormState`.\n * @returns boolean - whether or not the recursive function should continue\n */\nexport const stripUnselectedFields = ({\n field,\n select,\n selectMode,\n siblingDoc,\n}: {\n field: Field | TabAsField\n select: SelectType\n selectMode: SelectMode\n siblingDoc: Data\n}): boolean => {\n let shouldContinue = true\n\n if (fieldAffectsData(field) && select && selectMode && field.name) {\n if (selectMode === 'include') {\n if (!select[field.name]) {\n delete siblingDoc[field.name]\n shouldContinue = false\n }\n }\n\n if (selectMode === 'exclude') {\n if (select[field.name] === false) {\n delete siblingDoc[field.name]\n shouldContinue = false\n }\n }\n }\n\n return shouldContinue\n}\n"],"names":["fieldAffectsData","stripUnselectedFields","field","select","selectMode","siblingDoc","shouldContinue","name"],"mappings":"AAIA,SAASA,gBAAgB,QAAQ,4BAA2B;AAE5D;;;;;CAKC,GACD,OAAO,MAAMC,wBAAwB,CAAC,EACpCC,KAAK,EACLC,MAAM,EACNC,UAAU,EACVC,UAAU,EAMX;IACC,IAAIC,iBAAiB;IAErB,IAAIN,iBAAiBE,UAAUC,UAAUC,cAAcF,MAAMK,IAAI,EAAE;QACjE,IAAIH,eAAe,WAAW;YAC5B,IAAI,CAACD,MAAM,CAACD,MAAMK,IAAI,CAAC,EAAE;gBACvB,OAAOF,UAAU,CAACH,MAAMK,IAAI,CAAC;gBAC7BD,iBAAiB;YACnB;QACF;QAEA,IAAIF,eAAe,WAAW;YAC5B,IAAID,MAAM,CAACD,MAAMK,IAAI,CAAC,KAAK,OAAO;gBAChC,OAAOF,UAAU,CAACH,MAAMK,IAAI,CAAC;gBAC7BD,iBAAiB;YACnB;QACF;IACF;IAEA,OAAOA;AACT,EAAC"}