hayun-vite 0.0.3 → 0.1.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.
Files changed (42) hide show
  1. package/assets/styles-test.css +90 -90
  2. package/assets/styles.css +90 -90
  3. package/data/formData1.js +42 -42
  4. package/data/officesObjStore.js +56 -56
  5. package/data/patientsObjStore.js +73 -73
  6. package/data/sampleData.js +94 -94
  7. package/index.js +11 -11
  8. package/package.json +1 -1
  9. package/src/Audiogram/Audiogram.js +194 -197
  10. package/src/Audiogram/dims.js +83 -83
  11. package/src/Form/Form.js +268 -276
  12. package/src/Form/Form_N.js +158 -158
  13. package/src/Form/Forms-Test.html +124 -124
  14. package/src/Form/Forms.js +121 -134
  15. package/src/Form/Header.js +91 -91
  16. package/src/Form/Reflex.js +141 -141
  17. package/src/Form/Sections.js +71 -71
  18. package/src/Form/Speech.js +132 -132
  19. package/src/Form/TextBox.js +66 -82
  20. package/src/Form/Tympanogram.js +355 -355
  21. package/src/Form/formStyles.css +122 -122
  22. package/src/Form/globalinfo.js +68 -68
  23. package/src/Form/grid/drawGrid.js +84 -84
  24. package/src/Form/grid/hideGrid.js +8 -8
  25. package/src/Form/printForm.js +122 -75
  26. package/src/Form/templates/combo.js +248 -248
  27. package/src/Form/templates/dims.js +204 -204
  28. package/src/Form/templates/rasaAud.js +287 -287
  29. package/src/Symbol/Symbols.js +29 -29
  30. package/src/Symbol/createSymbolSVG.js +240 -240
  31. package/src/Symbol/getAllSymbolsSVG.js +21 -21
  32. package/src/Symbol/insertSymbol.js +10 -10
  33. package/src/Symbol/symbolChart.js +47 -47
  34. package/src/common/putLine.js +16 -16
  35. package/src/common/putPoint.js +12 -12
  36. package/src/common/putRect.js +13 -13
  37. package/src/common/putText.js +17 -16
  38. package/src/common/putTopLayer.js +17 -17
  39. package/src/main.js +88 -87
  40. package/src/note.css +62 -0
  41. package/src/style.css +152 -157
  42. 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
- // import '../fonts/Vazirmatn-Regular.woff2'
9
- import '../style.css'
10
-
11
- // کلاس جدید که فرم‌های مختلف را نمایش میدهد
12
- export default class Forms {
13
- constructor({ assets, container } = {}) {
14
- // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
15
- const div = document.createElement('div');
16
- div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
17
- container.appendChild(div);
18
- // اضافه کردن دکمه به دیو فرم
19
- const btn1 = this.putButton({ container: div, text: 'پرنده پرپر' });
20
- const btn2 = this.putButton({ container: div, text: combo.label });
21
- const printBtn = this.putButton({ container: div, text: 'Print', id: 'print' });
22
-
23
- // یک دیو تعریف میکنیم که سمت ادیولاگ برای تعریف لیستنر استفاده می‌شود
24
- this.div = document.createElement('div'); // این بخش فقط شامل بخش اس‌وی‌جی هست
25
- container.appendChild(this.div)
26
-
27
- this.forms = []; // آرایه آبجکت های فرم های مختلف
28
- this.forms.push(new Form({ container: this.div, template: rasaAud, image: rasaAudImage }));
29
- this.forms.push(new Form({ container: this.div, template: combo }));
30
-
31
- // انتخاب فرم پیش‌فرض
32
- this.forms[0].form.style.display = 'block';
33
- this.selectedForm = this.forms[0]
34
-
35
- // تعریف رویداد دکمه چاپ فرم نمایشی
36
- printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) })
37
-
38
- btn1.addEventListener('click', () => {
39
- this.forms[1].form.style.display = 'none'
40
- // this.forms[2].form.style.display = 'none'
41
- this.forms[0].form.style.display = 'block';
42
- this.selectedForm = this.forms[0];
43
- this.update(this.allData);
44
-
45
- });
46
-
47
- btn2.addEventListener('click', () => {
48
- this.forms[0].form.style.display = 'none'
49
- // this.forms[2].form.style.display = 'none'
50
- this.forms[1].form.style.display = 'block';
51
- this.selectedForm = this.forms[1];
52
- // آپدیت فرم انتخاب شده
53
- this.update(this.allData);
54
- });
55
-
56
- // btn3.addEventListener('click', () => {
57
- // this.forms[0].form.style.display = 'none'
58
- // this.forms[1].form.style.display = 'none'
59
- // this.forms[2].form.style.display = 'block';
60
- // this.selectedForm = this.forms[2]
61
- // // آپدیت فرم انتخاب شده
62
- // this.update(this.allData);
63
-
64
- // });
65
- // for Develop
66
- this.event();
67
- }
68
-
69
- event() {
70
- this.div.addEventListener('click', (e) => {
71
- console.log(e.target);
72
- })
73
- }
74
- // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
75
- update({ data, officeData, patientData, sessionIndex = 0 }) {
76
- // ذخیره کل دیتا برای استفاده داخلی آپدیت فرم انتخاب شده
77
- this.allData = { data, officeData, patientData, sessionIndex }
78
- this.selectedForm.update({ data, officeData, patientData, sessionIndex })
79
- }
80
- // ایجاد دکمه تاگل خطوط مرزی فرم و سکشن و المان
81
- toggleBorders({ activeForm, container = 'form' }) {
82
- const borders = activeForm.querySelectorAll(`[data-name="${container}-border"]`);
83
- // آبجکت نگهداری رنگ بوردرها
84
- const color = { form: 'black', section: 'blue', element: 'green' }
85
- borders.forEach(border => {
86
- // console.log(border.style.stroke);
87
- border.style.stroke = (border.style.stroke === 'transparent') ? color[container] : 'transparent';
88
- })
89
- }
90
- // توابع داخلی ایجاد دکمه و لینک های بالای فرم
91
- putButton({ container, id, text, }) {
92
- let style
93
- // style = `
94
- // background-color:rgb(0, 149, 149);
95
- // /* Green background */
96
- // border: none;
97
- // /* Remove borders */
98
- // color: white;
99
- // /* White text */
100
- // padding: 15px 32px;
101
- // /* Some padding */
102
- // text-align: center;
103
- // /* Centered text */
104
- // text-decoration: none;
105
- // /* Remove underline */
106
- // display: inline-block;
107
- // /* Make the button inline */
108
- // font-size: 16px;
109
- // /* Increase font size */
110
- // margin: 4px 2px;
111
- // /* Add some margin */
112
- // cursor: pointer;
113
- // /* Pointer cursor on hover */
114
- // border-radius: 8px;
115
- // /* Rounded corners */
116
- // transition: background-color 0.3s;
117
- // /* Smooth transition */
118
- // `;
119
- const button = document.createElement('button');
120
- button.setAttribute('id', id);
121
- button.setAttribute('style', style);
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 = 'button-form 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: 'چاپ', className });
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
  }
@@ -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
  }