hayun-vite 0.0.3 → 0.1.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/styles-test.css +90 -90
- package/assets/styles.css +90 -90
- package/data/formData1.js +42 -42
- package/data/officesObjStore.js +56 -56
- package/data/patientsObjStore.js +73 -73
- package/data/sampleData.js +94 -94
- package/index.js +11 -11
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +194 -197
- package/src/Audiogram/dims.js +83 -83
- package/src/Form/Form.js +268 -276
- package/src/Form/Form_N.js +158 -158
- package/src/Form/Forms-Test.html +124 -124
- package/src/Form/Forms.js +121 -134
- package/src/Form/Header.js +91 -91
- package/src/Form/Reflex.js +141 -141
- package/src/Form/Sections.js +71 -71
- package/src/Form/Speech.js +132 -132
- package/src/Form/TextBox.js +66 -82
- package/src/Form/Tympanogram.js +355 -355
- package/src/Form/formStyles.css +122 -122
- package/src/Form/globalinfo.js +68 -68
- package/src/Form/grid/drawGrid.js +84 -84
- package/src/Form/grid/hideGrid.js +8 -8
- package/src/Form/printForm.js +122 -75
- package/src/Form/templates/combo.js +248 -248
- package/src/Form/templates/dims.js +204 -204
- package/src/Form/templates/rasaAud.js +287 -287
- package/src/Symbol/Symbols.js +29 -29
- package/src/Symbol/createSymbolSVG.js +240 -240
- package/src/Symbol/getAllSymbolsSVG.js +21 -21
- package/src/Symbol/insertSymbol.js +10 -10
- package/src/Symbol/symbolChart.js +47 -47
- package/src/common/putLine.js +16 -16
- package/src/common/putPoint.js +12 -12
- package/src/common/putRect.js +13 -13
- package/src/common/putText.js +17 -16
- package/src/common/putTopLayer.js +17 -17
- package/src/main.js +88 -87
- package/src/note.css +62 -0
- package/src/style.css +189 -156
- package/src/note.html +0 -1
package/src/Form/Forms.js
CHANGED
@@ -1,135 +1,122 @@
|
|
1
|
-
const svgNS = "http://www.w3.org/2000/svg";
|
2
|
-
|
3
|
-
import printForm from "./printForm.js";
|
4
|
-
import Form from "./Form.js";
|
5
|
-
import combo from "./templates/combo.js"; // این در حقیقیت یک تمپلت هست
|
6
|
-
import rasaAud from "./templates/rasaAud.js";
|
7
|
-
import rasaAudImage from './templates/rasaAud.png'
|
8
|
-
//
|
9
|
-
import '../
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
div
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
this.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
this.forms
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
this.forms[0].form.style.display = '
|
49
|
-
|
50
|
-
|
51
|
-
this.selectedForm = this.forms[
|
52
|
-
|
53
|
-
|
54
|
-
});
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
this.
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
//
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
//
|
112
|
-
//
|
113
|
-
//
|
114
|
-
//
|
115
|
-
//
|
116
|
-
//
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
button.innerHTML = text;
|
123
|
-
|
124
|
-
// button.addEventListener('mouseenter', () => {
|
125
|
-
// button.style.backgroundColor = 'rgb(54, 115, 115)'; // Change color on hover
|
126
|
-
// });
|
127
|
-
// button.addEventListener('mouseleave', () => {
|
128
|
-
// button.style.backgroundColor = 'rgb(0, 149, 149)'; // Revert color when not hovering
|
129
|
-
// });
|
130
|
-
|
131
|
-
container.appendChild(button);
|
132
|
-
return button;
|
133
|
-
|
134
|
-
}
|
1
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
2
|
+
|
3
|
+
import printForm from "./printForm.js";
|
4
|
+
import Form from "./Form.js";
|
5
|
+
import combo from "./templates/combo.js"; // این در حقیقیت یک تمپلت هست
|
6
|
+
import rasaAud from "./templates/rasaAud.js";
|
7
|
+
import rasaAudImage from './templates/rasaAud.png'
|
8
|
+
// خط کد زیر لازم هست
|
9
|
+
import '../fonts/Vazirmatn-Regular.woff2'
|
10
|
+
import '../style.css'
|
11
|
+
|
12
|
+
// کلاس جدید که فرمهای مختلف را نمایش میدهد
|
13
|
+
export default class Forms {
|
14
|
+
constructor({ assets, container } = {}) {
|
15
|
+
// ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
|
16
|
+
const div = document.createElement('div');
|
17
|
+
div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
|
18
|
+
container.appendChild(div);
|
19
|
+
// اضافه کردن دکمه به دیو فرم
|
20
|
+
let className = 'persian';
|
21
|
+
const btn =[];
|
22
|
+
btn[0] = this.putButton({ container: div, text: rasaAud.label, className });
|
23
|
+
btn[1] = this.putButton({ container: div, text: combo.label, className });
|
24
|
+
const printBtn = this.putButton({ container: div, text: 'Print', id: 'print' });
|
25
|
+
|
26
|
+
// یک دیو تعریف میکنیم که سمت ادیولاگ برای تعریف لیستنر استفاده میشود
|
27
|
+
this.div = document.createElement('div'); // این بخش فقط شامل بخش اسویجی هست
|
28
|
+
container.appendChild(this.div)
|
29
|
+
|
30
|
+
this.forms = []; // آرایه آبجکت های فرم های مختلف
|
31
|
+
this.forms.push(new Form({ container: this.div, template: rasaAud, image: rasaAudImage }));
|
32
|
+
this.forms.push(new Form({ container: this.div, template: combo }));
|
33
|
+
|
34
|
+
// انتخاب فرم پیشفرض
|
35
|
+
this.forms[1].form.style.display = 'block';
|
36
|
+
this.selectedForm = this.forms[1]
|
37
|
+
btn[1].style.backgroundColor = ' #1c15e1'
|
38
|
+
|
39
|
+
|
40
|
+
// تعریف رویداد دکمه چاپ فرم نمایشی
|
41
|
+
printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) })
|
42
|
+
|
43
|
+
btn[0].addEventListener('click', () => {
|
44
|
+
this.forms[1].form.style.display = 'none'
|
45
|
+
btn[1].style.backgroundColor = ' #7472e2'
|
46
|
+
|
47
|
+
// this.forms[2].form.style.display = 'none'
|
48
|
+
this.forms[0].form.style.display = 'block';
|
49
|
+
btn[0].style.backgroundColor = ' #1c15e1'
|
50
|
+
|
51
|
+
this.selectedForm = this.forms[0];
|
52
|
+
this.update(this.allData);
|
53
|
+
|
54
|
+
});
|
55
|
+
|
56
|
+
btn[1].addEventListener('click', () => {
|
57
|
+
this.forms[0].form.style.display = 'none'
|
58
|
+
btn[0].style.backgroundColor = ' #7472e2'
|
59
|
+
|
60
|
+
// this.forms[2].form.style.display = 'none'
|
61
|
+
this.forms[1].form.style.display = 'block';
|
62
|
+
btn[1].style.backgroundColor = ' #1c15e1'
|
63
|
+
|
64
|
+
this.selectedForm = this.forms[1];
|
65
|
+
// آپدیت فرم انتخاب شده
|
66
|
+
this.update(this.allData);
|
67
|
+
});
|
68
|
+
|
69
|
+
// btn3.addEventListener('click', () => {
|
70
|
+
// this.forms[0].form.style.display = 'none'
|
71
|
+
// this.forms[1].form.style.display = 'none'
|
72
|
+
// this.forms[2].form.style.display = 'block';
|
73
|
+
// this.selectedForm = this.forms[2]
|
74
|
+
// // آپدیت فرم انتخاب شده
|
75
|
+
// this.update(this.allData);
|
76
|
+
|
77
|
+
// });
|
78
|
+
// for Develop
|
79
|
+
this.event();
|
80
|
+
}
|
81
|
+
|
82
|
+
event() {
|
83
|
+
this.div.addEventListener('click', (e) => {
|
84
|
+
console.log(e.target);
|
85
|
+
})
|
86
|
+
}
|
87
|
+
// این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
|
88
|
+
update({ data, officeData, patientData, sessionIndex = 0 }) {
|
89
|
+
// ذخیره کل دیتا برای استفاده داخلی آپدیت فرم انتخاب شده
|
90
|
+
this.allData = { data, officeData, patientData, sessionIndex }
|
91
|
+
this.selectedForm.update({ data, officeData, patientData, sessionIndex })
|
92
|
+
}
|
93
|
+
// ایجاد دکمه تاگل خطوط مرزی فرم و سکشن و المان
|
94
|
+
toggleBorders({ activeForm, container = 'form' }) {
|
95
|
+
const borders = activeForm.querySelectorAll(`[data-name="${container}-border"]`);
|
96
|
+
// آبجکت نگهداری رنگ بوردرها
|
97
|
+
const color = { form: 'black', section: 'blue', element: 'green' }
|
98
|
+
borders.forEach(border => {
|
99
|
+
// console.log(border.style.stroke);
|
100
|
+
border.style.stroke = (border.style.stroke === 'transparent') ? color[container] : 'transparent';
|
101
|
+
})
|
102
|
+
}
|
103
|
+
// توابع داخلی ایجاد دکمه و لینک های بالای فرم
|
104
|
+
putButton({ container, id, text, className }) {
|
105
|
+
|
106
|
+
const button = document.createElement('button');
|
107
|
+
button.setAttribute('id', id);
|
108
|
+
className && button.setAttribute('class', className);
|
109
|
+
button.innerHTML = text;
|
110
|
+
|
111
|
+
// button.addEventListener('mouseenter', () => {
|
112
|
+
// button.style.backgroundColor = 'rgb(54, 115, 115)'; // Change color on hover
|
113
|
+
// });
|
114
|
+
// button.addEventListener('mouseleave', () => {
|
115
|
+
// button.style.backgroundColor = 'rgb(0, 149, 149)'; // Revert color when not hovering
|
116
|
+
// });
|
117
|
+
|
118
|
+
container.appendChild(button);
|
119
|
+
return button;
|
120
|
+
|
121
|
+
}
|
135
122
|
}
|
package/src/Form/Header.js
CHANGED
@@ -1,92 +1,92 @@
|
|
1
|
-
import putLine from "../common/putLine.js";
|
2
|
-
import putRect from "../common/putRect.js";
|
3
|
-
import putText from "../common/putText.js";
|
4
|
-
const svgNS = "http://www.w3.org/2000/svg";
|
5
|
-
|
6
|
-
export default class Header {
|
7
|
-
constructor({ container }) {
|
8
|
-
this.container = container;
|
9
|
-
}
|
10
|
-
|
11
|
-
draw({ dims, stroke = true }) {
|
12
|
-
|
13
|
-
this.inputs = dims.inputs
|
14
|
-
let value;
|
15
|
-
let width = dims.width;
|
16
|
-
let height = dims.height;
|
17
|
-
let x = dims.margin.left;
|
18
|
-
let y = dims.margin.top;
|
19
|
-
|
20
|
-
const svg = document.createElementNS(svgNS, "svg");
|
21
|
-
svg.setAttribute("x", x);
|
22
|
-
svg.setAttribute("y", y);
|
23
|
-
svg.setAttribute("width", width);
|
24
|
-
svg.setAttribute("height", height);
|
25
|
-
svg.setAttribute('style', 'direction: rtl !important; user-select: none;')
|
26
|
-
|
27
|
-
// Logo
|
28
|
-
let image = document.createElementNS(svgNS, "image");
|
29
|
-
image.setAttribute("data-name", "officeLogo")
|
30
|
-
image.setAttribute("width", "17");
|
31
|
-
image.setAttribute("height", "17");
|
32
|
-
image.setAttribute("x", width - 16);
|
33
|
-
image.setAttribute("y", 0.5);
|
34
|
-
svg.appendChild(image);
|
35
|
-
|
36
|
-
let style = `
|
37
|
-
user-select: none;
|
38
|
-
direction: rtl;
|
39
|
-
/* text-align: center; */
|
40
|
-
font-family: vazirmatn;
|
41
|
-
font-size: 0.8mm;
|
42
|
-
font-weight: bolder;
|
43
|
-
text-anchor: start; /*تراز افقی*/
|
44
|
-
dominant-baseline: auto; /* تراز عمودی*/
|
45
|
-
`;
|
46
|
-
|
47
|
-
// اگر مقدار استروک درست بود لیبل ها را چاپ کن
|
48
|
-
if (!dims.hideContext) {
|
49
|
-
dims.elements.forEach(element => {
|
50
|
-
switch (element.type) {
|
51
|
-
case 'text':
|
52
|
-
({ x, y, value } = element);
|
53
|
-
|
54
|
-
putText({ container: svg, value, x, y, style: style });
|
55
|
-
break;
|
56
|
-
case 'line':
|
57
|
-
let { x1, y1, x2, y2 } = element;
|
58
|
-
putLine({ container: svg, x1, y1, x2, y2 });
|
59
|
-
break;
|
60
|
-
}
|
61
|
-
});
|
62
|
-
}
|
63
|
-
|
64
|
-
style = `
|
65
|
-
font-family: Arial, Helvetica, sans-serif !important;
|
66
|
-
font-size: 0.8mm;
|
67
|
-
font-weight: bold;
|
68
|
-
text-anchor: start; /*تراز افقی*/
|
69
|
-
/* dominant-baseline: middle; /* تراز عمودی*/
|
70
|
-
`;
|
71
|
-
// محل اینپوتهای دیتا
|
72
|
-
let name;
|
73
|
-
dims.inputs.forEach(input => {
|
74
|
-
({ name, x, y } = input);
|
75
|
-
putText({ container: svg, x, y, style: style, name });
|
76
|
-
});
|
77
|
-
|
78
|
-
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
79
|
-
const borderRect = putRect({ container: svg, x: 0, y: 0, width, height, name: "header" });;
|
80
|
-
this.borderRect = borderRect;
|
81
|
-
this.container.appendChild(svg);
|
82
|
-
// this.header = svg;
|
83
|
-
}
|
84
|
-
|
85
|
-
update(data) {
|
86
|
-
this.container.querySelector("[data-name=officeName]").innerHTML = data?.officeName || "";
|
87
|
-
this.container.querySelector("[data-name=date]").innerHTML = data?.createDate || "";
|
88
|
-
this.container.querySelector("[data-name=officeLogo]").setAttribute("href", data?.officeLogo || "");
|
89
|
-
|
90
|
-
}
|
91
|
-
|
1
|
+
import putLine from "../common/putLine.js";
|
2
|
+
import putRect from "../common/putRect.js";
|
3
|
+
import putText from "../common/putText.js";
|
4
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
5
|
+
|
6
|
+
export default class Header {
|
7
|
+
constructor({ container }) {
|
8
|
+
this.container = container;
|
9
|
+
}
|
10
|
+
|
11
|
+
draw({ dims, stroke = true }) {
|
12
|
+
|
13
|
+
this.inputs = dims.inputs
|
14
|
+
let value;
|
15
|
+
let width = dims.width;
|
16
|
+
let height = dims.height;
|
17
|
+
let x = dims.margin.left;
|
18
|
+
let y = dims.margin.top;
|
19
|
+
|
20
|
+
const svg = document.createElementNS(svgNS, "svg");
|
21
|
+
svg.setAttribute("x", x);
|
22
|
+
svg.setAttribute("y", y);
|
23
|
+
svg.setAttribute("width", width);
|
24
|
+
svg.setAttribute("height", height);
|
25
|
+
svg.setAttribute('style', 'direction: rtl !important; user-select: none;')
|
26
|
+
|
27
|
+
// Logo
|
28
|
+
let image = document.createElementNS(svgNS, "image");
|
29
|
+
image.setAttribute("data-name", "officeLogo")
|
30
|
+
image.setAttribute("width", "17");
|
31
|
+
image.setAttribute("height", "17");
|
32
|
+
image.setAttribute("x", width - 16);
|
33
|
+
image.setAttribute("y", 0.5);
|
34
|
+
svg.appendChild(image);
|
35
|
+
|
36
|
+
let style = `
|
37
|
+
user-select: none;
|
38
|
+
direction: rtl;
|
39
|
+
/* text-align: center; */
|
40
|
+
font-family: vazirmatn;
|
41
|
+
font-size: 0.8mm;
|
42
|
+
font-weight: bolder;
|
43
|
+
text-anchor: start; /*تراز افقی*/
|
44
|
+
dominant-baseline: auto; /* تراز عمودی*/
|
45
|
+
`;
|
46
|
+
|
47
|
+
// اگر مقدار استروک درست بود لیبل ها را چاپ کن
|
48
|
+
if (!dims.hideContext) {
|
49
|
+
dims.elements.forEach(element => {
|
50
|
+
switch (element.type) {
|
51
|
+
case 'text':
|
52
|
+
({ x, y, value } = element);
|
53
|
+
|
54
|
+
putText({ container: svg, value, x, y, style: style });
|
55
|
+
break;
|
56
|
+
case 'line':
|
57
|
+
let { x1, y1, x2, y2 } = element;
|
58
|
+
putLine({ container: svg, x1, y1, x2, y2 });
|
59
|
+
break;
|
60
|
+
}
|
61
|
+
});
|
62
|
+
}
|
63
|
+
|
64
|
+
style = `
|
65
|
+
font-family: Arial, Helvetica, sans-serif !important;
|
66
|
+
font-size: 0.8mm;
|
67
|
+
font-weight: bold;
|
68
|
+
text-anchor: start; /*تراز افقی*/
|
69
|
+
/* dominant-baseline: middle; /* تراز عمودی*/
|
70
|
+
`;
|
71
|
+
// محل اینپوتهای دیتا
|
72
|
+
let name;
|
73
|
+
dims.inputs.forEach(input => {
|
74
|
+
({ name, x, y } = input);
|
75
|
+
putText({ container: svg, x, y, style: style, name });
|
76
|
+
});
|
77
|
+
|
78
|
+
// مربع احاطهکننده کل جدول برای راهنمای توسعه
|
79
|
+
const borderRect = putRect({ container: svg, x: 0, y: 0, width, height, name: "header" });;
|
80
|
+
this.borderRect = borderRect;
|
81
|
+
this.container.appendChild(svg);
|
82
|
+
// this.header = svg;
|
83
|
+
}
|
84
|
+
|
85
|
+
update(data) {
|
86
|
+
this.container.querySelector("[data-name=officeName]").innerHTML = data?.officeName || "";
|
87
|
+
this.container.querySelector("[data-name=date]").innerHTML = data?.createDate || "";
|
88
|
+
this.container.querySelector("[data-name=officeLogo]").setAttribute("href", data?.officeLogo || "");
|
89
|
+
|
90
|
+
}
|
91
|
+
|
92
92
|
}
|