Skip to content

Commit f305101

Browse files
authored
Merge pull request #12 from yWorks/dev
v2.0.0-beta.1
2 parents bda2e27 + 9ec1ab2 commit f305101

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@yworks/react-yfiles-core",
3-
"version": "1.2.0",
3+
"version": "2.0.0-beta.1",
44
"author": {
55
"name": "yFiles for HTML team @ yWorks GmbH",
66
"email": "[email protected]"

src/graph-component/EdgeStyles.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ export interface EdgeStyle {
1616
* The bend smoothing of the connection.
1717
*/
1818
smoothingLength?: number
19+
/**
20+
* The source arrow type.
21+
*/
22+
sourceArrow?: Arrow
1923
/**
2024
* The target arrow type.
2125
*/
@@ -47,16 +51,16 @@ export function convertToPolylineEdgeStyle(style: EdgeStyle) {
4751
thickness: style.thickness ?? 1
4852
}),
4953
cssClass: style.className ?? '',
50-
sourceArrow: IArrow.NONE,
54+
sourceArrow: convertArrow(style, true),
5155
targetArrow: convertArrow(style)
5256
})
5357
}
5458

5559
/**
5660
* Converts the input style arrow to a yFiles PolylineEdgeStyle.
5761
*/
58-
function convertArrow(style: EdgeStyle): IArrow {
59-
const arrow = style.targetArrow
62+
function convertArrow(style: EdgeStyle, isSource = false): IArrow {
63+
const arrow = isSource ? style.sourceArrow : style.targetArrow
6064
if (!arrow) {
6165
return IArrow.NONE
6266
}

src/license/LicenseError.tsx

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import './LicenseError.css'
22

3-
export function LicenseError() {
3+
export interface LicenseErrorProps {
4+
componentName: string
5+
codeSample: string
6+
}
7+
8+
export function LicenseError(props: LicenseErrorProps) {
49
return (
510
<>
611
<div className="yfiles-react-license-error">
712
<div className="yfiles-react-license-error-dialog">
813
<div className="yfiles-react-license-error-dialog__title">Invalid / Missing License</div>
914
<div className="yfiles-react-license-error-dialog__content">
1015
<div className="yfiles-react-license-error-dialog__paragraph">
11-
The <em>yFiles React Organization Chart Component</em> requires a valid{' '}
16+
The <em>{props.componentName}</em> requires a valid{' '}
1217
<a href="https://www.yworks.com/products/yfiles-for-html">yFiles for HTML</a> license.
1318
</div>
1419
<div className="yfiles-react-license-error-dialog__paragraph">
@@ -17,27 +22,12 @@ export function LicenseError() {
1722
</div>
1823

1924
<div className="yfiles-react-license-error-dialog__paragraph">
20-
Add the <code>license.json</code> to your React application and register it like this:
25+
Add the <code>license.json</code> to your React application and register it before
26+
using the component.
2127
</div>
2228

2329
<div className="yfiles-react-license-error-dialog__code-snippet">
24-
<pre>
25-
{`import {OrgChart, registerLicense} from '@yworks/react-yfiles-orgchart'
26-
import '@yworks/react-yfiles-orgchart/dist/index.css'
27-
import yFilesLicense from './license.json'
28-
29-
function App() {
30-
registerLicense(yFilesLicense)
31-
32-
const data = [
33-
{id: 0, name: 'Eric Joplin', subordinates: [1, 2]},
34-
{id: 1, name: 'Amy Kain'},
35-
{id: 2, name: 'David Kerry'}
36-
]
37-
38-
return <OrgChart data={data}></OrgChart>
39-
}`}
40-
</pre>
30+
<pre>{props.codeSample}</pre>
4131
</div>
4232
</div>
4333
</div>

0 commit comments

Comments
 (0)