hayun-vite 0.3.1 → 0.4.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/index.js +2 -2
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +380 -69
- package/src/Audiogram/dims.js +117 -77
- package/src/Form/Form.js +21 -79
- package/src/Form/Forms.js +55 -60
- package/src/Form/Reflex.js +15 -25
- package/src/Form/Sections.js +7 -11
- package/src/Form/Speech.js +2 -2
- package/src/Form/TextBox.js +5 -1
- package/src/Form/Tympanogram.js +6 -8
- package/src/Form/fonts/Vazirmatn-Regular.woff2 +0 -0
- package/src/Form/printForm.js +2 -1
- package/src/Form/templates/combo.js +2 -3
- package/src/Form/templates/rasa_audiometry.jpg +0 -0
- package/src/Form/templates/rasa_audiometry.js +24 -15
- package/src/Form/templates/rasa_tymp_reflex.jpg +0 -0
- package/src/Form/templates/rasa_tymp_reflex.js +199 -0
- package/src/Symbol/createSymbolSVG.js +1 -1
- package/src/common/putRect.js +2 -1
- package/src/common/putSVG.js +13 -0
- package/src/common/putText.js +2 -1
- package/src/main.js +34 -52
- package/src/{note.css → note.html} +3 -1
- package/src/style.css +26 -3
- package/src/Form/Form_N.js +0 -159
- package/src/Symbol/Symbols.js +0 -30
- package/src/Symbol/insertSymbol.js +0 -10
- package/src/Symbol/symbolChart.js +0 -47
- /package/{src → public}/fonts/Vazirmatn-Regular.woff2 +0 -0
package/src/Form/Sections.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import putRect from "../common/putRect";
|
2
|
+
|
1
3
|
export default class Sections {
|
2
4
|
constructor({ container, dims }) {
|
3
5
|
this.dims = dims
|
@@ -44,17 +46,11 @@ export default class Sections {
|
|
44
46
|
// نگهداری مختصات رسم بوردر هر سکشن برای استفاده در متد داخلی رسم بودر تاپ لایر
|
45
47
|
this.cords.push({ name: name, width: width, height: height, x: this.left, y: this.top });
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
rect.setAttribute("height", height);
|
53
|
-
rect.setAttribute("fill", "transparent");
|
54
|
-
rect.setAttribute("stroke", "blue");
|
55
|
-
rect.setAttribute("stroke-width", "0.1mm");
|
56
|
-
rect.setAttribute("data-name", "section-border");
|
57
|
-
svg.appendChild(rect);
|
49
|
+
putRect({
|
50
|
+
container: svg, x: 0, y: 0, width, height,
|
51
|
+
style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
|
52
|
+
className: 'no-print', name: 'guide-border'
|
53
|
+
})
|
58
54
|
this[name] = svg;
|
59
55
|
this.container.appendChild(svg)
|
60
56
|
|
package/src/Form/Speech.js
CHANGED
@@ -82,7 +82,6 @@ export default class Speech {
|
|
82
82
|
// اینپوتها
|
83
83
|
style += 'text-anchor: middle; dominant-baseline: middle; /* تراز عمودی*/ ';
|
84
84
|
|
85
|
-
|
86
85
|
// New
|
87
86
|
if (!dims.forceInsert) {
|
88
87
|
let index = 0;
|
@@ -102,7 +101,8 @@ export default class Speech {
|
|
102
101
|
}
|
103
102
|
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
104
103
|
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
105
|
-
|
104
|
+
let className = 'no-print'
|
105
|
+
putRect({ container: svg, x: 0, y: 0, width, height, style, name: dims.name, className })
|
106
106
|
this.chart = svg;
|
107
107
|
this.container.appendChild(svg);
|
108
108
|
|
package/src/Form/TextBox.js
CHANGED
@@ -50,7 +50,11 @@ export default class TextBox {
|
|
50
50
|
});
|
51
51
|
|
52
52
|
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
53
|
-
const borderRect = putRect({
|
53
|
+
const borderRect = putRect({
|
54
|
+
container: svg, x: 0, y: 0, width, height,
|
55
|
+
name: dims.name, className: 'no-print',
|
56
|
+
style: 'stroke: transparent; fill: transparent '
|
57
|
+
});
|
54
58
|
this.borderRect = borderRect;
|
55
59
|
// console.log(dims);
|
56
60
|
|
package/src/Form/Tympanogram.js
CHANGED
@@ -3,11 +3,12 @@ import putText from "../common/putText.js";
|
|
3
3
|
const svgNS = "http://www.w3.org/2000/svg";
|
4
4
|
|
5
5
|
export default class Tympanogram {
|
6
|
-
constructor({ container
|
6
|
+
constructor({ container, side }) {
|
7
7
|
this.pressure = { min: -600, max: +400, step: 200 };
|
8
8
|
this.compliance = { min: -0.50, max: 3, step: 0.50 };
|
9
9
|
this.padding = { right: 5, left: 8, top: 7, bottom: 14 };
|
10
10
|
this.container = container;
|
11
|
+
this.side = side
|
11
12
|
}
|
12
13
|
|
13
14
|
draw({ dims }) {
|
@@ -30,7 +31,7 @@ export default class Tympanogram {
|
|
30
31
|
svg.setAttribute("x", x);
|
31
32
|
svg.setAttribute("y", y);
|
32
33
|
svg.setAttribute("viewBox", [-padding.left, -padding.top, width, height]);
|
33
|
-
|
34
|
+
|
34
35
|
|
35
36
|
|
36
37
|
const pressureAxiosLength = {
|
@@ -191,8 +192,8 @@ export default class Tympanogram {
|
|
191
192
|
// console.log(this.container);
|
192
193
|
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
193
194
|
style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
|
194
|
-
|
195
|
-
|
195
|
+
// یک بوردر راهنمای توسعه برای اس وی جی به تمام پهنا و ارتفاع رسم میکنیم
|
196
|
+
putRect({ container: svg, x: -padding.left, y: -padding.top, width, height, name: dims.name, style })
|
196
197
|
this.chart = svg;
|
197
198
|
this.container.appendChild(svg);
|
198
199
|
|
@@ -236,13 +237,10 @@ export default class Tympanogram {
|
|
236
237
|
|
237
238
|
// جایگذاری مقادیر تمپانومتری در تکستباکس ها
|
238
239
|
this.chart.querySelector(`text[data-name="Type"]`).innerHTML = data?.type || "";
|
239
|
-
// container.getElementById(container.id + "_Type").innerHTML = data?.Type || "";
|
240
240
|
this.chart.querySelector(`text[data-name="ECV"]`).innerHTML = data?.ECV || "";
|
241
241
|
this.chart.querySelector(`text[data-name="MEP"]`).innerHTML = data?.MEP || "";
|
242
242
|
this.chart.querySelector(`text[data-name="SC"]`).innerHTML = data?.SC || "";
|
243
243
|
this.chart.querySelector(`text[data-name="G"]`).innerHTML = data?.G || "";
|
244
|
-
// container.getElementById(container.id + "_SC").innerHTML = data?.SC || "";
|
245
|
-
// document.getElementById(container + "_G").innerHTML = data.G;
|
246
244
|
// پاک کردن منحنی قبلی از کانتینر جاری
|
247
245
|
this.chart.querySelector(`path[data-name="curve"]`)?.remove();
|
248
246
|
// رسم منحنی
|
@@ -312,7 +310,7 @@ export default class Tympanogram {
|
|
312
310
|
let path = document.createElementNS(svgNS, "path");
|
313
311
|
path.setAttribute("fill", "none");
|
314
312
|
path.setAttribute("data-name", "curve");
|
315
|
-
let color = (
|
313
|
+
let color = (this.side == "R") ? "red" : "blue";
|
316
314
|
path.setAttribute("stroke", color);
|
317
315
|
path.setAttribute("stroke-width", "0.5px");
|
318
316
|
path.setAttribute(
|
Binary file
|
package/src/Form/printForm.js
CHANGED
@@ -4,6 +4,7 @@ export default function printForm({ container }) {
|
|
4
4
|
iframe.style.display = "block";
|
5
5
|
let style = `
|
6
6
|
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');
|
7
|
+
font-display: auto;
|
7
8
|
|
8
9
|
@page {
|
9
10
|
|
@@ -42,7 +43,7 @@ export default function printForm({ container }) {
|
|
42
43
|
padding: 0;
|
43
44
|
break-inside: avoid;
|
44
45
|
}
|
45
|
-
.
|
46
|
+
.no-print {
|
46
47
|
display: none;
|
47
48
|
}
|
48
49
|
|
@@ -42,17 +42,16 @@ const combo = {
|
|
42
42
|
|
43
43
|
this.RAudiogram = {}
|
44
44
|
Object.assign(this.RAudiogram,
|
45
|
-
audDims[this.name],
|
46
45
|
{
|
46
|
+
blank: false,
|
47
47
|
name: 'RAudiogram',
|
48
|
-
w: width / 2, h: 100,
|
48
|
+
w: width / 2, h: 100, // ابعاد سکشن ادیوگرام
|
49
49
|
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
50
50
|
display: 'inline',
|
51
51
|
});
|
52
52
|
|
53
53
|
this.LAudiogram = {}
|
54
54
|
Object.assign(this.LAudiogram,
|
55
|
-
audDims[this.name],
|
56
55
|
{
|
57
56
|
name: 'LAudiogram',
|
58
57
|
w: width / 2, h: 100, // پهنای سکشن هست
|
Binary file
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import audDims from "../../Audiogram/dims.js"
|
1
|
+
import audDims from "../../Audiogram/dims.js"
|
2
|
+
import image from './rasa_audiometry.jpg'
|
2
3
|
|
3
|
-
|
4
|
-
const templateRasaAud = {
|
4
|
+
const rasaAud = {
|
5
5
|
name: 'rasa_audiometry',
|
6
6
|
label: 'ادیومتری رسا',
|
7
|
-
backgroundImage:
|
7
|
+
backgroundImage: image, // Just Path of image
|
8
8
|
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
9
9
|
paper: { type: 'A4', case: 'portrait', width: 209, height: 294.5 },
|
10
10
|
|
@@ -52,25 +52,34 @@ const templateRasaAud = {
|
|
52
52
|
|
53
53
|
this.RAudiogram = {}
|
54
54
|
Object.assign(this.RAudiogram,
|
55
|
-
audDims[this.name],
|
56
55
|
{
|
56
|
+
blank: true,
|
57
|
+
chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
|
58
|
+
|
57
59
|
name: 'RAudiogram',
|
58
|
-
w: width / 2, h: 99,
|
60
|
+
w: width / 2, h: 99, // این پهنا و ارتفاع سکشن هست
|
59
61
|
margin: { left: 18.1, top: 18.5, right: 16.4, bottom: 11.2 },
|
62
|
+
intensity: { min: -20, max: 120, step: 10 },
|
63
|
+
// بعدا از مقادیر بالا برای محاسبه اتومات پهنا و ارتفاع استفاده میشود
|
64
|
+
|
60
65
|
display: 'inline',
|
61
|
-
}
|
66
|
+
}
|
67
|
+
);
|
62
68
|
|
63
69
|
this.LAudiogram = {}
|
64
70
|
Object.assign(this.LAudiogram,
|
65
|
-
audDims[this.name],
|
66
71
|
{
|
67
72
|
name: 'LAudiogram',
|
73
|
+
blank: true,
|
74
|
+
|
75
|
+
chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
|
76
|
+
intensity: { min: -20, max: 120, step: 10 },
|
77
|
+
|
68
78
|
w: width / 2, h: 99, // پهنای سکشن هست
|
69
79
|
margin: { left: 18.2, top: 18.5, right: 16.4, bottom: 11.2 },
|
70
80
|
display: 'block',
|
71
|
-
}
|
72
|
-
|
73
|
-
|
81
|
+
}
|
82
|
+
);
|
74
83
|
|
75
84
|
this.RSpeech = {
|
76
85
|
name: 'RSpeech',
|
@@ -238,11 +247,11 @@ const templateRasaAud = {
|
|
238
247
|
|
239
248
|
}
|
240
249
|
|
241
|
-
|
242
|
-
|
243
|
-
|
250
|
+
rasaAud.calc1()
|
251
|
+
rasaAud.calc2()
|
252
|
+
rasaAud.calcSectionsArray()
|
244
253
|
|
245
254
|
// پهنا و ارتفاع قابل استفاده منهای پد ها میشه پهنا و ارتفاع اصلی
|
246
255
|
|
247
|
-
export default
|
256
|
+
export default rasaAud;
|
248
257
|
|
Binary file
|
@@ -0,0 +1,199 @@
|
|
1
|
+
import audDims from "../../Audiogram/dims.js"
|
2
|
+
import image from './rasa_tymp_reflex.jpg'
|
3
|
+
|
4
|
+
const rasaTymp = {
|
5
|
+
name: 'combo',
|
6
|
+
label: 'تمپانومتری رسا',
|
7
|
+
backgroundImage: image, // Just Path of image
|
8
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
9
|
+
paper: { type: 'A4', case: 'portrait', width: 209, height: 294.5 },
|
10
|
+
|
11
|
+
// Printable Dimention
|
12
|
+
calc1: function () {
|
13
|
+
this.width = this.paper.width - (this.margin.left + this.margin.right);
|
14
|
+
this.height = this.paper.height - (this.margin.top + this.margin.bottom);
|
15
|
+
let width = this.width;
|
16
|
+
// ابعاد و پدینگ المنت ها
|
17
|
+
// فضای خالی
|
18
|
+
this.blank = {
|
19
|
+
name: 'blank',
|
20
|
+
w: width, h: 20,
|
21
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
22
|
+
display: 'block',
|
23
|
+
}
|
24
|
+
this.header = {
|
25
|
+
// hideContext: true,
|
26
|
+
name: 'header',
|
27
|
+
w: width, h: 20,
|
28
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
29
|
+
display: 'block',
|
30
|
+
}
|
31
|
+
this.patient = {
|
32
|
+
name: 'patient',
|
33
|
+
w: width, h: 10,
|
34
|
+
margin: { left: 5, top: 1, right: 5, bottom: 1},
|
35
|
+
display: 'block',
|
36
|
+
}
|
37
|
+
this.history = {
|
38
|
+
name: 'history',
|
39
|
+
w: width, h: 10,
|
40
|
+
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
41
|
+
display: 'block',
|
42
|
+
}
|
43
|
+
|
44
|
+
this.RTympanogram = {
|
45
|
+
name: 'RTympanogram',
|
46
|
+
w: width / 2, h: 60,
|
47
|
+
margin: { left: 5, top: 2, right: 3, bottom: 2 },
|
48
|
+
display: 'inline',
|
49
|
+
}
|
50
|
+
|
51
|
+
this.LTympanogram = {
|
52
|
+
name: 'LTympanogram',
|
53
|
+
w: width / 2, h: 60,
|
54
|
+
margin: { left: 3, top: 2, right: 5, bottom: 2 },
|
55
|
+
display: 'block',
|
56
|
+
}
|
57
|
+
this.RReflex = {
|
58
|
+
name: 'RReflex',
|
59
|
+
w: width / 2, h: 30,
|
60
|
+
margin: { left: 5, top: 2, right: 3, bottom: 2 },
|
61
|
+
display: 'inline'
|
62
|
+
}
|
63
|
+
|
64
|
+
this.LReflex = {
|
65
|
+
name: 'LReflex',
|
66
|
+
w: width / 2, h: 30,
|
67
|
+
margin: { left: 3, top: 2, right: 5, bottom: 2 },
|
68
|
+
display: 'block'
|
69
|
+
}
|
70
|
+
|
71
|
+
this.report = {
|
72
|
+
name: 'report',
|
73
|
+
w: width, h: 20,
|
74
|
+
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
75
|
+
display: 'block'
|
76
|
+
}
|
77
|
+
|
78
|
+
this.footer = {
|
79
|
+
name: 'footer',
|
80
|
+
w: width, h: 10,
|
81
|
+
margin: { left: 1, top: 1, right: 1, bottom: 1 },
|
82
|
+
display: 'block'
|
83
|
+
}
|
84
|
+
},
|
85
|
+
|
86
|
+
calc2: function () {
|
87
|
+
// let dims = this.dims;
|
88
|
+
let width, height;
|
89
|
+
|
90
|
+
width = this.header.width = this.getWidth(this.header)
|
91
|
+
height = this.header.height = this.getHeight(this.header)
|
92
|
+
|
93
|
+
this.header.elements = [
|
94
|
+
{ type: 'line', x1: 0, y1: height, x2: width, y2: height },
|
95
|
+
{ type: 'text', x: 30, y: 5, value: 'تاریخ :' },
|
96
|
+
]
|
97
|
+
this.header.inputs = [
|
98
|
+
{ name: 'officeName', x: width - 20, y: height - 10 },
|
99
|
+
{ name: 'date', x: 20, y: 5 },
|
100
|
+
]
|
101
|
+
|
102
|
+
width = this.patient.width = this.getWidth(this.patient)
|
103
|
+
this.patient.height = this.getHeight(this.patient)
|
104
|
+
this.patient.elements = [
|
105
|
+
{ type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
|
106
|
+
{ type: 'text', x: width, y: 5, value: 'نام:' },
|
107
|
+
{ type: 'text', x: width - 30, y: 5, value: 'نام خانوادگی:' },
|
108
|
+
{ type: 'text', x: width - 90, y: 5, value: 'سن:' },
|
109
|
+
{ type: 'text', x: width - 130, y: 5, value: 'ارجاع از:' }
|
110
|
+
]
|
111
|
+
this.patient.inputs = [
|
112
|
+
{ name: 'name', x: width - 5, y: 5 },
|
113
|
+
{ name: 'lastName', x: width - 47, y: 5 },
|
114
|
+
{ name: 'age', x: width - 97, y: 5 },
|
115
|
+
{ name: 'referrer', x: width - 142, y: 5 }
|
116
|
+
]
|
117
|
+
this.patient.forceInputs = [
|
118
|
+
{ name: 'name', x: width - 10, y: 4 },
|
119
|
+
{ name: 'lastName', x: width - 47, y: 5 },
|
120
|
+
{ name: 'age', x: width - 97, y: 5 },
|
121
|
+
{ name: 'referrer', x: width - 142, y: 5 }
|
122
|
+
]
|
123
|
+
|
124
|
+
width = this.history.width = this.getWidth(this.history)
|
125
|
+
this.history.height = this.getHeight(this.history)
|
126
|
+
this.history.elements = [
|
127
|
+
{ type: 'line', x1: 0, y1: 20, x2: width, y2: 20 },
|
128
|
+
{ type: 'text', x: width, y: 5, value: 'شرح حال:' },
|
129
|
+
]
|
130
|
+
this.history.inputs = [
|
131
|
+
{ name: 'description', x: width - 13, y: 5 },
|
132
|
+
]
|
133
|
+
|
134
|
+
width = this.RTympanogram.width = this.getWidth(this.RTympanogram)
|
135
|
+
this.RTympanogram.height = this.getHeight(this.RTympanogram)
|
136
|
+
width = this.LTympanogram.width = this.getWidth(this.LTympanogram)
|
137
|
+
this.LTympanogram.height = this.getHeight(this.LTympanogram)
|
138
|
+
|
139
|
+
width = this.RReflex.width = this.getWidth(this.RReflex)
|
140
|
+
this.RReflex.height = this.getHeight(this.RReflex)
|
141
|
+
width = this.LReflex.width = this.getWidth(this.LReflex)
|
142
|
+
this.LReflex.height = this.getHeight(this.LReflex)
|
143
|
+
|
144
|
+
width = this.report.width = this.getWidth(this.report)
|
145
|
+
this.report.height = this.getHeight(this.report)
|
146
|
+
this.report.elements = [
|
147
|
+
{ type: 'text', x: width, y: 5, value: 'گزارش:' },
|
148
|
+
]
|
149
|
+
this.report.inputs = [
|
150
|
+
{ name: 'description', x: width - 10, y: 5 },
|
151
|
+
]
|
152
|
+
|
153
|
+
width = this.footer.width = this.getWidth(this.footer)
|
154
|
+
this.footer.height = this.getHeight(this.footer)
|
155
|
+
this.footer.elements = [
|
156
|
+
{ type: 'line', x1: 0, y1: 0, x2: width, y2: 0 },
|
157
|
+
{ type: 'text', x: width, y: 5, value: 'آدرس:' },
|
158
|
+
{ type: 'text', x: width - 120, y: 5, value: 'تلفن:' },
|
159
|
+
]
|
160
|
+
this.footer.inputs = [
|
161
|
+
{ name: 'address', x: width - 10, y: 5 },
|
162
|
+
{ name: 'tel', x: width - 128, y: 5 },
|
163
|
+
]
|
164
|
+
},
|
165
|
+
|
166
|
+
getWidth: function (element) {
|
167
|
+
return (element.w - (element.margin.left + element.margin.right))
|
168
|
+
},
|
169
|
+
getHeight: function (element) {
|
170
|
+
return (element.h - (element.margin.top + element.margin.bottom))
|
171
|
+
},
|
172
|
+
|
173
|
+
calcSectionsArray: function () {
|
174
|
+
// این آرایه دقیقا ترتیب قرارگیری سکشن ها را بدون اون اوردر قبلی تعیین میکند
|
175
|
+
this.sections = [
|
176
|
+
this.blank,
|
177
|
+
this.patient,
|
178
|
+
// this.history,
|
179
|
+
// this.RAudiogram,
|
180
|
+
// this.LAudiogram,
|
181
|
+
// this.RSpeech,
|
182
|
+
// this.LSpeech,
|
183
|
+
this.RTympanogram, this.LTympanogram,
|
184
|
+
this.RReflex, this.LReflex,
|
185
|
+
// this.report,
|
186
|
+
// this.footer
|
187
|
+
|
188
|
+
]
|
189
|
+
},
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
rasaTymp.calc1()
|
194
|
+
rasaTymp.calc2()
|
195
|
+
rasaTymp.calcSectionsArray()
|
196
|
+
// پهنا و ارتفاع قابل استفاده منهای پد ها میشه پهنا و ارتفاع اصلی
|
197
|
+
|
198
|
+
export default rasaTymp;
|
199
|
+
|
@@ -19,7 +19,7 @@ export default function createSymbolSVG({ side = "R", type = "AC", masked = fals
|
|
19
19
|
svg.setAttribute("data-side", side);
|
20
20
|
svg.setAttribute("data-type", type);
|
21
21
|
svg.setAttribute("data-masked", masked);
|
22
|
-
svg.setAttribute("data-
|
22
|
+
svg.setAttribute("data-nr", NR);
|
23
23
|
|
24
24
|
|
25
25
|
if (side == "R" && type == "AC" && !masked) {
|
package/src/common/putRect.js
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
const svgNS = "http://www.w3.org/2000/svg";
|
2
2
|
|
3
|
-
export default function putRect({ container, x, y, width, height, style = 'fill: transparent; stroke: green; stroke-width: 0.5;', name }) {
|
3
|
+
export default function putRect({ container, x, y, width, height, style = 'fill: transparent; stroke: green; stroke-width: 0.5;', name, className }) {
|
4
4
|
let rect = document.createElementNS(svgNS, "rect");
|
5
5
|
rect.setAttribute("x", x);
|
6
6
|
rect.setAttribute("y", y);
|
7
7
|
rect.setAttribute("width", width);
|
8
8
|
rect.setAttribute("height", height);
|
9
9
|
rect.setAttribute("style", style);
|
10
|
+
className && rect.setAttribute("class", className);
|
10
11
|
rect.setAttribute("data-name", name);
|
11
12
|
container.appendChild(rect);
|
12
13
|
return rect;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
2
|
+
|
3
|
+
export default function putSVG({ container, x, y, width, height, viewBox }) {
|
4
|
+
const svg = document.createElementNS(svgNS, "svg");
|
5
|
+
width && svg.setAttribute("width", width);
|
6
|
+
height && svg.setAttribute("height", height);
|
7
|
+
x && svg.setAttribute("x", x);
|
8
|
+
y && svg.setAttribute("y", y);
|
9
|
+
viewBox && svg.setAttribute("viewBox", viewBox);
|
10
|
+
container.appendChild(svg);
|
11
|
+
return svg;
|
12
|
+
|
13
|
+
}
|
package/src/common/putText.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
const svgNS = "http://www.w3.org/2000/svg";
|
2
2
|
|
3
3
|
// متن اسویجی
|
4
|
-
export default function putText({ container, value = '', x, y, id,
|
4
|
+
export default function putText({ container, value = '', x, y, id,
|
5
|
+
dx = 0, dy = 0, style, name, className }) {
|
5
6
|
let text = document.createElementNS(svgNS, "text");
|
6
7
|
name && text.setAttribute("data-name", name)
|
7
8
|
className && text.setAttribute("class", className);
|
package/src/main.js
CHANGED
@@ -1,62 +1,20 @@
|
|
1
1
|
// import './style.css'
|
2
|
-
|
3
|
-
import AudiogramChart from "./Audiogram/Audiogram.js"
|
2
|
+
import Audiogram from "./Audiogram/Audiogram.js"
|
4
3
|
import dims from './Audiogram/dims.js'
|
5
4
|
import Forms from "./Form/Forms.js";
|
6
5
|
import { officeData, patientData } from "../data/sampleData.js"
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
// import javascriptLogo from './javascript.svg'
|
11
|
-
// import viteLogo from '/vite.svg'
|
12
|
-
// import { setupCounter } from './counter.js'
|
13
|
-
|
14
|
-
// document.querySelector('#app').innerHTML = `
|
15
|
-
// <div>
|
16
|
-
// <a href="https://vite.dev" target="_blank">
|
17
|
-
// <img src="${viteLogo}" class="logo" alt="Vite logo" />
|
18
|
-
// </a>
|
19
|
-
// <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
|
20
|
-
// <img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
|
21
|
-
// </a>
|
22
|
-
// <h1>Hello Vite!</h1>
|
23
|
-
// <div class="card">
|
24
|
-
// <button id="counter" type="button"></button>
|
25
|
-
// </div>
|
26
|
-
// <p class="read-the-docs">
|
27
|
-
// Click on the Vite logo to learn more
|
28
|
-
// </p>
|
29
|
-
// </div>
|
30
|
-
// `
|
31
|
-
|
32
|
-
// setupCounter(document.querySelector('#counter'))
|
33
|
-
|
34
|
-
|
35
7
|
document.querySelector('#app').innerHTML = `
|
36
|
-
<
|
37
|
-
<button>Tok</button>
|
38
|
-
<p>Mahdi</p>
|
39
|
-
<h1>مهدی جاویدی پرنده پرکلاغی</h1>
|
8
|
+
<div id="audiogram-div" style=""></div>
|
40
9
|
<div id="forms-div"></div>
|
41
|
-
|
42
|
-
`
|
43
|
-
|
44
|
-
const forms = new Forms({ container: document.getElementById('forms-div'), name: 'form1' });
|
45
|
-
forms.update({ officeData, patientData, sessionIndex: 0 })
|
10
|
+
`
|
46
11
|
|
47
|
-
|
48
|
-
|
49
|
-
container: document.getElementById('audiogram-div'),
|
50
|
-
dims: dims.display,
|
51
|
-
side: 'R', x: 0, y: 0,
|
52
|
-
width: 700, height: 800, events: true
|
12
|
+
const RAudiogram = new Audiogram({
|
13
|
+
container: document.getElementById('audiogram-div'), side: 'R',
|
53
14
|
})
|
54
15
|
|
55
|
-
const LAudiogram = new
|
56
|
-
container: document.getElementById('audiogram-div'),
|
57
|
-
dims: dims.display,
|
58
|
-
side: 'L', x: 0, y: 0,
|
59
|
-
width: 700, height: 800, events: true
|
16
|
+
const LAudiogram = new Audiogram({
|
17
|
+
container: document.getElementById('audiogram-div'), side: 'L',
|
60
18
|
})
|
61
19
|
|
62
20
|
RAudiogram.update({
|
@@ -74,15 +32,39 @@ RAudiogram.update({
|
|
74
32
|
LAudiogram.update({
|
75
33
|
data: {
|
76
34
|
// R_AC_M: { 8000: 25, 2000: 5, 1500: 0, },
|
77
|
-
L_AC: { 1000:
|
78
|
-
L_AC_NR: { 1500: 85 },
|
35
|
+
L_AC: { 1000: 30, 500: 20, 750: 30, 250: 5, 6000: 35, 2000: 45 },
|
79
36
|
L_BC_M: { 2000: 25, 6000: 25 },
|
80
|
-
L_BC_M_NR: { 3000: 85 },
|
81
37
|
L_BC: { 1000: 20, 500: 10, 750: 15, 250: 5, 4000: 20 },
|
82
38
|
},
|
83
39
|
side: 'L',
|
84
40
|
})
|
85
41
|
|
42
|
+
const forms = new Forms({ container: document.getElementById('forms-div'), name: 'form1' });
|
43
|
+
forms.update({ officeData, patientData, sessionIndex: 0 })
|
44
|
+
|
86
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
|
+
|
68
|
+
// setupCounter(document.querySelector('#counter'))
|
87
69
|
|
88
70
|
|
@@ -5,7 +5,6 @@
|
|
5
5
|
url('../fonts/Vazirmatn-Regular.woff') format('woff');
|
6
6
|
}
|
7
7
|
@page {
|
8
|
-
|
9
8
|
size: a4;
|
10
9
|
margin: 0;
|
11
10
|
padding: 0;
|
@@ -23,6 +22,9 @@
|
|
23
22
|
}
|
24
23
|
|
25
24
|
svg {
|
25
|
+
max-width: 400px;
|
26
|
+
scrollbar-width: 400px;
|
27
|
+
overflow-block:scroll;
|
26
28
|
margin: 0;
|
27
29
|
padding: 0;
|
28
30
|
break-inside: avoid;
|
package/src/style.css
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
@font-face {
|
2
2
|
font-family: vazirmatn;
|
3
3
|
src:
|
4
|
-
url("
|
5
|
-
url('
|
4
|
+
url("fonts/Vazirmatn-Regular.woff2") format("woff2"),
|
5
|
+
url('fonts/Vazirmatn-Regular.woff') format('woff');
|
6
|
+
font-display: swap;
|
6
7
|
|
7
8
|
}
|
8
9
|
|
@@ -32,6 +33,28 @@
|
|
32
33
|
font-weight: bold;
|
33
34
|
}
|
34
35
|
|
36
|
+
.container {
|
37
|
+
display: flex;
|
38
|
+
/* Use flexbox to align items */
|
39
|
+
align-items: center;
|
40
|
+
/* Center items vertically */
|
41
|
+
}
|
42
|
+
|
43
|
+
.left {
|
44
|
+
/* background-color: lightblue; */
|
45
|
+
padding: 20px;
|
46
|
+
margin-right: 10px;
|
47
|
+
/* Space between the two divs */
|
48
|
+
}
|
49
|
+
|
50
|
+
.right {
|
51
|
+
/* background-color: lightgreen; */
|
52
|
+
margin-left: 10px;
|
53
|
+
|
54
|
+
/* padding: 20px; */
|
55
|
+
}
|
56
|
+
|
57
|
+
|
35
58
|
/* :root {
|
36
59
|
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
37
60
|
line-height: 1.5;
|
@@ -149,4 +172,4 @@ button:focus-visible {
|
|
149
172
|
|
150
173
|
/* body {
|
151
174
|
font-family: vazirmatn;
|
152
|
-
} */
|
175
|
+
} */
|