Skip to content

Commit e998f3a

Browse files
authored
Merge pull request #2289 from marmelab/next
[WIP] Prepare 2.3 release
2 parents ca9fc37 + 150b693 commit e998f3a

File tree

263 files changed

+9030
-4108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+9030
-4108
lines changed

.babelrc

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,56 @@
11
{
2-
"presets": ["es2015", "stage-0", "react"],
3-
"plugins": [
4-
"transform-react-jsx",
5-
"add-module-exports",
6-
["babel-plugin-transform-builtin-extend", {
7-
"globals": ["Error"]
8-
}],
9-
["transform-runtime", {
10-
"polyfill": false,
11-
"regenerator": true
12-
}]
13-
]
2+
"env": {
3+
"cjs": {
4+
"presets": [
5+
["env", {
6+
"targets": {
7+
"browsers": ["last 2 versions"]
8+
}
9+
}],
10+
"react"
11+
],
12+
"plugins": [
13+
"transform-react-jsx",
14+
"add-module-exports",
15+
["babel-plugin-transform-builtin-extend", {
16+
"globals": ["Error"]
17+
}],
18+
["transform-runtime", {
19+
"polyfill": false,
20+
"regenerator": true
21+
}],
22+
"transform-class-properties",
23+
"transform-object-rest-spread",
24+
"transform-export-extensions",
25+
"transform-async-to-generator",
26+
"syntax-trailing-function-commas"
27+
]
28+
},
29+
"esm": {
30+
"presets": [
31+
["env", {
32+
"modules": false,
33+
"targets": {
34+
"browsers": ["last 2 versions"]
35+
}
36+
}],
37+
"react"
38+
],
39+
"plugins": [
40+
"transform-react-jsx",
41+
["babel-plugin-transform-builtin-extend", {
42+
"globals": ["Error"]
43+
}],
44+
["transform-runtime", {
45+
"polyfill": false,
46+
"regenerator": true
47+
}],
48+
"transform-class-properties",
49+
"transform-object-rest-spread",
50+
"transform-export-extensions",
51+
"transform-async-to-generator",
52+
"syntax-trailing-function-commas"
53+
]
54+
},
55+
},
1456
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ yarn-error.log
33
lerna-debug.log
44
node_modules
55
lib
6+
esm
67
es6
78
docs/_site/
89
packages/react-admin/docs

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,52 @@
11
# Changelog
22

3+
## v2.3.0
4+
5+
* [`Actions`] Move `<Refresh>` to `<AppBar>` ([fzaninotto](https://github.com/fzaninotto))
6+
* [`Actions`] Remove the `<ListButton>` ([fzaninotto](https://github.com/fzaninotto))
7+
* [`Actions`] Update `<Button>` to adapt the icon size to the button size ([fzaninotto](https://github.com/fzaninotto))
8+
* [`AppBar`] Add `<UserMenu>` to group user-related actions (and `<Logout>`) ([fzaninotto](https://github.com/fzaninotto))
9+
* [`AppBar`] Add Headroom effect (show/hide on scroll) ([zyhou](https://github.com/zyhou))
10+
* [`ArrayInput`] Add debounce to `crudGetMatching` calls ([djhi](https://github.com/djhi))
11+
* [`ArrayInput`] Allow the `<FormDataConsumer>` to be used inside an `ArrayInput` ([djhi](https://github.com/djhi))
12+
* [`AutocompleteArrayInput`] Fix select on click ([djhi](https://github.com/djhi))
13+
* [`Datagrid`] Add padding right to the last column ([fzaninotto](https://github.com/fzaninotto))
14+
* [`Datagrid`] Hide the sort icons when the column is not active ([fzaninotto](https://github.com/fzaninotto))
15+
* [`Edit`] Add the `<TitleForRecord>` component (replacement for `<RecordTitle>`) ([fzaninotto](https://github.com/fzaninotto))
16+
* [`Edit`] Move the `<Delete>` button down to the Toolbar ([fzaninotto](https://github.com/fzaninotto))
17+
* [`Edit`] Use material design recommended margin for content ([fzaninotto](https://github.com/fzaninotto))
18+
* [`FormDataConsumer`] Fix wrong warning ([djhi](https://github.com/djhi))
19+
* [`FormInput`] Add the component to the export ([pedrohh](https://github.com/pedrohh))
20+
* [`Input`] Add `<AutocompleteArrayInput>` for editing one-to-many relationships with a large number of options ([djhi](https://github.com/djhi))
21+
* [`List`] Add `<BulkActionToolbar>` as a replacement for the `<BulkActions>` ([fzaninotto](https://github.com/fzaninotto))
22+
* [`List`] Display the `Filter` on the top left of the content ([fzaninotto](https://github.com/fzaninotto))
23+
* [`Login`] Replace the lock icon to allow forward compatibility with `@material-ui/icons` 2.0 ([djhi](https://github.com/djhi))
24+
* [`Pagination`] Add the ability to set the number of rows per page ([fzaninotto](https://github.com/fzaninotto))
25+
* [`RichTextInput`] Add support for `fullWidth` prop ([natrim](https://github.com/natrim))
26+
* [`Sidebar`] Add the ability to change the width ([fzaninotto](https://github.com/fzaninotto))
27+
* [`TabbedLayout`, `TabbedForm`] Let large forms extend horizontally, remove overflow scroll ([djhi](https://github.com/djhi))
28+
* [`Title`] Move the content to the `AppBar` ([fzaninotto](https://github.com/fzaninotto))
29+
* [`tree`] Introduce `ra-tree-core` and `ra-tree-ui-materialui` to display and edit tress structures in a List view (Labs) ([djhi](https://github.com/djhi))
30+
* [console] Add deprecation warnings (when not in production mode) ([djhi](https://github.com/djhi))
31+
* [Demo] Fix and upgrade GraphQL and Graphcool demos ([djhi](https://github.com/djhi))
32+
* [Demo] Improve fake data to have real avatars, consistent emails, and better looking reviews ([fzaninotto](https://github.com/fzaninotto))
33+
* [GraphQL] Add 'How does it work' section to the `ra-data-graphql` README ([Weakky](https://github.com/Weakky))
34+
* [GraphQL] Add a link to a Prisma `dataProvider` ([Weakky](https://github.com/Weakky))
35+
* [GraphQL] Allow easier per-query override ([djhi](https://github.com/djhi))
36+
* [npm] Expose `esm` modules to enable tree shaking (and smaller bundle size) ([Kmaschta](https://github.com/Kmaschta))
37+
* [npm] Remove babel `stage-0` preset and use `preset-env` instead ([Kmaschta](https://github.com/Kmaschta))
38+
* [redux] Allow to use <Admin> inside an external <Provider> ([fzaninotto](https://github.com/fzaninotto))
39+
40+
Deprecations:
41+
42+
* `<Admin>` `menu` prop. To override the menu component, use a [custom layout](#appLayout) instead.
43+
* `<AppBarMobile>`. The `<AppBar>` component is now responsive.
44+
* `<BulkActions>`. Use `<BulkActionToolbar>` instead.
45+
* `<Header>`. Use `<Title>` instead.
46+
* `<RecordTitle>`. Use `<TitleForRecord>` instead.
47+
* `<ViewTitle>`. Use `<Title>` instead.
48+
* GraphQL provides `override` prop. Use `buildQuery` instead.
49+
350
## v2.2.4
451

552
* Fix `<SaveButton>` misaligned `<CircularProgress>` ([natrim](https://github.com/natrim))

Makefile

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ install: package.json ## install dependencies
99
run: run-simple
1010

1111
run-simple: ## run the simple example
12-
@yarn -s run-simple
12+
@BABEL_ENV=cjs yarn -s run-simple
1313

1414
run-tutorial: ## run the tutorial example
1515
@yarn -s run-tutorial
@@ -28,56 +28,64 @@ run-graphcool-demo: ## run the demo example
2828

2929
build-ra-core:
3030
@echo "Transpiling ra-core files...";
31-
@cd ./packages/ra-core && yarn -s build
31+
@cd ./packages/ra-core && yarn -s build && yarn -s build-esm
3232

3333
build-ra-ui-materialui:
3434
@echo "Transpiling ra-ui-materialui files...";
35-
@cd ./packages/ra-ui-materialui && yarn -s build
35+
@cd ./packages/ra-ui-materialui && yarn -s build && yarn -s build-esm
3636

3737
build-react-admin:
3838
@echo "Transpiling react-admin files...";
3939
@rm -rf ./packages/react-admin/docs
40-
@cd ./packages/react-admin && yarn -s build
40+
@cd ./packages/react-admin && yarn -s build && yarn -s build-esm
4141
@mkdir packages/react-admin/docs
4242
@cp docs/*.md packages/react-admin/docs
4343

4444
build-ra-data-fakerest:
4545
@echo "Transpiling ra-data-fakerest files...";
46-
@cd ./packages/ra-data-fakerest && yarn -s build
46+
@cd ./packages/ra-data-fakerest && yarn -s build && yarn -s build-esm
4747

4848
build-ra-data-json-server:
4949
@echo "Transpiling ra-data-json-server files...";
50-
@cd ./packages/ra-data-json-server && yarn -s build
50+
@cd ./packages/ra-data-json-server && yarn -s build && yarn -s build-esm
5151

5252
build-ra-data-simple-rest:
5353
@echo "Transpiling ra-data-simple-rest files...";
54-
@cd ./packages/ra-data-simple-rest && yarn -s build
54+
@cd ./packages/ra-data-simple-rest && yarn -s build && yarn -s build-esm
5555

5656
build-ra-data-graphql:
5757
@echo "Transpiling ra-data-graphql files...";
58-
@cd ./packages/ra-data-graphql && yarn -s build
58+
@cd ./packages/ra-data-graphql && yarn -s build && yarn -s build-esm
5959

6060
build-ra-data-graphcool:
6161
@echo "Transpiling ra-data-graphcool files...";
62-
@cd ./packages/ra-data-graphcool && yarn -s build
62+
@cd ./packages/ra-data-graphcool && yarn -s build && yarn -s build-esm
6363

6464
build-ra-data-graphql-simple:
6565
@echo "Transpiling ra-data-graphql-simple files...";
66-
@cd ./packages/ra-data-graphql-simple && yarn -s build
66+
@cd ./packages/ra-data-graphql-simple && yarn -s build && yarn -s build-esm
6767

6868
build-ra-input-rich-text:
6969
@echo "Transpiling ra-input-rich-text files...";
70-
@cd ./packages/ra-input-rich-text && yarn -s build
70+
@cd ./packages/ra-input-rich-text && yarn -s build && yarn -s build-esm
7171

7272
build-ra-realtime:
7373
@echo "Transpiling ra-realtime files...";
74-
@cd ./packages/ra-realtime && yarn -s build
74+
@cd ./packages/ra-realtime && yarn -s build && yarn -s build-esm
75+
76+
build-ra-tree-core:
77+
@echo "Transpiling ra-tree-core files...";
78+
@cd ./packages/ra-tree-core && yarn -s build && yarn -s build-esm
79+
80+
build-ra-tree-ui-materialui:
81+
@echo "Transpiling ra-tree-ui-materialui files...";
82+
@cd ./packages/ra-tree-ui-materialui && yarn -s build && yarn -s build-esm
7583

7684
build-data-generator:
7785
@echo "Transpiling data-generator files...";
78-
@cd ./examples/data-generator && yarn -s build
86+
@cd ./examples/data-generator && yarn -s build && yarn -s build-esm
7987

80-
build: build-ra-core build-ra-ui-materialui build-react-admin build-ra-data-fakerest build-ra-data-json-server build-ra-data-simple-rest build-ra-data-graphql build-ra-data-graphcool build-ra-data-graphql-simple build-ra-input-rich-text build-ra-realtime build-data-generator ## compile ES6 files to JS
88+
build: build-ra-core build-ra-ui-materialui build-react-admin build-ra-data-fakerest build-ra-data-json-server build-ra-data-simple-rest build-ra-data-graphql build-ra-data-graphcool build-ra-data-graphql-simple build-ra-input-rich-text build-ra-realtime build-ra-tree-core build-ra-tree-ui-materialui build-data-generator ## compile ES6 files to JS
8189

8290
doc: ## compile doc as html and launch doc web server
8391
@yarn -s doc
@@ -108,12 +116,12 @@ test-unit-watch: ## launch unit tests and watch for changes
108116
test-e2e: ## launch end-to-end tests
109117
@if [ "$(build)" != "false" ]; then \
110118
echo 'Building example code (call "make build=false test-e2e" to skip the build)...'; \
111-
cd examples/simple && yarn -s build; \
119+
cd examples/simple && BABEL_ENV=cjs yarn -s build; \
112120
fi
113121

114122
@NODE_ENV=test cd cypress && yarn -s test
115123

116124

117125
test-e2e-local: ## launch end-to-end tests for development
118-
echo 'Starting e2e tests environment. Ensure you started the simple example first (make run-simple)'
119-
cd cypress && yarn -s start
126+
@echo 'Starting e2e tests environment. Ensure you started the simple example first (make run-simple)'
127+
@cd cypress && yarn -s start

cypress/integration/create.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import createPageFactory from '../support/CreatePage';
2+
import editPageFactory from '../support/EditPage';
23
import showPageFactory from '../support/ShowPage';
34
import loginPageFactory from '../support/LoginPage';
45

56
describe('Create Page', () => {
67
const CreatePage = createPageFactory('/#/posts/create');
78
const UserCreatePage = createPageFactory('/#/users/create');
89
const ShowPage = showPageFactory('/#/posts/14/show');
10+
const EditPage = editPageFactory('/#/posts/14');
911
const LoginPage = loginPageFactory('/#/login');
1012

1113
beforeEach(() => {
@@ -14,6 +16,10 @@ describe('Create Page', () => {
1416
CreatePage.navigate();
1517
});
1618

19+
it('should show the correct title in the appBar', () => {
20+
cy.get(CreatePage.elements.title).contains('Create Post');
21+
});
22+
1723
it('should put the current date in the field by default', () => {
1824
const currentDate = new Date();
1925
const currentDateString = currentDate.toISOString().slice(0, 10);
@@ -33,11 +39,25 @@ describe('Create Page', () => {
3339
);
3440
});
3541

36-
it('should have a working array input with references', () => {
42+
it('should have a working array input with references', () => {
3743
cy.get(CreatePage.elements.addAuthor).click();
3844
cy.get(CreatePage.elements.input('authors[0].user_id')).should(
3945
el => expect(el).to.exist
4046
);
47+
cy.get(CreatePage.elements.input('authors[0].role')).should(
48+
el => expect(el).to.not.exist
49+
);
50+
});
51+
52+
it('should have a working array input with a scoped FormDataConsumer', () => {
53+
cy.get(CreatePage.elements.addAuthor).click();
54+
CreatePage.setValues([
55+
{
56+
type: 'input',
57+
name: 'authors[0].user_id',
58+
value: 'Annamarie Mayer{enter}',
59+
},
60+
]);
4161
cy.get(CreatePage.elements.input('authors[0].role')).should(
4262
el => expect(el).to.exist
4363
);
@@ -60,7 +80,8 @@ describe('Create Page', () => {
6080
CreatePage.setValues(values);
6181
CreatePage.submit();
6282
ShowPage.waitUntilVisible();
63-
ShowPage.delete();
83+
EditPage.navigate();
84+
EditPage.delete();
6485
});
6586

6687
it('should stay at create page after create success with "Save and add"', () => {
@@ -83,8 +104,8 @@ describe('Create Page', () => {
83104
expect(el).to.have.value('')
84105
); // new empty form
85106

86-
ShowPage.navigate();
87-
ShowPage.delete();
107+
EditPage.navigate();
108+
EditPage.delete();
88109
});
89110

90111
it('should allow to call a custom action updating values before submit', () => {
@@ -111,7 +132,8 @@ describe('Create Page', () => {
111132
ShowPage.waitUntilVisible();
112133
ShowPage.gotoTab(3);
113134
cy.contains('10');
114-
ShowPage.delete();
135+
EditPage.navigate();
136+
EditPage.delete();
115137
});
116138

117139
it('should not accept creation without required fields', () => {

cypress/integration/custom-forms.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import createPageFactory from '../support/CustomFormPage';
2-
import showPageFactory from '../support/ShowPage';
2+
import editPageFactory from '../support/EditPage';
33

44
describe('Custom Forms', () => {
55
const CreatePage = createPageFactory('#/comments/create');
6-
const ShowPage = showPageFactory('#/posts/14/show');
6+
const EditPage = editPageFactory('#/posts/14');
77

88
beforeEach(() => CreatePage.navigate());
99

@@ -28,7 +28,7 @@ describe('Custom Forms', () => {
2828
CreatePage.setInputValue('textarea', 'teaser', 'Bazingaaaaaaaa!');
2929
cy.get(CreatePage.elements.modalSubmitButton).click();
3030
cy.contains('Bazinga!');
31-
ShowPage.navigate();
32-
ShowPage.delete();
31+
EditPage.navigate();
32+
EditPage.delete();
3333
});
3434
});

cypress/integration/customPages.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('Custom Pages', () => {
88
describe('Without Layout', () => {
99
it('should not display the layout', () => {
1010
CustomPageNoLayout.navigate();
11-
cy.contains('Example Admin').should(el => expect(el).to.not.exist);
11+
cy.get('main').should(el => expect(el).to.not.exist);
1212
});
1313

1414
it('should have retrieved the number of posts', () => {
@@ -19,7 +19,7 @@ describe('Custom Pages', () => {
1919
describe('With Layout', () => {
2020
it('should display the layout', () => {
2121
CustomPageWithLayout.navigate();
22-
cy.contains('Example Admin');
22+
cy.get('main').should(el => expect(el).to.exist);
2323
});
2424

2525
it('should have retrieved the number of posts', () => {

cypress/integration/edit.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ describe('Edit Page', () => {
66
const CreatePostPage = createPageFactory('/#/posts/create');
77
const EditCommentPage = editPageFactory('/#/comments/5');
88

9+
describe('Title', () => {
10+
it('should show the correct title in the appBar', () => {
11+
EditPostPage.navigate();
12+
cy.get(EditPostPage.elements.title).contains(
13+
'Post "Sed quo et et fugiat modi"'
14+
);
15+
});
16+
});
17+
918
describe('TabbedForm', () => {
1019
beforeEach(() => EditPostPage.navigate());
1120

0 commit comments

Comments
 (0)