Skip to content

Commit 34f678a

Browse files
authored
Merge pull request #2081 from plotly/master-2.5.0
Master 2.5.0
2 parents 8c73426 + 58e2a3f commit 34f678a

File tree

285 files changed

+4131
-1550
lines changed

Some content is hidden

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

285 files changed

+4131
-1550
lines changed

@plotly/dash-generator-test-component-typescript/generator.test.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ function getMetadata() {
1212
'""', // reserved keywords
1313
path.join(__dirname, 'src', 'components')
1414
],
15-
// To debug `meta-ts.js` using pycharm debugger:
16-
// comment `env` and add `MODULES_PATH=./node_modules`
17-
// in the run config environment variables.
1815
{
19-
env: {MODULES_PATH: path.resolve(__dirname, './node_modules')},
16+
env: {MODULES_PATH: path.resolve(__dirname, './node_modules'), ...process.env},
2017
cwd: __dirname
2118
}
2219
);
@@ -218,6 +215,21 @@ describe('Test Typescript component metadata generation', () => {
218215
});
219216
}
220217
);
218+
219+
test(
220+
'Nested props to any', () => {
221+
expect(
222+
R.path([
223+
'TypeScriptComponent',
224+
'props',
225+
'nested',
226+
'type',
227+
'value',
228+
'nested',
229+
'name'
230+
], metadata)).toBe('any')
231+
}
232+
)
221233
});
222234

223235
describe('Test component comments', () => {
@@ -245,4 +257,9 @@ describe('Test Typescript component metadata generation', () => {
245257
expect(R.path(['StandardComponent'], metadata)).toBeDefined();
246258
});
247259
});
260+
describe('Test namespace props', () => {
261+
test('Component with picked boolean prop', () => {
262+
expect(R.path(['WrappedHTML', "props", "autoFocus", "type", "name"], metadata)).toBe("bool");
263+
})
264+
})
248265
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import {WrappedHTMLProps} from '../props';
3+
4+
/**
5+
* Component docstring
6+
*/
7+
const WrappedHTML = (props: WrappedHTMLProps) => {
8+
return null;
9+
};
10+
11+
export default WrappedHTML;

@plotly/dash-generator-test-component-typescript/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import TypeScriptComponent from './components/TypeScriptComponent';
22
import TypeScriptClassComponent from './components/TypeScriptClassComponent';
33
import MemoTypeScriptComponent from './components/MemoTypeScriptComponent';
44
import StandardComponent from './components/StandardComponent.react';
5+
import WrappedHTML from './components/WrappedHTML';
56

67
export {
78
TypeScriptComponent,
89
TypeScriptClassComponent,
910
MemoTypeScriptComponent,
10-
StandardComponent
11+
StandardComponent,
12+
WrappedHTML,
1113
};

@plotly/dash-generator-test-component-typescript/src/props.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// Needs to export types if not in a d.ts file or if any import is present in the d.ts
22
import React from 'react';
33

4+
5+
type Nested = {
6+
nested: Nested;
7+
}
8+
49
export type TypescriptComponentProps = {
510
children?: React.ReactNode;
611
id?: string;
@@ -35,4 +40,11 @@ export type TypescriptComponentProps = {
3540
setProps?: (props: Record<string, any>) => void;
3641
className?: string;
3742
style?: any;
43+
44+
nested?: Nested;
3845
};
46+
47+
export type WrappedHTMLProps = {
48+
children?: React.ReactNode;
49+
id?: string;
50+
} & Pick<React.ButtonHTMLAttributes<any>, 'autoFocus'>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
5+
const ComponentAsProp = (props) => {
6+
const { element, id, shapeEl, list_of_shapes } = props;
7+
return (
8+
<div id={id}>
9+
{shapeEl && shapeEl.header}
10+
{element}
11+
{shapeEl && shapeEl.footer}
12+
{list_of_shapes && <ul>{list_of_shapes.map(e => <li key={e.value}>{e.label}</li>)}</ul> }
13+
</div>
14+
)
15+
}
16+
17+
ComponentAsProp.propTypes = {
18+
id: PropTypes.string,
19+
element: PropTypes.node,
20+
21+
shapeEl: PropTypes.shape({
22+
header: PropTypes.node,
23+
footer: PropTypes.node,
24+
}),
25+
26+
list_of_shapes: PropTypes.arrayOf(
27+
PropTypes.exact({
28+
label: PropTypes.node,
29+
value: PropTypes.number,
30+
})
31+
)
32+
}
33+
34+
export default ComponentAsProp;

@plotly/dash-test-components/src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import MyPersistedComponent from './components/MyPersistedComponent';
66
import MyPersistedComponentNested from './components/MyPersistedComponentNested';
77
import StyledComponent from './components/StyledComponent';
88
import WidthComponent from './components/WidthComponent';
9+
import ComponentAsProp from './components/ComponentAsProp';
910

1011
export {
1112
AsyncComponent,
@@ -15,5 +16,6 @@ export {
1516
MyPersistedComponent,
1617
MyPersistedComponentNested,
1718
StyledComponent,
18-
WidthComponent
19+
WidthComponent,
20+
ComponentAsProp,
1921
};

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [2.5.0] - 2022-06-07
6+
7+
### Added
8+
9+
- [#1947](https://github.com/plotly/dash/pull/1947) Added `pages` - a better way to build multi-page apps. For more information see the [forum post.](https://community.plotly.com/t/introducing-dash-pages-a-dash-2-x-feature-preview/57775)
10+
- [#1965](https://github.com/plotly/dash/pull/1965) Add component as props.
11+
- [#2049](https://github.com/plotly/dash/pull/2043) Added `wait_for_class_to_equal` and `wait_for_contains_class` methods to `dash.testing`
12+
13+
### Changed
14+
15+
- [#2050](https://github.com/plotly/dash/pull/2050) Changed `find_element` and `find_elements` to accept an `attribute` argument that aligns with Selenium's `By` class, allowing you to search elements by other attributes. Default value is `CSS_SELECTOR` to maintain backwards compatibility with previous `find_elements`.
16+
17+
### Fixed
18+
19+
- [#2043](https://github.com/plotly/dash/pull/2043) Fix bug
20+
[#2003](https://github.com/plotly/dash/issues/2003) in which
21+
`dangerously_allow_html=True` + `mathjax=True` works in some cases, and in some cases not.
22+
- [#2065](https://github.com/plotly/dash/pull/2065) Fix bug [#2064](https://github.com/plotly/dash/issues/2064) rendering of `dcc.Dropdown` with a value but no options.
23+
- [#2047](https://github.com/plotly/dash/pull/2047) Fix bug [#1979](https://github.com/plotly/dash/issues/1979) in which `DASH_DEBUG` as environment variable gets ignored.
24+
- [#2070](https://github.com/plotly/dash/pull/2070) Fix bug [#2066](https://github.com/plotly/dash/issues/2066) nested types triggering maximum call stack error when building typescript components.
25+
26+
## [2.4.1] - 2022-05-11
27+
28+
### Fixed
29+
30+
- Fix [#2045](https://github.com/plotly/dash/issues/2045) import error when using pytest but `dash[testing]` is not installed.
31+
532
## [2.4.0] - 2022-05-11
633

734
### Added

components/dash-core-components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-core-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dash-core-components",
3-
"version": "2.4.0",
3+
"version": "2.5.0",
44
"description": "Core component suite for Dash",
55
"repository": {
66
"type": "git",

components/dash-core-components/src/components/Checklist.react.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,7 @@ Checklist.propTypes = {
104104
/**
105105
* The option's label
106106
*/
107-
label: PropTypes.oneOfType([
108-
PropTypes.string,
109-
PropTypes.number,
110-
PropTypes.bool,
111-
]).isRequired,
107+
label: PropTypes.node.isRequired,
112108

113109
/**
114110
* The value of the option. This value

0 commit comments

Comments
 (0)