hayun-vite 0.11.2 → 0.12.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.
@@ -4,6 +4,7 @@ const template_combo = {
4
4
  // backgroundImage: 'backgroundImage',
5
5
  // تعیین نمایش بوردرهای سکشن ها
6
6
  sectionBorders: 'display', // display || none
7
+ boxBorders: 'none', // display || none
7
8
  margin: { left: 5, top: 5, right: 5, bottom: 5 },
8
9
  paper: { type: 'A4', case: 'portrait', width: 210, height: 297 },
9
10
 
@@ -36,6 +37,7 @@ const template_combo = {
36
37
  w: width, h: 8,
37
38
  margin: { left: 1, top: 0, right: 1, bottom: 0 },
38
39
  display: 'block',
40
+ boxBorder: 'none' // display || none default: none
39
41
  }
40
42
 
41
43
  this.history = {
@@ -43,6 +45,7 @@ const template_combo = {
43
45
  w: width, h: 14,
44
46
  margin: { left: 1, top: 0, right: 1, bottom: 0 },
45
47
  display: 'block',
48
+ boxBorder: 'none' // display || none
46
49
  }
47
50
 
48
51
  // Titles Common Object
@@ -92,7 +95,7 @@ const template_combo = {
92
95
  this.RSpeech = {
93
96
  name: 'RSpeech',
94
97
  w: width / 2, h: 15,
95
- margin: { left: 1, top: 0, right: 2, bottom: 0 },
98
+ margin: { left: 1, top: 0, right: 10, bottom: 0 },
96
99
  display: 'inline',
97
100
  stroke: true,
98
101
  }
@@ -100,7 +103,7 @@ const template_combo = {
100
103
  this.LSpeech = {
101
104
  name: 'LSpeech',
102
105
  w: width / 2, h: 15,
103
- margin: { left: 2, top: 0, right: 1, bottom: 0 },
106
+ margin: { left: 10, top: 0, right: 1, bottom: 0 },
104
107
  display: 'block',
105
108
  stroke: true
106
109
  }
@@ -116,14 +119,14 @@ const template_combo = {
116
119
  this.RTympanogram = {
117
120
  name: 'RTympanogram',
118
121
  w: width / 2, h: 60,
119
- margin: { left: 1, top: 0, right: 2, bottom: 0 },
122
+ margin: { left: 1, top: 0, right: 10, bottom: 0 },
120
123
  display: 'inline',
121
124
  }
122
125
 
123
126
  this.LTympanogram = {
124
127
  name: 'LTympanogram',
125
128
  w: width / 2, h: 60,
126
- margin: { left: 2, top: 0, right: 1, bottom: 0 },
129
+ margin: { left: 10, top: 0, right: 1, bottom: 0 },
127
130
  display: 'block',
128
131
  }
129
132
 
@@ -138,14 +141,14 @@ const template_combo = {
138
141
  this.RReflex = {
139
142
  name: 'RReflex',
140
143
  w: width / 2, h: 26,
141
- margin: { left: 1, top: 0, right: 2, bottom: 1 },
144
+ margin: { left: 1, top: 0, right: 10, bottom: 1 },
142
145
  display: 'inline'
143
146
  }
144
147
 
145
148
  this.LReflex = {
146
149
  name: 'LReflex',
147
150
  w: width / 2, h: 26,
148
- margin: { left: 2, top: 0, right: 1, bottom: 1 },
151
+ margin: { left: 10, top: 0, right: 1, bottom: 1 },
149
152
  display: 'block'
150
153
  }
151
154
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "0.11.2",
4
+ "version": "0.12.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
package/src/Form/Form.js CHANGED
@@ -14,13 +14,13 @@ export default class Form {
14
14
  this.container = container;
15
15
  this.data = {};
16
16
  let { width, height, margin, paper } = template;
17
- this.form = this.create({ paper, margin });
18
- this.form.style.display = 'none';
17
+ this.page = this.create({ paper, margin });
18
+ this.page.style.display = 'none';
19
19
  let dims;
20
20
  // رسم مارجین های فرم
21
- this.drawMarginLines({ container: this.form, width, height });
21
+ this.drawMarginLines({ container: this.page, width, height });
22
22
 
23
- const sections = new Sections({ container: this.form, dims: template });
23
+ const sections = new Sections({ container: this.page, dims: template });
24
24
  this.sections = sections;
25
25
 
26
26
  if (sections.header) {
@@ -101,7 +101,7 @@ export default class Form {
101
101
  this.footer = new MultiText({ container: sections.footer, dims})
102
102
  }
103
103
 
104
- this.container.appendChild(this.form);
104
+ this.container.appendChild(this.page);
105
105
  }
106
106
 
107
107
 
@@ -46,7 +46,7 @@ export default class Sections {
46
46
  putRect({
47
47
  container: svg, x: 0, y: 0, width, height,
48
48
  style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
49
- className: 'no-print', name: 'guide-border'
49
+ className: 'no-print', name: 'section-border'
50
50
  });
51
51
 
52
52
  this[name] = svg;
@@ -46,7 +46,7 @@ export default class Sections {
46
46
  putRect({
47
47
  container: svg, x: 0, y: 0, width, height,
48
48
  style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
49
- className: 'no-print', name: 'guide-border'
49
+ className: 'no-print', name: 'section-border'
50
50
  });
51
51
 
52
52
  this[name] = svg;
@@ -9,6 +9,7 @@ import Form from "../Form/Form.js";
9
9
  // خط کد زیر لازم هست
10
10
  // import '/fonts/webfonts/Vazirmatn-Regular.woff2'
11
11
  import '../styles.css'
12
+ import putLine from "../common/putLine.js";
12
13
 
13
14
  // کلاس جدید که فرم‌های مختلف را نمایش میدهد
14
15
  export default class Forms {
@@ -22,9 +23,9 @@ export default class Forms {
22
23
  // افزودن فرم
23
24
  addForms({ templates, defaultTemplateIndex }) {
24
25
  const container = this.container
25
-
26
26
  // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
27
27
  const div = document.createElement('div');
28
+
28
29
  div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
29
30
  container.appendChild(div);
30
31
 
@@ -34,17 +35,17 @@ export default class Forms {
34
35
 
35
36
  const forms = []; // آرایه آبجکت های فرم های مختلف
36
37
  this.forms = forms;
37
- this.pages = forms
38
38
 
39
- templates.forEach((template, index) => {
40
- (this.mode == 'develop') &&
41
- (btns[index] = this.putButton({ container: div, text: template.label, className }));
42
- this.forms.push(new Form({ container, template }));
43
- });
39
+ templates.
40
+ forEach((template, index) => {
41
+ this.mode == 'develop' &&
42
+ (btns[index] = this.putButton({ container: div, text: template.label, className }));
43
+ this.forms.push(new Form({ container, template }));
44
+ });
44
45
 
45
46
  // انتخاب فرم پیش‌فرض
46
47
  let selectedIndex = defaultTemplateIndex;
47
- forms[selectedIndex].form.style.display = 'block';
48
+ forms[selectedIndex].page.style.display = 'block';
48
49
  this.selectedForm = this.forms[selectedIndex];
49
50
  (this.mode == 'develop') && (btns[selectedIndex].style.backgroundColor = ' #1c15e1');
50
51
 
@@ -52,18 +53,18 @@ export default class Forms {
52
53
 
53
54
  const printBtn = this.putButton({ container: div, text: 'چاپ', className });
54
55
  // تعریف رویداد دکمه چاپ فرم نمایشی
55
- printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.form }) });
56
+ printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.page }) });
56
57
 
57
58
  btns.forEach((btn, index) => {
58
59
  btn.addEventListener('click', () => {
59
60
  // Hide All forms
60
61
  forms.forEach((form, i) => {
61
- form.form.style.display = 'none'
62
+ form.page.style.display = 'none'
62
63
  btns[i].style.backgroundColor = ' #7472e2'
63
64
 
64
65
  });
65
66
 
66
- forms[index].form.style.display = 'block';
67
+ forms[index].page.style.display = 'block';
67
68
  btns[index].style.backgroundColor = ' #1c15e1'
68
69
 
69
70
  this.selectedForm = forms[index];
@@ -72,13 +73,56 @@ export default class Forms {
72
73
  })
73
74
  })
74
75
 
75
- this.putButton({ container: div, text: 'Show/Hide', className })
76
- .addEventListener('click', () => { this.toggleDisplay({ container: forms[selectedIndex].form }) });
76
+ // دکمه نمایش و پنهان خطوط سکشن
77
+ this.putButton({ container: div, text: 'Show/Hide Section Borders', className })
78
+ .addEventListener('click', () => {
79
+ this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'section-border' })
80
+ });
81
+
82
+ // دکمه نمایش و پنهان خطوط بوردر
83
+ this.putButton({ container: div, text: 'Show/Hide Box Borders', className })
84
+ .addEventListener('click', () => {
85
+ this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'box-border' })
86
+ });
87
+
88
+ // دکمه نمایش و پنهان شطرنجی
89
+ this.putButton({ container: div, text: 'Show/Hide Grid', className })
90
+ .addEventListener('mouseenter', () => {
91
+ this.grid({ container: forms[selectedIndex].page })
92
+ });
93
+ // فراخوانی تابع شطرنجی در اولین اجرا
94
+ this.grid({ container: forms[selectedIndex].page })
77
95
  }
78
96
  }
79
97
 
98
+ grid({ container }) {
99
+ console.log(container);
100
+ const cord = { xStart: -5, yStart: -5, xEnd: 210 - 5, yEnd: 297 - 5, xStep: 1, yStep: 1 }
101
+ let { xStart, yStart, xEnd, yEnd, xStep, yStep } = cord
102
+
103
+ // رسم خطوط افقی
104
+ let style = 'stroke: blue; stroke-width: 0.05 ; stroke-opacity: 0.8; stroke-dasharray: 0.2;'
105
+ let x1 = xStart
106
+ let y1
107
+
108
+ let x2 = xEnd
109
+ let y2
110
+
111
+ for (let y1 = yStart; y1 <= yEnd; y1 += yStep) {
112
+ y2 = y1
113
+ putLine({ container, x1, y1, x2, y2, style, name: 'grid' })
114
+ }
115
+
116
+ // رسم خطوط عمودی
117
+ y1 = yStart
118
+ for (x1 = xStart; x1 <= xEnd; x1 += xStep) {
119
+ const x2 = x1
120
+ putLine({ container, x1, y1, x2, y2, style, name: 'grid' })
121
+ }
80
122
 
81
123
 
124
+ }
125
+
82
126
  // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
83
127
  update({ data, officeData, patientData, sessionIndex = 0 }) {
84
128
  // ذخیره کل دیتا برای استفاده داخلی آپدیت فرم انتخاب شده
@@ -97,8 +141,8 @@ export default class Forms {
97
141
  }
98
142
 
99
143
  // تابع تاگل نمایش و مخفی کردن خطوط راهنمای طراحی
100
- toggleDisplay({ container }) {
101
- container.querySelectorAll(`[data-name='guide-border']`)
144
+ toggleDisplay({ container, borderName }) {
145
+ container.querySelectorAll(`[data-name=${borderName}]`)
102
146
  .forEach(element => {
103
147
  element.style.display = (element.style.display === '') ? 'none' : '';
104
148
  });
@@ -62,11 +62,23 @@ export default class MultiText {
62
62
  const borderRect = putRect({
63
63
  container: svg, x: 0, y: 0, width, height,
64
64
  name: dims.name, className: 'no-print',
65
- style: 'stroke: green; fill: transparent; stroke-width: 0.3;'
65
+ style: 'stroke: transparent; fill: transparent; stroke-width: 0.3;'
66
66
  });
67
-
68
67
  this.borderRect = borderRect;
69
68
  this.container.appendChild(svg)
69
+
70
+ // Box Border for Design guid with Brown Color
71
+ dims.boxBorder === 'display' && putRect({
72
+ container: svg, x: 0, y: 0, width, height,
73
+ style: 'fill: transparent; stroke-width: 0.3; stroke: brown;',
74
+ name: 'box-border',
75
+ className: 'no-print',
76
+ })
77
+
78
+ this.container.appendChild(svg)
79
+
80
+
81
+
70
82
  }
71
83
 
72
84
  update(data) {
@@ -1,14 +1,13 @@
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 putCell from "../common/putCell.js";
5
4
  import units from "./units.js";
6
5
 
7
6
  export default class Reflex {
8
7
  constructor({ container, side, dims }) {
9
8
  this.container = container;
10
9
  this.side = side; // این برای تعیین رنگ راست و چپ استفاده می‌شود
11
- this.draw({dims})
10
+ this.draw({ dims })
12
11
  }
13
12
 
14
13
  draw({ dims }) {
@@ -22,54 +21,35 @@ export default class Reflex {
22
21
  // کل چارت
23
22
  // const svg = putSVG({ x, y, width, height, className: 'reflex' })
24
23
  let { styles, vbWidth, vbHeight } = units;
25
-
24
+
26
25
  // کل چارت
26
+ style = styles.svg
27
27
  vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
28
28
  const viewBox = [0, 0, vbWidth, vbHeight].join(' ');
29
- const svg = putSVG({ x, y, width, height, viewBox })
29
+ const svg = putSVG({ x, y, width, height, viewBox, style })
30
30
  // این خط شد دو خط کد طلایی که مشکل سایز فونت در دیسپلی و کاغذ رو حل کرد
31
31
  width = vbWidth; // ثابت می‌ماند همیشه
32
32
  height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
33
33
 
34
34
 
35
-
35
+ // چاپ برچسب‌های سطر اول
36
+ style = styles.numberlabel;
36
37
  let lable = ["", "500", "1000", "2000", "4000"]; // مقادیر برچسب‌های سطر اول
37
38
  // جدولی با ۳ سطر و ۵ ستون
38
39
  let cw1 = width / 5; // پهنای خانه‌های سطر اول
39
40
  let ch1 = height / 3; // ارتفاع خانه‌های سطر اول
40
41
  let ch2 = height / 3; // ارتفاع خانه‌های سطر دوم
41
42
 
42
- // چاپ برچسب‌های سطر اول
43
- style = `
44
- user-select: none;
45
- direction: ltr !important;
46
- /* text-align: center; */
47
- font-family: Arial, Helvetica, sans-serif !important;
48
- font-size: 1mm;
49
- font-weight: bold;
50
- text-anchor: middle; /*تراز افقی*/
51
- dominant-baseline: middle; /* تراز عمودی*/
52
- `;
53
43
  lable.forEach((value, i) => {
54
44
  if (value != "") {
55
45
  let x = cw1 / 2 + cw1 * i;
56
46
  let y = ch1 / 2;
57
- // putText(value, x, y, "", "middle", "middle"); // با استایل تراز عمودی پایین نسبت به خط پایه
58
47
  putText({ container: svg, value, x, y, style })
59
48
  }
60
49
  });
61
50
 
62
51
  // مقادیر برچسب‌های ستون اول
63
- style = `
64
- user-select: none;
65
- direction: ltr !important;
66
- /* text-align: center; */
67
- font-family: Arial, Helvetica, sans-serif !important;
68
- font-size: 1mm;
69
- font-weight: bold;
70
- text-anchor: end; /*تراز افقی*/
71
- dominant-baseline: middle; /* تراز عمودی*/
72
- `;
52
+ style = styles.textLable
73
53
  lable = ["Freq", "IPSI", "CONTRA"];
74
54
  // چاپ برچسب‌های ستون اول
75
55
  putText({ container: svg, value: "Freq", x: cw1, y: ch1 / 2, style: style })
@@ -77,24 +57,27 @@ export default class Reflex {
77
57
  putText({ container: svg, value: "CONTRA", x: cw1, y: ch1 * 5 / 2, style: style })
78
58
 
79
59
  //چاپ ده باکس سطر دوم و سوم
60
+ const inputBox = {
61
+ width: width / 5 * 0.80, height: height / 3 * 0.8,
62
+ rx: width / 100
63
+ }
64
+ // محاسبه کمان گردی بر اساس مقدار پهنا
65
+ inputBox.rx = inputBox.width / 10
66
+
80
67
  for (let j = 1; j <= 2; j++) {
81
68
  for (let i = 1; i <= 4; i++) {
82
- let x = cw1 / 2 + cw1 * i;
83
- let y = ch1 * j + ch2 / 2;
69
+ let cx = cw1 / 2 + cw1 * i;
70
+ let cy = ch1 * j + ch2 / 2;
84
71
  //رسم باکس با مختصات مرکز باکس
85
- putCell({ container: svg, x, y, dx: 0, dy: -1, width: 13, height: 7, rx: 1 });
72
+ putRect({
73
+ container: svg, cx, cy,
74
+ width: inputBox.width, height: inputBox.height, rx: inputBox.rx
75
+ });
86
76
  }
87
77
  }
88
78
 
89
- style = `
90
- user-select: none;
91
- direction: ltr !important;
92
- /* text-align: center; */
93
- font-family: Arial, Helvetica, sans-serif !important;
94
- font-size: 1mm;
95
- text-anchor: middle; /*تراز افقی*/
96
- dominant-baseline: middle; /* تراز عمودی*/
97
- `;
79
+ // مقادیر ورودی عددی
80
+ style = styles.inputNumber
98
81
  // اضافه کردن رنگ قرمز یا آبی به استایل بر اساس جهت
99
82
  style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
100
83
 
@@ -102,7 +85,7 @@ export default class Reflex {
102
85
  for (let index = 0; index < 4; index++) {
103
86
  x = cw1 / 2 + cw1 * (index + 1);
104
87
  y = ch1 + ch2 / 2;
105
- putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
88
+ putText({ container: svg, value: "", x, y, style, name: names[index] })
106
89
  }
107
90
 
108
91
  // المنت‌های تکست خالی با آیدی یکتا در سطر سوم
@@ -113,7 +96,7 @@ export default class Reflex {
113
96
  // const idValue = idValues[index];
114
97
  x = cw1 / 2 + cw1 * (index + 1);
115
98
  y = ch1 * 2 + ch2 / 2;
116
- putText({ container: svg, value: "", x, y, dx: 0, dy: -1, style, name: names[index] })
99
+ putText({ container: svg, value: "", x, y, style, name: names[index] })
117
100
  }
118
101
  // مربع احاطه‌کننده کل جدول برای راهنمای توسعه و دریافت رویداد کلیک روی فرم
119
102
  style = 'fill: transparent; stroke: green; stroke-width: 0.5;';
@@ -12,53 +12,25 @@ const units = {
12
12
  height: 30,
13
13
 
14
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;
15
+ svg: 'user-select: none; direction: ltr !important; font-family: Vazir;',
16
+ textLable: `
17
+ font-size: 4.2;
18
+ font-weight: bold;
19
+ text-anchor: end;
29
20
  dominant-baseline: middle;
30
21
  `,
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;
22
+ numberlabel: `
23
+ font-size: 4.2;
24
+ font-weight: 700;
25
+ text-anchor: middle;
46
26
  dominant-baseline: middle;
47
27
  `,
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;
28
+ inputNumber: `
29
+ font-size: 4.2;
30
+ font-weight: 700;
31
+ text-anchor: middle;
32
+ dominant-baseline: middle;
55
33
  `,
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
34
  },
63
35
  }
64
36
 
@@ -1,4 +1,4 @@
1
- import putCell from "../common/putCell.js";
1
+ // https://docs.google.com/document/d/19Pgsi0eHRDgsxjkbxweHLRKVB60jrH4fzV52I83-6CM/edit?tab=t.977lyzmcu5uu#heading=h.sd8yc08kbsfo
2
2
  import putRect from "../common/putRect.js";
3
3
  import putText from "../common/putText.js";
4
4
  import putSVG from "../common/putSVG.js";
@@ -9,11 +9,10 @@ export default class Speech {
9
9
  constructor({ container, side = 'R', dims }) {
10
10
  this.container = container;
11
11
  this.side = side;
12
- this.draw({dims})
12
+ this.draw({ dims })
13
13
  }
14
14
 
15
15
  draw({ dims }) {
16
- // console.log(dims);
17
16
 
18
17
  // دریافت اطلاعات مختصات چاپ ورودی ها به جز عادی محاسبه شده
19
18
  this.inputs = (dims.forceInsert) ? dims.forceInputs : dims.inputs
@@ -23,6 +22,7 @@ export default class Speech {
23
22
  let x = dims.margin.left;
24
23
  let y = dims.margin.top;
25
24
  let { styles, vbWidth, vbHeight } = units;
25
+ let cx, cy;
26
26
 
27
27
  // کل چارت
28
28
  vbHeight = (vbWidth * height) / width // متناسب سازی ارتفاع ویباکس با پهنا و ارتفاع ورودی
@@ -32,7 +32,6 @@ export default class Speech {
32
32
  width = vbWidth; // ثابت می‌ماند همیشه
33
33
  height = vbHeight // با نسبت پهنا و ارتفاع ورودی تغییر میکند
34
34
 
35
-
36
35
  const labels = dims.labels;
37
36
  this.labels = labels;
38
37
  // یک جدول 6*2 - ۲ سطر و ۶ ستون
@@ -57,11 +56,11 @@ export default class Speech {
57
56
  ];
58
57
 
59
58
  for (let i = 0; i < rows; i++) {
60
- x = cw / 2;
61
- y = ch / 2 + ch * i;
59
+ cx = cw / 2;
60
+ cy = ch / 2 + ch * i;
62
61
  for (let j = 0; j < columns; j++) {
63
- matrix[i][j] = { i, j, x, y };
64
- x += cw;
62
+ matrix[i][j] = { i, j, cx, cy };
63
+ cx += cw;
65
64
  }
66
65
  }
67
66
 
@@ -70,12 +69,15 @@ export default class Speech {
70
69
  // برای فرم های پیش چاپ شده انجام نمیشود
71
70
  !dims.hideContext &&
72
71
  matrix[0].forEach((cell, index) =>
73
- putText({ container: svg, value: labels[index], x: cell.x, y: cell.y, dx: 0, dy: 1, style }));
72
+ putText({
73
+ container: svg, value: labels[index],
74
+ x: cell.cx, y: cell.cy, dx: 0, dy: 1, style
75
+ }));
74
76
 
75
77
  style += (this.side === 'R') ? 'fill: red;' : 'fill: blue;';
76
78
 
77
79
  const inputBox = {
78
- width: width / 5 * 0.70, height: height / 2 * 0.85,
80
+ width: width / 5 * 0.80, height: height / 2 * 0.95,
79
81
  rx: width / 100
80
82
  }
81
83
  // محاسبه کمان گردی بر اساس مقدار پهنا
@@ -85,14 +87,14 @@ export default class Speech {
85
87
  matrix[1].forEach((cell, index) => {
86
88
  // برای فرم های پیش چاپ شده باکس رسم نمیشود
87
89
  !dims.hideContext &&
88
- putCell({
89
- container: svg, x: cell.x, y: cell.y, dy: -1,
90
+ putRect({
91
+ container: svg, cx: cell.cx, cy: cell.cy, dy: -1,
90
92
  width: inputBox.width, height: inputBox.height,
91
93
  rx: inputBox.rx,
92
94
  });
93
95
  // مقدار نگه دارها
94
96
  if (!dims.forceInsert) {
95
- putText({ container: svg, value: "", x: cell.x, y: cell.y, style, name: labels[index] });
97
+ putText({ container: svg, value: "", x: cell.cx, y: cell.cy, style, name: labels[index] });
96
98
  } else {
97
99
  // برای فرم های مثل رسا استفاده میشود
98
100
  let name;
@@ -1,4 +1,3 @@
1
- import putCell from "../common/putCell.js";
2
1
  import putRect from "../common/putRect.js";
3
2
  import putText from "../common/putText.js";
4
3
  import putSVG from "../common/putSVG.js";
@@ -84,8 +83,8 @@ export default class Speech {
84
83
  matrix[1].forEach((cell, index) => {
85
84
  // برای فرم های پیش چاپ شده باکس رسم نمیشود
86
85
  // !dims.hideContext &&
87
- putCell({
88
- container, x: cell.x, y: cell.y, dy: -1,
86
+ putRect({
87
+ container, cx: cell.x, cy: cell.y, dy: -1,
89
88
  width: inputBox.width, height: inputBox.height,
90
89
  rx: inputBox.rx,
91
90
  });
@@ -2,7 +2,7 @@
2
2
  const svgNS = "http://www.w3.org/2000/svg";
3
3
 
4
4
  export default function putLine({ container, x1, y1, x2, y2, style = 'stroke: black; stroke-width: 0.3;', name }) {
5
-
5
+
6
6
  let line = document.createElementNS(svgNS, "line");
7
7
  line.setAttribute("x1", x1);
8
8
  line.setAttribute("y1", y1);
@@ -10,8 +10,7 @@ export default function putLine({ container, x1, y1, x2, y2, style = 'stroke: bl
10
10
  line.setAttribute("y2", y2);
11
11
  line.setAttribute("style", style)
12
12
  line.setAttribute("data-name", name)
13
- // line.setAttribute("stroke", "black");
14
- // line.setAttribute("stroke-width", 0.5);
13
+
15
14
  container.appendChild(line);
16
15
 
17
16
  }
@@ -1,15 +1,25 @@
1
+ // https://docs.google.com/document/d/19Pgsi0eHRDgsxjkbxweHLRKVB60jrH4fzV52I83-6CM/edit?tab=t.0#heading=h.5zc9gsazq7wu
1
2
  const svgNS = "http://www.w3.org/2000/svg";
2
3
 
3
- export default function putRect({ container, x, y, width, height, style = 'fill: transparent; stroke: green; stroke-width: 0.5;', name, className }) {
4
+
5
+ export default function putRect({
6
+ container, x, y, cx, cy, dx = 0, dy = 0, rx, width, height,
7
+ style = 'fill: transparent; stroke: black; stroke-width: 0.2;', name, className
8
+ }
9
+ ) {
4
10
  let rect = document.createElementNS(svgNS, "rect");
5
- rect.setAttribute("x", x);
6
- rect.setAttribute("y", y);
11
+ cx && rect.setAttribute("x", cx - width / 2 + dx);
12
+ cy && rect.setAttribute("y", cy - height / 2 + dy);
13
+ rx && rect.setAttribute("rx", rx);
14
+ x && rect.setAttribute("x", x + dx);
15
+ y && rect.setAttribute("y", y + dy);
7
16
  rect.setAttribute("width", width);
8
17
  rect.setAttribute("height", height);
9
18
  rect.setAttribute("style", style);
10
19
  className && rect.setAttribute("class", className);
11
- rect.setAttribute("data-name", name);
12
- container.appendChild(rect);
20
+ name && rect.setAttribute("data-name", name);
21
+ container && container.appendChild(rect);
22
+
13
23
  return rect;
14
24
 
15
25
  }
package/src/main.js CHANGED
@@ -195,7 +195,7 @@ dims = {
195
195
  // side: 'R',
196
196
  // })
197
197
 
198
- const forms = new Forms({ container: document.getElementById('forms-div'), templates: [template], mode: 'production' });
198
+ const forms = new Forms({ container: document.getElementById('forms-div'), templates: [template], mode: 'develop' });
199
199
  forms.update({ officeData, patientData, sessionIndex: 0 })
200
200
 
201
201
 
@@ -1,84 +0,0 @@
1
- // import { svgNS } from "../../globalinfo.js";
2
- const svgNS = "http://www.w3.org/2000/svg";
3
-
4
- // پهنا و ارتفاع ظرف را پیدا کن و آنرا شطرنجی کن
5
- export default function drawGrid(container) {
6
- const viewBox = container.getAttribute("viewBox");
7
- const w = container.getAttribute("width");
8
- const h = container.getAttribute("height");
9
- const svg = document.createElementNS(svgNS, "svg");
10
- svg.setAttribute("viewBox", viewBox);
11
- // svg.setAttribute("width", 210);
12
- // svg.setAttribute("height", 297);
13
-
14
- // مربع احاطه‌کننده کل جدول برای راهنمای توسعه
15
- let rect = document.createElementNS(svgNS, "rect");
16
- rect.setAttribute("x", 0);
17
- rect.setAttribute("y", 0);
18
- rect.setAttribute("width", 210);
19
- rect.setAttribute("height", 297);
20
- rect.setAttribute("style", "fill: transparent; stroke-width: 1;");
21
- svg.appendChild(rect);
22
-
23
- let line,
24
- x,
25
- y = 0;
26
- // رسم خطوط افقی با فاصله واحد ویوباکس
27
- for (y = 1; y <= 296; y++) {
28
- line = document.createElementNS(svgNS, "line");
29
- line.setAttribute("x1", 1);
30
- line.setAttribute("y1", y);
31
- line.setAttribute("x2", 209);
32
- line.setAttribute("y2", y);
33
- line.setAttribute(
34
- "style",
35
- "stroke: black; stroke-width: 0.1; stroke-opacity: 0.5; stroke-dasharray: 0.1;"
36
- );
37
- line.setAttribute("class", "gridLines");
38
- svg.appendChild(line);
39
- }
40
-
41
- // رسم خطوط عمودی با فاصله واحد ویوباکس
42
- for (x = 1; x <= 209; x++) {
43
- line = document.createElementNS(svgNS, "line");
44
- line.setAttribute("x1", x);
45
- line.setAttribute("y1", 1);
46
- line.setAttribute("x2", x);
47
- line.setAttribute("y2", 296);
48
- line.setAttribute(
49
- "style",
50
- "stroke: black; stroke-width: 0.1; stroke-opacity: 0.5; stroke-dasharray: 0.1;"
51
- );
52
- line.setAttribute("class", "gridLines");
53
-
54
- svg.appendChild(line);
55
- }
56
- // رسم خط میانی افقی
57
- line = document.createElementNS(svgNS, "line");
58
- line.setAttribute("x1", 1);
59
- line.setAttribute("y1", 297/2);
60
- line.setAttribute("x2", 209);
61
- line.setAttribute("y2", 297/2);
62
- line.setAttribute(
63
- "style",
64
- "stroke: black; stroke-width: 0.2; stroke-opacity: 0.8;"
65
- );
66
- line.setAttribute("class", "gridLines");
67
-
68
- svg.appendChild(line);
69
-
70
- // رسم خط میانی عمودی
71
- line = document.createElementNS(svgNS, "line");
72
- line.setAttribute("x1", 105);
73
- line.setAttribute("y1", 1);
74
- line.setAttribute("x2", 105);
75
- line.setAttribute("y2", 296);
76
- line.setAttribute(
77
- "style",
78
- "stroke: black; stroke-width: 0.2; stroke-opacity: 0.8;"
79
- );
80
- line.setAttribute("class", "gridLines");
81
-
82
- svg.appendChild(line);
83
- container.appendChild(svg);
84
- }
@@ -1,9 +0,0 @@
1
- export default function hideGrid() {
2
-
3
- let gridLines = document.getElementsByClassName("gridLines");
4
-
5
- for (const line of gridLines) {
6
- line.style = "stroke: transparent; fill: transparent;"
7
- }
8
-
9
- }
@@ -1,18 +0,0 @@
1
- const svgNS = "http://www.w3.org/2000/svg";
2
-
3
- export default function putCell(
4
- {
5
- container, x, y, dx = 0, dy= 0 , width, height, rx,
6
- style = "fill: transparent; stroke: black; stroke-width: 0.2;",
7
- }) {
8
- let rect = document.createElementNS(svgNS, "rect");
9
- rect.setAttribute("x", x - width / 2 + dx);
10
- rect.setAttribute("y", y - height / 2 + dy);
11
- rect.setAttribute("rx", rx);
12
-
13
- rect.setAttribute("width", width);
14
- rect.setAttribute("height", height);
15
- rect.setAttribute("style", style);
16
- container.appendChild(rect);
17
-
18
- }