Skip to content

Commit

Permalink
Ajout "name" sur displayprops
Browse files Browse the repository at this point in the history
  • Loading branch information
JabX committed Nov 18, 2024
1 parent fe30418 commit 69c77d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/forms/src/components/display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export interface DisplayProps<T extends DomainFieldType> {
* Par défaut : `lists-if-multiple` (`inline` si une seule valeur et `lists` sinon).
*/
multiValueDisplay?: "inline" | "lists-if-multiple" | "lists";
/** Nom du champ. */
name?: string;
/** CSS. */
theme?: CSSProp<DisplayCss>;
/** Type du champ (celui du domaine). */
Expand All @@ -48,6 +50,7 @@ export function Display<T extends DomainFieldType>({
listChunkSize,
keyResolver,
multiValueDisplay = "lists-if-multiple",
name,
theme: pTheme,
value,
values
Expand Down Expand Up @@ -91,7 +94,7 @@ export function Display<T extends DomainFieldType>({
);

return useObserver(() => (
<div className={theme.display()}>
<div className={theme.display()} data-name={name}>
{Array.isArray(label) ? (
multiValueDisplay === "lists" || (multiValueDisplay === "lists-if-multiple" && label.length > 1) ? (
<div className={theme.lists()}>
Expand Down
1 change: 1 addition & 0 deletions packages/forms/src/fields/field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export function Field<F extends FieldEntry>(
{...displayProps}
formatter={displayFormatter}
keyResolver={autocompleteProps.keyResolver}
name={name}
theme={themeable(domainDCP.theme ?? {}, displayProps.theme ?? {})}
type={type}
value={value}
Expand Down
1 change: 1 addition & 0 deletions packages/stores/src/entity/types/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface BaseAutocompleteProps<DT extends DomainFieldType> extends BaseI
export interface BaseDisplayProps<DT extends DomainFieldType> extends WithThemeProps {
formatter?: (value: DomainType<SingleDomainFieldType<DT>>) => string;
keyResolver?: (key: DomainType<SingleDomainFieldType<DT>>) => Promise<string | undefined>;
name?: string;
type?: DT;
value?: DomainType<DT>;
values?: ReferenceList;
Expand Down

0 comments on commit 69c77d7

Please sign in to comment.