hayun-vite 0.11.1 → 0.11.2

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.
@@ -16,6 +16,7 @@ const mainTemplate = {
16
16
  },
17
17
 
18
18
  defSections: function () {
19
+
19
20
  this['Header'] = {
20
21
  name: 'header', container: '',
21
22
  width: this.width, height: 20,
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Audiogram from './src/Audiogram/Audiogram'
2
2
  import dims from './src/Audiogram/dims'
3
3
  import { officeData, patientData } from './assets/data/sampleData'
4
- import Forms from './src/Form/Forms'
4
+ import Forms from './src/Forms/Forms'
5
5
  import combo_template from './assets/templates/template_combo'
6
6
  // import rasa_aud_template from './assets/templates/rasa_audiometry'
7
7
  // import rasa_tymp_reflex_template from './assets/templates/rasa_tymp_reflex'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hayun-vite",
3
3
  "private": false,
4
- "version": "0.11.1",
4
+ "version": "0.11.2",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -1,43 +1,42 @@
1
+ import putG from "../common/putG.js";
1
2
  import putLine from "../common/putLine.js";
2
3
  import putPoint from "../common/putPoint.js";
3
4
  import putRect from "../common/putRect.js";
4
5
  import putSVG from "../common/putSVG.js";
5
6
  import putText from "../common/putText.js";
6
7
  import getAllSymbolsSVG from "../Symbol/getAllSymbolsSVG.js";
7
- import mainDims from './dims_N.js';
8
+ import mainDims from './dims.js';
8
9
 
9
10
  export default class Audiogram {
10
- constructor({ box, side, events = true }) {
11
+ constructor({ box, container, side, dims, events = true }) {
12
+ console.log(box);
13
+
14
+ this.container = container;
15
+ this.dims = {}
16
+ Object.assign(this.dims, mainDims)
17
+ // dims = { blank: false }
18
+ // اضافه کردن ابعاد جایگزین و یا اختصاصی دیگر به آبجکت ابعاد
19
+ dims && Object.assign(this.dims, dims);
20
+ // console.log(dims);
11
21
 
12
- // this.container = container;
13
22
 
14
23
  this.events = events;
15
24
  this.side = side;
16
25
  this.data = {};
17
26
  const symbols = getAllSymbolsSVG();
18
27
  this.symbols = symbols;
19
- this.draw({ box });
28
+ this.draw();
20
29
  events && this.addEvents();
21
30
  }
22
31
 
23
- draw({ box }) {
24
-
25
- const { container, width, height, margin, elements, name } = box
26
-
27
- // this.dims = {}
28
- // Object.assign(this.dims, mainDims)
29
-
30
- // اضافه کردن ابعاد جایگزین و یا اختصاصی دیگر به آبجکت ابعاد
31
- // dims && Object.assign(this.dims, dims);
32
-
33
-
34
- // const [container, dims] = [this.container, this.dims]
32
+ draw() {
33
+ const [container, dims] = [this.container, this.dims]
35
34
  let
36
35
  {
37
- vbWidth, vbHeight, chartPadding, symbolDims, vf, vfArray,
36
+ vbWidth, vbHeight, width, height, chartPadding, symbolDims, vf, vfArray,
38
37
  vfToF, fToVf, intensity, styles, frequencies
39
38
  }
40
- = mainDims;
39
+ = dims;
41
40
  // متناسب سازی مقدار ارتفاع ویوباکس بر حسب نسبت طول و عرض پیکسلی
42
41
  const
43
42
  kpx = height / width,
@@ -45,8 +44,8 @@ export default class Audiogram {
45
44
 
46
45
  vbHeight = vbHeight * kpx * kvb;
47
46
 
48
- let x = margin.left
49
- let y = margin.top
47
+ let x = dims.margin.left
48
+ let y = dims.margin.top
50
49
 
51
50
  this.symbolDims = symbolDims;
52
51
  this.vf = vf;
@@ -75,64 +74,88 @@ export default class Audiogram {
75
74
  this.yAxisLength = yAxisLength
76
75
 
77
76
  // Main SVG for Audiogram
77
+ style = styles.svg;
78
78
  const viewBox = [-chartPadding.left, -chartPadding.top, vbWidth, vbHeight]
79
- const svg = putSVG({ container, x, y, width, height, viewBox })
79
+ const svg = putSVG({ container, x, y, width, height, viewBox, style })
80
80
  this.svg = svg; // کل نودی که به کانتینر اپند میشه
81
81
 
82
82
  // برای فرم‌های پیش چاپ نشده
83
- // if (!dims.blank) {
84
- // محدوده مختصات خطوط جدول
85
- const chartArea = putRect({
86
- container: svg,
87
- x: this.getX(vf.min), y: this.getY(intensity.min),
88
- width: xAxisLength.vb, height: yAxisLength.vb,
89
- style: 'stroke-width: 0.4; stroke: gray; fill: transparent'
90
- })
91
- // رسم خطوط افقی از بالا به پایین
92
- let x1 = this.getX(vf.min);
93
- let x2 = this.getX(vf.max);
94
- for (let i = intensity.min; i <= intensity.max; i += intensity.step) {
95
- const y1 = this.getY(i)
96
- const y2 = y1;
97
- style = (i === 0) ? styles.boldLine : styles.line;
98
- putLine({ container: svg, x1, y1, x2, y2, style })
99
- }
83
+ if (!dims.blank) {
84
+ // محدوده مختصات خطوط جدول
85
+ putRect({
86
+ container: svg,
87
+ x: this.getX(vf.min), y: this.getY(intensity.min),
88
+ width: xAxisLength.vb, height: yAxisLength.vb,
89
+ style: 'stroke-width: 0.4; stroke: gray; fill: transparent'
90
+ })
91
+
92
+ // رسم خطوط افقی از بالا به پایین
93
+ let g = putG({ container: svg });
94
+
95
+ let x1 = this.getX(vf.min);
96
+ let x2 = this.getX(vf.max);
97
+
98
+ for (let i = intensity.min; i <= intensity.max; i += intensity.step) {
99
+ const y1 = this.getY(i)
100
+ const y2 = y1;
101
+ style = (i === 0) ? styles.boldLine : styles.line;
102
+ putLine({ container: g, x1, y1, x2, y2, style })
103
+ }
100
104
 
101
- // رسم خطوط عمودی از چپ به راست
102
- let y1 = this.getY(intensity.min)
103
- let y2 = this.getY(intensity.max)
104
- frequencies.forEach(item => {
105
- const x1 = this.getX(item.vf)
106
- const x2 = x1
107
- style = (item.semiOctav) ? styles.semiOctavFreqline : styles.mainFreqline;
108
- (item.f === 1000) && (style = styles.boldLine);
109
- putLine({ container: svg, x1, y1, x2, y2, style })
110
- })
111
- // برچسب های اعداد فرکانس
112
- style = styles.frequency
113
- const y = this.getY(-25)
114
- frequencies.forEach(item => {
115
- const value = item.f
116
- const x = this.getX(item.vf)
117
- !item.semiOctav && item.f != 125 && item.f != 16000 &&
118
- putText({ container: svg, value, x, y, style });
119
- })
105
+ svg.appendChild(g);
106
+
107
+ // رسم خطوط عمودی از چپ به راست
108
+ g = putG({ container: svg });
109
+
110
+ let y1 = this.getY(intensity.min)
111
+ let y2 = this.getY(intensity.max)
112
+
113
+ frequencies.
114
+ forEach(item => {
115
+ const x1 = this.getX(item.vf)
116
+ const x2 = x1
117
+ style = (item.semiOctav) ? styles.semiOctavFreqline : styles.mainFreqline;
118
+ (item.f === 1000) && (style = styles.boldLine);
119
+ putLine({ container: g, x1, y1, x2, y2, style })
120
+ });
121
+
122
+ svg.appendChild(g);
123
+
124
+ // برچسب های اعداد فرکانس
125
+ style = styles.frequency
126
+ g = putG({ container: svg, style });
127
+ const y = this.getY(-25)
128
+
129
+ frequencies.
130
+ forEach(item => {
131
+ const value = item.f
132
+ const x = this.getX(item.vf)
133
+ !item.semiOctav && item.f != 125 && item.f != 16000 &&
134
+ putText({ container: g, value, x, y, });
135
+ });
136
+
137
+ svg.appendChild(g);
138
+
139
+ // رسم اعداد شدت محور عمودی
140
+ style = styles.intensity
141
+ g = putG({ container: svg, style });
142
+ const x = this.getX(-0.1)
143
+
144
+ for (let i = -10; i <= 120; i += 10) {
145
+ const y = this.getY(i)
146
+ const value = i
147
+ putText({ container: g, x, y, value })
148
+ }
149
+
150
+ svg.appendChild(g);
120
151
 
121
- // رسم اعداد شدت محور عمودی
122
- style = styles.intensity
123
- const x = this.getX(-0.1)
124
- for (let i = -10; i <= 120; i += 10) {
125
- const y = this.getY(i)
126
- const value = i
127
- putText({ container: svg, x, y, value, style })
128
152
  }
129
- // }
130
153
  // یک بوردر راهنمای توسعه برای اس‌ وی جی به تمام پهنا و ارتفاع رسم می‌کنیم
131
154
  // این مربع مرزی را آخرین ایجاد میکنیم تا بالاترین لایه باشد و روی ریودادها درست عمل کند
132
155
  const borderRect = putRect({
133
156
  container: svg, x: -chartPadding.left, y: -chartPadding.top,
134
157
  width: vbWidth, height: vbHeight, name: '',
135
- style: 'fill: transparent; stroke: transparent;',
158
+ style: 'fill: transparent; stroke: green;',
136
159
  });
137
160
  this.borderRect = borderRect;
138
161
 
@@ -1,14 +1,10 @@
1
- import Box from "./Box.js";
2
- import Header from "../Header/Header_N.js";
3
- import Reflex from "../Reflex/Reflex.js";
4
- import Sections from "./Sections_N.js";
5
- import Speech from "../Speech/Speech_N.js";
6
- import Tympanogram from "../Tympanogram/Tympanogram.js";
1
+ import Header from "../Header/Header_box.js";
2
+ import Speech from "../Speech/Speech_box.js";
7
3
  import putRect from "../common/putRect.js";
8
- import Audiogram from "../Audiogram/Audiogram_N.js";
4
+ import Audiogram from "../Audiogram/Audiogram_box.js";
9
5
  import mainTemplate from "../../assets/templates/mainTemplate.js";
10
6
  import putSVG from "../common/putSVG.js";
11
- import MultiText from "../MultiText/MultiText.js";
7
+ import MultiText from "../MultiText/MultiText_box.js";
12
8
  const svgNS = "http://www.w3.org/2000/svg";
13
9
 
14
10
  export default class Form {
@@ -40,7 +36,7 @@ export default class Form {
40
36
  case 'history':
41
37
  break;
42
38
  case 'RAudiogram':
43
- const RAudiogram = new Audiogram({ box, side: 'R', events: false })
39
+ const RAudiogram = new Audiogram({ box, container: box.container, side: 'R', events: false })
44
40
  break;
45
41
  case 'LAudiogram':
46
42
  // const LAudiogram = new Audiogram({ container: box.container, side: 'L', dims: box, events: false })
@@ -1,7 +1,7 @@
1
1
  const svgNS = "http://www.w3.org/2000/svg";
2
2
 
3
3
  import printForm from "./printForm.js";
4
- import Form from "./Form.js";
4
+ import Form from "../Form/Form.js";
5
5
  // import combo from "./templates/combo.js"; // این در حقیقیت یک تمپلت هست
6
6
  // import rasaAud from "./templates/rasa_audiometry.js";
7
7
  // import rasaTymp from './templates/rasa_tymp_reflex.js'
@@ -22,9 +22,9 @@ export default class Forms {
22
22
  // افزودن فرم
23
23
  addForms({ templates, defaultTemplateIndex }) {
24
24
  const container = this.container
25
+
25
26
  // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
26
27
  const div = document.createElement('div');
27
-
28
28
  div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
29
29
  container.appendChild(div);
30
30
 
@@ -37,7 +37,8 @@ export default class Forms {
37
37
  this.pages = forms
38
38
 
39
39
  templates.forEach((template, index) => {
40
- (this.mode == 'develop') && (btns[index] = this.putButton({ container: div, text: template.label, className }));
40
+ (this.mode == 'develop') &&
41
+ (btns[index] = this.putButton({ container: div, text: template.label, className }));
41
42
  this.forms.push(new Form({ container, template }));
42
43
  });
43
44
 
@@ -76,6 +77,8 @@ export default class Forms {
76
77
  }
77
78
  }
78
79
 
80
+
81
+
79
82
  // این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
80
83
  update({ data, officeData, patientData, sessionIndex = 0 }) {
81
84
  // ذخیره کل دیتا برای استفاده داخلی آپدیت فرم انتخاب شده
@@ -7,13 +7,10 @@ const svgNS = "http://www.w3.org/2000/svg";
7
7
 
8
8
  export default class Speech {
9
9
  constructor({ box, side = 'R' }) {
10
- console.log(box);
11
-
12
10
  // const { container, width, height, elements } = box
13
11
  // this.container = container;
14
12
  this.side = side;
15
13
  this.draw({ box })
16
-
17
14
  }
18
15
 
19
16
  draw({ box }) {
@@ -52,7 +49,6 @@ export default class Speech {
52
49
  }
53
50
  }
54
51
 
55
-
56
52
  // ایجاد ماتریکس سلول های چارت که آدرس و مختصات مرکز هر سلول را نگهداری میکند
57
53
  const matrix = [
58
54
  [],
@@ -69,7 +65,6 @@ export default class Speech {
69
65
  }
70
66
 
71
67
  style = styles.label;
72
-
73
68
  // برچسب های سطر اول
74
69
  // برای فرم های پیش چاپ شده انجام نمیشود
75
70
  // !dims.hideContext &&
package/src/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // import './style.css'
2
2
  import Audiogram from "./Audiogram/Audiogram.js"
3
- import Forms from "./Form/Forms.js";
3
+ import Forms from "./Forms/Forms.js";
4
4
  import { officeData, patientData } from "../assets/data/sampleData.js"
5
5
  import template from "../assets/templates/template_combo.js";
6
6
  import Tympanogram from "./Tympanogram/Tympanogram.js";
@@ -163,7 +163,7 @@ dims = {
163
163
  ]
164
164
  }
165
165
 
166
- const patient = new MultiText({ container, dims })
166
+ // const patient = new MultiText({ container, dims })
167
167
 
168
168
  dims = {
169
169
  "blank": false,
@@ -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: 'develop' });
198
+ const forms = new Forms({ container: document.getElementById('forms-div'), templates: [template], mode: 'production' });
199
199
  forms.update({ officeData, patientData, sessionIndex: 0 })
200
200
 
201
201
 
File without changes
File without changes