hayun-vite 0.4.1 → 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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "0.4.1",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -13,7 +13,9 @@ export default class Audiogram {
13
13
  Object.assign(this.dims, mainDims)
14
14
  // dims = { blank: false }
15
15
  // اضافه کردن ابعاد جایگزین و یا اختصاصی دیگر به آبجکت ابعاد
16
- dims && Object.assign(this.dims, dims)
16
+ dims && Object.assign(this.dims, dims);
17
+ // console.log(dims);
18
+
17
19
 
18
20
  this.events = events;
19
21
  this.side = side;
package/src/Form/Form.js CHANGED
@@ -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 })
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 })
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) {
package/src/Form/Forms.js CHANGED
@@ -42,11 +42,12 @@ export default class Forms {
42
42
  });
43
43
 
44
44
  const printBtn = this.putButton({ container: div, text: 'چاپ', className });
45
+
45
46
  // تعریف رویداد دکمه چاپ فرم نمایشی
46
47
  printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) });
47
48
 
48
49
  // انتخاب فرم پیش‌فرض
49
- let selectedIndex = 0
50
+ let selectedIndex = 1
50
51
  forms[selectedIndex].form.style.display = 'block';
51
52
  this.selectedForm = this.forms[selectedIndex]
52
53
  btns[selectedIndex].style.backgroundColor = ' #1c15e1'
@@ -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] || "";
package/src/main.js CHANGED
@@ -1,14 +1,13 @@
1
1
  // import './style.css'
2
2
  import Audiogram from "./Audiogram/Audiogram.js"
3
- import dims from './Audiogram/dims.js'
4
3
  import Forms from "./Form/Forms.js";
5
4
  import { officeData, patientData } from "../data/sampleData.js"
6
5
 
7
6
  document.querySelector('#app').innerHTML = `
8
- <div id="audiogram-div" style=""></div>
7
+ <div id="audiogram-div"></div>
9
8
  <div id="forms-div"></div>
10
9
  `
11
-
10
+ /*
12
11
  const RAudiogram = new Audiogram({
13
12
  container: document.getElementById('audiogram-div'), side: 'R',
14
13
  })
@@ -39,6 +38,7 @@ LAudiogram.update({
39
38
  side: 'L',
40
39
  })
41
40
 
41
+ */
42
42
  const forms = new Forms({ container: document.getElementById('forms-div'), name: 'form1' });
43
43
  forms.update({ officeData, patientData, sessionIndex: 0 })
44
44
 
@@ -1,125 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Form New Test</title>
8
- <style>
9
- button {
10
- background-color: #4CAF50;
11
- /* Green background */
12
- border: none;
13
- /* Remove borders */
14
- color: white;
15
- /* White text */
16
- padding: 15px 32px;
17
- /* Some padding */
18
- text-align: center;
19
- /* Centered text */
20
- text-decoration: none;
21
- /* Remove underline */
22
- display: inline-block;
23
- /* Make the button inline */
24
- font-size: 16px;
25
- /* Increase font size */
26
- margin: 4px 2px;
27
- /* Add some margin */
28
- cursor: pointer;
29
- /* Pointer cursor on hover */
30
- border-radius: 8px;
31
- /* Rounded corners */
32
- transition: background-color 0.3s;
33
- /* Smooth transition */
34
- }
35
-
36
- button:hover {
37
- background-color: #45a049;
38
- /* Darker green on hover */
39
- }
40
-
41
- button:active {
42
- background-color: #3e8e41;
43
- /* Even darker green when clicked */
44
- }
45
- </style>
46
- <style>
47
- @page {
48
-
49
- size: a4 portrait;
50
- margin: 0cm;
51
- }
52
-
53
- @media print {
54
-
55
- /* All your print styles go here */
56
- button {
57
- display: none !important;
58
- }
59
-
60
- svg {
61
- margin: 0;
62
- }
63
-
64
- body {
65
- margin: 0;
66
- }
67
- }
68
- </style>
69
- </head>
70
- <!-- <button></button> -->
71
-
72
- <body>
73
- <input type="checkbox" id="a">
74
- <label for="a">Select for Print</label>
75
- <button id="formBtn">Hide Form Margins</button>
76
- <button id="sectionBtn">Hide Section Margins</button>
77
- <button id="elementBtn">Hide Element Margins</button>
78
- <button id="printBtn">Print Form</button>
79
- <!-- <svg width="210mm" height="298mm" id="form-div" style="border: 1px solid blue"></svg> -->
80
- <div id="form-div"></div>
81
-
82
- <script type="module">
83
- import Forms from "./Forms.js";
84
- import { officeData, patientData } from "../../data/sampleData.js"
85
- const forms = new Forms({ container: document.getElementById('form-div'), name: 'form1' });
86
- // form.draw();
87
- // تابع افزودن دکمه‌های تاگل نمایش و محو خطوط راهنما هر سه نوع
88
- // form section element
89
- // document.getElementById('formBtn').addEventListener('mouseenter', () => {
90
- // forms.toggleBorders({ container: 'form', activeForm: form.activeForm });
91
- // });
92
-
93
- // document.getElementById('sectionBtn').addEventListener('mouseenter', () => {
94
- // forms.toggleBorders({ container: 'section', activeForm: form.activeForm });
95
- // });
96
-
97
- // document.getElementById('elementBtn').addEventListener('mouseenter', () => {
98
- // forms.toggleBorders({ container: 'element', activeForm: form.activeForm });
99
- // });
100
-
101
- // document.getElementById('printBtn').addEventListener('mouseenter', () => {
102
- // // form.toggleBorders({container: 'element'});
103
- // // window.print()
104
- // // const printDateTime = form.print();
105
- // // console.log(printDateTime);
106
-
107
- // });
108
-
109
-
110
-
111
- // const data = {
112
- // audiogram: {
113
- // R: { R_AC: { 500: 25, 1000: 35, 2000: 45, 4000: 55, 8000: 60 } },
114
- // L: { L_AC: { 500: 70, 1000: 75, 2000: 80, 4000: 65, 8000: 60 } }
115
- // },
116
- // tympanogram: {
117
- // R: { ECV: 2.52, SC: 0.80, MEP: -100, type: 'An' },
118
- // L: { ECV: 2.52, SC: 0.80, MEP: -300, type: 'An' }
119
- // }
120
- // }
121
- forms.update({ officeData, patientData, sessionIndex: 0 })
122
- </script>
123
- </body>
124
-
125
- </html>