hayun-vite 0.4.0 → 0.5.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.
@@ -1,85 +1,125 @@
1
- // for
2
1
  const dims = {
3
2
  name: 'Audiogram',
4
- // پس از اضافه کردن هر آیتم در زیر این تمپلت رو هم آپدیت کنید
5
- template: {
6
- margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
7
-
8
- width: 700,
9
- height: 700,
10
-
11
- chartPadding: { left: 30, top: 45, right: 30, bottom: 10 },
12
- symbolDims: { width: 55, height: 55 },
13
- // virtual frequency
14
- vFrequency: { min: 0, max: 14, step: 1 },
15
- vToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
16
- freqToV: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
17
- intensity: { min: -20, max: 120, step: 10 },
18
-
19
- styles: {
20
- line: ``,
21
- juncDashLine: ``,
22
- juncLine: ``,
23
- }
24
- },
3
+ margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
4
+
5
+ // واحد ویوباکس - بدون واحد
6
+ vbWidth: 700, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
7
+ vbHeight: 750, // این به نسبت تغییر می‌کند
25
8
 
26
- display: {
27
- margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
28
-
29
- width: 700,
30
- height: 700,
31
-
32
- chartPadding: { left: 30, top: 45, right: 30, bottom: 10 }, // این فاصله خطوط جدول از لبه ها هست
33
- symbolDims: { width: 55, height: 55 },
34
- // virtual frequency
35
- vFrequency: { min: 0, max: 14, step: 1 },
36
- vToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
37
- freqToV: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
38
- intensity: { min: -20, max: 130, step: 10 },
39
-
40
- styles: {
41
- line: `stroke: black; stroke-width: 1;`,
42
- juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
43
- juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
44
- }
9
+ // واحد پیکسل، میلیمتر، ...
10
+ // اگر واحد پایینی توسط بیرون تغییر کرد واحدهای بالایی باید با نسبت پایینی تغییر کنند
11
+ width: 700,
12
+ height: 700 ,
13
+
14
+ // این فاصله خطوط محورهای بالا و چپ ادیوگرام از لبه ها هست
15
+ chartPadding: { left: 40, top: 40, right: 30, bottom: 20 },
16
+ symbolDims: { width: 55, height: 55 },
17
+ symbolsChart: {
18
+ width: 240, height: 60
45
19
  },
46
- rasa_audiometry: {
47
- blank: true, // define Blank Chart for PrePrinted Chart, Lines do not draw
48
- // width: 70.6,
49
- // height: 70,
50
- // margin: { left: 17, top: 18.5, },
51
- chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
52
- symbolDims: { width: 8, height: 8 },
53
- // virtual frequency
54
- vFrequency: { min: 0, max: 14, step: 1 },
55
- vToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
56
- freqToV: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
57
- intensity: { min: -20, max: 120, step: 10 },
58
-
59
- styles: {
60
- line: `stroke: black; stroke-width: 0.1;`,
61
- juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
62
- juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
63
- }
20
+ // virtual frequency
21
+ mainFrequencies: [125, 250, 500, 1000, 2000, 4000, 8000],
22
+ frequencies: [
23
+ { f: 125, vf: 0, label: false }, { f: 250, vf: 2 },
24
+ { f: 500, vf: 4 }, { f: 750, vf: 5.2, semiOctav: true },
25
+ { f: 1000, vf: 6 }, { f: 1500, vf: 7.2, semiOctav: true },
26
+ { f: 2000, vf: 8 }, { f: 3000, vf: 9.2, semiOctav: true },
27
+ { f: 4000, vf: 10 }, { f: 6000, vf: 11.2, semiOctav: true },
28
+ { f: 8000, vf: 12 }, { f: 16000, vf: 14 },
29
+ ],
30
+
31
+ vf: { min: 0, max: 14, step: 1 }, // virtual frequency
32
+ vfArray: [0, 2, 4, 5.2, 6, 7.2, 8, 9.2, 10, 11.2, 12],
33
+ vfToF: { 0: 125, 2: 250, 4: 500, 5.2: 750, 6: 1000, 7.2: 1500, 8: 2000, 9.2: 3000, 10: 4000, 11.2: 6000, 12: 8000, 13: 12000, 14: 16000 },
34
+ fToVf: { 125: 0, 250: 2, 500: 4, 750: 5.2, 1000: 6, 1500: 7.2, 2000: 8, 3000: 9.2, 4000: 10, 6000: 11.2, 8000: 12, 12000: 13.2, 16000: 14 },
35
+ intensity: { min: -20, max: 130, step: 10 },
36
+ styles: {
37
+ frequency: `text-anchor: middle; dominant-baseline: hanging;
38
+ font: 1.3em Verdana, Helvetica, Arial, sans-serif; user-select: none;font-weight:bold;`,
39
+ intensity: `text-anchor: end; dominant-baseline: middle;
40
+ font: 1.3em Verdana, Helvetica, Arial, sans-serif; user-select: none;font-weight:bold;`,
41
+ mainFreqline: `stroke: black; stroke-width: 1;`,
42
+ semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
43
+ boldLine: 'stroke: black; stroke-width: 3;',
44
+
45
+ juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
46
+ juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
64
47
  },
65
- combo: {
66
- // width: 50,
67
- // height: 40,
68
- // margin: { left: 5, top: 5, right: 5, bottom: 5 },
69
- chartPadding: { left: 8, top: 8, right: 5, bottom: 3 },
70
- symbolDims: { width: 8, height: 8 },
71
- // virtual frequency
72
- vFrequency: { min: 0, max: 14, step: 1 },
73
- vToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
74
- freqToV: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
75
- intensity: { min: -20, max: 120, step: 10 },
76
-
77
- styles: {
78
- line: `stroke: black; stroke-width: 0.1;`,
79
- juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
80
- juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
81
- }
82
- }
48
+
49
+ // پس از اضافه کردن هر آیتم در زیر این تمپلت رو هم آپدیت کنید
50
+ // template: {
51
+ // margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
52
+
53
+ // width: 700,
54
+ // height: 700,
55
+
56
+ // chartPadding: { left: 40, top: 50, right: 30, bottom: 10 },
57
+ // symbolDims: { width: 55, height: 55 },
58
+ // // virtual frequency
59
+ // frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
60
+
61
+ // iFrequency: { min: 0, max: 14, step: 1 },
62
+ // iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
63
+ // fToVf: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
64
+ // intensity: { min: -20, max: 120, step: 10 },
65
+
66
+ // styles: {
67
+ // freq: ``,
68
+ // line: ``,
69
+ // juncDashLine: ``,
70
+ // juncLine: ``,
71
+ // }
72
+ // },
73
+
74
+ // display: {
75
+ // width: 800,
76
+ // height: 600,
77
+
78
+
79
+ // },
80
+ // rasa_audiometry: {
81
+ // blank: true, // define Blank Chart for PrePrinted Chart, Lines do not draw
82
+ // // width: 70.6,
83
+ // // height: 70,
84
+ // // margin: { left: 17, top: 18.5, },
85
+ // chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
86
+ // symbolDims: { width: 8, height: 8 },
87
+ // // virtual frequency
88
+ // frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
89
+
90
+ // iFrequency: { min: 0, max: 14, step: 1 },
91
+ // iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
92
+ // fTovf: { 125: 0, 250: 2, 500: 4, 750: 5.2, 1000: 6, 1500: 7.2, 2000: 8, 3000: 9.2, 4000: 10, 6000: 11.2, 8000: 12, 12000: 13.2, 16000: 14 },
93
+ // intensity: { min: -20, max: 120, step: 10 },
94
+
95
+ // styles: {
96
+ // freq: ``,
97
+ // line: `stroke: black; stroke-width: 0.1;`,
98
+ // juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
99
+ // juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
100
+ // }
101
+ // },
102
+ // combo: {
103
+ // // width: 50,
104
+ // // height: 40,
105
+ // // margin: { left: 5, top: 5, right: 5, bottom: 5 },
106
+ // chartPadding: { left: 8, top: 8, right: 5, bottom: 3 },
107
+ // symbolDims: { width: 8, height: 8 },
108
+ // // virtual frequency
109
+ // frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
110
+
111
+ // iFrequency: { min: 0, max: 14, step: 1 },
112
+ // iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
113
+ // freqToi: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
114
+ // intensity: { min: -20, max: 120, step: 10 },
115
+
116
+ // styles: {
117
+ // freq: ``,
118
+ // line: `stroke: black; stroke-width: 0.1;`,
119
+ // juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
120
+ // juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
121
+ // }
122
+ // }
83
123
  }
84
124
 
85
125
  export default dims;
package/src/Form/Form.js CHANGED
@@ -1,4 +1,4 @@
1
- import Symbols from "../Symbol/Symbols.js";
1
+ // import Symbols from "../Symbol/Symbols.js";
2
2
  import TextBox from "./TextBox.js";
3
3
  import Header from "./Header.js";
4
4
  import Reflex from "./Reflex.js";
@@ -34,26 +34,26 @@ export default class Form {
34
34
  this.patient.draw({ dims: template.patient });
35
35
  }
36
36
 
37
-
38
37
  if (sections.history) {
39
38
  this.history = new TextBox({ container: sections.history })
40
39
  this.history.draw({ dims: template.history });
41
40
  }
42
41
 
43
- this.symbols = new Symbols();
44
-
45
42
  if (sections.RAudiogram) {
46
43
  this.RAudiogram = new AudiogramChart({
47
44
  container: sections.RAudiogram,
48
45
  dims: template.RAudiogram,
49
46
  side: 'R',
47
+ events: false
50
48
  });
51
49
  }
50
+
52
51
  if (sections.LAudiogram) {
53
52
  this.LAudiogram = new AudiogramChart({
54
53
  container: sections.LAudiogram,
55
54
  dims: template.LAudiogram,
56
55
  side: 'L',
56
+ events: false
57
57
  });
58
58
  }
59
59
  if (sections.RSpeech) {
@@ -73,11 +73,11 @@ export default class Form {
73
73
  this.LTympanogram.draw({ dims: template.LTympanogram });
74
74
  }
75
75
  if (sections.RReflex) {
76
- this.RReflex = new Reflex({ container: sections.RReflex, dims: template.RReflex })
76
+ this.RReflex = new Reflex({ container: sections.RReflex, side: 'R' })
77
77
  this.RReflex.draw({ dims: template.RReflex });
78
78
  }
79
79
  if (sections.LReflex) {
80
- this.LReflex = new Reflex({ container: sections.LReflex, dims: template.LReflex })
80
+ this.LReflex = new Reflex({ container: sections.LReflex, side: 'L' })
81
81
  this.LReflex.draw({ dims: template.LReflex });
82
82
  }
83
83
  if (sections.report) {
@@ -85,45 +85,13 @@ export default class Form {
85
85
  this.report.draw({ dims: template.report });
86
86
  }
87
87
  if (sections.footer) {
88
-
89
88
  this.footer = new TextBox({ container: sections.footer })
90
89
  this.footer.draw({ dims: template.footer });
91
90
  }
92
91
 
93
92
  this.container.appendChild(this.form);
94
-
95
93
  }
96
94
 
97
- draw() {
98
-
99
- let pad;
100
- let style = `
101
- user-select: none;
102
- direction: ltr !important;
103
- /* text-align: center; */
104
- font-family: Arial, Helvetica, sans-serif !important;
105
- font-size: 1.3mm;
106
- font-weight: bold;
107
- color: red;
108
- text-anchor: middle; /*تراز افقی*/
109
- dominant-baseline: middle; /* تراز عمودی*/
110
- `;
111
- // Draw Titles first
112
- // putText({ container: this.sections.audiograms, value: "Right Ear", x: 42.5, y: 4, style: style })
113
- // putText({ container: this.sections.speechs, value: "Speech Tests", x: this.sectionWidth / 2, y: 4, style: style })
114
- // putText({ container: this.sections.tympanograms, value: "Tympanometry", x: this.sectionWidth / 2, y: 4, style: style })
115
- // putText({ container: this.sections.reflexes, value: "Acoustic Reflexes", x: this.sectionWidth / 2, y: 4, style: style })
116
-
117
-
118
- // برای مخفی کردن بوردرها تابع تاگل بوردر همین جا فراخوانی شود
119
- // this.toggleBorders({ container: 'form' })
120
- // this.toggleBorders({ container: 'section' })
121
- // this.toggleBorders({ container: 'element' })
122
-
123
-
124
- // بعد از رسم همه المنت ها یک المنت مستطیل تاپ لایر
125
- // drawTopLayer({ container: this.form, dims: this.sections.dims });
126
- }
127
95
 
128
96
  create({ paper, margin }) {
129
97
  const { width, height } = paper;
@@ -242,15 +210,4 @@ export default class Form {
242
210
  `;
243
211
  putRect({ container, x: 0, y: 0, width, height, style, className: 'no-print' })
244
212
  }
245
-
246
- // ایجاد دکمه تاگل خطوط مرزی فرم و سکشن و المان
247
- toggleBorders({ activeForm, container = 'form' }) {
248
- const borders = activeForm.querySelectorAll(`[data-name="${container}-border"]`);
249
- // آبجکت نگهداری رنگ بوردرها
250
- const color = { form: 'black', section: 'blue', element: 'green' }
251
- borders.forEach(border => {
252
- // console.log(border.style.stroke);
253
- border.style.stroke = (border.style.stroke === 'transparent') ? color[container] : 'transparent';
254
- })
255
- }
256
213
  }
package/src/Form/Forms.js CHANGED
@@ -22,6 +22,10 @@ export default class Forms {
22
22
  const container = this.container
23
23
  // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
24
24
  const div = document.createElement('div');
25
+ container.addEventListener('click', e => {
26
+ console.log(e.target);
27
+ })
28
+
25
29
  div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
26
30
  container.appendChild(div);
27
31
 
@@ -38,13 +42,16 @@ export default class Forms {
38
42
  });
39
43
 
40
44
  const printBtn = this.putButton({ container: div, text: 'چاپ', className });
45
+
41
46
  // تعریف رویداد دکمه چاپ فرم نمایشی
42
47
  printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) });
43
48
 
44
49
  // انتخاب فرم پیش‌فرض
45
- forms[1].form.style.display = 'block';
46
- this.selectedForm = this.forms[1]
47
- btns[1].style.backgroundColor = ' #1c15e1'
50
+ let selectedIndex = 1
51
+ forms[selectedIndex].form.style.display = 'block';
52
+ this.selectedForm = this.forms[selectedIndex]
53
+ btns[selectedIndex].style.backgroundColor = ' #1c15e1'
54
+
48
55
 
49
56
  btns.forEach((btn, index) => {
50
57
  btn.addEventListener('click', () => {
@@ -59,10 +66,13 @@ export default class Forms {
59
66
  btns[index].style.backgroundColor = ' #1c15e1'
60
67
 
61
68
  this.selectedForm = forms[index];
69
+ selectedIndex = index
62
70
  this.update(this.allData);
63
-
64
71
  })
65
72
  })
73
+
74
+ this.putButton({ container: div, text: 'Show/Hide', className })
75
+ .addEventListener('click', () => { this.toggleDisplay({ container: forms[selectedIndex].form }) });
66
76
  }
67
77
 
68
78
  // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
@@ -81,4 +91,13 @@ export default class Forms {
81
91
  container.appendChild(button);
82
92
  return button;
83
93
  }
94
+
95
+ // تابع تاگل نمایش و مخفی کردن خطوط راهنمای طراحی
96
+ toggleDisplay({ container }) {
97
+ container.querySelectorAll(`[data-name='guide-border']`)
98
+ .forEach(element => {
99
+ element.style.display = (element.style.display === '') ? 'none' : '';
100
+ });
101
+
102
+ }
84
103
  }
@@ -4,8 +4,9 @@ import putText from "../common/putText.js";
4
4
  const svgNS = "http://www.w3.org/2000/svg";
5
5
 
6
6
  export default class Reflex {
7
- constructor({ container }) {
7
+ constructor({ container, side }) {
8
8
  this.container = container;
9
+ this.side = side; // این برای تعیین رنگ راست و چپ استفاده می‌شود
9
10
  }
10
11
 
11
12
  draw({ dims }) {
@@ -84,8 +85,11 @@ export default class Reflex {
84
85
  font-family: Arial, Helvetica, sans-serif !important;
85
86
  font-size: 0.8mm;
86
87
  text-anchor: middle; /*تراز افقی*/
87
- dominant-baseline: middle; /* تراز عمودی*/
88
+ dominant-baseline: middle; /* تراز عمودی*/
88
89
  `;
90
+ // اضافه کردن رنگ قرمز یا آبی به استایل بر اساس جهت
91
+ style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
92
+
89
93
  let names = ["IPSI_500", "IPSI_1000", "IPSI_2000", "IPSI_4000"];
90
94
  for (let index = 0; index < 4; index++) {
91
95
  x = cw1 / 2 + cw1 * (index + 1);
@@ -122,7 +126,9 @@ export default class Reflex {
122
126
  }
123
127
  }
124
128
 
129
+ // جایگذاری داده های رفلکس
125
130
  update(data) {
131
+
126
132
  for (const key in data) {
127
133
  for (const freq in data[key]) {
128
134
  this.chart.querySelector(`text[data-name=${key}_${freq}]`).innerHTML = data?.[key]?.[freq] || "";
@@ -49,7 +49,7 @@ export default class Sections {
49
49
  putRect({
50
50
  container: svg, x: 0, y: 0, width, height,
51
51
  style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
52
- className: 'no-print'
52
+ className: 'no-print', name: 'guide-border'
53
53
  })
54
54
  this[name] = svg;
55
55
  this.container.appendChild(svg)
@@ -50,7 +50,11 @@ export default class TextBox {
50
50
  });
51
51
 
52
52
  // مربع احاطه‌کننده کل جدول برای راهنمای توسعه
53
- const borderRect = putRect({ container: svg, x: 0, y: 0, width, height, name: dims.name, className: 'no-print' });
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
 
@@ -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, // پهنای سکشن هست
@@ -52,25 +52,34 @@ const rasaAud = {
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',
@@ -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-NR", NR);
22
+ svg.setAttribute("data-nr", NR);
23
23
 
24
24
 
25
25
  if (side == "R" && type == "AC" && !masked) {
@@ -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
+ }
@@ -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, dx = 0, dy = 0, style, name, className }) {
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,19 @@
1
1
  // import './style.css'
2
-
3
- import AudiogramChart from "./Audiogram/Audiogram.js"
4
- import dims from './Audiogram/dims.js'
2
+ import Audiogram from "./Audiogram/Audiogram.js"
5
3
  import Forms from "./Form/Forms.js";
6
4
  import { officeData, patientData } from "../data/sampleData.js"
7
5
 
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
6
  document.querySelector('#app').innerHTML = `
36
- <button>Ok</button>
37
- <button>Tok</button>
38
- <p>Mahdi</p>
39
- <h1>مهدی جاویدی پرنده پرکلاغی</h1>
40
- <div id="forms-div"></div>
41
7
  <div id="audiogram-div"></div>
42
- `
43
-
44
- const forms = new Forms({ container: document.getElementById('forms-div'), name: 'form1' });
45
- forms.update({ officeData, patientData, sessionIndex: 0 })
46
-
47
-
48
- const RAudiogram = new AudiogramChart({
49
- container: document.getElementById('audiogram-div'),
50
- dims: dims.display,
51
- side: 'R', x: 0, y: 0,
52
- width: 700, height: 800, events: true
8
+ <div id="forms-div"></div>
9
+ `
10
+ /*
11
+ const RAudiogram = new Audiogram({
12
+ container: document.getElementById('audiogram-div'), side: 'R',
53
13
  })
54
14
 
55
- const LAudiogram = new AudiogramChart({
56
- container: document.getElementById('audiogram-div'),
57
- dims: dims.display,
58
- side: 'L', x: 0, y: 0,
59
- width: 700, height: 800, events: true
15
+ const LAudiogram = new Audiogram({
16
+ container: document.getElementById('audiogram-div'), side: 'L',
60
17
  })
61
18
 
62
19
  RAudiogram.update({
@@ -74,15 +31,40 @@ RAudiogram.update({
74
31
  LAudiogram.update({
75
32
  data: {
76
33
  // R_AC_M: { 8000: 25, 2000: 5, 1500: 0, },
77
- L_AC: { 1000: 25, 500: 15, 750: 20, 250: 10, 6000: 35, 2000: 45 },
78
- L_AC_NR: { 1500: 85 },
34
+ L_AC: { 1000: 30, 500: 20, 750: 30, 250: 5, 6000: 35, 2000: 45 },
79
35
  L_BC_M: { 2000: 25, 6000: 25 },
80
- L_BC_M_NR: { 3000: 85 },
81
36
  L_BC: { 1000: 20, 500: 10, 750: 15, 250: 5, 4000: 20 },
82
37
  },
83
38
  side: 'L',
84
39
  })
85
40
 
41
+ */
42
+ const forms = new Forms({ container: document.getElementById('forms-div'), name: 'form1' });
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
+ // `
86
67
 
68
+ // setupCounter(document.querySelector('#counter'))
87
69
 
88
70