Skip to content

Commit 1a614d3

Browse files
authored
Merge branch 'plotly:dev' into add-missing-doc
2 parents 42f6a07 + 90bb137 commit 1a614d3

File tree

233 files changed

+10710
-10020
lines changed

Some content is hidden

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

233 files changed

+10710
-10020
lines changed

.circleci/config.yml

-63
Original file line numberDiff line numberDiff line change
@@ -227,24 +227,6 @@ jobs:
227227
- store_artifacts:
228228
path: /tmp/dash_artifacts
229229

230-
test-312-react-18:
231-
<<: *test
232-
docker:
233-
- image: cimg/python:3.12.1-browsers
234-
auth:
235-
username: dashautomation
236-
password: $DASH_PAT_DOCKERHUB
237-
environment:
238-
PERCY_ENABLE: 0
239-
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: True
240-
PYVERSION: python312
241-
REDIS_URL: redis://localhost:6379
242-
REACT_VERSION: "18.2.0"
243-
- image: cimg/redis:6.2.6
244-
auth:
245-
username: dashautomation
246-
password: $DASH_PAT_DOCKERHUB
247-
248230
test-38:
249231
<<: *test
250232
docker:
@@ -349,18 +331,6 @@ jobs:
349331
- store_artifacts:
350332
path: /tmp/dash_artifacts
351333

352-
dcc-312-react-18:
353-
<<: *dcc-test
354-
docker:
355-
- image: cimg/python:3.12.1-browsers
356-
auth:
357-
username: dashautomation
358-
password: $DASH_PAT_DOCKERHUB
359-
environment:
360-
PYVERSION: python312
361-
PERCY_ENABLE: 0
362-
REACT_VERSION: "18.2.0"
363-
364334
dcc-38:
365335
<<: *dcc-test
366336
docker:
@@ -430,18 +400,6 @@ jobs:
430400
- store_artifacts:
431401
path: /tmp/dash_artifacts
432402

433-
html-312-react-18:
434-
<<: *html-test
435-
docker:
436-
- image: cimg/python:3.12.1-browsers
437-
auth:
438-
username: dashautomation
439-
password: $DASH_PAT_DOCKERHUB
440-
environment:
441-
PYVERSION: python312
442-
PERCY_ENABLE: 0
443-
REACT_VERSION: "18.2.0"
444-
445403
html-38:
446404
<<: *html-test
447405
docker:
@@ -506,15 +464,6 @@ jobs:
506464
- store_artifacts:
507465
path: /tmp/dash_artifacts
508466

509-
table-server-react-18:
510-
<<: *table-server
511-
docker:
512-
- image: cimg/python:3.12.1-browsers
513-
environment:
514-
PYVERSION: python312
515-
PERCY_ENABLE: 0
516-
REACT_VERSION: "18.2.0"
517-
518467
table-unit-test:
519468
working_directory: ~/dash
520469
docker:
@@ -655,9 +604,6 @@ workflows:
655604
- test-312:
656605
requires:
657606
- install-dependencies-312
658-
- test-312-react-18:
659-
requires:
660-
- install-dependencies-312
661607
- test-38:
662608
requires:
663609
- install-dependencies-38
@@ -672,19 +618,13 @@ workflows:
672618
- dcc-312:
673619
requires:
674620
- install-dependencies-312
675-
- dcc-312-react-18:
676-
requires:
677-
- install-dependencies-312
678621
- dcc-38:
679622
requires:
680623
- install-dependencies-38
681624

682625
- html-312:
683626
requires:
684627
- install-dependencies-312
685-
- html-312-react-18:
686-
requires:
687-
- install-dependencies-312
688628
- html-38:
689629
requires:
690630
- install-dependencies-38
@@ -699,9 +639,6 @@ workflows:
699639
- table-server:
700640
requires:
701641
- install-dependencies-312
702-
- table-server-react-18:
703-
requires:
704-
- install-dependencies-312
705642

706643
- percy/finalize_all:
707644
requires:

.pylintrc

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ disable=fixme,
7575
unnecessary-lambda-assignment,
7676
broad-exception-raised,
7777
consider-using-generator,
78+
too-many-ancestors
7879

7980

8081
# Enable the message, report, category or checker with the given id(s). You can

@plotly/dash-generator-test-component-nested/src/components/MyNestedComponent.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
/**
55
* MyNestedComponent description
66
*/
7-
const MyNestedComponent = ({ id, value }) => (<div id={id}>{value}</div>);
7+
const MyNestedComponent = ({ id, value = '' }) => (<div id={id}>{value}</div>);
88

99
MyNestedComponent.propTypes = {
1010
/**
@@ -18,8 +18,4 @@ MyNestedComponent.propTypes = {
1818
value: PropTypes.string
1919
};
2020

21-
MyNestedComponent.defaultProps = {
22-
value: ''
23-
};
24-
2521
export default MyNestedComponent;

@plotly/dash-generator-test-component-standard/src/components/MyStandardComponent.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
/**
55
* MyComponent description
66
*/
7-
const MyStandardComponent = ({ id, style, value }) => (<div id={id} style={style}>{value}</div>);
7+
const MyStandardComponent = ({ id, style, value = '' }) => (<div id={id} style={style}>{value}</div>);
88

99
MyStandardComponent.propTypes = {
1010
/**
@@ -23,8 +23,4 @@ MyStandardComponent.propTypes = {
2323
value: PropTypes.string
2424
};
2525

26-
MyStandardComponent.defaultProps = {
27-
value: ''
28-
};
29-
30-
export default MyStandardComponent;
26+
export default MyStandardComponent;

@plotly/dash-generator-test-component-typescript/base/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@
1616
dict(
1717
relative_package_path='dash_generator_test_component_typescript.js',
1818
namespace='dash_generator_test_component_typescript'
19-
)
19+
),
20+
{
21+
"dev_package_path": "proptypes.js",
22+
"dev_only": True,
23+
"namespace": 'dash_generator_test_component_typescript'
24+
}
2025
]
2126

2227
for _component in __all__:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ignore_props = ['ignored_prop']

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

+17
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,23 @@ describe('Test Typescript component metadata generation', () => {
271271
);
272272
expect(objectOfComponents).toBe("node");
273273
}
274+
);
275+
276+
test(
277+
'union and literal values', () => {
278+
const propType = R.path(
279+
propPath('TypeScriptComponent', 'union_enum').concat(
280+
'type'
281+
),
282+
metadata
283+
);
284+
expect(propType.name).toBe('union');
285+
expect(propType.value.length).toBe(3);
286+
expect(propType.value[0].name).toBe('number');
287+
expect(propType.value[1].name).toBe('literal');
288+
expect(propType.value[2].name).toBe('literal');
289+
expect(propType.value[1].value).toBe('small');
290+
}
274291
)
275292
});
276293

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

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export type TypescriptComponentProps = {
2525
array_obj?: {a: string}[];
2626
array_any?: any[];
2727
enum_string?: 'one' | 'two';
28+
enum_number?: 2 | 3 | 4 | 5 | 6;
2829
union?: number | string;
2930
union_shape?: {a: string} | string;
3031
array_union_shape?: ({a: string} | string)[];
@@ -46,6 +47,8 @@ export type TypescriptComponentProps = {
4647

4748
object_of_string?: {[k: string]: string};
4849
object_of_components?: {[k: string]: JSX.Element};
50+
ignored_prop?: {ignore: {me: string}};
51+
union_enum?: number | 'small' | 'large'
4952
};
5053

5154
export type WrappedHTMLProps = {

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ const AddPropsComponent = (props) => {
77

88
return (
99
<div id={id}>
10-
{React.cloneElement(children, {
10+
{React.cloneElement(children, {
1111
receive: `Element #${id} pass`,
12-
id: id,
1312
})}
1413
</div>
1514
);

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

-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,4 @@ AsyncComponent.propTypes = {
1414
value: PropTypes.string
1515
};
1616

17-
AsyncComponent.defaultProps = {};
18-
1917
export default AsyncComponent;

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

-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,4 @@ CollapseComponent.propTypes = {
1111
id: PropTypes.string
1212
};
1313

14-
CollapseComponent.defaultProps = {
15-
display: false
16-
};
17-
1814
export default CollapseComponent;
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import PropTypes from 'prop-types';
22
import React from 'react';
33

4-
const DelayedEventComponent = ({ id, n_clicks, setProps }) => (<button
4+
const DelayedEventComponent = ({ id, n_clicks = 0, setProps }) => (<button
55
id={id}
66
onClick={() => setTimeout(() => setProps({ n_clicks: n_clicks + 1 }), 20)}
77
/>);
@@ -11,8 +11,4 @@ DelayedEventComponent.propTypes = {
1111
n_clicks: PropTypes.number
1212
};
1313

14-
DelayedEventComponent.defaultProps = {
15-
n_clicks: 0
16-
};
17-
1814
export default DelayedEventComponent;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
5+
const ExternalComponent = ({ id, text, input_id, extra_component }) => {
6+
const ctx = window.dash_component_api.useDashContext();
7+
const ExternalWrapper = window.dash_component_api.ExternalWrapper;
8+
9+
return (
10+
<div id={id}>
11+
{text && <ExternalWrapper
12+
13+
component={{
14+
type: "Input",
15+
namespace: "dash_core_components",
16+
props: {
17+
value: text,
18+
id: input_id
19+
}
20+
}}
21+
componentPath={[...ctx.componentPath, 'external']}
22+
/>}
23+
{
24+
extra_component &&
25+
<ExternalWrapper
26+
component={extra_component}
27+
componentPath={[...ctx.componentPath, 'extra']}
28+
/>}
29+
</div>
30+
)
31+
}
32+
33+
ExternalComponent.propTypes = {
34+
id: PropTypes.string,
35+
text: PropTypes.string,
36+
input_id: PropTypes.string,
37+
extra_component: PropTypes.exact({
38+
type: PropTypes.string,
39+
namespace: PropTypes.string,
40+
props: PropTypes.object,
41+
}),
42+
};
43+
44+
export default ExternalComponent;

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ FragmentComponent.propTypes = {
1010
id: PropTypes.string
1111
};
1212

13-
FragmentComponent.defaultProps = {};
14-
15-
export default FragmentComponent;
13+
export default FragmentComponent;

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
/**
55
* MyComponent description
66
*/
7-
const StyledComponent = ({ id, style, value }) => (<div id={id} style={style}>{value}</div>);
7+
const StyledComponent = ({ id, style, value = '' }) => (<div id={id} style={style}>{value}</div>);
88

99
StyledComponent.propTypes = {
1010
/**
@@ -23,8 +23,4 @@ StyledComponent.propTypes = {
2323
value: PropTypes.string
2424
};
2525

26-
StyledComponent.defaultProps = {
27-
value: ''
28-
};
29-
3026
export default StyledComponent;
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import PropTypes from 'prop-types';
22
import React, { Fragment } from 'react';
33

4-
const WidthComponent = props => (<Fragment>
5-
{props.width}
4+
const WidthComponent = ({width = 0}) => (<Fragment>
5+
{width}
66
</Fragment>);
77

88
WidthComponent.propTypes = {
99
id: PropTypes.string,
1010
width: PropTypes.number
1111
};
1212

13-
WidthComponent.defaultProps = {
14-
width: 0
15-
};
16-
17-
export default WidthComponent;
13+
export default WidthComponent;

@plotly/dash-test-components/src/fragments/AsyncComponent.js

-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,4 @@ AsyncComponent.propTypes = {
1111
value: PropTypes.string
1212
};
1313

14-
AsyncComponent.defaultProps = {};
15-
1614
export default AsyncComponent;

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import AddPropsComponent from "./components/AddPropsComponent";
1313
import ReceivePropsComponent from "./components/ReceivePropsComponent";
1414
import ShapeOrExactKeepOrderComponent from "./components/ShapeOrExactKeepOrderComponent";
1515
import ArrayOfExactOrShapeWithNodePropAssignNone from './components/ArrayOfExactOrShapeWithNodePropAssignNone';
16+
import ExternalComponent from './components/ExternalComponent';
1617

1718

1819
export {
@@ -29,5 +30,6 @@ export {
2930
AddPropsComponent,
3031
ReceivePropsComponent,
3132
ShapeOrExactKeepOrderComponent,
32-
ArrayOfExactOrShapeWithNodePropAssignNone
33+
ArrayOfExactOrShapeWithNodePropAssignNone,
34+
ExternalComponent,
3335
};

0 commit comments

Comments
 (0)