hayun-vite 0.10.1 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/data/sampleData.js +10 -2
- package/assets/templates/mainTemplate.js +128 -0
- package/assets/templates/template_combo.js +49 -44
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +43 -21
- package/src/Audiogram/Audiogram_100.js +499 -0
- package/src/Audiogram/Audiogram_box.js +483 -0
- package/src/Audiogram/dims.js +4 -80
- package/src/Audiogram/dims_100.js +51 -0
- package/src/Audiogram/dims_box.js +125 -0
- package/src/Form/Form.js +38 -42
- package/src/Form/Form_N.js +194 -0
- package/src/Form/Forms.js +0 -2
- package/src/Form/Sections.js +0 -6
- package/src/Form/Sections_N.js +66 -0
- package/src/{Form → Header}/Header.js +1 -4
- package/src/Header/Header_N.js +72 -0
- package/src/{Form/Box.js → MultiText/MultiText.js} +42 -25
- package/src/MultiText/MultiText_N.js +37 -0
- package/src/{Form/Reflex_N.js → Reflex/Reflex.js} +17 -4
- package/src/Reflex/units.js +65 -0
- package/src/{Form/Speech_N.js → Speech/Speech.js} +47 -30
- package/src/Speech/Speech_N.js +125 -0
- package/src/Speech/units.js +31 -0
- package/src/{Form → Tympanogram}/Tympanogram.js +39 -69
- package/src/Tympanogram/units.js +76 -0
- package/src/common/{putTextBox.js → putCell.js} +6 -6
- package/src/common/putG.js +10 -0
- package/src/common/putLine.js +1 -1
- package/src/common/putText.js +5 -4
- package/src/main.js +192 -19
- package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
- package/assets/styles-test.css +0 -86
- package/assets/styles.css +0 -86
- package/src/Form/Reflex.js +0 -145
- package/src/Form/Speech.js +0 -121
- package/src/Form/globalinfo.js +0 -68
@@ -1,15 +1,18 @@
|
|
1
1
|
import putLine from "../common/putLine.js";
|
2
2
|
import putRect from "../common/putRect.js";
|
3
|
+
import putSVG from "../common/putSVG.js";
|
3
4
|
import putText from "../common/putText.js";
|
4
5
|
const svgNS = "http://www.w3.org/2000/svg";
|
5
6
|
|
6
|
-
export default class
|
7
|
-
constructor({ container }) {
|
7
|
+
export default class MultiText {
|
8
|
+
constructor({ container, dims }) {
|
8
9
|
this.container = container;
|
10
|
+
this.draw({ dims })
|
9
11
|
}
|
10
|
-
|
12
|
+
|
13
|
+
draw({ dims }) {
|
11
14
|
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
12
|
-
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
|
15
|
+
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs;
|
13
16
|
|
14
17
|
let value;
|
15
18
|
let width = dims.width;
|
@@ -19,21 +22,15 @@ export default class TextBox {
|
|
19
22
|
|
20
23
|
let style, className;
|
21
24
|
style = `
|
22
|
-
|
25
|
+
font-family: Vazir;
|
23
26
|
font-size: 1mm;
|
27
|
+
white-space: break-spaces;
|
24
28
|
/* font-weight: bold; */
|
25
29
|
direction: rtl !important;
|
26
30
|
user-select: none;
|
27
|
-
|
31
|
+
dominant-baseline: middle;
|
28
32
|
`;
|
29
|
-
|
30
|
-
const svg = document.createElementNS(svgNS, "svg");
|
31
|
-
svg.setAttribute("x", x);
|
32
|
-
svg.setAttribute("y", y);
|
33
|
-
svg.setAttribute("width", width);
|
34
|
-
svg.setAttribute("height", height);
|
35
|
-
svg.setAttribute('style', style)
|
36
|
-
// svg.setAttribute('class', 'text-box')
|
33
|
+
const svg = putSVG({ x, y, width, height, style })
|
37
34
|
|
38
35
|
// اگر مقدار استروک درست بود لیبل ها را چاپ کن
|
39
36
|
if (!dims.hideContext) {
|
@@ -55,28 +52,48 @@ export default class TextBox {
|
|
55
52
|
|
56
53
|
// محل اینپوتهای دیتا
|
57
54
|
let name;
|
58
|
-
this.inputs && this.inputs.
|
59
|
-
(
|
60
|
-
|
61
|
-
|
55
|
+
this.inputs && this.inputs.
|
56
|
+
forEach(input => {
|
57
|
+
({ name, x, y } = input);
|
58
|
+
putText({ container: svg, x, y, className: 'persian', name });
|
59
|
+
});
|
62
60
|
|
63
61
|
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
64
62
|
const borderRect = putRect({
|
65
63
|
container: svg, x: 0, y: 0, width, height,
|
66
64
|
name: dims.name, className: 'no-print',
|
67
|
-
style: 'stroke:
|
65
|
+
style: 'stroke: green; fill: transparent; stroke-width: 0.3;'
|
68
66
|
});
|
69
|
-
this.borderRect = borderRect;
|
70
|
-
// console.log(dims);
|
71
67
|
|
68
|
+
this.borderRect = borderRect;
|
72
69
|
this.container.appendChild(svg)
|
73
|
-
// this.patient = svg;
|
74
|
-
|
75
70
|
}
|
76
71
|
|
77
72
|
update(data) {
|
78
73
|
this.inputs.forEach(input => {
|
79
|
-
|
74
|
+
let value = data?.[input.name];
|
75
|
+
const textInput = this.container.querySelector(`text[data-name=${input.name}]`)
|
76
|
+
|
77
|
+
// پیدا کردن کاراکترهای رفتن به سرخط در متن
|
78
|
+
const textLines = value.toString().split(/\n|\r|\r\n/);
|
79
|
+
const x = textInput.getAttribute('x')
|
80
|
+
// اگر متن چند خطی بود
|
81
|
+
if (textLines.length >= 2) {
|
82
|
+
let y = 5;
|
83
|
+
textLines.forEach(value => {
|
84
|
+
putTspan({ container: textInput, value, x, y });
|
85
|
+
y += 6;
|
86
|
+
})
|
87
|
+
} else textInput.innerHTML = value || "";
|
80
88
|
});
|
81
89
|
}
|
82
|
-
}
|
90
|
+
}
|
91
|
+
|
92
|
+
function putTspan({ container, value, x, y = 5, dx = 0, dy = 0, style }) {
|
93
|
+
const tspan = document.createElementNS(svgNS, "tspan");
|
94
|
+
tspan.setAttribute('x', x);
|
95
|
+
tspan.setAttribute('y', y)
|
96
|
+
tspan.textContent = value;
|
97
|
+
container && container.appendChild(tspan)
|
98
|
+
return tspan;
|
99
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export default class MultiText {
|
2
|
+
constructor({ box }) {
|
3
|
+
this.box = box;
|
4
|
+
this.container = box.container;
|
5
|
+
// this.draw({ box })
|
6
|
+
|
7
|
+
}
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
draw({ box }) {
|
13
|
+
// همه چیز را توی کانتینر باکس آبجکت رسم کن
|
14
|
+
const { container, elements, width, height } = box
|
15
|
+
console.log(box);
|
16
|
+
|
17
|
+
elements.forEach(element => {
|
18
|
+
const { name, value, x, y, style } = element;
|
19
|
+
|
20
|
+
switch (element.type) {
|
21
|
+
case 'label':
|
22
|
+
// const { value, x, y, style } = element
|
23
|
+
putText({ container, value, x, y, style })
|
24
|
+
break;
|
25
|
+
case 'input':
|
26
|
+
putText({ container, x, y, style, name });
|
27
|
+
|
28
|
+
break;
|
29
|
+
default:
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
|
33
|
+
});
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import putRect from "../common/putRect.js";
|
2
2
|
import putSVG from "../common/putSVG.js";
|
3
3
|
import putText from "../common/putText.js";
|
4
|
-
import
|
4
|
+
import putCell from "../common/putCell.js";
|
5
|
+
import units from "./units.js";
|
5
6
|
|
6
7
|
export default class Reflex {
|
7
|
-
constructor({ container, side }) {
|
8
|
+
constructor({ container, side, dims }) {
|
8
9
|
this.container = container;
|
9
10
|
this.side = side; // این برای تعیین رنگ راست و چپ استفاده میشود
|
11
|
+
this.draw({dims})
|
10
12
|
}
|
11
13
|
|
12
14
|
draw({ dims }) {
|
@@ -18,7 +20,18 @@ export default class Reflex {
|
|
18
20
|
let style;
|
19
21
|
|
20
22
|
// کل چارت
|
21
|
-
const svg = putSVG({ x, y, width, height, className: 'reflex' })
|
23
|
+
// const svg = putSVG({ x, y, width, height, className: 'reflex' })
|
24
|
+
let { styles, vbWidth, vbHeight } = units;
|
25
|
+
|
26
|
+
// کل چارت
|
27
|
+
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
28
|
+
const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
|
29
|
+
const svg = putSVG({ x, y, width, height, viewBox })
|
30
|
+
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
31
|
+
width = vbWidth; // ثابت میماند همیشه
|
32
|
+
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
33
|
+
|
34
|
+
|
22
35
|
|
23
36
|
let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسبهای سطر اول
|
24
37
|
// جدولی با ۳ سطر و ۵ ستون
|
@@ -69,7 +82,7 @@ export default class Reflex {
|
|
69
82
|
let x = cw1 / 2 + cw1 * i;
|
70
83
|
let y = ch1 * j + ch2 / 2;
|
71
84
|
//رسم باکس با مختصات مرکز باکس
|
72
|
-
|
85
|
+
putCell({ container: svg, x, y, dx: 0, dy: -1, width: 13, height: 7, rx: 1 });
|
73
86
|
}
|
74
87
|
}
|
75
88
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const units = {
|
2
|
+
name: 'Acoustic Reflexes',
|
3
|
+
margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
4
|
+
|
5
|
+
// واحد ویوباکس - بدون واحد
|
6
|
+
vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
|
7
|
+
vbHeight: 30, // این به نسبت تغییر میکند
|
8
|
+
|
9
|
+
// واحد پیکسل، میلیمتر، ...
|
10
|
+
// اگر واحد پایینی توسط بیرون تغییر کرد واحدهای بالایی باید با نسبت پایینی تغییر کنند
|
11
|
+
width: 100,
|
12
|
+
height: 30,
|
13
|
+
|
14
|
+
styles: {
|
15
|
+
pressure: `
|
16
|
+
user-select: none;
|
17
|
+
direction: ltr !important;
|
18
|
+
font-family: Vazir;
|
19
|
+
font-size: 3;
|
20
|
+
text-anchor: middle;
|
21
|
+
dominant-baseline: hanging;
|
22
|
+
`,
|
23
|
+
caption: `
|
24
|
+
user-select: none;
|
25
|
+
direction: ltr !important;
|
26
|
+
font-family: Vazir;
|
27
|
+
font-size: 3;
|
28
|
+
text-anchor: middle;
|
29
|
+
dominant-baseline: middle;
|
30
|
+
`,
|
31
|
+
label: `
|
32
|
+
user-select: none;
|
33
|
+
direction: ltr !important;
|
34
|
+
font-family: Vazir;
|
35
|
+
font-size: 1mm;
|
36
|
+
text-anchor: start;
|
37
|
+
dominant-baseline: middle;
|
38
|
+
`,
|
39
|
+
type: `
|
40
|
+
user-select: none;
|
41
|
+
direction: ltr !important;
|
42
|
+
font-family: Vazir;
|
43
|
+
font-size: 1mm;
|
44
|
+
font-weight: bold;
|
45
|
+
text-anchor: start;
|
46
|
+
dominant-baseline: middle;
|
47
|
+
`,
|
48
|
+
compliance: `
|
49
|
+
user-select: none;
|
50
|
+
direction: ltr !important;
|
51
|
+
font-family: Vazir;
|
52
|
+
font-size: 0.7mm;
|
53
|
+
text-anchor: end;
|
54
|
+
dominant-baseline: middle;
|
55
|
+
`,
|
56
|
+
mainFreqline: `stroke: black; stroke-width: 1;`,
|
57
|
+
semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
|
58
|
+
boldLine: 'stroke: black; stroke-width: 3;',
|
59
|
+
|
60
|
+
juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
|
61
|
+
juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
|
62
|
+
},
|
63
|
+
}
|
64
|
+
|
65
|
+
export default units;
|
@@ -1,21 +1,19 @@
|
|
1
|
-
import
|
1
|
+
import putCell from "../common/putCell.js";
|
2
2
|
import putRect from "../common/putRect.js";
|
3
3
|
import putText from "../common/putText.js";
|
4
4
|
import putSVG from "../common/putSVG.js";
|
5
|
-
import
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
import units from "./units.js";
|
10
6
|
const svgNS = "http://www.w3.org/2000/svg";
|
11
7
|
|
12
8
|
export default class Speech {
|
13
|
-
constructor({ container, side = 'R' }) {
|
9
|
+
constructor({ container, side = 'R', dims }) {
|
14
10
|
this.container = container;
|
15
11
|
this.side = side;
|
12
|
+
this.draw({dims})
|
16
13
|
}
|
17
14
|
|
18
|
-
draw({ dims
|
15
|
+
draw({ dims }) {
|
16
|
+
// console.log(dims);
|
19
17
|
|
20
18
|
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
21
19
|
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
|
@@ -24,43 +22,50 @@ export default class Speech {
|
|
24
22
|
let height = dims.height;
|
25
23
|
let x = dims.margin.left;
|
26
24
|
let y = dims.margin.top;
|
25
|
+
let { styles, vbWidth, vbHeight } = units;
|
26
|
+
|
27
|
+
// کل چارت
|
28
|
+
vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
|
29
|
+
const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
|
30
|
+
const svg = putSVG({ x, y, width, height, viewBox })
|
31
|
+
// این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
|
32
|
+
width = vbWidth; // ثابت میماند همیشه
|
33
|
+
height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
|
34
|
+
|
35
|
+
|
27
36
|
const labels = dims.labels;
|
28
37
|
this.labels = labels;
|
29
|
-
// const cn = labels.length;
|
30
|
-
let sideCaption = this.side === "R" ? "Right" : "Left";
|
31
38
|
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
32
39
|
const rows = 2;
|
33
|
-
const
|
34
|
-
|
35
|
-
const cw = width / column; // پهنای هر خانه
|
40
|
+
const columns = labels.length;
|
41
|
+
const cw = width / columns; // پهنای هر خانه
|
36
42
|
const ch = height / rows; // ارتفاع هر خانه
|
43
|
+
// تعریف آبجکتی چارت
|
44
|
+
const chart = {
|
45
|
+
width, height,
|
46
|
+
rows: 2, column: labels.length,
|
47
|
+
cell: { width: 1, height: 1 },
|
48
|
+
calc1: function () {
|
49
|
+
this.cell.width = this.width / this.column
|
50
|
+
}
|
51
|
+
}
|
37
52
|
|
38
|
-
//
|
39
|
-
const svg = putSVG({ x, y, width, height, className: 'speach' })
|
40
|
-
|
53
|
+
// ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
|
41
54
|
const matrix = [
|
42
55
|
[],
|
43
56
|
[]
|
44
57
|
];
|
45
58
|
|
46
|
-
for (let i = 0; i <
|
59
|
+
for (let i = 0; i < rows; i++) {
|
47
60
|
x = cw / 2;
|
48
61
|
y = ch / 2 + ch * i;
|
49
|
-
for (let j = 0; j <
|
62
|
+
for (let j = 0; j < columns; j++) {
|
50
63
|
matrix[i][j] = { i, j, x, y };
|
51
64
|
x += cw;
|
52
65
|
}
|
53
66
|
}
|
54
|
-
style = `
|
55
|
-
user-select: none;
|
56
|
-
direction: ltr !important;
|
57
|
-
/* text-align: center; */
|
58
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
59
|
-
font-size: 1mm;
|
60
|
-
font-weight: bold;
|
61
|
-
text-anchor: middle; /*تراز افقی*/
|
62
|
-
`;
|
63
67
|
|
68
|
+
style = styles.label;
|
64
69
|
// برچسب های سطر اول
|
65
70
|
// برای فرم های پیش چاپ شده انجام نمیشود
|
66
71
|
!dims.hideContext &&
|
@@ -69,19 +74,31 @@ export default class Speech {
|
|
69
74
|
|
70
75
|
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
71
76
|
|
77
|
+
const inputBox = {
|
78
|
+
width: width / 5 * 0.70, height: height / 2 * 0.85,
|
79
|
+
rx: width / 100
|
80
|
+
}
|
81
|
+
// محاسبه کمان گردی بر اساس مقدار پهنا
|
82
|
+
inputBox.rx = inputBox.width / 10
|
83
|
+
|
72
84
|
// باکس و تکست مقادیر
|
73
85
|
matrix[1].forEach((cell, index) => {
|
74
86
|
// برای فرم های پیش چاپ شده باکس رسم نمیشود
|
75
|
-
!dims.hideContext &&
|
87
|
+
!dims.hideContext &&
|
88
|
+
putCell({
|
89
|
+
container: svg, x: cell.x, y: cell.y, dy: -1,
|
90
|
+
width: inputBox.width, height: inputBox.height,
|
91
|
+
rx: inputBox.rx,
|
92
|
+
});
|
76
93
|
// مقدار نگه دارها
|
77
94
|
if (!dims.forceInsert) {
|
78
|
-
putText({ container: svg, value: "", x: cell.x, y: cell.y, style
|
95
|
+
putText({ container: svg, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
|
79
96
|
} else {
|
80
97
|
// برای فرم های مثل رسا استفاده میشود
|
81
98
|
let name;
|
82
99
|
this.inputs.forEach(input => {
|
83
100
|
({ name, x, y } = input);
|
84
|
-
putText({ container: svg, x, y, style
|
101
|
+
putText({ container: svg, x, y, style, name });
|
85
102
|
});
|
86
103
|
}
|
87
104
|
}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import putCell from "../common/putCell.js";
|
2
|
+
import putRect from "../common/putRect.js";
|
3
|
+
import putText from "../common/putText.js";
|
4
|
+
import putSVG from "../common/putSVG.js";
|
5
|
+
import units from "./units.js";
|
6
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
7
|
+
|
8
|
+
export default class Speech {
|
9
|
+
constructor({ box, side = 'R' }) {
|
10
|
+
console.log(box);
|
11
|
+
|
12
|
+
// const { container, width, height, elements } = box
|
13
|
+
// this.container = container;
|
14
|
+
this.side = side;
|
15
|
+
this.draw({ box })
|
16
|
+
|
17
|
+
}
|
18
|
+
|
19
|
+
draw({ box }) {
|
20
|
+
const { container, width, height, margin, elements, name} = box
|
21
|
+
|
22
|
+
// console.log(dims);
|
23
|
+
|
24
|
+
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
25
|
+
// this.inputs = (dims.forceInsesrt) ? dims.forceInputs : dims.inputs
|
26
|
+
let style;
|
27
|
+
// let width = dims.width;
|
28
|
+
// let height = dims.height;
|
29
|
+
let x = margin.left;
|
30
|
+
let y = margin.top;
|
31
|
+
|
32
|
+
// کل چارت
|
33
|
+
// const svg = putSVG({ x, y, width, height, viewBox: [0, 0, width, height] })
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
const labels = elements;
|
38
|
+
this.labels = labels;
|
39
|
+
let { styles } = units;
|
40
|
+
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
41
|
+
const rows = 2;
|
42
|
+
const columns = labels.length;
|
43
|
+
const cw = width / columns; // پهنای هر خانه
|
44
|
+
const ch = height / rows; // ارتفاع هر خانه
|
45
|
+
// تعریف آبجکتی چارت
|
46
|
+
const chart = {
|
47
|
+
width, height,
|
48
|
+
rows: 2, column: labels.length,
|
49
|
+
cell: { width: 1, height: 1 },
|
50
|
+
calc1: function () {
|
51
|
+
this.cell.width = this.width / this.column
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
// ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
|
57
|
+
const matrix = [
|
58
|
+
[],
|
59
|
+
[]
|
60
|
+
];
|
61
|
+
|
62
|
+
for (let i = 0; i < rows; i++) {
|
63
|
+
x = cw / 2;
|
64
|
+
y = ch / 2 + ch * i;
|
65
|
+
for (let j = 0; j < columns; j++) {
|
66
|
+
matrix[i][j] = { i, j, x, y };
|
67
|
+
x += cw;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
style = styles.label;
|
72
|
+
|
73
|
+
// برچسب های سطر اول
|
74
|
+
// برای فرم های پیش چاپ شده انجام نمیشود
|
75
|
+
// !dims.hideContext &&
|
76
|
+
matrix[0].forEach((cell, index) =>
|
77
|
+
putText({ container, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
|
78
|
+
|
79
|
+
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
80
|
+
|
81
|
+
const inputBox = {
|
82
|
+
width: width / 5 * 0.78, height: height / 2 * 0.85,
|
83
|
+
rx: width / 100
|
84
|
+
}
|
85
|
+
// محاسبه کمان گردی بر اساس مقدار پهنا
|
86
|
+
inputBox.rx = inputBox.width / 10
|
87
|
+
|
88
|
+
// باکس و تکست مقادیر
|
89
|
+
matrix[1].forEach((cell, index) => {
|
90
|
+
// برای فرم های پیش چاپ شده باکس رسم نمیشود
|
91
|
+
// !dims.hideContext &&
|
92
|
+
putCell({
|
93
|
+
container, x: cell.x, y: cell.y, dy: -1,
|
94
|
+
width: inputBox.width, height: inputBox.height,
|
95
|
+
rx: inputBox.rx,
|
96
|
+
});
|
97
|
+
// مقدار نگه دارها
|
98
|
+
// if (!dims.forceInsert) {
|
99
|
+
putText({ container, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
|
100
|
+
// } else {
|
101
|
+
// // برای فرم های مثل رسا استفاده میشود
|
102
|
+
// let name;
|
103
|
+
// this.inputs.forEach(input => {
|
104
|
+
// ({ name, x, y } = input);
|
105
|
+
// putText({ container: svg, x, y, style, name });
|
106
|
+
// });
|
107
|
+
// }
|
108
|
+
}
|
109
|
+
);
|
110
|
+
|
111
|
+
|
112
|
+
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
113
|
+
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
114
|
+
let className = 'no-print'
|
115
|
+
putRect({ container, x: 0, y: 0, width, height, style, name })
|
116
|
+
// this.chart = svg;
|
117
|
+
// container.appendChild(svg);
|
118
|
+
}
|
119
|
+
|
120
|
+
update(data) {
|
121
|
+
this.labels.forEach((label) => {
|
122
|
+
this.chart.querySelector(`text[data-name=${label}]`).innerHTML = data?.[label] || "";
|
123
|
+
})
|
124
|
+
}
|
125
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
const units = {
|
2
|
+
|
3
|
+
name: 'Speech',
|
4
|
+
margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
5
|
+
// اگر واحد پایینی توسط بیرون تغییر کرد ارتفاع ویوباکس باید با نسبت پایینی تغییر کنند
|
6
|
+
width: 100,
|
7
|
+
height: 20,
|
8
|
+
// این فاصله خطوط محورهای بالا و چپ ادیوگرام از لبه ها هست
|
9
|
+
chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
|
10
|
+
// واحد ویوباکس - بدون واحد
|
11
|
+
vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
|
12
|
+
vbHeight: 20, // این به نسبت تغییر میکند
|
13
|
+
// پایینی شکل آبجکت بالایی هست
|
14
|
+
// viewBoxObj: { 'min-x': -0, 'min-y': 0, width: 100, height: 20 },
|
15
|
+
// viewBox: [0, 0, 100, 20],
|
16
|
+
// واحد پیکسل، میلیمتر، ...
|
17
|
+
|
18
|
+
|
19
|
+
styles: {
|
20
|
+
label: `
|
21
|
+
user-select: none;
|
22
|
+
direction: ltr;
|
23
|
+
font-family: Vazir;
|
24
|
+
font-size: ${4.2};
|
25
|
+
font-weight: 700;
|
26
|
+
text-anchor: middle;
|
27
|
+
`,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
export default units
|