Skip to content

Commit

Permalink
refactor: rename v1 directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bubkoo committed Apr 26, 2020
1 parent 943415a commit 58a1a5c
Show file tree
Hide file tree
Showing 251 changed files with 870 additions and 298 deletions.
8 changes: 4 additions & 4 deletions examples/x6-example-features/src/pages/v1/animation/1.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react'
import { joint, Point } from '@antv/x6'
import { Timing, Interpolation } from '@antv/x6/es/research/animation'
import { v1, Point } from '@antv/x6'
import { Timing, Interpolation } from '@antv/x6/es/v1/animation'
import '../../index.less'
import '../index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 650,
height: 400,
Expand Down Expand Up @@ -93,7 +93,7 @@ export default class Example extends React.Component {
},
})

function fly(cell: joint.Cell) {
function fly(cell: v1.Cell) {
cell.transition('position', 20, {
delay: 0,
duration: 5000,
Expand Down
18 changes: 9 additions & 9 deletions examples/x6-example-features/src/pages/v1/animation/2.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react'
import { joint, Point, Angle } from '@antv/x6'
import { NodeView } from '@antv/x6/es/research/core/node-view'
import { Interpolation } from '@antv/x6/es/research/animation'
import { v1, Point, Angle } from '@antv/x6'
import { NodeView } from '@antv/x6/es/v1/core/node-view'
import { Interpolation } from '@antv/x6/es/v1/animation'
import '../../index.less'
import '../index.less'

class BallView extends NodeView {
protected speed: number = 0
protected angle: number = 0
protected timerId: number = 0
protected edge: joint.Edge
protected edge: v1.Edge

protected init() {
this.timerId = this.cell.transition('attrs/label/opacity', 1, {
Expand All @@ -31,7 +31,7 @@ class BallView extends NodeView {
})

this.cell.on('change:position', ({ cell, current }) => {
const node = (cell as any) as joint.Node
const node = (cell as any) as v1.Node
this.angle = Point.create(node.getPosition()).theta(
node.previous('position'),
)
Expand Down Expand Up @@ -126,7 +126,7 @@ class BallView extends NodeView {
}) as any
// Change the marker arrow color.
this.edge.on('change:target', ({ cell }) => {
const edge = (cell as any) as joint.Edge
const edge = (cell as any) as v1.Edge
const sourcePoint = edge.getSourcePoint()!
const targetPoint = edge.getTargetPoint()!
const dist = sourcePoint.distance(targetPoint)
Expand Down Expand Up @@ -166,9 +166,9 @@ class BallView extends NodeView {
}
}

joint.ViewRegistry.register('ball', BallView as any)
v1.ViewRegistry.register('ball', BallView as any)

joint.NodeRegistry.register('ball', {
v1.NodeRegistry.register('ball', {
view: 'ball',
markup: [
{
Expand Down Expand Up @@ -206,7 +206,7 @@ export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 650,
height: 400,
Expand Down
8 changes: 4 additions & 4 deletions examples/x6-example-features/src/pages/v1/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { v, joint } from '@antv/x6'
import { v, v1 } from '@antv/x6'
import '../index.less'
import './index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
background: {
// color: '#f5f5f5',
Expand Down Expand Up @@ -87,7 +87,7 @@ export default class Example extends React.Component {
},
})

const DecoratedRect = joint.Node.define({
const DecoratedRect = v1.Node.define({
markup:
'<g class="rotatable"><g class="scalable"><rect/></g><image/><text/></g>',
size: { width: 100, height: 60 },
Expand Down Expand Up @@ -132,7 +132,7 @@ export default class Example extends React.Component {
'Lorem ipsum dolor sit amet,\n consectetur adipiscing elit. Nulla vel porttitor est.',
})

const MyElementWithPorts = joint.Node.define({
const MyElementWithPorts = v1.Node.define({
markup: [
'<g class="rotatable">',
'<g class="scalable">',
Expand Down
10 changes: 5 additions & 5 deletions examples/x6-example-features/src/pages/v1/bus/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { joint } from '@antv/x6'
import { v1 } from '@antv/x6'
import { Bus, Connector, Component, Fader, Aux } from './shapes'
import '../../index.less'
import '../index.less'
Expand All @@ -9,7 +9,7 @@ export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 1000,
height: 800,
Expand Down Expand Up @@ -41,14 +41,14 @@ export default class Example extends React.Component {
},
})

function getCellOutbounds(cell: joint.Cell) {
function getCellOutbounds(cell: v1.Cell) {
return [cell].concat(
graph.model.getNeighbors(cell, { outgoing: true, indirect: true }),
graph.model.getConnectedEdges(cell, { outgoing: true, indirect: true }),
)
}

function highlight(cell: joint.Cell) {
function highlight(cell: v1.Cell) {
getCellOutbounds(cell).forEach(cell => {
const view = graph.findViewByCell(cell)
if (view) {
Expand All @@ -57,7 +57,7 @@ export default class Example extends React.Component {
})
}

function unhighlight(cell: joint.Cell) {
function unhighlight(cell: v1.Cell) {
getCellOutbounds(cell).forEach(cell => {
const view = graph.findViewByCell(cell)
if (view) {
Expand Down
8 changes: 4 additions & 4 deletions examples/x6-example-features/src/pages/v1/bus/shapes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { joint } from '@antv/x6'
import { Rect, Edge } from '@antv/x6/es/research/shape/standard'
import { v1 } from '@antv/x6'
import { Rect, Edge } from '@antv/x6/es/v1/shape/standard'

export class Bus extends Edge {
static create(x: number, label: string, color: string) {
Expand Down Expand Up @@ -177,7 +177,7 @@ Component.config({
},
})

export class Fader extends joint.Node {
export class Fader extends v1.Node {
static create(x: number, y: number) {
return new Fader({ position: { x, y } })
}
Expand Down Expand Up @@ -232,7 +232,7 @@ Fader.config({
},
})

export class Aux extends joint.Node {
export class Aux extends v1.Node {
static create(x: number, y: number, label: string) {
return new Aux({
position: { x, y },
Expand Down
16 changes: 8 additions & 8 deletions examples/x6-example-features/src/pages/v1/edges.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { v, joint } from '@antv/x6'
import { v, v1 } from '@antv/x6'
import '../index.less'
import './index.less'

class CustomEdgeView extends joint.EdgeView {
class CustomEdgeView extends v1.EdgeView {
onDblClick(e: JQuery.DoubleClickEvent, x: number, y: number) {
if (this.cell.getProp('customLinkInteractions')) {
this.addVertex(x, y)
Expand All @@ -20,10 +20,10 @@ class CustomEdgeView extends joint.EdgeView {
}
}

CustomEdgeView.config<joint.EdgeView.Options>({ doubleTools: true })
joint.ViewRegistry.register('customEdgeView', CustomEdgeView)
CustomEdgeView.config<v1.EdgeView.Options>({ doubleTools: true })
v1.ViewRegistry.register('customEdgeView', CustomEdgeView)

const CustomEdge = joint.Edge.define({
const CustomEdge = v1.Edge.define({
name: 'custom-edge',
defaultLabel: {
markup: [
Expand Down Expand Up @@ -67,19 +67,19 @@ const CustomEdge = joint.Edge.define({
},
})

joint.EdgeRegistry.register('customEdge', CustomEdge)
v1.EdgeRegistry.register('customEdge', CustomEdge)

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 800,
height: 1400,
gridSize: 10,
perpendicularLinks: false,
interactive: function(cellView: joint.CellView) {
interactive: function(cellView: v1.CellView) {
if (cellView.cell.getProp('customLinkInteractions')) {
return { vertexAdd: false }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { joint, Path, Point } from '@antv/x6'
import { v1, Path, Point } from '@antv/x6'
import '../../index.less'
import '../index.less'

joint.ConnectorRegistry.register(
v1.ConnectorRegistry.register(
'wobble',
(sourcePoint, targetPoint, vertices, args) => {
const spread = args.spread || 20
Expand Down Expand Up @@ -38,7 +38,7 @@ export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 1000,
height: 600,
Expand Down
10 changes: 5 additions & 5 deletions examples/x6-example-features/src/pages/v1/edges/custom-edge.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react'
import { joint } from '@antv/x6'
import { ShadowEdge } from '@antv/x6/es/research/shape/standard'
import { Timing } from '@antv/x6/es/research/animation/easing'
import { v1 } from '@antv/x6'
import { ShadowEdge } from '@antv/x6/es/v1/shape/standard'
import { Timing } from '@antv/x6/es/v1/animation/easing'
import '../../index.less'
import '../index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 800,
height: 600,
Expand Down Expand Up @@ -211,7 +211,7 @@ export default class Example extends React.Component {
},
})

joint.EdgeRegistry.register('arrow', {
v1.EdgeRegistry.register('arrow', {
markup: [
{
tagName: 'path',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { joint, Point } from '@antv/x6'
import { v1, Point } from '@antv/x6'
import '../../index.less'
import '../index.less'

joint.RouterRegistry.register('random', (vertices, args, view) => {
v1.RouterRegistry.register('random', (vertices, args, view) => {
const BOUNCES = args.bounces || 20
const points = vertices.map(p => Point.create(p))

Expand All @@ -26,7 +26,7 @@ export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 1000,
height: 600,
Expand Down
4 changes: 2 additions & 2 deletions examples/x6-example-features/src/pages/v1/edges/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { joint, v, Path } from '@antv/x6'
import { v1, v, Path } from '@antv/x6'
import '../../index.less'
import '../index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 800,
height: 600,
Expand Down
4 changes: 2 additions & 2 deletions examples/x6-example-features/src/pages/v1/edges/jump-over.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react'
import { joint } from '@antv/x6'
import { v1 } from '@antv/x6'
import '../../index.less'
import '../index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 1000,
height: 600,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react'
import { joint } from '@antv/x6'
import { Rect, Edge } from '@antv/x6/es/research/shape/standard'
import { v1 } from '@antv/x6'
import { Rect, Edge } from '@antv/x6/es/v1/shape/standard'
import '../../index.less'
import '../index.less'

export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 800,
height: 600,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { joint } from '@antv/x6'
import { v1 } from '@antv/x6'
import '../../index.less'
import '../index.less'

joint.NodeRegistry.register('rectText', {
v1.NodeRegistry.register('rectText', {
inherit: 'rect',
attrs: { body: { stroke: 'none' } },
})
Expand All @@ -12,7 +12,7 @@ export default class Example extends React.Component {
private container: HTMLDivElement

componentDidMount() {
const graph = new joint.Graph({
const graph = new v1.Graph({
container: this.container,
width: 1000,
height: 800,
Expand Down

0 comments on commit 58a1a5c

Please sign in to comment.