Files
klz-cables.com/.pnpm-store/v10/files/dc/1d4e903124d1c08211cdc0295488278a576540d7db64ce5e4099b0ff985bf2d1c230a4bc4557b911f0e9e30d60572b28f3f7b5f343eacd1d28681b87a86013
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

63 lines
2.0 KiB
Plaintext

'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { fieldIsHiddenOrDisabled, fieldIsID } from 'payload/shared';
import React, { useId, useMemo } from 'react';
import { FieldLabel } from '../../fields/FieldLabel/index.js';
import { useEditDepth } from '../../providers/EditDepth/index.js';
import { useTableColumns } from '../../providers/TableColumns/index.js';
import { PillSelector } from '../PillSelector/index.js';
export const ColumnSelector = ({
collectionSlug
}) => {
const {
columns,
moveColumn,
toggleColumn
} = useTableColumns();
const uuid = useId();
const editDepth = useEditDepth();
const filteredColumns = useMemo(() => columns?.filter(col => !(fieldIsHiddenOrDisabled(col.field) && !fieldIsID(col.field)) && !col?.field?.admin?.disableListColumn), [columns]);
const pills = useMemo(() => {
return filteredColumns ? filteredColumns.map((col_0, i) => {
const {
accessor,
active,
field
} = col_0;
const label = 'labelWithPrefix' in field && field.labelWithPrefix !== undefined ? field.labelWithPrefix : 'label' in field && field.label !== undefined ? field.label : 'name' in field && field.name !== undefined ? field.name : undefined;
return {
name: accessor,
key: `${collectionSlug}-${accessor}-${i}${editDepth ? `-${editDepth}-` : ''}${uuid}`,
Label: /*#__PURE__*/_jsx(FieldLabel, {
label: label,
unstyled: true
}),
selected: active
};
}) : null;
}, [collectionSlug, editDepth, filteredColumns, uuid]);
if (!pills) {
return null;
}
return /*#__PURE__*/_jsx(PillSelector, {
draggable: {
onDragEnd: ({
moveFromIndex,
moveToIndex
}) => {
void moveColumn({
fromIndex: moveFromIndex,
toIndex: moveToIndex
});
}
},
onClick: ({
pill
}) => {
void toggleColumn(pill.name);
},
pills: pills
});
};
//# sourceMappingURL=index.js.map