Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import { css } from '@emotion/react'; import { IconKey } from '@tabler/icons-react'; import { Group } from '@allshares/studio-design-system'; import { DesignerTokenIcon } from '@amalia/amalia-lang/tokens/components'; import { TokenType } from '@amalia/amalia-lang/tokens/types'; import { type FormatsEnum, type Property } from '@amalia/data-capture/fields/types'; export const buildPropertiesOptions = ( properties: Property[] | undefined, externalId: string | null, format?: FormatsEnum, ) => (properties ?? []) .filter(format ? (property) => property.format === format : () => true) .toSorted((a, b) => { if (a.machineName === externalId) { return -1; } if (b.machineName === externalId) { return 1; } return a.machineName.localeCompare(b.machineName); }) .map((property) => ({ label: externalId === property.machineName ? ( <Group align="center" justify="space-between" > {property.name} <IconKey size={16} css={css` flex-shrink: 0; `} /> </Group> ) : ( property.name ), filterLabel: `${property.machineName} ${property.name}`, value: property.machineName, valueLabel: property.name, icon: ( <DesignerTokenIcon tokenFormat={property.format} tokenType={TokenType.PROPERTY} /> ), })); |