hayun-vite 1.0.0 → 1.2.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/assets/templates/mainTemplate.js +1 -1
- package/assets/templates/templAudiometry.js +1 -1
- package/assets/templates/templCombo.js +1 -1
- package/data/currentData.js +117 -0
- package/index.html +41 -63
- package/index.js +10 -6
- package/package.json +3 -7
- package/prac.html +42 -0
- package/src/Audiogram/dims_100.js +2 -2
- package/src/Form/Form.js +29 -10
- package/src/Forms/Forms.js +31 -11
- package/src/Forms/FormsUI.js +34 -0
- package/src/Header/Header.js +1 -1
- package/src/Header/Header_box.js +1 -1
- package/src/MultiText/MultiText.js +1 -1
- package/src/Reflex/Reflex.js +46 -2
- package/src/Reflex/ReflexUI.js +78 -0
- package/src/Reflex/units.js +1 -1
- package/src/Speech/Speech.js +56 -1
- package/src/Speech/SpeechUI.js +94 -0
- package/src/Speech/units.js +20 -2
- package/src/Tympanogram/Tympanogram.js +45 -1
- package/src/Tympanogram/TympanogramUI.js +166 -0
- package/src/Tympanogram/test.js +1 -1
- package/src/Tympanogram/units.js +1 -1
- package/src/main.js +11 -5
- package/style-font.css +10 -0
- package/styles-tailwind.css +14 -0
- package/styles.css +57 -178
- package/vite.config.js +7 -0
- package/assets/rasa.png +0 -0
- package/assets/templates/rasa_audiometry.jpg +0 -0
- package/assets/templates/rasa_tymp_reflex.jpg +0 -0
- package/src/Form/Form_box.js +0 -190
- package/src/Forms/ui.js +0 -52
- package/src/Speech/Speech_box.js +0 -119
- package/src/Speech/ui.js +0 -101
- package/src/components/SpeechUI.js +0 -111
- package/src/components/common/putG.js +0 -10
- package/src/components/common/putGrid.js +0 -31
- package/src/components/common/putLine.js +0 -16
- package/src/components/common/putPoint.js +0 -13
- package/src/components/common/putRect.js +0 -25
- package/src/components/common/putSVG.js +0 -14
- package/src/components/common/putText.js +0 -19
- package/src/components/common/putTopLayer.js +0 -18
- package/src/components/index.js +0 -12
- package/src/core/AppState.js +0 -36
- package/src/core/BaseComponent.js +0 -94
- package/src/core/README.md +0 -565
- package/src/core/Router.js +0 -74
- package/src/style.css +0 -243
package/src/Reflex/Reflex.js
CHANGED
|
@@ -117,12 +117,56 @@ export default class Reflex {
|
|
|
117
117
|
|
|
118
118
|
// جایگذاری داده های رفلکس
|
|
119
119
|
update(data) {
|
|
120
|
-
console.log(data);
|
|
121
|
-
|
|
122
120
|
for (const key in data) {
|
|
123
121
|
for (const freq in data[key]) {
|
|
124
122
|
this.chart.querySelector(`text[name=${key}-${freq}]`).innerHTML = data?.[key]?.[freq] || "";
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
}
|
|
126
|
+
|
|
127
|
+
createUserInput({ container }) {
|
|
128
|
+
// استایل دهی نسبی به کانتینر
|
|
129
|
+
// برای قرار دادن اینپوت ها در مختصات کانتینر
|
|
130
|
+
container.style.position = 'relative'
|
|
131
|
+
const width = 70 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
132
|
+
const height = 30 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
133
|
+
|
|
134
|
+
let style = `
|
|
135
|
+
all: revert;
|
|
136
|
+
width: ${width}px;
|
|
137
|
+
height: ${height}px;
|
|
138
|
+
box-sizing: border-box;
|
|
139
|
+
border: none;
|
|
140
|
+
/* Ensures padding doesn't increase height */
|
|
141
|
+
position: absolute;
|
|
142
|
+
padding-top: 4px;
|
|
143
|
+
text-align: center;
|
|
144
|
+
font-size: 24px;
|
|
145
|
+
font-weight: bold;
|
|
146
|
+
font-family: Vazirmatn;
|
|
147
|
+
`
|
|
148
|
+
const color = (this.side === 'R') ? 'crimson' : 'blue';
|
|
149
|
+
// ایجاد یک المنت اینپوت
|
|
150
|
+
// let input
|
|
151
|
+
// آماده سازی اولین نود اینپوت از داکیومنت و سپس ساختن بقیه نودها از روی آن
|
|
152
|
+
// const firstInput = input // نگهداری اولین اینپوت برای برگشت و فوکوس کردن بهش
|
|
153
|
+
let inputDims = this.inputDims
|
|
154
|
+
|
|
155
|
+
inputDims.forEach(dims => {
|
|
156
|
+
const input = document.createElement('input')
|
|
157
|
+
// input.className = 'user-input'
|
|
158
|
+
input.name = dims.name
|
|
159
|
+
input.type = 'text'
|
|
160
|
+
input.maxLength = 4
|
|
161
|
+
input.autocomplete = 'off'
|
|
162
|
+
input.placeholder = '---'
|
|
163
|
+
input.style = style
|
|
164
|
+
input.style.color = color
|
|
165
|
+
input.style.left = dims.x - width / 2 + 'px'
|
|
166
|
+
input.style.top = dims.y - height / 2 + 'px'
|
|
167
|
+
container.appendChild(input)
|
|
168
|
+
// input = input.cloneNode() // در آخر یک المنت اضافه ایجاد شده است - باگ بی آزار
|
|
169
|
+
})
|
|
170
|
+
// firstInput.focus()
|
|
171
|
+
}
|
|
128
172
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Reflex from "./Reflex";
|
|
2
|
+
|
|
3
|
+
class ReflexUI {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.data = { R: '', L: '' }
|
|
6
|
+
}
|
|
7
|
+
draw({ containerId = '#app' }) {
|
|
8
|
+
document.querySelector(containerId).insertAdjacentHTML('beforeend', `
|
|
9
|
+
<div name = "reflexes" class="border">
|
|
10
|
+
<h1 class="center title">Acoustic Reflexes</h1>
|
|
11
|
+
<div class="center">
|
|
12
|
+
<div>
|
|
13
|
+
<h2 class="side center red">Right</h2>
|
|
14
|
+
<section id="r-reflex"></section>
|
|
15
|
+
</div>
|
|
16
|
+
<div>
|
|
17
|
+
<h2 class="side center blue">Left</h2>
|
|
18
|
+
<section id="l-reflex"></section>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
`);
|
|
23
|
+
|
|
24
|
+
// ابعاد جداول تمپانوگرام
|
|
25
|
+
const dims = {
|
|
26
|
+
"name": "RTympanogram",
|
|
27
|
+
"w": 100,
|
|
28
|
+
"h": 30,
|
|
29
|
+
"margin": {
|
|
30
|
+
"left": 1,
|
|
31
|
+
"top": 0,
|
|
32
|
+
"right": 10,
|
|
33
|
+
"bottom": 0
|
|
34
|
+
},
|
|
35
|
+
"display": "inline",
|
|
36
|
+
"width": 100 * 6,
|
|
37
|
+
"height": 30 * 6
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.rcontainer = document.getElementById('r-reflex')
|
|
41
|
+
this.rchart = new Reflex({ container: this.rcontainer, dims, side: 'R' })
|
|
42
|
+
|
|
43
|
+
// فراخوانی متد ایجاد اینپوت روی چارت اسپیچ
|
|
44
|
+
// this.rchart.createUserInput({ container: this.rcontainer })
|
|
45
|
+
|
|
46
|
+
this.lcontainer = document.getElementById('l-reflex')
|
|
47
|
+
this.lchart = new Reflex({ container: this.lcontainer, dims, side: 'L' })
|
|
48
|
+
// this.lchart.createUserInput({ container: this.lcontainer })
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
update({ data } = {}) {
|
|
53
|
+
if (data) {
|
|
54
|
+
this.rchart.update(data.R, this.rcontainer)
|
|
55
|
+
this.lchart.update(data.L, this.lcontainer)
|
|
56
|
+
this.data = { R: data.R, L: data.L }
|
|
57
|
+
} else
|
|
58
|
+
// اگر این تابع بدون پارامتر فراخوانی شود مقادیر اینپوت کاربر گرفته و دیتاآبجکت را آپدیت کند
|
|
59
|
+
{
|
|
60
|
+
console.log('without param');
|
|
61
|
+
|
|
62
|
+
// this.rchart.fetchInputUserData()
|
|
63
|
+
// this.lchart.fetchInputUserData()
|
|
64
|
+
// this.data.R = this.rchart.data
|
|
65
|
+
// this.data.L = this.lchart.data
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default new ReflexUI()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
package/src/Reflex/units.js
CHANGED
|
@@ -12,7 +12,7 @@ const units = {
|
|
|
12
12
|
height: 30,
|
|
13
13
|
|
|
14
14
|
styles: {
|
|
15
|
-
svg: 'user-select: none; direction: ltr !important; font-family:
|
|
15
|
+
svg: 'user-select: none; direction: ltr !important; font-family: Vazirmatn;',
|
|
16
16
|
textLable: `
|
|
17
17
|
font-size: 4.2;
|
|
18
18
|
font-weight: bold;
|
package/src/Speech/Speech.js
CHANGED
|
@@ -11,6 +11,7 @@ export default class Speech {
|
|
|
11
11
|
|
|
12
12
|
this.container = container;
|
|
13
13
|
this.side = side;
|
|
14
|
+
this.data = {}
|
|
14
15
|
this.inputDims = [] // پراپرتی نگهداری مختصات مرکز اینپوت ها
|
|
15
16
|
this.draw({ dims })
|
|
16
17
|
}
|
|
@@ -135,6 +136,9 @@ export default class Speech {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
update(data, container) {
|
|
139
|
+
this.data = data
|
|
140
|
+
// انتخاب اینکه اینپوت های کاربر را آپدیت کنه یا اس وی جی تکست ها رو
|
|
141
|
+
// بر حسب اینکه پارامتر کانتینر باشه یا نباشه
|
|
138
142
|
const prop = container ? 'value' : 'textContent'
|
|
139
143
|
const elem = container ? 'input' : 'text';
|
|
140
144
|
!container && (container = this.chart);
|
|
@@ -144,7 +148,58 @@ export default class Speech {
|
|
|
144
148
|
})
|
|
145
149
|
}
|
|
146
150
|
|
|
147
|
-
|
|
151
|
+
createUserInput({ container }) {
|
|
152
|
+
// استایل دهی نسبی به کانتینر
|
|
153
|
+
container.style.position = 'relative'
|
|
154
|
+
const width = 70 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
155
|
+
const height = 30 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
156
|
+
|
|
157
|
+
let style = `
|
|
158
|
+
all: revert;
|
|
159
|
+
width: ${width}px;
|
|
160
|
+
height: ${height}px;
|
|
161
|
+
box-sizing: border-box;
|
|
162
|
+
border: none;
|
|
163
|
+
/* Ensures padding doesn't increase height */
|
|
164
|
+
position: absolute;
|
|
165
|
+
padding-top: 4px;
|
|
166
|
+
text-align: center;
|
|
167
|
+
font-size: 24px;
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
font-family: Vazirmatn;
|
|
170
|
+
`
|
|
171
|
+
const color = (this.side === 'R') ? 'crimson' : 'blue';
|
|
172
|
+
// ایجاد یک المنت اینپوت
|
|
173
|
+
// let input
|
|
174
|
+
// آماده سازی اولین نود اینپوت از داکیومنت و سپس ساختن بقیه نودها از روی آن
|
|
175
|
+
// const firstInput = input // نگهداری اولین اینپوت برای برگشت و فوکوس کردن بهش
|
|
176
|
+
let inputDims = this.inputDims
|
|
177
|
+
|
|
178
|
+
inputDims.forEach(dims => {
|
|
179
|
+
const input = document.createElement('input')
|
|
180
|
+
// input.className = 'user-input'
|
|
181
|
+
input.name = dims.name
|
|
182
|
+
input.type = 'text'
|
|
183
|
+
input.maxLength = 4
|
|
184
|
+
input.autocomplete = 'off'
|
|
185
|
+
input.placeholder = '---'
|
|
186
|
+
input.style = style
|
|
187
|
+
input.style.color = color
|
|
188
|
+
input.style.left = dims.x - width / 2 + 'px'
|
|
189
|
+
input.style.top = dims.y - height / 2 + 'px'
|
|
190
|
+
container.appendChild(input)
|
|
191
|
+
// input = input.cloneNode() // در آخر یک المنت اضافه ایجاد شده است - باگ بی آزار
|
|
192
|
+
})
|
|
193
|
+
// firstInput.focus()
|
|
194
|
+
}
|
|
148
195
|
|
|
196
|
+
// دریافت دیتای کاربر از اینپوت ها و جایگزین کردن در دیتای آبجکت کلاس
|
|
197
|
+
// تغییر این دیتا باعث تغییر دیتای جاری میشود. چون آبجکت ها اشاره گر هستن
|
|
198
|
+
fetchInputUserData() {
|
|
199
|
+
['SAT', 'SRT', 'MCL', 'UCL', 'SDS'].forEach(name => {
|
|
200
|
+
const value = this.container.querySelector(`input[name= ${name}]`).value
|
|
201
|
+
this.data[name] = value // جایگزین کردن پراپرتی آبجکت دیتای جاری و اینجا
|
|
202
|
+
})
|
|
149
203
|
}
|
|
204
|
+
|
|
150
205
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import Speech from "./Speech"
|
|
2
|
+
|
|
3
|
+
class SpeechUI {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.data = { R: '', L: '' }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
draw({ containerId = '#app' } = {}) {
|
|
9
|
+
|
|
10
|
+
document.querySelector(containerId).insertAdjacentHTML('beforeend', `
|
|
11
|
+
<div name="speechs" class="border">
|
|
12
|
+
<h1 class="center title">Speech Tests</h1>
|
|
13
|
+
<div class="center">
|
|
14
|
+
<div>
|
|
15
|
+
<h2 class="side center red">Right</h2>
|
|
16
|
+
<section id="r-speech"></section>
|
|
17
|
+
</div>
|
|
18
|
+
<div>
|
|
19
|
+
<h2 class="side center blue">Left</h2>
|
|
20
|
+
<section id="l-speech"></section>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
`)
|
|
25
|
+
|
|
26
|
+
let dims = {
|
|
27
|
+
"name": "RSpeech",
|
|
28
|
+
"w": 89,
|
|
29
|
+
"h": 15,
|
|
30
|
+
"margin": {
|
|
31
|
+
"left": 1,
|
|
32
|
+
"top": 0,
|
|
33
|
+
"right": 10,
|
|
34
|
+
"bottom": 0
|
|
35
|
+
},
|
|
36
|
+
"display": "inline",
|
|
37
|
+
"stroke": true,
|
|
38
|
+
"width": 100 * 6,
|
|
39
|
+
"height": 20 * 5,
|
|
40
|
+
"labels": [
|
|
41
|
+
"SAT",
|
|
42
|
+
"SRT",
|
|
43
|
+
"MCL",
|
|
44
|
+
"UCL",
|
|
45
|
+
"SDS"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
this.rcontainer = document.getElementById('r-speech')
|
|
50
|
+
this.rchart = new Speech({ container: this.rcontainer, dims, side: 'R' })
|
|
51
|
+
|
|
52
|
+
// فراخوانی متد ایجاد اینپوت روی چارت اسپیچ
|
|
53
|
+
this.rchart.createUserInput({ container: this.rcontainer })
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
this.lcontainer = document.getElementById('l-speech')
|
|
57
|
+
this.lchart = new Speech({ container: this.lcontainer, dims, side: 'L' })
|
|
58
|
+
|
|
59
|
+
// فراخوانی متد ایجاد اینپوت روی چارت اسپیچ
|
|
60
|
+
this.lchart.createUserInput({ container: this.lcontainer })
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
update({ data } = {}) {
|
|
66
|
+
if (data) {
|
|
67
|
+
this.rchart.update(data.R, this.rcontainer)
|
|
68
|
+
this.lchart.update(data.L, this.lcontainer)
|
|
69
|
+
this.data = { R: data.R, L: data.L }
|
|
70
|
+
} else
|
|
71
|
+
// اگر این تابع بدون پارامتر فراخوانی شود مقادیر اینپوت کاربر گرفته و دیتاآبجکت را آپدیت کند
|
|
72
|
+
{
|
|
73
|
+
console.log('without param');
|
|
74
|
+
|
|
75
|
+
this.rchart.fetchInputUserData()
|
|
76
|
+
this.lchart.fetchInputUserData()
|
|
77
|
+
this.data.R = this.rchart.data
|
|
78
|
+
this.data.L = this.lchart.data
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
export default new SpeechUI()
|
|
86
|
+
// تابع زیر فقط در ایمپورت کل ماژول در فایل ایندکس اچ تی ام ال فراخوانی میشود و عملا با ایمپورت تابع فراخوانی میشود و برای تست هست
|
|
87
|
+
// ui()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
package/src/Speech/units.js
CHANGED
|
@@ -20,7 +20,7 @@ const units = {
|
|
|
20
20
|
label: `
|
|
21
21
|
user-select: none;
|
|
22
22
|
direction: ltr;
|
|
23
|
-
font-family:
|
|
23
|
+
font-family: Vazirmatn;
|
|
24
24
|
font-size: ${4.2};
|
|
25
25
|
font-weight: 700;
|
|
26
26
|
text-anchor: middle;
|
|
@@ -28,13 +28,31 @@ const units = {
|
|
|
28
28
|
svgInput: `
|
|
29
29
|
user-select: none;
|
|
30
30
|
direction: ltr;
|
|
31
|
-
font-family:
|
|
31
|
+
font-family: Vazirmatn;
|
|
32
32
|
font-size: ${4.2};
|
|
33
33
|
font-weight: 700;
|
|
34
34
|
text-anchor: middle;
|
|
35
35
|
dominant-baseline: middle;
|
|
36
36
|
|
|
37
37
|
`,
|
|
38
|
+
center: `
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: space-evenly;
|
|
42
|
+
`,
|
|
43
|
+
title: `
|
|
44
|
+
font: 2em Vazirmatn;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
margin: 0rem 0em 0em 0em;
|
|
47
|
+
`,
|
|
48
|
+
side: `
|
|
49
|
+
font: 1.5rem Vazirmatn;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
margin: 0rem 0em 0em 0em;
|
|
52
|
+
`,
|
|
53
|
+
red:`color: red;`,
|
|
54
|
+
blue: `color: blue;`,
|
|
55
|
+
border:`border: 1px solid green;`,
|
|
38
56
|
}
|
|
39
57
|
}
|
|
40
58
|
|
|
@@ -249,6 +249,8 @@ export default class Tympanogram {
|
|
|
249
249
|
this.chart.querySelector(`text[name="SC"]`).innerHTML = SC || "-";
|
|
250
250
|
this.chart.querySelector(`text[name="G"]`).innerHTML = G || "-";
|
|
251
251
|
// پاک کردن منحنی قبلی از کانتینر جاری
|
|
252
|
+
// console.log(this.chart.querySelector(`path[name="curve"]`));
|
|
253
|
+
|
|
252
254
|
this.chart.querySelector(`path[name="curve"]`)?.remove();
|
|
253
255
|
// رسم منحنی
|
|
254
256
|
this.drawCurve(data);
|
|
@@ -333,7 +335,7 @@ export default class Tympanogram {
|
|
|
333
335
|
let color = (this.side == "R") ? "red" : "blue";
|
|
334
336
|
let path = document.createElementNS(svgNS, "path");
|
|
335
337
|
path.setAttribute("fill", "none");
|
|
336
|
-
path.setAttribute("
|
|
338
|
+
path.setAttribute("name", "curve");
|
|
337
339
|
path.setAttribute("stroke", color);
|
|
338
340
|
path.setAttribute("stroke-width", "0.5px");
|
|
339
341
|
path.setAttribute(
|
|
@@ -374,4 +376,46 @@ export default class Tympanogram {
|
|
|
374
376
|
return (compliance.max - c) * (complianceAxiosLength.mm / complianceAxiosLength.ml)
|
|
375
377
|
}
|
|
376
378
|
}
|
|
379
|
+
|
|
380
|
+
// ایجاد اینپوتهای کاربر در کانتینر چارت
|
|
381
|
+
createUserInput({ container }) {
|
|
382
|
+
// استایل دهی نسبی به کانتینر
|
|
383
|
+
container.style.position = 'relative'
|
|
384
|
+
// ایجاد یک المنت اینپوت
|
|
385
|
+
let input = document.createElement('input')
|
|
386
|
+
input.name = 'SAT'
|
|
387
|
+
input.type = 'text'
|
|
388
|
+
input.maxLength = 4
|
|
389
|
+
input.autocomplete = 'off'
|
|
390
|
+
input.placeholder = '---'
|
|
391
|
+
const width = 70 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
392
|
+
const height = 25 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
393
|
+
let style = `
|
|
394
|
+
margin: 0;
|
|
395
|
+
padding: 0;
|
|
396
|
+
text-align: center;
|
|
397
|
+
font-size: 24px;
|
|
398
|
+
font-weight: bold;
|
|
399
|
+
color: crimson;
|
|
400
|
+
position: absolute;
|
|
401
|
+
width: ${width}px;
|
|
402
|
+
height: ${height}px;
|
|
403
|
+
border: none;
|
|
404
|
+
`
|
|
405
|
+
input.style = style
|
|
406
|
+
// آماده سازی اولین نود اینپوت از داکیومنت و سپس ساختن بقیه نودها از روی آن
|
|
407
|
+
const firstInput = input // نگهداری اولین اینپوت برای برگشت و فوکوس کردن بهش
|
|
408
|
+
let inputDims = this.inputDims
|
|
409
|
+
input.style.color = (this.side === 'R') ? 'crimson' : 'blue';
|
|
410
|
+
|
|
411
|
+
inputDims.forEach(dims => {
|
|
412
|
+
input.style.left = dims.x - width / 2 + 'px'
|
|
413
|
+
input.style.top = dims.y - height / 2 + 'px'
|
|
414
|
+
input.setAttribute('name', dims.name)
|
|
415
|
+
container.appendChild(input)
|
|
416
|
+
input = input.cloneNode() // در آخر یک المنت اضافه ایجاد شده است - باگ بی آزار
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
firstInput.focus()
|
|
420
|
+
}
|
|
377
421
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { BaseComponent } from "../core/BaseComponent.js";
|
|
2
|
+
import Tympanogram from "../Tympanogram/Tympanogram";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class TympanogramUI extends BaseComponent {
|
|
6
|
+
constructor(selector, props = {}) {
|
|
7
|
+
super(selector, props);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
render() {
|
|
11
|
+
this.element.innerHTML = `
|
|
12
|
+
<h1 class="center">Tympanograms</h1>
|
|
13
|
+
<div class="center">
|
|
14
|
+
<div>
|
|
15
|
+
<h2 class="center red">Right</h2>
|
|
16
|
+
<section id="r-tympanogram" style="position: relative;">
|
|
17
|
+
<input type="text" name="type" maxlength="4" placeholder="---" autocomplete="off" />
|
|
18
|
+
</section>
|
|
19
|
+
<section name="r-tympanogram">
|
|
20
|
+
<p>Curve settings:</p>
|
|
21
|
+
<input type="range" id="cp" name="cp" min="10" max="150" value="70" step="5" />
|
|
22
|
+
<label for="cp">cp</label>
|
|
23
|
+
<input type="range" id="cpp" name="cpp" min="1" max="10" value="5" step="1" />
|
|
24
|
+
<label for="cpp">cpp</label>
|
|
25
|
+
<div>
|
|
26
|
+
<input type="checkbox" name="extra-sc" id="r-extra-sc">
|
|
27
|
+
<label for="r-extra-sc">Extra SC</label>
|
|
28
|
+
</div>
|
|
29
|
+
<div>
|
|
30
|
+
<input type="checkbox" name="compensated" id="r-compensated">
|
|
31
|
+
<label for="r-compensated">Compensated</label>
|
|
32
|
+
</div>
|
|
33
|
+
</section>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div>
|
|
37
|
+
<h2 class="center blue">Left</h2>
|
|
38
|
+
<section id="l-tympanogram" style="position: relative;">
|
|
39
|
+
<input type="text" name="type" maxlength="4" placeholder="---" autocomplete="off" />
|
|
40
|
+
</section>
|
|
41
|
+
<section name="l-tympanogram">
|
|
42
|
+
<p>Curve settings:</p>
|
|
43
|
+
<input type="range" id="cp" name="cp" min="10" max="150" value="70" step="5" />
|
|
44
|
+
<label for="cp">cp</label>
|
|
45
|
+
<input type="range" id="cpp" name="cpp" min="1" max="10" value="5" step="1" />
|
|
46
|
+
<label for="cpp">cpp</label>
|
|
47
|
+
<div>
|
|
48
|
+
<input type="checkbox" name="extra-sc" id="l-extra-sc">
|
|
49
|
+
<label for="l-extra-sc">Extra SC</label>
|
|
50
|
+
</div>
|
|
51
|
+
<div>
|
|
52
|
+
<input type="checkbox" name="compensated" id="l-compensated">
|
|
53
|
+
<label for="l-compensated">Compensated</label>
|
|
54
|
+
</section>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
`;
|
|
58
|
+
let dims = {
|
|
59
|
+
"name": "RTympanogram",
|
|
60
|
+
"w": 100,
|
|
61
|
+
"h": 60,
|
|
62
|
+
"margin": {
|
|
63
|
+
"left": 2,
|
|
64
|
+
"top": 0,
|
|
65
|
+
"right": 2,
|
|
66
|
+
"bottom": 0
|
|
67
|
+
},
|
|
68
|
+
"display": "inline",
|
|
69
|
+
"width": 100 * 6,
|
|
70
|
+
"height": 60 * 6,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
let data = {
|
|
74
|
+
type: "An",
|
|
75
|
+
ECV: '1.30',
|
|
76
|
+
SC: '0.80',
|
|
77
|
+
MEP: '-130',
|
|
78
|
+
G: 0.2,
|
|
79
|
+
expanded: false, // by default is false for expand pressure from -600 to +400
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let cp = 70, cpp = 5, extraCompliance, compensated
|
|
84
|
+
|
|
85
|
+
const width = 50 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
86
|
+
const height = 25 // به دست آوردن پهنای اینپوت برای محاسبه مختصات نقطه مرکزش
|
|
87
|
+
|
|
88
|
+
let style = `
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding: 0;
|
|
91
|
+
text-align: center;
|
|
92
|
+
font-size: 22px;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
color: crimson;
|
|
95
|
+
position: absolute;
|
|
96
|
+
width: ${width}px;
|
|
97
|
+
height: ${height}px;
|
|
98
|
+
border: none;
|
|
99
|
+
`
|
|
100
|
+
insertInputs({ containerID: 'r-tympanogram', side: 'R', dims, style }).focus()
|
|
101
|
+
|
|
102
|
+
insertInputs({ containerID: 'l-tympanogram', side: 'L', dims, style })
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
function insertInputs({ containerID, side, dims, style }) {
|
|
106
|
+
let container = document.getElementById(containerID)
|
|
107
|
+
const tympanogram = new Tympanogram({ container, dims, side })
|
|
108
|
+
tympanogram.update(data)
|
|
109
|
+
|
|
110
|
+
let input = container.querySelector('[name=type]')
|
|
111
|
+
const firstInput = input // اولین اینپوت
|
|
112
|
+
|
|
113
|
+
let inputDims = tympanogram.inputDims
|
|
114
|
+
input.style = style
|
|
115
|
+
input.style.color = (side === 'R') ? 'crimson' : 'blue';
|
|
116
|
+
input.style.left = inputDims[0].x - width / 2 + 'px'
|
|
117
|
+
input.style.top = inputDims[0].y - height / 2 + 'px'
|
|
118
|
+
inputDims.shift() // حذف اولین عنصر آرایه بخاط اینکه استفاده شد در نود بالایی
|
|
119
|
+
|
|
120
|
+
inputDims.forEach(dims => {
|
|
121
|
+
input = input.cloneNode()
|
|
122
|
+
input.style.left = dims.x - width / 2 + 'px'
|
|
123
|
+
input.style.top = dims.y - height / 2 + 'px'
|
|
124
|
+
input.setAttribute('name', dims.name)
|
|
125
|
+
container.appendChild(input)
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
container = document.querySelector(`[name=${containerID}]`)
|
|
129
|
+
container.querySelector("[name=compensated]").addEventListener("input", e => {
|
|
130
|
+
compensated = e.target.checked
|
|
131
|
+
console.log(e.target.checked);
|
|
132
|
+
dims = { ...dims, compensated }
|
|
133
|
+
tympanogram.draw({ dims })
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
container.querySelector("[name=extra-sc]").addEventListener("input", e => {
|
|
137
|
+
extraCompliance = e.target.checked
|
|
138
|
+
console.log(e.target.checked);
|
|
139
|
+
dims = { ...dims, extraCompliance }
|
|
140
|
+
tympanogram.draw({ dims })
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
container.querySelector("#cp").addEventListener("input", e => {
|
|
144
|
+
cp = e.target.value
|
|
145
|
+
console.log(cp);
|
|
146
|
+
data = { ...data, cp }
|
|
147
|
+
tympanogram.update(data)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
container.querySelector("#cpp").addEventListener("input", e => {
|
|
151
|
+
cpp = e.target.value
|
|
152
|
+
console.log(cpp);
|
|
153
|
+
data = { ...data, cpp }
|
|
154
|
+
tympanogram.update(data)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
return firstInput
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
bindEvents() {
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
}
|
package/src/Tympanogram/test.js
CHANGED
|
@@ -64,7 +64,7 @@ document.querySelector("#extra-sc").addEventListener("input", e => {
|
|
|
64
64
|
document.querySelector("#cp")
|
|
65
65
|
.addEventListener("input", e => {
|
|
66
66
|
cp = e.target.value
|
|
67
|
-
console.log(cp);
|
|
67
|
+
// console.log(cp);
|
|
68
68
|
data = { ...data, cp }
|
|
69
69
|
|
|
70
70
|
RTympanogram.update(data)
|
package/src/Tympanogram/units.js
CHANGED
|
@@ -21,7 +21,7 @@ const units = {
|
|
|
21
21
|
compensated: false, // default is false | true
|
|
22
22
|
|
|
23
23
|
styles: {
|
|
24
|
-
svg: 'user-select: none; direction: ltr !important; font-family:
|
|
24
|
+
svg: 'user-select: none; direction: ltr !important; font-family: Vazirmatn;',
|
|
25
25
|
pressure: `
|
|
26
26
|
font-size: 3;
|
|
27
27
|
text-anchor: middle;
|
package/src/main.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/main.js - Your app's entry point
|
|
4
4
|
import { BaseComponent } from './core/BaseComponent.js';
|
|
5
|
-
import { SpeechUI } from './components/index.js';
|
|
5
|
+
import { AudiogramUI, ReflexUI, SpeechUI, TympanogramUI } from './components/index.js';
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
// Main App component that orchestrates all other components
|
|
8
9
|
class App extends BaseComponent {
|
|
@@ -14,7 +15,10 @@ class App extends BaseComponent {
|
|
|
14
15
|
render() {
|
|
15
16
|
// Main layout structure
|
|
16
17
|
this.element.innerHTML = `
|
|
18
|
+
<div id="audiograms"></div>
|
|
17
19
|
<div id="speechs"></div>
|
|
20
|
+
<div id="tympanograms"></div>
|
|
21
|
+
<div id="reflexes"></div>
|
|
18
22
|
`;
|
|
19
23
|
}
|
|
20
24
|
|
|
@@ -25,8 +29,10 @@ class App extends BaseComponent {
|
|
|
25
29
|
|
|
26
30
|
initializeComponents() {
|
|
27
31
|
// Initialize Header component
|
|
28
|
-
this.components.speechUI = this.createChild(SpeechUI, '#speechs', {
|
|
29
|
-
});
|
|
32
|
+
this.components.speechUI = this.createChild(SpeechUI, '#speechs', {});
|
|
33
|
+
// this.components.reflexUI = this.createChild(ReflexUI, '#reflexes', {});
|
|
34
|
+
// this.components.TympanogramUI = this.createChild(TympanogramUI, '#tympanograms', {});
|
|
35
|
+
// this.components.audiogramUI = this.createChild(AudiogramUI, '#audiograms', {});
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
|
|
@@ -39,8 +45,8 @@ const app = new App('#app');
|
|
|
39
45
|
document.addEventListener('DOMContentLoaded', () => {
|
|
40
46
|
|
|
41
47
|
app.mount();
|
|
42
|
-
|
|
43
|
-
console.log(app.components
|
|
48
|
+
|
|
49
|
+
console.log(app.components);
|
|
44
50
|
|
|
45
51
|
|
|
46
52
|
console.log('Audiolog app initialized successfully!');
|
package/style-font.css
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* این فقط در تست پکیج در فایل اصلی لینک یا ایمپورت میشه با ارسالش به پروژه خطای کنسول پیدا میکنیم */
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'Vazirmatn';
|
|
5
|
+
src: url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2 supports variations'),
|
|
6
|
+
url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2-variations');
|
|
7
|
+
font-weight: 100 900;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-display: swap;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
|
|
3
|
+
@font-face {
|
|
4
|
+
font-family: 'Vazirmatn';
|
|
5
|
+
src: url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2 supports variations'),
|
|
6
|
+
url('fonts/webfonts/Vazirmatn[wght].woff2') format('woff2-variations');
|
|
7
|
+
font-weight: 100 900;
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-display: swap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
font-family: Vazirmatn;
|
|
14
|
+
}
|