Skip to content

Commit ae66a9c

Browse files
Fixed samples integration into react-live
1 parent 5e97bd2 commit ae66a9c

17 files changed

+397
-301
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add following changes into App.js
3838

3939
``` JavaScript
4040
import React from 'react';
41-
import './App.css';
41+
import './global.css';
4242
import { OrgDiagram } from 'basicprimitivesreact';
4343
import primitives from 'basicprimitives';
4444

docs/DiagramSizing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Having scroll bars enabled for components is fine if they fit into the page view
1616

1717
The "classic" and the most popular approach for desktop applications is to fit page and diagram 100%. In that case you have to design your web site appropriatly.
1818

19-
![Classic desktop layout](./images/PageSizeDiagram2.png "Classic desktop layout")
19+
![Classic desktop layout](./images/PageSizeDiagram3.png "Classic desktop layout")
2020

2121
The following sample control hight is sized by CSS @Media rules to be within current page view port size. Try to resize your browser window in order to see how it works. The diagraming component has minimum vertical size set to hardcoded 250px.
2222

2323
See [CSS @Media](https://developer.mozilla.org/en-US/docs/Web/CSS/@media) for more reference
2424

25-
[Sample of diagram size controlled by CSS @Media](../src/Samples/PageSizeDiagram.js)
25+
[React](../src/Samples/PageSizeDiagram.js)
2626

2727
## Auto Size Diagram in Article
2828
Another diagram integration scenario is diagram placement inside article, so component needs to auto expand its size in order to accommodate all nodes of diagram without minimization or trancation. Set `pageFitMode` to `primitives.common.PageFitMode.AutoSize` and component will size itself to show all nodes of diagram.

docs/DragNDrop.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Drag & Drop Support
2+
3+
Basic Primitives Diagrams library for React was created with only one purpose, it is to be complient with [React Drag & Drop](http://react-dnd.github.io/react-dnd/about) library. The only option to achive this is to render all content using React Virtual DOM without direct DOM manipulations.
4+
5+
In the best software engineering traditions our library does not implement any Drag & Drop related functionalty. Everything as before is achived via item templates customizations.
6+
7+
See [React Drag & Drop](http://react-dnd.github.io/react-dnd/about) library for reference and samples, from our side pay attentions to the following take aways:
8+
9+
## npm packages
10+
* [react-dnd](https://www.npmjs.com/package/react-dnd)
11+
* [react-dnd-cjs](https://www.npmjs.com/package/react-dnd-html5-backend)
12+
13+
## React `DndProvider` does not support nested `backend`s
14+
If you use Drag and Drop in multiple places of your application `DndProvider` should create no nested `backend`s.
15+
16+
```JavaScript
17+
import React, { Component } from 'react';
18+
import { App } from './App';
19+
import { DndProvider } from 'react-dnd';
20+
import HTML5Backend from 'react-dnd-html5-backend';
21+
22+
class Sample extends Component {
23+
render() {
24+
return <>
25+
<DndProvider backend={HTML5Backend}>
26+
<App />
27+
</DndProvider>
28+
</>;
29+
}
30+
}
31+
32+
export default Sample;
33+
```
34+
35+
## Drag & Drop diagram nodes
36+
37+
[React](../src/Samples/DragNDrop.js)
38+
39+
40+
## Drag & Drop diagram nodes to application
41+
42+
[React](../src/Samples/DragToTrashBin.js)

docs/FirstFamilyChart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ Family diagram shares a lot of common features with Organizational chart. The ma
7070
* Loops - loop references between nodes
7171
* Hiding grand parent connections - if node is accessable via other node then direct connection can be eliminated to minimize clutter
7272

73-
[React](../src/Samples/FirstFamilyChart.js)
73+
[React](../src/Samples/FirstFamilyChart.js)

docs/FirstOrganizationalChart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Add following changes into App.js
1717

1818
```JavaScript
1919
import React from 'react';
20-
import './App.css';
20+
import './global.css';
2121
import { OrgDiagram } from 'basicprimitivesreact';
2222
import primitives from 'basicprimitives';
2323

File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "basicprimitivesreact",
3-
"version": "5.4.16",
3+
"version": "5.4.17",
44
"main": "dist/index.js",
55
"module": "dist/index.js",
66
"babel": {

src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { Component } from 'react';
22
import primitives from 'basicprimitives';
33
import SamplesList from './SamplesList';
4-
import './App.css';
4+
import './global.css';
55

66
class App extends Component {
77
constructor(props, context) {

src/Diagrams/Templates/CheckBoxTemplate.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ class CheckBoxTemplate extends AbstractTemplate {
1414
<input type="checkbox" name="checkbox" style={{
1515
fontSize: "12px",
1616
lineHeight: "12px",
17-
verticalAlign: "middle"
17+
verticalAlign: "middle",
18+
margin: "0px",
19+
padding: "0px"
1820
}} checked={data.isSelected} data-id={data.id} />
1921
<span name="selectiontext" style={{
2022
fontSize: "12px",
2123
lineHeight: "12px",
22-
verticalAlign: "middle"
24+
verticalAlign: "middle",
25+
maring: "0px",
26+
paddingLeft: "2px",
27+
paddingTop: "0px",
28+
paddingRight: "0px",
29+
paddingBottom: "0px"
2330
}} data-id={data.id} >
2431
{this.selectCheckBoxLabel}
2532
</span>

src/Samples/ConnectorAnnotation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Sample extends Component {
3131
annotationType: primitives.common.AnnotationType.Connector,
3232
fromItem: 0,
3333
toItem: 2,
34-
label: <div className="Badge" style={{
34+
label: <div className="BadgeSymbol" style={{
3535
backgroundColor: primitives.common.Colors.Green
3636
}}>2</div>,
3737
labelSize: { width: 80, height: 30 },
@@ -48,7 +48,7 @@ class Sample extends Component {
4848
annotationType: primitives.common.AnnotationType.Connector,
4949
fromItem: 0,
5050
toItem: 1,
51-
label: <div className="Badge" style={{
51+
label: <div className="BadgeSymbol" style={{
5252
backgroundColor: primitives.common.Colors.Red
5353
}}>1</div>,
5454
labelSize: new primitives.common.Size(80, 30),
@@ -65,7 +65,7 @@ class Sample extends Component {
6565
annotationType: primitives.common.AnnotationType.Connector,
6666
fromItem: 0,
6767
toItem: 3,
68-
label: <div className="Badge" style={{
68+
label: <div className="BadgeSymbol" style={{
6969
backgroundColor: primitives.common.Colors.Blue
7070
}}>3</div>,
7171
labelSize: new primitives.common.Size(80, 30),

0 commit comments

Comments
 (0)