{"version":3,"file":"listView.mjs","sources":["../../../admin/src/contentManagerHooks/listView.tsx"],"sourcesContent":["/* eslint-disable check-file/filename-naming-convention */\nimport { LocaleListCell } from '../components/LocaleListCell';\nimport { doesPluginOptionsHaveI18nLocalized } from '../utils/fields';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { ListFieldLayout, ListLayout } from '@strapi/content-manager/strapi-admin';\n\n/* -------------------------------------------------------------------------------------------------\n * addColumnToTableHook\n * -----------------------------------------------------------------------------------------------*/\ninterface AddColumnToTableHookArgs {\n  layout: ListLayout;\n  displayedHeaders: ListFieldLayout[];\n}\n\nconst addColumnToTableHook = ({ displayedHeaders, layout }: AddColumnToTableHookArgs) => {\n  const { options } = layout;\n\n  const isFieldLocalized = doesPluginOptionsHaveI18nLocalized(options)\n    ? options.i18n.localized\n    : false;\n\n  if (!isFieldLocalized) {\n    return { displayedHeaders, layout };\n  }\n\n  return {\n    displayedHeaders: [\n      ...displayedHeaders,\n      {\n        attribute: { type: 'string' },\n        label: {\n          id: getTranslation('list-view.table.header.label'),\n          defaultMessage: 'Available in',\n        },\n        searchable: false,\n        sortable: false,\n        name: 'locales',\n        // @ts-expect-error – ID is seen as number | string; this will change when we move the type over.\n        cellFormatter: (props, _header, meta) => (\n          <LocaleListCell {...props} {...meta} documentId={props.documentId} />\n        ),\n      },\n    ],\n    layout,\n  };\n};\n\nexport { addColumnToTableHook };\n"],"names":["addColumnToTableHook","displayedHeaders","layout","options","isFieldLocalized","doesPluginOptionsHaveI18nLocalized","i18n","localized","attribute","type","label","id","getTranslation","defaultMessage","searchable","sortable","name","cellFormatter","props","_header","meta","_jsx","LocaleListCell","documentId"],"mappings":";;;;;AAeA,MAAMA,uBAAuB,CAAC,EAAEC,gBAAgB,EAAEC,MAAM,EAA4B,GAAA;IAClF,MAAM,EAAEC,OAAO,EAAE,GAAGD,MAAAA;AAEpB,IAAA,MAAME,mBAAmBC,kCAAAA,CAAmCF,OAAAA,CAAAA,GACxDA,QAAQG,IAAI,CAACC,SAAS,GACtB,KAAA;AAEJ,IAAA,IAAI,CAACH,gBAAAA,EAAkB;QACrB,OAAO;AAAEH,YAAAA,gBAAAA;AAAkBC,YAAAA;AAAO,SAAA;AACpC,IAAA;IAEA,OAAO;QACLD,gBAAAA,EAAkB;AACbA,YAAAA,GAAAA,gBAAAA;AACH,YAAA;gBACEO,SAAAA,EAAW;oBAAEC,IAAAA,EAAM;AAAS,iBAAA;gBAC5BC,KAAAA,EAAO;AACLC,oBAAAA,EAAAA,EAAIC,cAAAA,CAAe,8BAAA,CAAA;oBACnBC,cAAAA,EAAgB;AAClB,iBAAA;gBACAC,UAAAA,EAAY,KAAA;gBACZC,QAAAA,EAAU,KAAA;gBACVC,IAAAA,EAAM,SAAA;;AAENC,gBAAAA,aAAAA,EAAe,CAACC,KAAAA,EAAOC,OAAAA,EAASC,IAAAA,iBAC9BC,GAAA,CAACC,cAAAA,EAAAA;AAAgB,wBAAA,GAAGJ,KAAK;AAAG,wBAAA,GAAGE,IAAI;AAAEG,wBAAAA,UAAAA,EAAYL,MAAMK;;AAE3D;AACD,SAAA;AACDrB,QAAAA;AACF,KAAA;AACF;;;;"}