hayun-vite 0.10.0 → 0.11.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.
Files changed (59) hide show
  1. package/assets/data/sampleData.js +10 -2
  2. package/assets/templates/mainTemplate.js +128 -0
  3. package/assets/templates/template_combo.js +50 -45
  4. package/package.json +1 -1
  5. package/public/fonts/Vazir-Black-UI.eot +0 -0
  6. package/public/fonts/Vazir-Black-UI.woff +0 -0
  7. package/public/fonts/Vazir-Black-UI.woff2 +0 -0
  8. package/public/fonts/Vazir-Bold-UI.eot +0 -0
  9. package/public/fonts/Vazir-Bold-UI.woff +0 -0
  10. package/public/fonts/Vazir-Bold-UI.woff2 +0 -0
  11. package/public/fonts/Vazir-Light-UI.eot +0 -0
  12. package/public/fonts/Vazir-Light-UI.woff +0 -0
  13. package/public/fonts/Vazir-Light-UI.woff2 +0 -0
  14. package/public/fonts/Vazir-Medium-UI.eot +0 -0
  15. package/public/fonts/Vazir-Medium-UI.woff +0 -0
  16. package/public/fonts/Vazir-Medium-UI.woff2 +0 -0
  17. package/public/fonts/Vazir-Regular-UI.eot +0 -0
  18. package/public/fonts/Vazir-Regular-UI.woff +0 -0
  19. package/public/fonts/Vazir-Regular-UI.woff2 +0 -0
  20. package/public/fonts/Vazir-Thin-UI.eot +0 -0
  21. package/public/fonts/Vazir-Thin-UI.woff +0 -0
  22. package/public/fonts/Vazir-Thin-UI.woff2 +0 -0
  23. package/src/Audiogram/Audiogram.js +43 -21
  24. package/src/Audiogram/Audiogram_100.js +499 -0
  25. package/src/Audiogram/Audiogram_box.js +483 -0
  26. package/src/Audiogram/dims.js +4 -80
  27. package/src/Audiogram/dims_100.js +51 -0
  28. package/src/Audiogram/dims_box.js +125 -0
  29. package/src/{Form → Box}/Box.js +26 -3
  30. package/src/Form/Form.js +8 -8
  31. package/src/Form/Form_N.js +194 -0
  32. package/src/Form/Forms.js +0 -2
  33. package/src/Form/Sections.js +0 -6
  34. package/src/Form/Sections_N.js +66 -0
  35. package/src/Form/printForm.js +57 -5
  36. package/src/{Form → Header}/Header.js +2 -5
  37. package/src/Header/Header_N.js +72 -0
  38. package/src/MultiText/MultiText.js +37 -0
  39. package/src/{Form/Reflex_N.js → Reflex/Reflex.js} +15 -3
  40. package/src/Reflex/units.js +65 -0
  41. package/src/{Form/Speech_N.js → Speech/Speech.js} +45 -28
  42. package/src/Speech/Speech_N.js +125 -0
  43. package/src/Speech/units.js +31 -0
  44. package/src/{Form → Tympanogram}/Tympanogram.js +37 -68
  45. package/src/Tympanogram/units.js +76 -0
  46. package/src/common/{putTextBox.js → putCell.js} +6 -6
  47. package/src/common/putG.js +10 -0
  48. package/src/common/putLine.js +1 -1
  49. package/src/common/putText.js +5 -4
  50. package/src/main.js +140 -19
  51. package/src/styles.css +63 -3
  52. package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
  53. package/assets/styles-test.css +0 -90
  54. package/assets/styles.css +0 -90
  55. package/src/Form/Reflex.js +0 -145
  56. package/src/Form/Speech.js +0 -121
  57. package/src/Form/formStyles.css +0 -117
  58. package/src/Form/globalinfo.js +0 -68
  59. package/src/note.html +0 -64
@@ -0,0 +1,72 @@
1
+ import putLine from "../common/putLine.js";
2
+ import putRect from "../common/putRect.js";
3
+ import putSVG from "../common/putSVG.js";
4
+ import putText from "../common/putText.js";
5
+ const svgNS = "http://www.w3.org/2000/svg";
6
+
7
+
8
+ export default class Header {
9
+ constructor({ box }) {
10
+ this.box = box;
11
+ this.container = box.container;
12
+ this.draw({ box })
13
+
14
+ }
15
+
16
+ draw({ box }) {
17
+ // همه چیز را توی کانتینر باکس آبجکت رسم کن
18
+ const { container, elements, width, height } = box
19
+
20
+ elements.forEach(element => {
21
+ const { name, value, x, y, style } = element;
22
+
23
+ switch (element.type) {
24
+ case 'label':
25
+ // const { value, x, y, style } = element
26
+ putText({ container, value, x, y, style })
27
+ break;
28
+ case 'input':
29
+ putText({ container, x, y, style, name });
30
+
31
+ break;
32
+ default:
33
+ break;
34
+ }
35
+
36
+ });
37
+
38
+
39
+
40
+
41
+ // Logo
42
+ let image = document.createElementNS(svgNS, "image");
43
+ image.setAttribute("data-name", "officeLogo")
44
+ image.setAttribute("width", "17");
45
+ image.setAttribute("height", height - 1);
46
+ image.setAttribute("x", width - 16);
47
+ image.setAttribute("y", 0.5);
48
+ this.container.appendChild(image);
49
+
50
+ this.update({ officeName: 'دفتر ارزیابی شنوایی و خدمات سمعک سروش' })
51
+
52
+
53
+ let style = `
54
+ user-select: none;
55
+ direction: rtl;
56
+ /* text-align: center; */
57
+ font-family: Vazir;
58
+ font-size: 0.8mm;
59
+ font-weight: bolder;
60
+ text-anchor: start; /*تراز افقی*/
61
+ dominant-baseline: auto; /* تراز عمودی*/
62
+ `;
63
+
64
+ // this.container.appendChild(svg);
65
+ }
66
+
67
+ update(data) {
68
+ this.container.querySelector("[data-name=officeName]").innerHTML = data?.officeName || "";
69
+ this.container.querySelector("[data-name=date]").innerHTML = data?.createDate || "";
70
+ this.container.querySelector("[data-name=officeLogo]").setAttribute("href", data?.officeLogo || "");
71
+ }
72
+ }
@@ -0,0 +1,37 @@
1
+ export default class MultiText {
2
+ constructor({ box }) {
3
+ this.box = box;
4
+ this.container = box.container;
5
+ // this.draw({ box })
6
+
7
+ }
8
+
9
+
10
+
11
+
12
+ draw({ box }) {
13
+ // همه چیز را توی کانتینر باکس آبجکت رسم کن
14
+ const { container, elements, width, height } = box
15
+ console.log(box);
16
+
17
+ elements.forEach(element => {
18
+ const { name, value, x, y, style } = element;
19
+
20
+ switch (element.type) {
21
+ case 'label':
22
+ // const { value, x, y, style } = element
23
+ putText({ container, value, x, y, style })
24
+ break;
25
+ case 'input':
26
+ putText({ container, x, y, style, name });
27
+
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+
33
+ });
34
+
35
+ }
36
+
37
+ }
@@ -1,7 +1,8 @@
1
1
  import putRect from "../common/putRect.js";
2
2
  import putSVG from "../common/putSVG.js";
3
3
  import putText from "../common/putText.js";
4
- import putTextBox from "../common/putTextBox.js";
4
+ import putCell from "../common/putCell.js";
5
+ import units from "./units.js";
5
6
 
6
7
  export default class Reflex {
7
8
  constructor({ container, side }) {
@@ -18,7 +19,18 @@ export default class Reflex {
18
19
  let style;
19
20
 
20
21
  // کل چارت
21
- const svg = putSVG({ x, y, width, height, className: 'reflex' })
22
+ // const svg = putSVG({ x, y, width, height, className: 'reflex' })
23
+ let { styles, vbWidth, vbHeight } = units;
24
+
25
+ // کل چارت
26
+ vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
27
+ const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
28
+ const svg = putSVG({ x, y, width, height, viewBox })
29
+ // این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
30
+ width = vbWidth; // ثابت می‌ماند همیشه
31
+ height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
32
+
33
+
22
34
 
23
35
  let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسب‌های سطر اول
24
36
  // جدولی با ۳ سطر و ۵ ستون
@@ -69,7 +81,7 @@ export default class Reflex {
69
81
  let x = cw1 / 2 + cw1 * i;
70
82
  let y = ch1 * j + ch2 / 2;
71
83
  //رسم باکس با مختصات مرکز باکس
72
- putTextBox({ container: svg, x, y, dx: 0, dy: -1, w: 13, h: 7, rx: 1 });
84
+ putCell({ container: svg, x, y, dx: 0, dy: -1, width: 13, height: 7, rx: 1 });
73
85
  }
74
86
  }
75
87
 
@@ -0,0 +1,65 @@
1
+ const units = {
2
+ name: 'Acoustic Reflexes',
3
+ margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
4
+
5
+ // واحد ویوباکس - بدون واحد
6
+ vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
7
+ vbHeight: 30, // این به نسبت تغییر می‌کند
8
+
9
+ // واحد پیکسل، میلیمتر، ...
10
+ // اگر واحد پایینی توسط بیرون تغییر کرد واحدهای بالایی باید با نسبت پایینی تغییر کنند
11
+ width: 100,
12
+ height: 30,
13
+
14
+ styles: {
15
+ pressure: `
16
+ user-select: none;
17
+ direction: ltr !important;
18
+ font-family: Vazir;
19
+ font-size: 3;
20
+ text-anchor: middle;
21
+ dominant-baseline: hanging;
22
+ `,
23
+ caption: `
24
+ user-select: none;
25
+ direction: ltr !important;
26
+ font-family: Vazir;
27
+ font-size: 3;
28
+ text-anchor: middle;
29
+ dominant-baseline: middle;
30
+ `,
31
+ label: `
32
+ user-select: none;
33
+ direction: ltr !important;
34
+ font-family: Vazir;
35
+ font-size: 1mm;
36
+ text-anchor: start;
37
+ dominant-baseline: middle;
38
+ `,
39
+ type: `
40
+ user-select: none;
41
+ direction: ltr !important;
42
+ font-family: Vazir;
43
+ font-size: 1mm;
44
+ font-weight: bold;
45
+ text-anchor: start;
46
+ dominant-baseline: middle;
47
+ `,
48
+ compliance: `
49
+ user-select: none;
50
+ direction: ltr !important;
51
+ font-family: Vazir;
52
+ font-size: 0.7mm;
53
+ text-anchor: end;
54
+ dominant-baseline: middle;
55
+ `,
56
+ mainFreqline: `stroke: black; stroke-width: 1;`,
57
+ semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
58
+ boldLine: 'stroke: black; stroke-width: 3;',
59
+
60
+ juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
61
+ juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
62
+ },
63
+ }
64
+
65
+ export default units;
@@ -1,12 +1,8 @@
1
- import putTextBox from "../common/putTextBox.js";
1
+ import putCell from "../common/putCell.js";
2
2
  import putRect from "../common/putRect.js";
3
3
  import putText from "../common/putText.js";
4
4
  import putSVG from "../common/putSVG.js";
5
- import putPoint from "../common/putPoint.js";
6
-
7
-
8
-
9
-
5
+ import units from "./units.js";
10
6
  const svgNS = "http://www.w3.org/2000/svg";
11
7
 
12
8
  export default class Speech {
@@ -15,7 +11,8 @@ export default class Speech {
15
11
  this.side = side;
16
12
  }
17
13
 
18
- draw({ dims, stroke = true }) {
14
+ draw({ dims }) {
15
+ // console.log(dims);
19
16
 
20
17
  // دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
21
18
  this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
@@ -24,43 +21,51 @@ export default class Speech {
24
21
  let height = dims.height;
25
22
  let x = dims.margin.left;
26
23
  let y = dims.margin.top;
24
+ let { styles, vbWidth, vbHeight } = units;
25
+
26
+ // کل چارت
27
+ vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
28
+ const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
29
+ const svg = putSVG({ x, y, width, height, viewBox })
30
+ // این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
31
+ width = vbWidth; // ثابت می‌ماند همیشه
32
+ height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
33
+
34
+
27
35
  const labels = dims.labels;
28
36
  this.labels = labels;
29
- // const cn = labels.length;
30
- let sideCaption = this.side === "R" ? "Right" : "Left";
31
37
  // یک جدول 6*2 - ۲ سطر و ۶ ستون
32
38
  const rows = 2;
33
- const column = labels.length;
34
-
35
- const cw = width / column; // پهنای هر خانه
39
+ const columns = labels.length;
40
+ const cw = width / columns; // پهنای هر خانه
36
41
  const ch = height / rows; // ارتفاع هر خانه
42
+ // تعریف آبجکتی چارت
43
+ const chart = {
44
+ width, height,
45
+ rows: 2, column: labels.length,
46
+ cell: { width: 1, height: 1 },
47
+ calc1: function () {
48
+ this.cell.width = this.width / this.column
49
+ }
50
+ }
37
51
 
38
- // کل چارت
39
- const svg = putSVG({ x, y, width, height, className: 'speach' })
40
52
 
53
+ // ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
41
54
  const matrix = [
42
55
  [],
43
56
  []
44
57
  ];
45
58
 
46
- for (let i = 0; i < 2; i++) {
59
+ for (let i = 0; i < rows; i++) {
47
60
  x = cw / 2;
48
61
  y = ch / 2 + ch * i;
49
- for (let j = 0; j < 5; j++) {
62
+ for (let j = 0; j < columns; j++) {
50
63
  matrix[i][j] = { i, j, x, y };
51
64
  x += cw;
52
65
  }
53
66
  }
54
- style = `
55
- user-select: none;
56
- direction: ltr !important;
57
- /* text-align: center; */
58
- font-family: Arial, Helvetica, sans-serif !important;
59
- font-size: 1mm;
60
- font-weight: bold;
61
- text-anchor: middle; /*تراز افقی*/
62
- `;
63
67
 
68
+ style = styles.label;
64
69
  // برچسب های سطر اول
65
70
  // برای فرم های پیش چاپ شده انجام نمیشود
66
71
  !dims.hideContext &&
@@ -69,19 +74,31 @@ export default class Speech {
69
74
 
70
75
  style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
71
76
 
77
+ const inputBox = {
78
+ width: width / 5 * 0.70, height: height / 2 * 0.85,
79
+ rx: width / 100
80
+ }
81
+ // محاسبه کمان گردی بر اساس مقدار پهنا
82
+ inputBox.rx = inputBox.width / 10
83
+
72
84
  // باکس و تکست مقادیر
73
85
  matrix[1].forEach((cell, index) => {
74
86
  // برای فرم های پیش چاپ شده باکس رسم نمیشود
75
- !dims.hideContext && putTextBox({ container: svg, x: cell.x, y: cell.y, dy: -1, w: 13, h: 7, rx: 1, });
87
+ !dims.hideContext &&
88
+ putCell({
89
+ container: svg, x: cell.x, y: cell.y, dy: -1,
90
+ width: inputBox.width, height: inputBox.height,
91
+ rx: inputBox.rx,
92
+ });
76
93
  // مقدار نگه دارها
77
94
  if (!dims.forceInsert) {
78
- putText({ container: svg, value: "", x: cell.x, y: cell.y, style: style, name: labels[index] });
95
+ putText({ container: svg, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
79
96
  } else {
80
97
  // برای فرم های مثل رسا استفاده میشود
81
98
  let name;
82
99
  this.inputs.forEach(input => {
83
100
  ({ name, x, y } = input);
84
- putText({ container: svg, x, y, style: style, name });
101
+ putText({ container: svg, x, y, style, name });
85
102
  });
86
103
  }
87
104
  }
@@ -0,0 +1,125 @@
1
+ import putCell from "../common/putCell.js";
2
+ import putRect from "../common/putRect.js";
3
+ import putText from "../common/putText.js";
4
+ import putSVG from "../common/putSVG.js";
5
+ import units from "./units.js";
6
+ const svgNS = "http://www.w3.org/2000/svg";
7
+
8
+ export default class Speech {
9
+ constructor({ box, side = 'R' }) {
10
+ console.log(box);
11
+
12
+ // const { container, width, height, elements } = box
13
+ // this.container = container;
14
+ this.side = side;
15
+ this.draw({ box })
16
+
17
+ }
18
+
19
+ draw({ box }) {
20
+ const { container, width, height, margin, elements, name} = box
21
+
22
+ // console.log(dims);
23
+
24
+ // دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
25
+ // this.inputs = (dims.forceInsesrt) ? dims.forceInputs : dims.inputs
26
+ let style;
27
+ // let width = dims.width;
28
+ // let height = dims.height;
29
+ let x = margin.left;
30
+ let y = margin.top;
31
+
32
+ // کل چارت
33
+ // const svg = putSVG({ x, y, width, height, viewBox: [0, 0, width, height] })
34
+
35
+
36
+
37
+ const labels = elements;
38
+ this.labels = labels;
39
+ let { styles } = units;
40
+ // یک جدول 6*2 - ۲ سطر و ۶ ستون
41
+ const rows = 2;
42
+ const columns = labels.length;
43
+ const cw = width / columns; // پهنای هر خانه
44
+ const ch = height / rows; // ارتفاع هر خانه
45
+ // تعریف آبجکتی چارت
46
+ const chart = {
47
+ width, height,
48
+ rows: 2, column: labels.length,
49
+ cell: { width: 1, height: 1 },
50
+ calc1: function () {
51
+ this.cell.width = this.width / this.column
52
+ }
53
+ }
54
+
55
+
56
+ // ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
57
+ const matrix = [
58
+ [],
59
+ []
60
+ ];
61
+
62
+ for (let i = 0; i < rows; i++) {
63
+ x = cw / 2;
64
+ y = ch / 2 + ch * i;
65
+ for (let j = 0; j < columns; j++) {
66
+ matrix[i][j] = { i, j, x, y };
67
+ x += cw;
68
+ }
69
+ }
70
+
71
+ style = styles.label;
72
+
73
+ // برچسب های سطر اول
74
+ // برای فرم های پیش چاپ شده انجام نمیشود
75
+ // !dims.hideContext &&
76
+ matrix[0].forEach((cell, index) =>
77
+ putText({ container, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
78
+
79
+ style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
80
+
81
+ const inputBox = {
82
+ width: width / 5 * 0.78, height: height / 2 * 0.85,
83
+ rx: width / 100
84
+ }
85
+ // محاسبه کمان گردی بر اساس مقدار پهنا
86
+ inputBox.rx = inputBox.width / 10
87
+
88
+ // باکس و تکست مقادیر
89
+ matrix[1].forEach((cell, index) => {
90
+ // برای فرم های پیش چاپ شده باکس رسم نمیشود
91
+ // !dims.hideContext &&
92
+ putCell({
93
+ container, x: cell.x, y: cell.y, dy: -1,
94
+ width: inputBox.width, height: inputBox.height,
95
+ rx: inputBox.rx,
96
+ });
97
+ // مقدار نگه دارها
98
+ // if (!dims.forceInsert) {
99
+ putText({ container, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
100
+ // } else {
101
+ // // برای فرم های مثل رسا استفاده میشود
102
+ // let name;
103
+ // this.inputs.forEach(input => {
104
+ // ({ name, x, y } = input);
105
+ // putText({ container: svg, x, y, style, name });
106
+ // });
107
+ // }
108
+ }
109
+ );
110
+
111
+
112
+ // مربع احاطه‌کننده کل جدول برای راهنمای توسعه
113
+ style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
114
+ let className = 'no-print'
115
+ putRect({ container, x: 0, y: 0, width, height, style, name })
116
+ // this.chart = svg;
117
+ // container.appendChild(svg);
118
+ }
119
+
120
+ update(data) {
121
+ this.labels.forEach((label) => {
122
+ this.chart.querySelector(`text[data-name=${label}]`).innerHTML = data?.[label] || "";
123
+ })
124
+ }
125
+ }
@@ -0,0 +1,31 @@
1
+ const units = {
2
+
3
+ name: 'Speech',
4
+ margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
5
+ // اگر واحد پایینی توسط بیرون تغییر کرد ارتفاع ویوباکس باید با نسبت پایینی تغییر کنند
6
+ width: 100,
7
+ height: 20,
8
+ // این فاصله خطوط محورهای بالا و چپ ادیوگرام از لبه ها هست
9
+ chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
10
+ // واحد ویوباکس - بدون واحد
11
+ vbWidth: 100, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
12
+ vbHeight: 20, // این به نسبت تغییر می‌کند
13
+ // پایینی شکل آبجکت بالایی هست
14
+ // viewBoxObj: { 'min-x': -0, 'min-y': 0, width: 100, height: 20 },
15
+ // viewBox: [0, 0, 100, 20],
16
+ // واحد پیکسل، میلیمتر، ...
17
+
18
+
19
+ styles: {
20
+ label: `
21
+ user-select: none;
22
+ direction: ltr;
23
+ font-family: Vazir;
24
+ font-size: ${4.2};
25
+ font-weight: 700;
26
+ text-anchor: middle;
27
+ `,
28
+ }
29
+ }
30
+
31
+ export default units