hayun-vite 0.7.3 → 0.8.0
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/package.json +1 -1
- package/src/Form/{TextBox.js → Box.js} +15 -13
- package/src/Form/Form.js +29 -16
- package/src/Form/Forms.js +4 -3
- package/src/Form/Reflex.js +9 -3
- package/src/Form/Reflex_N.js +121 -0
- package/src/Form/Sections.js +3 -5
- package/src/Form/Speech.js +2 -14
- package/src/Form/Speech_N.js +103 -0
- package/src/Form/printForm.js +7 -2
- package/src/Form/templates/combo.js +112 -18
- package/src/common/putSVG.js +3 -3
- package/src/common/putText.js +2 -2
- package/src/common/putTextBox.js +18 -0
- package/src/main.js +5 -27
- package/src/Form/fonts/Vazirmatn-Regular.woff2 +0 -0
- package/src/common/putBox.js +0 -0
package/package.json
CHANGED
@@ -37,23 +37,25 @@ export default class TextBox {
|
|
37
37
|
|
38
38
|
// اگر مقدار استروک درست بود لیبل ها را چاپ کن
|
39
39
|
if (!dims.hideContext) {
|
40
|
-
dims.elements
|
41
|
-
|
42
|
-
|
43
|
-
(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
dims.elements
|
41
|
+
.forEach(
|
42
|
+
element => {
|
43
|
+
switch (element.type) {
|
44
|
+
case 'text':
|
45
|
+
({ x, y, value, style } = element);
|
46
|
+
putText({ container: svg, value, x, y, style, className: 'persian bold' });
|
47
|
+
break;
|
48
|
+
case 'line':
|
49
|
+
let { x1, y1, x2, y2 } = element;
|
50
|
+
putLine({ container: svg, x1, y1, x2, y2 });
|
51
|
+
break;
|
52
|
+
}
|
53
|
+
});
|
52
54
|
}
|
53
55
|
|
54
56
|
// محل اینپوتهای دیتا
|
55
57
|
let name;
|
56
|
-
this.inputs.forEach(input => {
|
58
|
+
this.inputs && this.inputs.forEach(input => {
|
57
59
|
({ name, x, y } = input);
|
58
60
|
putText({ container: svg, x, y, className: 'persian', name });
|
59
61
|
});
|
package/src/Form/Form.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
// import Symbols from "../Symbol/Symbols.js";
|
2
|
-
import
|
2
|
+
import Box from "./Box.js";
|
3
3
|
import Header from "./Header.js";
|
4
|
-
import Reflex from "./
|
4
|
+
import Reflex from "./Reflex_N.js";
|
5
5
|
import Sections from "./Sections.js";
|
6
|
-
import Speech from "./
|
6
|
+
import Speech from "./Speech_N.js";
|
7
7
|
import Tympanogram from "./Tympanogram.js";
|
8
8
|
import putRect from "../common/putRect.js";
|
9
9
|
import AudiogramChart from "../Audiogram/Audiogram.js";
|
@@ -20,28 +20,28 @@ export default class Form {
|
|
20
20
|
this.form.style.display = 'none';
|
21
21
|
// رسم مارجین های فرم
|
22
22
|
this.drawMarginLines({ container: this.form, width, height });
|
23
|
-
|
23
|
+
|
24
24
|
const sections = new Sections({ container: this.form, dims: template });
|
25
25
|
this.sections = sections;
|
26
|
-
|
27
|
-
|
26
|
+
|
28
27
|
if (sections.header) {
|
29
28
|
this.header = new Header({ container: sections.header })
|
30
29
|
this.header.draw({ dims: template.header });
|
31
30
|
}
|
32
|
-
|
33
31
|
if (sections.patient) {
|
34
|
-
|
32
|
+
// (template.label === 'تمپانومتری رسا') && console.log(template.patient);
|
35
33
|
|
36
|
-
this.patient = new
|
34
|
+
this.patient = new Box({ container: sections.patient });
|
37
35
|
this.patient.draw({ dims: template.patient });
|
38
36
|
}
|
39
|
-
|
40
37
|
if (sections.history) {
|
41
|
-
this.history = new
|
38
|
+
this.history = new Box({ container: sections.history })
|
42
39
|
this.history.draw({ dims: template.history });
|
43
40
|
}
|
44
|
-
|
41
|
+
if (sections['Audiogram Titles']) {
|
42
|
+
const titles = new Box({ container: sections['Audiogram Titles'] });
|
43
|
+
titles.draw({ dims: template['Audiogram Titles'] });
|
44
|
+
}
|
45
45
|
if (sections.RAudiogram) {
|
46
46
|
this.RAudiogram = new AudiogramChart({
|
47
47
|
container: sections.RAudiogram,
|
@@ -50,7 +50,6 @@ export default class Form {
|
|
50
50
|
events: false
|
51
51
|
});
|
52
52
|
}
|
53
|
-
|
54
53
|
if (sections.LAudiogram) {
|
55
54
|
this.LAudiogram = new AudiogramChart({
|
56
55
|
container: sections.LAudiogram,
|
@@ -59,7 +58,11 @@ export default class Form {
|
|
59
58
|
events: false
|
60
59
|
});
|
61
60
|
}
|
62
|
-
if (sections
|
61
|
+
if (sections['Speech Titles']) {
|
62
|
+
const titles = new Box({ container: sections['Speech Titles'] });
|
63
|
+
titles.draw({ dims: template['Speech Titles'] });
|
64
|
+
}
|
65
|
+
if (sections['RSpeech']) {
|
63
66
|
this.RSpeech = new Speech({ container: sections.RSpeech, side: 'R' })
|
64
67
|
this.RSpeech.draw({ dims: template.RSpeech, })
|
65
68
|
}
|
@@ -67,6 +70,10 @@ export default class Form {
|
|
67
70
|
this.LSpeech = new Speech({ container: sections.LSpeech, side: 'L' })
|
68
71
|
this.LSpeech.draw({ dims: template.LSpeech, });
|
69
72
|
}
|
73
|
+
if (sections['Tympanogram Titles']) {
|
74
|
+
const titles = new Box({ container: sections['Tympanogram Titles'] });
|
75
|
+
titles.draw({ dims: template['Tympanogram Titles'] });
|
76
|
+
}
|
70
77
|
if (sections.RTympanogram) {
|
71
78
|
this.RTympanogram = new Tympanogram({ container: sections.RTympanogram, side: 'R' })
|
72
79
|
this.RTympanogram.draw({ dims: template.RTympanogram });
|
@@ -75,6 +82,12 @@ export default class Form {
|
|
75
82
|
this.LTympanogram = new Tympanogram({ container: sections.LTympanogram, side: 'L' })
|
76
83
|
this.LTympanogram.draw({ dims: template.LTympanogram });
|
77
84
|
}
|
85
|
+
|
86
|
+
if (sections['Reflex Titles']) {
|
87
|
+
const titles = new Box({ container: sections['Reflex Titles'] });
|
88
|
+
titles.draw({ dims: template['Reflex Titles'] });
|
89
|
+
}
|
90
|
+
|
78
91
|
if (sections.RReflex) {
|
79
92
|
this.RReflex = new Reflex({ container: sections.RReflex, side: 'R' })
|
80
93
|
this.RReflex.draw({ dims: template.RReflex });
|
@@ -84,11 +97,11 @@ export default class Form {
|
|
84
97
|
this.LReflex.draw({ dims: template.LReflex });
|
85
98
|
}
|
86
99
|
if (sections.report) {
|
87
|
-
this.report = new
|
100
|
+
this.report = new Box({ container: sections.report })
|
88
101
|
this.report.draw({ dims: template.report });
|
89
102
|
}
|
90
103
|
if (sections.footer) {
|
91
|
-
this.footer = new
|
104
|
+
this.footer = new Box({ container: sections.footer })
|
92
105
|
this.footer.draw({ dims: template.footer });
|
93
106
|
}
|
94
107
|
|
package/src/Form/Forms.js
CHANGED
@@ -7,14 +7,15 @@ import rasaAud from "./templates/rasa_audiometry.js";
|
|
7
7
|
import rasaTymp from './templates/rasa_tymp_reflex.js'
|
8
8
|
|
9
9
|
// خط کد زیر لازم هست
|
10
|
-
import './fonts/Vazirmatn-Regular.woff2'
|
10
|
+
// import './fonts/Vazirmatn-Regular.woff2'
|
11
11
|
import '../style.css'
|
12
12
|
|
13
13
|
// کلاس جدید که فرمهای مختلف را نمایش میدهد
|
14
14
|
export default class Forms {
|
15
|
-
constructor({ assets, container, defaultFormIndex =
|
15
|
+
constructor({ assets, container, defaultFormIndex = 0 } = {}) {
|
16
16
|
this.container = container
|
17
|
-
this.addForms({ templates: [rasaAud, rasaTymp, combo], defaultFormIndex })
|
17
|
+
// this.addForms({ templates: [rasaAud, rasaTymp, combo], defaultFormIndex })
|
18
|
+
this.addForms({ templates: [combo], defaultFormIndex })
|
18
19
|
}
|
19
20
|
|
20
21
|
// افزودن فرم
|
package/src/Form/Reflex.js
CHANGED
@@ -10,13 +10,18 @@ export default class Reflex {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
draw({ dims }) {
|
13
|
-
|
13
|
+
|
14
14
|
let width = dims.width;
|
15
15
|
let height = dims.height;
|
16
16
|
let x = dims.margin.left;
|
17
17
|
let y = dims.margin.top;
|
18
18
|
let style;
|
19
19
|
|
20
|
+
// x = 10
|
21
|
+
// y=1
|
22
|
+
// width= 80
|
23
|
+
// height = 24
|
24
|
+
|
20
25
|
const svg = document.createElementNS(svgNS, "svg");
|
21
26
|
svg.setAttribute("x", x);
|
22
27
|
svg.setAttribute("y", y);
|
@@ -36,7 +41,7 @@ export default class Reflex {
|
|
36
41
|
direction: ltr !important;
|
37
42
|
/* text-align: center; */
|
38
43
|
font-family: Arial, Helvetica, sans-serif !important;
|
39
|
-
font-size:
|
44
|
+
font-size: 1mm;
|
40
45
|
font-weight: bold;
|
41
46
|
text-anchor: middle; /*تراز افقی*/
|
42
47
|
dominant-baseline: middle; /* تراز عمودی*/
|
@@ -56,7 +61,7 @@ export default class Reflex {
|
|
56
61
|
direction: ltr !important;
|
57
62
|
/* text-align: center; */
|
58
63
|
font-family: Arial, Helvetica, sans-serif !important;
|
59
|
-
font-size:
|
64
|
+
font-size: 1mm;
|
60
65
|
font-weight: bold;
|
61
66
|
text-anchor: end; /*تراز افقی*/
|
62
67
|
dominant-baseline: middle; /* تراز عمودی*/
|
@@ -122,6 +127,7 @@ export default class Reflex {
|
|
122
127
|
rect.setAttribute("y", y - h / 2);
|
123
128
|
rect.setAttribute("width", w);
|
124
129
|
rect.setAttribute("height", h);
|
130
|
+
rect.setAttribute("rx", 1.5)
|
125
131
|
rect.setAttribute("style", "fill: transparent; stroke: black; stroke-width: 0.2;");
|
126
132
|
svg.appendChild(rect);
|
127
133
|
}
|
@@ -0,0 +1,121 @@
|
|
1
|
+
import putRect from "../common/putRect.js";
|
2
|
+
import putSVG from "../common/putSVG.js";
|
3
|
+
import putText from "../common/putText.js";
|
4
|
+
import putTextBox from "../common/putTextBox.js";
|
5
|
+
|
6
|
+
export default class Reflex {
|
7
|
+
constructor({ container, side }) {
|
8
|
+
this.container = container;
|
9
|
+
this.side = side; // این برای تعیین رنگ راست و چپ استفاده میشود
|
10
|
+
}
|
11
|
+
|
12
|
+
draw({ dims }) {
|
13
|
+
|
14
|
+
let width = dims.width;
|
15
|
+
let height = dims.height;
|
16
|
+
let x = dims.margin.left;
|
17
|
+
let y = dims.margin.top;
|
18
|
+
let style;
|
19
|
+
|
20
|
+
// کل چارت
|
21
|
+
const svg = putSVG({ x, y, width, height, className: 'reflex' })
|
22
|
+
|
23
|
+
let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسبهای سطر اول
|
24
|
+
// جدولی با ۳ سطر و ۵ ستون
|
25
|
+
let cw1 = width / 5; // پهنای خانههای سطر اول
|
26
|
+
let ch1 = height / 3; // ارتفاع خانههای سطر اول
|
27
|
+
let ch2 = height / 3; // ارتفاع خانههای سطر دوم
|
28
|
+
|
29
|
+
// چاپ برچسبهای سطر اول
|
30
|
+
style = `
|
31
|
+
user-select: none;
|
32
|
+
direction: ltr !important;
|
33
|
+
/* text-align: center; */
|
34
|
+
font-family: Arial, Helvetica, sans-serif !important;
|
35
|
+
font-size: 1mm;
|
36
|
+
font-weight: bold;
|
37
|
+
text-anchor: middle; /*تراز افقی*/
|
38
|
+
dominant-baseline: middle; /* تراز عمودی*/
|
39
|
+
`;
|
40
|
+
lable.forEach((value, i) => {
|
41
|
+
if (value != "") {
|
42
|
+
let x = cw1 / 2 + cw1 * i;
|
43
|
+
let y = ch1 / 2;
|
44
|
+
// putText(value, x, y, "", "middle", "middle"); // با استایل تراز عمودی پایین نسبت به خط پایه
|
45
|
+
putText({ container: svg, value, x, y, style })
|
46
|
+
}
|
47
|
+
});
|
48
|
+
|
49
|
+
// مقادیر برچسبهای ستون اول
|
50
|
+
style = `
|
51
|
+
user-select: none;
|
52
|
+
direction: ltr !important;
|
53
|
+
/* text-align: center; */
|
54
|
+
font-family: Arial, Helvetica, sans-serif !important;
|
55
|
+
font-size: 1mm;
|
56
|
+
font-weight: bold;
|
57
|
+
text-anchor: end; /*تراز افقی*/
|
58
|
+
dominant-baseline: middle; /* تراز عمودی*/
|
59
|
+
`;
|
60
|
+
lable = ["Freq", "IPSI", "CONTRA"];
|
61
|
+
// چاپ برچسبهای ستون اول
|
62
|
+
putText({ container: svg, value: "Freq", x: cw1, y: ch1 / 2, style: style })
|
63
|
+
putText({ container: svg, value: "IPSI", x: cw1, y: ch1 * 3 / 2, style: style })
|
64
|
+
putText({ container: svg, value: "CONTRA", x: cw1, y: ch1 * 5 / 2, style: style })
|
65
|
+
|
66
|
+
//چاپ ده باکس سطر دوم و سوم
|
67
|
+
for (let j = 1; j <= 2; j++) {
|
68
|
+
for (let i = 1; i <= 4; i++) {
|
69
|
+
let x = cw1 / 2 + cw1 * i;
|
70
|
+
let y = ch1 * j + ch2 / 2;
|
71
|
+
//رسم باکس با مختصات مرکز باکس
|
72
|
+
putTextBox({ container: svg, x, y, dx: 0, dy: -1, w: 13, h: 7, rx: 1 });
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
style = `
|
77
|
+
user-select: none;
|
78
|
+
direction: ltr !important;
|
79
|
+
/* text-align: center; */
|
80
|
+
font-family: Arial, Helvetica, sans-serif !important;
|
81
|
+
font-size: 1mm;
|
82
|
+
text-anchor: middle; /*تراز افقی*/
|
83
|
+
dominant-baseline: middle; /* تراز عمودی*/
|
84
|
+
`;
|
85
|
+
// اضافه کردن رنگ قرمز یا آبی به استایل بر اساس جهت
|
86
|
+
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
87
|
+
|
88
|
+
let names = ["IPSI_500", "IPSI_1000", "IPSI_2000", "IPSI_4000"];
|
89
|
+
for (let index = 0; index < 4; index++) {
|
90
|
+
x = cw1 / 2 + cw1 * (index + 1);
|
91
|
+
y = ch1 + ch2 / 2;
|
92
|
+
putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
|
93
|
+
}
|
94
|
+
|
95
|
+
// المنتهای تکست خالی با آیدی یکتا در سطر سوم
|
96
|
+
// آرایه نام آیدی یکتا برای المنت تکست مقادیر برای استفاده تابع آپدیت
|
97
|
+
names = ["CONTRA_500", "CONTRA_1000", "CONTRA_2000", "CONTRA_4000"];
|
98
|
+
|
99
|
+
for (let index = 0; index < 4; index++) {
|
100
|
+
// const idValue = idValues[index];
|
101
|
+
x = cw1 / 2 + cw1 * (index + 1);
|
102
|
+
y = ch1 * 2 + ch2 / 2;
|
103
|
+
putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
|
104
|
+
}
|
105
|
+
// مربع احاطهکننده کل جدول برای راهنمای توسعه و دریافت رویداد کلیک روی فرم
|
106
|
+
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
107
|
+
putRect({ container: svg, x: 0, y: 0, width, height, style, name: dims.name })
|
108
|
+
this.container.appendChild(svg);
|
109
|
+
this.chart = svg;
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
// جایگذاری داده های رفلکس
|
114
|
+
update(data) {
|
115
|
+
for (const key in data) {
|
116
|
+
for (const freq in data[key]) {
|
117
|
+
this.chart.querySelector(`text[data-name=${key}_${freq}]`).innerHTML = data?.[key]?.[freq] || "";
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}
|
package/src/Form/Sections.js
CHANGED
@@ -17,9 +17,6 @@ export default class Sections {
|
|
17
17
|
|
18
18
|
// یک حلقه آرایه ایجاد میکنیم همه سکشن ها رسم شود
|
19
19
|
this.create()
|
20
|
-
|
21
|
-
|
22
|
-
|
23
20
|
}
|
24
21
|
// ایجاد سکشنها
|
25
22
|
create() {
|
@@ -44,13 +41,14 @@ export default class Sections {
|
|
44
41
|
svg.setAttribute("y", this.top);
|
45
42
|
|
46
43
|
// نگهداری مختصات رسم بوردر هر سکشن برای استفاده در متد داخلی رسم بودر تاپ لایر
|
47
|
-
this.cords.push({ name
|
44
|
+
this.cords.push({ name, width, height, x: this.left, y: this.top });
|
48
45
|
|
49
46
|
putRect({
|
50
47
|
container: svg, x: 0, y: 0, width, height,
|
51
48
|
style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
|
52
49
|
className: 'no-print', name: 'guide-border'
|
53
|
-
})
|
50
|
+
});
|
51
|
+
|
54
52
|
this[name] = svg;
|
55
53
|
this.container.appendChild(svg)
|
56
54
|
|
package/src/Form/Speech.js
CHANGED
@@ -9,24 +9,18 @@ export default class Speech {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
draw({ dims, stroke = true }) {
|
12
|
+
console.log(dims);
|
13
|
+
|
12
14
|
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
13
15
|
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
|
14
|
-
|
15
16
|
let style;
|
16
|
-
|
17
17
|
let width = dims.width;
|
18
18
|
let height = dims.height;
|
19
19
|
let x = dims.margin.left;
|
20
20
|
let y = dims.margin.top;
|
21
|
-
|
22
21
|
const labels = dims.labels;
|
23
|
-
// const inputs = dims.inputs;
|
24
22
|
const cn = labels.length;
|
25
|
-
|
26
23
|
this.labels = labels;
|
27
|
-
|
28
|
-
|
29
|
-
|
30
24
|
let sideCaption = this.side === "R" ? "Right" : "Left";
|
31
25
|
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
32
26
|
// const cw = width / 6; // پهنای هر خانه
|
@@ -123,11 +117,5 @@ export default class Speech {
|
|
123
117
|
this.labels.forEach((label) => {
|
124
118
|
this.chart.querySelector(`text[data-name=${label}]`).innerHTML = data?.[label] || "";
|
125
119
|
})
|
126
|
-
// this.chart.querySelector(`text[data-name="SAT"]`).innerHTML = data?.SAT || "";
|
127
|
-
// this.chart.querySelector(`text[data-name="SRT"]`).innerHTML = data?.SRT || "";
|
128
|
-
// this.chart.querySelector(`text[data-name="MCL"]`).innerHTML = data?.MCL || "";
|
129
|
-
// this.chart.querySelector(`text[data-name="UCL"]`).innerHTML = data?.UCL || "";
|
130
|
-
// this.chart.querySelector(`text[data-name="SDS"]`).innerHTML = data?.SDS || "";
|
131
120
|
}
|
132
|
-
|
133
121
|
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import putTextBox from "../common/putTextBox.js";
|
2
|
+
import putRect from "../common/putRect.js";
|
3
|
+
import putText from "../common/putText.js";
|
4
|
+
import putSVG from "../common/putSVG.js";
|
5
|
+
import putPoint from "../common/putPoint.js";
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
11
|
+
|
12
|
+
export default class Speech {
|
13
|
+
constructor({ container, side = 'R' }) {
|
14
|
+
this.container = container;
|
15
|
+
this.side = side;
|
16
|
+
}
|
17
|
+
|
18
|
+
draw({ dims, stroke = true }) {
|
19
|
+
|
20
|
+
// دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
|
21
|
+
this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
|
22
|
+
let style;
|
23
|
+
let width = dims.width;
|
24
|
+
let height = dims.height;
|
25
|
+
let x = dims.margin.left;
|
26
|
+
let y = dims.margin.top;
|
27
|
+
const labels = dims.labels;
|
28
|
+
this.labels = labels;
|
29
|
+
// const cn = labels.length;
|
30
|
+
let sideCaption = this.side === "R" ? "Right" : "Left";
|
31
|
+
// یک جدول 6*2 - ۲ سطر و ۶ ستون
|
32
|
+
const rows = 2;
|
33
|
+
const column = labels.length;
|
34
|
+
|
35
|
+
const cw = width / column; // پهنای هر خانه
|
36
|
+
const ch = height / rows; // ارتفاع هر خانه
|
37
|
+
|
38
|
+
// کل چارت
|
39
|
+
const svg = putSVG({ x, y, width, height, className: 'speach' })
|
40
|
+
|
41
|
+
const matrix = [
|
42
|
+
[],
|
43
|
+
[]
|
44
|
+
];
|
45
|
+
|
46
|
+
for (let i = 0; i < 2; i++) {
|
47
|
+
x = cw / 2;
|
48
|
+
y = ch / 2 + ch * i;
|
49
|
+
for (let j = 0; j < 5; j++) {
|
50
|
+
matrix[i][j] = { i, j, x, y };
|
51
|
+
x += cw;
|
52
|
+
}
|
53
|
+
}
|
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
|
+
|
64
|
+
// برچسب های سطر اول
|
65
|
+
// برای فرم های پیش چاپ شده انجام نمیشود
|
66
|
+
!dims.hideContext &&
|
67
|
+
matrix[0].forEach((cell, index) =>
|
68
|
+
putText({ container: svg, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
|
69
|
+
|
70
|
+
style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
|
71
|
+
|
72
|
+
// باکس و تکست مقادیر
|
73
|
+
matrix[1].forEach((cell, index) => {
|
74
|
+
// برای فرم های پیش چاپ شده باکس رسم نمیشود
|
75
|
+
!dims.hideContext && putTextBox({ container: svg, x: cell.x, y: cell.y, dy: -1, w: 13, h: 7, rx: 1, });
|
76
|
+
// مقدار نگه دارها
|
77
|
+
if (!dims.forceInsert) {
|
78
|
+
putText({ container: svg, value: "", x: cell.x, y: cell.y, style: style, name: labels[index] });
|
79
|
+
} else {
|
80
|
+
// برای فرم های مثل رسا استفاده میشود
|
81
|
+
let name;
|
82
|
+
this.inputs.forEach(input => {
|
83
|
+
({ name, x, y } = input);
|
84
|
+
putText({ container: svg, x, y, style: style, name });
|
85
|
+
});
|
86
|
+
}
|
87
|
+
}
|
88
|
+
);
|
89
|
+
|
90
|
+
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
91
|
+
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
92
|
+
let className = 'no-print'
|
93
|
+
putRect({ container: svg, x: 0, y: 0, width, height, style, name: dims.name })
|
94
|
+
this.chart = svg;
|
95
|
+
this.container.appendChild(svg);
|
96
|
+
}
|
97
|
+
|
98
|
+
update(data) {
|
99
|
+
this.labels.forEach((label) => {
|
100
|
+
this.chart.querySelector(`text[data-name=${label}]`).innerHTML = data?.[label] || "";
|
101
|
+
})
|
102
|
+
}
|
103
|
+
}
|
package/src/Form/printForm.js
CHANGED
@@ -3,8 +3,13 @@ export default function printForm({ container }) {
|
|
3
3
|
iframe.onload = setPrint;
|
4
4
|
iframe.style.display = "block";
|
5
5
|
let style = `
|
6
|
-
@
|
7
|
-
font-
|
6
|
+
@font-face {
|
7
|
+
font-family: vazirmatn;
|
8
|
+
src:
|
9
|
+
url("/fonts/Vazirmatn-Regular.woff2") format("woff2"),
|
10
|
+
url('/fonts/Vazirmatn-Regular.woff') format('woff');
|
11
|
+
font-display: swap;
|
12
|
+
}
|
8
13
|
|
9
14
|
@page {
|
10
15
|
|
@@ -23,7 +23,7 @@ const combo = {
|
|
23
23
|
this.header = {
|
24
24
|
// hideContext: true,
|
25
25
|
name: 'header',
|
26
|
-
w: width, h:
|
26
|
+
w: width, h: 15,
|
27
27
|
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
28
28
|
display: 'block',
|
29
29
|
}
|
@@ -40,13 +40,23 @@ const combo = {
|
|
40
40
|
display: 'block',
|
41
41
|
}
|
42
42
|
|
43
|
+
// Audiogram Titles
|
44
|
+
this['Audiogram Titles'] = {
|
45
|
+
name: 'Audiogram Titles',
|
46
|
+
w: width, h: 8, // پهنا و ارتفاع سکشن
|
47
|
+
margin: { left: 5, top: 1, right: 5, bottom: 1 },
|
48
|
+
display: 'block',
|
49
|
+
stroke: true,
|
50
|
+
// محاسبه پهنا ارتفاع در تابع calc2
|
51
|
+
}
|
52
|
+
|
43
53
|
this.RAudiogram = {}
|
44
54
|
Object.assign(this.RAudiogram,
|
45
55
|
{
|
46
56
|
blank: false,
|
47
57
|
name: 'RAudiogram',
|
48
|
-
w: width / 2, h:
|
49
|
-
margin: { left: 1, top:
|
58
|
+
w: width / 2, h: 90, // ابعاد سکشن ادیوگرام
|
59
|
+
margin: { left: 1, top: 0, right: 1, bottom: 0 },
|
50
60
|
display: 'inline',
|
51
61
|
});
|
52
62
|
|
@@ -54,15 +64,25 @@ const combo = {
|
|
54
64
|
Object.assign(this.LAudiogram,
|
55
65
|
{
|
56
66
|
name: 'LAudiogram',
|
57
|
-
w: width / 2, h:
|
58
|
-
margin: { left: 1, top:
|
67
|
+
w: width / 2, h: 90, // پهنای سکشن هست
|
68
|
+
margin: { left: 1, top: 0, right: 1, bottom: 0 },
|
59
69
|
display: 'block',
|
60
70
|
});
|
61
71
|
|
72
|
+
// Speech Titles
|
73
|
+
this['Speech Titles'] = {
|
74
|
+
name: 'Speech Titles',
|
75
|
+
w: width, h: 8, // پهنا و ارتفاع سکشن
|
76
|
+
margin: { left: 5, top: 0.5, right: 5, bottom: 1 },
|
77
|
+
display: 'block',
|
78
|
+
stroke: true,
|
79
|
+
// محاسبه پهنا ارتفاع در تابع calc2
|
80
|
+
}
|
81
|
+
|
62
82
|
this.RSpeech = {
|
63
83
|
name: 'RSpeech',
|
64
84
|
w: width / 2, h: 15,
|
65
|
-
margin: { left: 5, top:
|
85
|
+
margin: { left: 5, top: 0, right: 10, bottom: 0 },
|
66
86
|
display: 'inline',
|
67
87
|
stroke: true,
|
68
88
|
}
|
@@ -70,24 +90,52 @@ const combo = {
|
|
70
90
|
this.LSpeech = {
|
71
91
|
name: 'LSpeech',
|
72
92
|
w: width / 2, h: 15,
|
73
|
-
margin: { left:
|
93
|
+
margin: { left: 10, top: 0, right: 5, bottom: 0 },
|
74
94
|
display: 'block',
|
75
95
|
stroke: true
|
76
96
|
}
|
77
97
|
|
98
|
+
// Tympanogram Titles
|
99
|
+
this['Tympanogram Titles'] = {
|
100
|
+
name: 'Tympanogram Titles',
|
101
|
+
w: width, h: 8, // پهنا و ارتفاع سکشن
|
102
|
+
margin: { left: 5, top: 1, right: 5, bottom: 1 },
|
103
|
+
display: 'block',
|
104
|
+
stroke: true,
|
105
|
+
// محاسبه پهنا ارتفاع در تابع calc2
|
106
|
+
}
|
107
|
+
|
78
108
|
this.RTympanogram = {
|
79
109
|
name: 'RTympanogram',
|
80
110
|
w: width / 2, h: 60,
|
81
|
-
margin: { left: 2, top:
|
111
|
+
margin: { left: 2, top: 0, right: 2, bottom: 0 },
|
82
112
|
display: 'inline',
|
83
113
|
}
|
84
114
|
|
85
115
|
this.LTympanogram = {
|
86
116
|
name: 'LTympanogram',
|
87
117
|
w: width / 2, h: 60,
|
88
|
-
margin: { left: 2, top:
|
118
|
+
margin: { left: 2, top: 0, right: 2, bottom: 0 },
|
89
119
|
display: 'block',
|
90
120
|
}
|
121
|
+
|
122
|
+
// Reflex Titles
|
123
|
+
this['Reflex Titles'] = {
|
124
|
+
name: 'Reflex Titles',
|
125
|
+
w: width, h: 8, // پهنا و ارتفاع سکشن
|
126
|
+
margin: { left: 5, top: 1, right: 5, bottom: 1 },
|
127
|
+
display: 'block',
|
128
|
+
stroke: true,
|
129
|
+
// محاسبه پهنا ارتفاع در تابع calc2
|
130
|
+
}
|
131
|
+
|
132
|
+
this.Reflexes = {
|
133
|
+
name: 'Reflexes',
|
134
|
+
w: width, h: 30,
|
135
|
+
margin: { left: 2, top: 2, right: 2, bottom: 2 },
|
136
|
+
display: 'block'
|
137
|
+
}
|
138
|
+
|
91
139
|
this.RReflex = {
|
92
140
|
name: 'RReflex',
|
93
141
|
w: width / 2, h: 30,
|
@@ -98,13 +146,13 @@ const combo = {
|
|
98
146
|
this.LReflex = {
|
99
147
|
name: 'LReflex',
|
100
148
|
w: width / 2, h: 30,
|
101
|
-
margin: { left: 2, top: 2, right:
|
149
|
+
margin: { left: 2, top: 2, right: 5, bottom: 2 },
|
102
150
|
display: 'block'
|
103
151
|
}
|
104
152
|
|
105
153
|
this.report = {
|
106
154
|
name: 'report',
|
107
|
-
w: width, h:
|
155
|
+
w: width, h: 15,
|
108
156
|
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
109
157
|
display: 'block'
|
110
158
|
}
|
@@ -117,9 +165,10 @@ const combo = {
|
|
117
165
|
}
|
118
166
|
},
|
119
167
|
|
168
|
+
// محاسبه پهنا و ارتفاع رسمی بخش های فرم از روی مارجین و ابعاد کاغذ
|
120
169
|
calc2: function () {
|
121
170
|
// let dims = this.dims;
|
122
|
-
let width, height;
|
171
|
+
let width, height, style;
|
123
172
|
|
124
173
|
width = this.header.width = this.getWidth(this.header)
|
125
174
|
height = this.header.height = this.getHeight(this.header)
|
@@ -138,15 +187,15 @@ const combo = {
|
|
138
187
|
this.patient.elements = [
|
139
188
|
{ type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
|
140
189
|
{ type: 'text', x: width, y: 5, value: 'نام:' },
|
141
|
-
{ type: 'text', x: width -
|
190
|
+
{ type: 'text', x: width - 38, y: 5, value: 'نام خانوادگی:' },
|
142
191
|
{ type: 'text', x: width - 90, y: 5, value: 'سن:' },
|
143
192
|
{ type: 'text', x: width - 130, y: 5, value: 'ارجاع از:' }
|
144
193
|
]
|
145
194
|
this.patient.inputs = [
|
146
|
-
{ name: 'name', x: width -
|
147
|
-
{ name: 'lastName', x: width -
|
148
|
-
{ name: 'age', x: width -
|
149
|
-
{ name: 'referrer', x: width -
|
195
|
+
{ name: 'name', x: width - 7, y: 5 },
|
196
|
+
{ name: 'lastName', x: width - 59, y: 5 },
|
197
|
+
{ name: 'age', x: width - 98, y: 5 },
|
198
|
+
{ name: 'referrer', x: width - 143, y: 5 }
|
150
199
|
]
|
151
200
|
this.patient.forceInputs = [
|
152
201
|
{ name: 'name', x: width - 10, y: 4 },
|
@@ -162,7 +211,21 @@ const combo = {
|
|
162
211
|
{ type: 'text', x: width, y: 5, value: 'شرح حال:' },
|
163
212
|
]
|
164
213
|
this.history.inputs = [
|
165
|
-
{ name: 'description', x: width -
|
214
|
+
{ name: 'description', x: width - 16, y: 5 },
|
215
|
+
]
|
216
|
+
|
217
|
+
width = this['Audiogram Titles'].width = this.getWidth(this['Audiogram Titles'])
|
218
|
+
height = this['Audiogram Titles'].height = this.getHeight(this['Audiogram Titles'])
|
219
|
+
style = `
|
220
|
+
text-anchor: middle;
|
221
|
+
font-size: 1.2mm
|
222
|
+
`;
|
223
|
+
|
224
|
+
this['Audiogram Titles'].elements = [
|
225
|
+
// { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
|
226
|
+
{ type: 'text', x: width / 2, y: 5, value: 'Audiograms', style },
|
227
|
+
{ type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
|
228
|
+
{ type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
|
166
229
|
]
|
167
230
|
|
168
231
|
width = this.RAudiogram.width = this.getWidth(this.RAudiogram)
|
@@ -171,6 +234,15 @@ const combo = {
|
|
171
234
|
width = this.LAudiogram.width = this.getWidth(this.LAudiogram)
|
172
235
|
this.LAudiogram.height = this.getHeight(this.LAudiogram)
|
173
236
|
|
237
|
+
width = this['Speech Titles'].width = this.getWidth(this['Speech Titles'])
|
238
|
+
height = this['Speech Titles'].height = this.getHeight(this['Speech Titles'])
|
239
|
+
this['Speech Titles'].elements = [
|
240
|
+
// { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
|
241
|
+
{ type: 'text', x: width / 2, y: 4, value: 'Speech Tests', style },
|
242
|
+
{ type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
|
243
|
+
{ type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
|
244
|
+
]
|
245
|
+
|
174
246
|
width = this.RSpeech.width = this.getWidth(this.RSpeech)
|
175
247
|
this.RSpeech.height = this.getHeight(this.RSpeech)
|
176
248
|
this.RSpeech.labels = ["SAT", "SRT", "MCL", "UCL", "SDS"]
|
@@ -179,11 +251,29 @@ const combo = {
|
|
179
251
|
this.LSpeech.height = this.getHeight(this.LSpeech)
|
180
252
|
this.LSpeech.labels = ["SAT", "SRT", "MCL", "UCL", "SDS"]
|
181
253
|
|
254
|
+
width = this['Tympanogram Titles'].width = this.getWidth(this['Tympanogram Titles'])
|
255
|
+
height = this['Tympanogram Titles'].height = this.getHeight(this['Tympanogram Titles'])
|
256
|
+
this['Tympanogram Titles'].elements = [
|
257
|
+
// { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
|
258
|
+
{ type: 'text', x: width / 2, y: 5, value: 'Tympanograms', style },
|
259
|
+
// { type: 'text', x: width / 4, y: 5, value: 'Right', style: 'fill: red' },
|
260
|
+
// { type: 'text', x: width * 3 / 4, y: 5, value: 'Left', style: 'fill: blue' },
|
261
|
+
]
|
262
|
+
|
182
263
|
width = this.RTympanogram.width = this.getWidth(this.RTympanogram)
|
183
264
|
this.RTympanogram.height = this.getHeight(this.RTympanogram)
|
184
265
|
width = this.LTympanogram.width = this.getWidth(this.LTympanogram)
|
185
266
|
this.LTympanogram.height = this.getHeight(this.LTympanogram)
|
186
267
|
|
268
|
+
width = this['Reflex Titles'].width = this.getWidth(this['Reflex Titles'])
|
269
|
+
height = this['Reflex Titles'].height = this.getHeight(this['Reflex Titles'])
|
270
|
+
this['Reflex Titles'].elements = [
|
271
|
+
// { type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
|
272
|
+
{ type: 'text', x: width / 2, y: 5, value: 'Acoustic Reflexes', style },
|
273
|
+
{ type: 'text', x: width / 4, y: 5, value: 'Probe in the Right Ear', style: 'fill: red; text-anchor: middle' },
|
274
|
+
{ type: 'text', x: width * 3 / 4, y: 5, value: 'Probe in the Left Ear', style: 'fill: blue; text-anchor: middle' },
|
275
|
+
]
|
276
|
+
|
187
277
|
width = this.RReflex.width = this.getWidth(this.RReflex)
|
188
278
|
this.RReflex.height = this.getHeight(this.RReflex)
|
189
279
|
width = this.LReflex.width = this.getWidth(this.LReflex)
|
@@ -224,11 +314,15 @@ const combo = {
|
|
224
314
|
this.header,
|
225
315
|
this.patient,
|
226
316
|
this.history,
|
317
|
+
this['Audiogram Titles'],
|
227
318
|
this.RAudiogram,
|
228
319
|
this.LAudiogram,
|
320
|
+
this['Speech Titles'],
|
229
321
|
this.RSpeech,
|
230
322
|
this.LSpeech,
|
323
|
+
this['Tympanogram Titles'],
|
231
324
|
this.RTympanogram, this.LTympanogram,
|
325
|
+
this['Reflex Titles'],
|
232
326
|
this.RReflex, this.LReflex,
|
233
327
|
this.report,
|
234
328
|
this.footer
|
package/src/common/putSVG.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
const svgNS = "http://www.w3.org/2000/svg";
|
2
2
|
|
3
|
-
export default function putSVG({ container, x, y, width, height, viewBox }) {
|
3
|
+
export default function putSVG({ container, x, y, width, height, viewBox, className }) {
|
4
4
|
const svg = document.createElementNS(svgNS, "svg");
|
5
5
|
width && svg.setAttribute("width", width);
|
6
6
|
height && svg.setAttribute("height", height);
|
7
7
|
x && svg.setAttribute("x", x);
|
8
8
|
y && svg.setAttribute("y", y);
|
9
9
|
viewBox && svg.setAttribute("viewBox", viewBox);
|
10
|
-
|
10
|
+
className && svg.setAttribute("class", className);
|
11
|
+
container && container.appendChild(svg);
|
11
12
|
return svg;
|
12
|
-
|
13
13
|
}
|
package/src/common/putText.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
const svgNS = "http://www.w3.org/2000/svg";
|
2
2
|
|
3
3
|
// متن اسویجی
|
4
|
-
export default function putText(
|
5
|
-
dx = 0, dy = 0, style, name, className }) {
|
4
|
+
export default function putText(
|
5
|
+
{ container, value = '', x, y, id, dx = 0, dy = 0, style, name, className }) {
|
6
6
|
let text = document.createElementNS(svgNS, "text");
|
7
7
|
name && text.setAttribute("data-name", name)
|
8
8
|
className && text.setAttribute("class", className);
|
@@ -0,0 +1,18 @@
|
|
1
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
2
|
+
|
3
|
+
export default function putTextBox(
|
4
|
+
{
|
5
|
+
container, x, y, dx = 0, dy= 0 , w, h, rx,
|
6
|
+
style = "fill: transparent; stroke: black; stroke-width: 0.2;",
|
7
|
+
}) {
|
8
|
+
let rect = document.createElementNS(svgNS, "rect");
|
9
|
+
rect.setAttribute("x", x - w / 2 + dx);
|
10
|
+
rect.setAttribute("y", y - h / 2 + dy);
|
11
|
+
rect.setAttribute("rx", rx);
|
12
|
+
|
13
|
+
rect.setAttribute("width", w);
|
14
|
+
rect.setAttribute("height", h);
|
15
|
+
rect.setAttribute("style", style);
|
16
|
+
container.appendChild(rect);
|
17
|
+
|
18
|
+
}
|
package/src/main.js
CHANGED
@@ -6,7 +6,11 @@ import { officeData, patientData } from "../data/sampleData.js"
|
|
6
6
|
document.querySelector('#app').innerHTML = `
|
7
7
|
<div id="audiogram-div"></div>
|
8
8
|
<div id="forms-div"></div>
|
9
|
-
|
9
|
+
`;
|
10
|
+
|
11
|
+
const forms = new Forms({ container: document.getElementById('forms-div') });
|
12
|
+
forms.update({ officeData, patientData, sessionIndex: 0 })
|
13
|
+
|
10
14
|
/*
|
11
15
|
const RAudiogram = new Audiogram({
|
12
16
|
container: document.getElementById('audiogram-div'), side: 'R',
|
@@ -39,32 +43,6 @@ LAudiogram.update({
|
|
39
43
|
})
|
40
44
|
|
41
45
|
*/
|
42
|
-
const forms = new Forms({ container: document.getElementById('forms-div') });
|
43
|
-
forms.update({ officeData, patientData, sessionIndex: 0 })
|
44
|
-
|
45
|
-
|
46
|
-
// import javascriptLogo from './javascript.svg'
|
47
|
-
// import viteLogo from '/vite.svg'
|
48
|
-
// import { setupCounter } from './counter.js'
|
49
|
-
|
50
|
-
// document.querySelector('#app').innerHTML = `
|
51
|
-
// <div>
|
52
|
-
// <a href="https://vite.dev" target="_blank">
|
53
|
-
// <img src="${viteLogo}" class="logo" alt="Vite logo" />
|
54
|
-
// </a>
|
55
|
-
// <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
|
56
|
-
// <img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
|
57
|
-
// </a>
|
58
|
-
// <h1>Hello Vite!</h1>
|
59
|
-
// <div class="card">
|
60
|
-
// <button id="counter" type="button"></button>
|
61
|
-
// </div>
|
62
|
-
// <p class="read-the-docs">
|
63
|
-
// Click on the Vite logo to learn more
|
64
|
-
// </p>
|
65
|
-
// </div>
|
66
|
-
// `
|
67
46
|
|
68
|
-
// setupCounter(document.querySelector('#counter'))
|
69
47
|
|
70
48
|
|
Binary file
|
package/src/common/putBox.js
DELETED
File without changes
|