Skip to content

Commit 78262e9

Browse files
committed
Merge branch 'next' into support-offline-mode
2 parents cf79b3b + 4f9f836 commit 78262e9

23 files changed

+786
-722
lines changed

examples/crm/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
"@types/papaparse": "^5",
3535
"@types/react": "^18.3.3",
3636
"@types/react-dom": "^18.3.0",
37-
"@vitejs/plugin-react": "^4.2.1",
38-
"rollup-plugin-visualizer": "^5.12.0",
39-
"rollup-preserve-directives": "^1.1.1",
37+
"@vitejs/plugin-react": "^4.3.4",
38+
"rollup-plugin-visualizer": "^5.14.0",
39+
"rollup-preserve-directives": "^1.1.3",
4040
"typescript": "^5.1.3",
41-
"vite": "^5.0.11",
41+
"vite": "^6.2.6",
4242
"web-vitals": "^3.5.1"
4343
},
4444
"scripts": {

examples/demo/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@apollo/client": "^3.12.4",
88
"@mui/icons-material": "^7.0.0",
99
"@mui/material": "^7.0.0",
10+
"@types/recharts": "^1.8.10",
1011
"@vitejs/plugin-react": "^2.2.0",
1112
"clsx": "^2.1.1",
1213
"data-generator-retail": "^5.0.0",
@@ -44,11 +45,10 @@
4445
"@types/node": "^20.10.7",
4546
"@types/react": "^18.3.3",
4647
"@types/react-dom": "^18.3.0",
47-
"@vitejs/plugin-react": "^4.2.1",
48-
"rewire": "^5.0.0",
49-
"rollup-plugin-visualizer": "^5.12.0",
50-
"rollup-preserve-directives": "^1.1.1",
48+
"@vitejs/plugin-react": "^4.3.4",
49+
"rollup-plugin-visualizer": "^5.14.0",
50+
"rollup-preserve-directives": "^1.1.3",
5151
"typescript": "^5.1.3",
52-
"vite": "^5.0.11"
52+
"vite": "^6.2.6"
5353
}
5454
}

examples/no-code/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"react-dom": "^18.3.1"
1717
},
1818
"devDependencies": {
19-
"@vitejs/plugin-react": "^4.2.1",
19+
"@vitejs/plugin-react": "^4.3.4",
2020
"typescript": "^5.1.3",
21-
"vite": "^5.0.11"
21+
"vite": "^6.2.6"
2222
},
2323
"gitHead": "6eb0f6fcbe3ba237b507f3506d230b3445c0a764"
2424
}

examples/simple/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
},
3333
"devDependencies": {
3434
"@hookform/devtools": "^4.3.3",
35-
"@vitejs/plugin-react": "^4.2.1",
35+
"@vitejs/plugin-react": "^4.3.4",
3636
"little-state-machine": "^4.8.1",
3737
"react-simple-animate": "^3.5.3",
3838
"typescript": "^5.1.3",
39-
"vite": "^5.0.11"
39+
"vite": "^6.2.6"
4040
}
4141
}

examples/tutorial/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"devDependencies": {
2020
"@types/react": "^18.3.3",
2121
"@types/react-dom": "^18.3.0",
22-
"@vitejs/plugin-react": "^4.2.1",
22+
"@vitejs/plugin-react": "^4.3.4",
2323
"typescript": "^5.1.3",
24-
"vite": "^5.0.11"
24+
"vite": "^6.2.6"
2525
}
2626
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"react-dom": "^18.3.1",
8181
"storybook": "^8.6.11",
8282
"ts-jest": "^29.1.0",
83-
"tsx": "^4.19.2",
83+
"tsx": "^4.19.3",
8484
"typescript": "^5.1.3",
8585
"typescript-eslint": "^8.28.0",
8686
"whatwg-fetch": "^3.0.0"

packages/create-react-admin/templates/common/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@types/node": "^20.10.7",
2626
"@types/react": "^18.3.3",
2727
"@types/react-dom": "^18.3.0",
28-
"@vitejs/plugin-react": "^4.0.1",
28+
"@vitejs/plugin-react": "^4.3.4",
2929
"eslint": "^9.23.0",
3030
"eslint-config-prettier": "^10.1.1",
3131
"eslint-plugin-prettier": "^5.2.5",
@@ -35,6 +35,6 @@
3535
"prettier": "^3.3.3",
3636
"typescript": "^5.1.6",
3737
"typescript-eslint": "^8.28.0",
38-
"vite": "^5.3.5"
38+
"vite": "^6.2.6"
3939
}
4040
}

packages/create-react-admin/templates/ra-data-fakerest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"@testing-library/dom": "^10.4.0",
1010
"@testing-library/react": "^16.0.0",
1111
"jsdom": "^24.1.1",
12-
"vitest": "^2.0.5"
12+
"vitest": "^3.1.1"
1313
}
1414
}

packages/ra-core/src/form/choices/useChoices.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export interface UseChoicesOptions {
2727
optionText?: OptionText;
2828
disableValue?: string;
2929
translateChoice?: boolean;
30+
createValue?: string;
31+
createHintValue?: string;
3032
}
3133

3234
/*
@@ -45,11 +47,20 @@ export const useChoices = ({
4547
optionValue = 'id',
4648
disableValue = 'disabled',
4749
translateChoice = true,
50+
createValue = '@@ra-create',
51+
createHintValue = '@@ra-create-hint',
4852
}: UseChoicesOptions) => {
4953
const translate = useTranslate();
5054

5155
const getChoiceText = useCallback(
5256
choice => {
57+
if (choice?.id === createValue || choice?.id === createHintValue) {
58+
return get(
59+
choice,
60+
typeof optionText === 'string' ? optionText : 'name'
61+
);
62+
}
63+
5364
if (isValidElement<{ record: any }>(optionText)) {
5465
return (
5566
<RecordContextProvider value={choice}>
@@ -68,7 +79,7 @@ export const useChoices = ({
6879
? translate(String(choiceName), { _: choiceName })
6980
: String(choiceName);
7081
},
71-
[optionText, translate, translateChoice]
82+
[createHintValue, createValue, optionText, translate, translateChoice]
7283
);
7384

7485
const getChoiceValue = useCallback(

packages/ra-core/src/form/useSuggestions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const useSuggestions = ({
3030
choices,
3131
createText = 'ra.action.create',
3232
createValue = '@@create',
33+
createHintValue = '@@ra-create-hint',
3334
limitChoicesToValue,
3435
matchSuggestion,
3536
optionText,
@@ -43,6 +44,8 @@ export const useSuggestions = ({
4344
optionText,
4445
optionValue,
4546
translateChoice,
47+
createValue,
48+
createHintValue,
4649
});
4750

4851
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -93,7 +96,6 @@ export interface UseSuggestionsOptions extends UseChoicesOptions {
9396
allowDuplicates?: boolean;
9497
choices?: any[];
9598
createText?: string;
96-
createValue?: any;
9799
limitChoicesToValue?: boolean;
98100
matchSuggestion?: (
99101
filter: string,

0 commit comments

Comments
 (0)