24 lines
802 B
JavaScript
24 lines
802 B
JavaScript
/**
|
|
* Readable array rows in the panel. Spread into an array field's `admin.components`:
|
|
*
|
|
* { name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' },
|
|
* admin: { initCollapsed: true, components: rowLabel(['heading'], 'Feature') }, fields: [...] }
|
|
*
|
|
* Rows then read "Fast delivery", "24/7 support"… instead of "Feature 01, Feature 02".
|
|
* After adding it to a project: `pnpm payload generate:importmap`.
|
|
*/ export function rowLabel(fields, fallback = 'Item') {
|
|
const clientProps = {
|
|
fields: Array.isArray(fields) ? fields : [
|
|
fields
|
|
],
|
|
fallback
|
|
};
|
|
return {
|
|
RowLabel: {
|
|
path: '@intecion/ipal-kit/admin#RowLabel',
|
|
clientProps
|
|
}
|
|
};
|
|
}
|
|
|
|
//# sourceMappingURL=rowLabel.js.map
|