Skip to content

Commit

Permalink
Merge pull request #5009 from marmelab/next
Browse files Browse the repository at this point in the history
Prepare 3.7.0
  • Loading branch information
fzaninotto committed Jul 6, 2020
2 parents 9539536 + 87cdf79 commit bc9ac4e
Show file tree
Hide file tree
Showing 109 changed files with 3,391 additions and 2,046 deletions.
17 changes: 7 additions & 10 deletions cypress/integration/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,17 @@ describe('List Page', () => {
ListPagePosts.logout();
LoginPage.login('admin', 'password');
ListPagePosts.showFilter('title');
ListPagePosts.setFilterValue('title', 'quis culpa impedit');
ListPagePosts.setFilterValue(
'title',
'Omnis voluptate enim similique est possimus'
);
cy.contains('1-1 of 1');

cy.get('[href="#/users"]').click();

cy.get('[href="#/posts"]').click();

cy.get(ListPagePosts.elements.filter('title')).should(el =>
expect(el).to.have.value('quis culpa impedit')
);
ListPagePosts.setFilterValue('title', '');
ListPagePosts.waitUntilDataLoaded();
cy.get(ListPagePosts.elements.filter('title')).should(
el => expect(el).to.exist
expect(el).to.have.value(
'Omnis voluptate enim similique est possimus'
)
);
});

Expand Down
8 changes: 6 additions & 2 deletions docs/Fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -858,9 +858,13 @@ export const PostList = (props) => (

| Prop | Required | Type | Default | Description |
| ----------- | -------- | ------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `reference` | Required | `string` | - | The name of the resource for the referenced records, e.g. 'tags' |
| `children` | Required | `Element` | - | The Field element used to render the referenced records |
| `reference` | Required | `string` | - | The name of the resource for the referenced records, e.g. 'tags' |
| `children` | Required | `Element` | - | The Field element used to render the referenced records |
| `sortBy` | Optional | `string | function` | `source` | When used in a List, name of the field to use for sorting when the user clicks on the column header. Set to `false` to disable the link. |
| `filter` | Optional | `Object` | - | Filters to use when fetching the related records (the filtering is done client-side) |
| `pagination` | Optional | `Element` | - | Pagination element to display pagination controls. empty by dfault (no pagination) |
| `perPage` | Optional | `number` | 1000 | Maximum number of results to display |
| `sort` | Optional | `{ field, order }` | `{ field: 'id', order: 'DESC' }` | Sort order to use when displaying the related records (the sort is done client-side) |

`<ReferenceArrayField>` also accepts the [common field props](./Fields.md#common-field-props).

Expand Down
644 changes: 343 additions & 301 deletions docs/List.md

Large diffs are not rendered by default.

167 changes: 161 additions & 6 deletions examples/data-generator/src/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,166 @@ import { random, lorem } from 'faker/locale/en';

import { randomFloat, weightedBoolean } from './utils';

const productReferences = {
animals: [
'Cat Nose',
'Dog Grass',
'Brown Cow',
'Leopard Road',
'Sad Dog',
'Pelican Pier',
'Green Birds',
'Concrete Seaguls',
'Hiding Seagul',
'Sand Caravan',
],
beard: [
'Black Auburn',
'Basket Beard',
'Handlebar Moustache',
'White Beard',
'Sailor Man',
'Natural Beard',
'Yeard Phone',
'Braid Beard',
'Terminal Black',
'Short Boxed',
],
business: [
'Corporate Prop',
'Office Chairs',
'White Clock',
'Work Suit',
'Suit & Tie',
'Shake Hands',
'Building Sky',
'Yellow Pad',
'Work Devices',
'Hands Clap',
'Work Meeting',
],
cars: [
'Old Combi',
'Asian Plates',
'Pedestrian Crossing',
'Farmer Boy',
'Make Over',
'Sports Sunset',
'Desert Jeep',
'Highway Bridge',
'Race Stickers',
'White Deluxe',
],
city: [
'Bridge Lights',
'Color Dots',
'Cloud Suspension',
'Paved Street',
'Blue Bay',
'Wooden Door',
'Concrete Angles',
'London Lights',
'Fort Point',
'Rainy Glass',
],
flowers: [
'Apricot Tree',
'Orange Rose',
'Purple Petunia',
'Water Lily',
'White Peony',
'Poppy Field',
'Blue Flax',
'Love Roses',
'California Poppy',
'Dalhia Colors',
],
food: [
'Fuzzy Forks',
'Stamp Mug',
'Two Expressos',
'Red Latte',
'Black Grapes',
'Forgotten Strawberries',
'Close Steam',
'Brewing Tea',
'Red Onions',
'Dark Honey',
],
nature: [
'Distant Mountains',
'Fog Pond',
'Sand Rocks',
'Pebble Shore',
'Eroded Fractals',
'Water Fall',
'Drif Wood',
'Dirt Track',
'Green Grass',
'Yellow Lichen',
],
people: [
'Crossing Alone',
'Budding Grove',
'Light Hair',
'Black & White',
'Rock Concert',
'Meeting Bench',
'Son & Lumière',
'Running Boy',
'Dining Hall',
'Tunnel People',
],
sports: [
'Feather Ball',
'Wall Skate',
'Kick Flip',
'Down Hill',
'Baseball Night',
'Touch Line',
'Alone Jogger',
'Green Basket',
'Mud Hug',
'Metal Cycle',
],
tech: [
'Black Screen',
'Phone Call',
'Tablet & Phone',
'No Battery',
'Phone Book',
'Camera Parts',
'Fuzzy Phone',
'Music & Light',
'Eye Rest',
'Aligned Parts',
],
travel: [
'Distant Jet',
'Foggy Beach',
'White Lime',
'Mysterious Cloud',
'Mountain Top',
'Light House',
'Gray Day',
'Desert Walkway',
'Train Track',
'Plane Trees',
],
water: [
'Fresh Stream',
'Reed Line',
'Mud Tracks',
'Beach Gazebo',
'Calm Sea',
'Early Bath',
'Aerial Coast',
'Canal Street',
'Artificial Beach',
'Rainy Day',
],
};

export default db => {
let id = 0;

Expand All @@ -15,12 +175,7 @@ export default db => {
return {
id: id++,
category_id: category.id,
reference:
category.name.substr(0, 2) +
'-' +
random.alphaNumeric(5) +
'-' +
random.arrayElement('ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
reference: productReferences[category.name][index],
width: width,
height: height,
price: randomFloat(
Expand Down
37 changes: 0 additions & 37 deletions examples/demo/src/dashboard/CardIcon.tsx

This file was deleted.

70 changes: 70 additions & 0 deletions examples/demo/src/dashboard/CardWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import * as React from 'react';
import { FC, createElement } from 'react';
import { Card, makeStyles, Box, Typography, Divider } from '@material-ui/core';
import { Link } from 'react-router-dom';

import cartouche from './cartouche.png';
import cartoucheDark from './cartoucheDark.png';

interface Props {
icon: FC<any>;
to: string;
title?: string;
subtitle?: string | number;
}

const useStyles = makeStyles(theme => ({
card: {
minHeight: 52,
flex: '1',
'& a': {
textDecoration: 'none',
color: 'inherit',
},
},
main: (props: Props) => ({
overflow: 'inherit',
padding: 16,
background: `url(${
theme.palette.type === 'dark' ? cartoucheDark : cartouche
}) no-repeat`,
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
'& .icon': {
color: theme.palette.type === 'dark' ? 'inherit' : '#dc2440',
},
}),
title: {},
}));

const CardWithIcon: FC<Props> = props => {
const { icon, title, subtitle, to, children } = props;
const classes = useStyles(props);
return (
<Card className={classes.card}>
<Link to={to}>
<div className={classes.main}>
<Box width="3em" className="icon">
{createElement(icon, { fontSize: 'large' })}
</Box>
<Box textAlign="right">
<Typography
className={classes.title}
color="textSecondary"
>
{title}
</Typography>
<Typography variant="h5" component="h2">
{subtitle || ' '}
</Typography>
</Box>
</div>
</Link>
{children && <Divider />}
{children}
</Card>
);
};

export default CardWithIcon;
Loading

0 comments on commit bc9ac4e

Please sign in to comment.