Skip to content

Commit

Permalink
Merge pull request #547 from clayzenx/req
Browse files Browse the repository at this point in the history
Smartants стили, конфигурация направления, стрелочки
  • Loading branch information
rpiontik authored Jun 20, 2024
2 parents 6f6399b + 9360506 commit 681ea97
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ nodes:
# Внешняя среда
outside:
title: Внешняя среда
hideBorder: true
outside.user: # Пользователь
title: Пользователь
symbol: user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ links:
# Внешняя среда
- from: outside
to: third-level
style: "<->"
style: "*-*"
- from: outside.customer
to: third-level.manager
style: "<->"
Expand Down
6 changes: 6 additions & 0 deletions public/documentation/docs/manual/docs/smartants.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ config:
![Результат на примере сложной диаграммы](@document/dochub.smartants.examples.complex.hideleaves)

**hideTitle** - индивидуально выключить заголовок у элемента или области:
Рамку для областей можно отключить параметром - **hideBorder**:
```yaml
...
# Внешняя среда
outside:
title: Внешняя среда
hideBorder: true
...
# Внутренняя среда
inside:
Expand Down
20 changes: 18 additions & 2 deletions src/frontend/components/Schema/DHSchema/DHSchema.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@
const queryID = message.data.queryID;
listeners[queryID] && listeners[queryID](message.data);
};
this.make = (grid, nodes, links, trackWidth, distance, symbols, availableWidth, isDebug) => {
this.make = (grid, styles, nodes, links, trackWidth, distance, direction, height, symbols, availableWidth, wrap, isDebug) => {
return new Promise((success, reject) => {
const params = {
grid, nodes, links, trackWidth, distance, symbols, isDebug
grid, styles, nodes, links, trackWidth, distance, direction, height, symbols, wrap, isDebug
};
const hash = window.localStorage ? md5(JSON.stringify(params)) : null;
const cacheKey = `SmartAnts.cache.v${CACHE_VERSION}.${hash}`;
Expand Down Expand Up @@ -223,6 +223,16 @@
type: Boolean,
default: false
},
// Направление диаграммы
direction: {
type: String,
default: 'row'
},
// Высота для колоночной диаграммы
height: {
type: Number,
default: 700
},
// Варнинги генерации диаграммы
warnings: {
type: Array,
Expand Down Expand Up @@ -603,18 +613,24 @@
this.recalcSymbols();
const trackWidth = this.data.config?.trackWidth || this.trackWidth;
const distance = this.data.config?.distance || this.distance;
const direction = this.data.config?.direction || this.direction;
const height = this.data.config?.height || this.height;
let availableWidth = this.$el?.clientWidth || 0;
if (availableWidth < 600) availableWidth = 600;
this.isBuilding++;
Graph.make(
this.data.config?.grid || {},
this.data.config?.styles || {},
nodes || this.data.nodes || {},
links || this.data.links || [],
trackWidth,
distance,
direction,
height,
this.landscape.symbols,
availableWidth,
this.limitHeight,
this.data.config?.wrap,
this.debug
)
.then((presentation) => {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/components/Schema/DHSchema/DHSchemaNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
v-on:dblclick.stop.prevent="onNodeDblClick(box, true)">
<template v-if="isShowArea">
<rect
v-if="isArea(box)"
v-if="isArea(box) && !box.node.hideBorder"
class="box"
v-bind:fill="`${box.node.background || '#fff'}`"
v-bind:fill-opacity="`${ box.node.background ? (box.node.opacity || 1) : 0}`"
Expand Down
27 changes: 17 additions & 10 deletions src/frontend/components/Schema/DHSchema/DHSchemaTrack.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<template>
<g>
<path
<path
v-bind:class="classesArrow"
v-bind:d="arrows"
v-bind:d="arrows"
v-bind:style="{ opacity: track.opacity, stroke: trackColor }"
v-on:mouseover="onTrackOver"
v-on:mouseleave="onTrackLeave"
v-on:mousedown.stop.prevent="onTrackClick" />
<path
v-bind:id="id"
v-bind:id="id"
v-bind:class="classesLine"
v-bind:d="line"
v-bind:d="line"
v-bind:style="{ opacity: track.opacity, 'stroke-width':strokeWidth, stroke: trackColor }"
v-bind:stroke-width="strokeWidth"
v-on:mouseover="onTrackOver"
Expand Down Expand Up @@ -58,7 +58,7 @@
data() {
return {
};
},
},
computed: {
strokeWidth() {
let width = ((this.isUnwisp || []).length || 1);
Expand Down Expand Up @@ -102,7 +102,7 @@
rotate: 0
};
if (maxSegment.from.x !== maxSegment.to.x)
if (maxSegment.from.x !== maxSegment.to.x)
result.point = {
x: maxSegment.from.x - (maxSegment.from.x - maxSegment.to.x) * 0.5,
y: maxSegment.from.y - 4
Expand Down Expand Up @@ -138,7 +138,7 @@
classesArrow() {
return this.makeClass(true);
},
// Стиль линии
// Стиль линии
classesLine() {
return this.makeClass();
},
Expand All @@ -161,7 +161,7 @@
arrow = this.makeArrow(pice.curr.x, pice.curr.y, pice.arrow, 'left');
else if ((pice.prev.x > pice.curr.x) && (pice.prev.y === pice.curr.y))
arrow = this.makeArrow(pice.curr.x, pice.curr.y, pice.arrow, 'right');
if (pice.after)
result += ` ${arrow}`;
else
Expand All @@ -176,7 +176,7 @@
return this.track.path;
},
// Путь
// Путь
line() {
return rounding(
this.simplePath
Expand All @@ -186,7 +186,7 @@
}
},
methods: {
//
//
onTrackClick() {
this.$emit('track-click', this.track);
},
Expand Down Expand Up @@ -221,7 +221,14 @@
},
// Генерирует path стрелки
makeArrow(x, y, style, direction) {
const shifts = {
left: -2,
right: 0,
up: -1,
down: -1
};
switch(style) {
case '*': return `M ${x+shifts[direction]}, ${y} m 3, 0 a 2,2 0 1,0 -4,0 a 2,2 0 1,0 4,0`;
case '>':
case '<':
switch (direction) {
Expand Down

0 comments on commit 681ea97

Please sign in to comment.