hayun-vite 0.10.1 → 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.
- package/assets/data/sampleData.js +10 -2
- package/assets/templates/mainTemplate.js +128 -0
- package/assets/templates/template_combo.js +49 -44
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +43 -21
- package/src/Audiogram/Audiogram_100.js +499 -0
- package/src/Audiogram/Audiogram_box.js +483 -0
- package/src/Audiogram/dims.js +4 -80
- package/src/Audiogram/dims_100.js +51 -0
- package/src/Audiogram/dims_box.js +125 -0
- package/src/{Form → Box}/Box.js +26 -3
- package/src/Form/Form.js +8 -8
- package/src/Form/Form_N.js +194 -0
- package/src/Form/Forms.js +0 -2
- package/src/Form/Sections.js +0 -6
- package/src/Form/Sections_N.js +66 -0
- package/src/{Form → Header}/Header.js +1 -4
- package/src/Header/Header_N.js +72 -0
- package/src/MultiText/MultiText.js +37 -0
- package/src/{Form/Reflex_N.js → Reflex/Reflex.js} +15 -3
- package/src/Reflex/units.js +65 -0
- package/src/{Form/Speech_N.js → Speech/Speech.js} +45 -28
- package/src/Speech/Speech_N.js +125 -0
- package/src/Speech/units.js +31 -0
- package/src/{Form → Tympanogram}/Tympanogram.js +37 -68
- package/src/Tympanogram/units.js +76 -0
- package/src/common/{putTextBox.js → putCell.js} +6 -6
- package/src/common/putG.js +10 -0
- package/src/common/putLine.js +1 -1
- package/src/common/putText.js +5 -4
- package/src/main.js +140 -19
- package/assets/fonts/Vazirmatn-Regular.woff2 +0 -0
- package/assets/styles-test.css +0 -86
- package/assets/styles.css +0 -86
- package/src/Form/Reflex.js +0 -145
- package/src/Form/Speech.js +0 -121
- package/src/Form/globalinfo.js +0 -68
@@ -0,0 +1,125 @@
|
|
1
|
+
const dims = {
|
2
|
+
name: 'Audiogram',
|
3
|
+
margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
4
|
+
|
5
|
+
// واحد ویوباکس - بدون واحد
|
6
|
+
vbWidth: 700, // برای اینکه ضخامت خطوط تغییری ناهنجار نکند این ثابت میماند
|
7
|
+
vbHeight: 750, // این به نسبت تغییر میکند
|
8
|
+
|
9
|
+
// واحد پیکسل، میلیمتر، ...
|
10
|
+
// اگر واحد پایینی توسط بیرون تغییر کرد واحدهای بالایی باید با نسبت پایینی تغییر کنند
|
11
|
+
width: 700,
|
12
|
+
height: 700 ,
|
13
|
+
|
14
|
+
// این فاصله خطوط محورهای بالا و چپ ادیوگرام از لبه ها هست
|
15
|
+
chartPadding: { left: 40, top: 40, right: 30, bottom: 20 },
|
16
|
+
symbolDims: { width: 55, height: 55 },
|
17
|
+
symbolsChart: {
|
18
|
+
width: 240, height: 60
|
19
|
+
},
|
20
|
+
// virtual frequency
|
21
|
+
mainFrequencies: [125, 250, 500, 1000, 2000, 4000, 8000],
|
22
|
+
frequencies: [
|
23
|
+
{ f: 125, vf: 0, label: false }, { f: 250, vf: 2 },
|
24
|
+
{ f: 500, vf: 4 }, { f: 750, vf: 5.2, semiOctav: true },
|
25
|
+
{ f: 1000, vf: 6 }, { f: 1500, vf: 7.2, semiOctav: true },
|
26
|
+
{ f: 2000, vf: 8 }, { f: 3000, vf: 9.2, semiOctav: true },
|
27
|
+
{ f: 4000, vf: 10 }, { f: 6000, vf: 11.2, semiOctav: true },
|
28
|
+
{ f: 8000, vf: 12 }, { f: 16000, vf: 14 },
|
29
|
+
],
|
30
|
+
|
31
|
+
vf: { min: 0, max: 14, step: 1 }, // virtual frequency
|
32
|
+
vfArray: [0, 2, 4, 5.2, 6, 7.2, 8, 9.2, 10, 11.2, 12],
|
33
|
+
vfToF: { 0: 125, 2: 250, 4: 500, 5.2: 750, 6: 1000, 7.2: 1500, 8: 2000, 9.2: 3000, 10: 4000, 11.2: 6000, 12: 8000, 13: 12000, 14: 16000 },
|
34
|
+
fToVf: { 125: 0, 250: 2, 500: 4, 750: 5.2, 1000: 6, 1500: 7.2, 2000: 8, 3000: 9.2, 4000: 10, 6000: 11.2, 8000: 12, 12000: 13.2, 16000: 14 },
|
35
|
+
intensity: { min: -20, max: 130, step: 10 },
|
36
|
+
styles: {
|
37
|
+
frequency: `text-anchor: middle; dominant-baseline: hanging;
|
38
|
+
font: 1.3em Verdana, Helvetica, Arial, sans-serif; user-select: none;font-weight:bold;`,
|
39
|
+
intensity: `text-anchor: end; dominant-baseline: middle;
|
40
|
+
font: 1.3em Verdana, Helvetica, Arial, sans-serif; user-select: none;font-weight:bold;`,
|
41
|
+
mainFreqline: `stroke: black; stroke-width: 1;`,
|
42
|
+
semiOctavFreqline: `stroke: black; stroke-width: 1; stroke-dasharray: 4;`,
|
43
|
+
boldLine: 'stroke: black; stroke-width: 3;',
|
44
|
+
|
45
|
+
juncDashLine: `stroke-width: 1 ; stroke-opacity: 0.8; stroke-dasharray: 4;`,
|
46
|
+
juncLine: `stroke-width: 1; stroke-opacity: 0.8;`,
|
47
|
+
},
|
48
|
+
|
49
|
+
// پس از اضافه کردن هر آیتم در زیر این تمپلت رو هم آپدیت کنید
|
50
|
+
// template: {
|
51
|
+
// margin: { left: 0, top: 0, }, // در کانتینر دیو این عمل نمیکنه. مگر در کانتینر اس وی جی بذاریم
|
52
|
+
|
53
|
+
// width: 700,
|
54
|
+
// height: 700,
|
55
|
+
|
56
|
+
// chartPadding: { left: 40, top: 50, right: 30, bottom: 10 },
|
57
|
+
// symbolDims: { width: 55, height: 55 },
|
58
|
+
// // virtual frequency
|
59
|
+
// frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
|
60
|
+
|
61
|
+
// iFrequency: { min: 0, max: 14, step: 1 },
|
62
|
+
// iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
|
63
|
+
// fToVf: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
|
64
|
+
// intensity: { min: -20, max: 120, step: 10 },
|
65
|
+
|
66
|
+
// styles: {
|
67
|
+
// freq: ``,
|
68
|
+
// line: ``,
|
69
|
+
// juncDashLine: ``,
|
70
|
+
// juncLine: ``,
|
71
|
+
// }
|
72
|
+
// },
|
73
|
+
|
74
|
+
// display: {
|
75
|
+
// width: 800,
|
76
|
+
// height: 600,
|
77
|
+
|
78
|
+
|
79
|
+
// },
|
80
|
+
// rasa_audiometry: {
|
81
|
+
// blank: true, // define Blank Chart for PrePrinted Chart, Lines do not draw
|
82
|
+
// // width: 70.6,
|
83
|
+
// // height: 70,
|
84
|
+
// // margin: { left: 17, top: 18.5, },
|
85
|
+
// chartPadding: { left: 0, top: 0, right: 0, bottom: 0 },
|
86
|
+
// symbolDims: { width: 8, height: 8 },
|
87
|
+
// // virtual frequency
|
88
|
+
// frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
|
89
|
+
|
90
|
+
// iFrequency: { min: 0, max: 14, step: 1 },
|
91
|
+
// iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
|
92
|
+
// fTovf: { 125: 0, 250: 2, 500: 4, 750: 5.2, 1000: 6, 1500: 7.2, 2000: 8, 3000: 9.2, 4000: 10, 6000: 11.2, 8000: 12, 12000: 13.2, 16000: 14 },
|
93
|
+
// intensity: { min: -20, max: 120, step: 10 },
|
94
|
+
|
95
|
+
// styles: {
|
96
|
+
// freq: ``,
|
97
|
+
// line: `stroke: black; stroke-width: 0.1;`,
|
98
|
+
// juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
|
99
|
+
// juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
|
100
|
+
// }
|
101
|
+
// },
|
102
|
+
// combo: {
|
103
|
+
// // width: 50,
|
104
|
+
// // height: 40,
|
105
|
+
// // margin: { left: 5, top: 5, right: 5, bottom: 5 },
|
106
|
+
// chartPadding: { left: 8, top: 8, right: 5, bottom: 3 },
|
107
|
+
// symbolDims: { width: 8, height: 8 },
|
108
|
+
// // virtual frequency
|
109
|
+
// frequencies: [{ value: 125, x: 0 }, { value: 250, x: 2 }, { value: 500, x: 4 }, { value: 750, x: 5 }],
|
110
|
+
|
111
|
+
// iFrequency: { min: 0, max: 14, step: 1 },
|
112
|
+
// iToFreq: { 0: 125, 2: 250, 4: 500, 5: 750, 6: 1000, 7: 1500, 8: 2000, 9: 3000, 10: 4000, 11: 6000, 12: 8000, 13: 12000, 14: 16000 },
|
113
|
+
// freqToi: { 125: 0, 250: 2, 500: 4, 750: 5, 1000: 6, 1500: 7, 2000: 8, 3000: 9, 4000: 10, 6000: 11, 8000: 12, 12000: 13, 16000: 14 },
|
114
|
+
// intensity: { min: -20, max: 120, step: 10 },
|
115
|
+
|
116
|
+
// styles: {
|
117
|
+
// freq: ``,
|
118
|
+
// line: `stroke: black; stroke-width: 0.1;`,
|
119
|
+
// juncDashLine: `stroke-width: 0.1 ; stroke-opacity: 0.8; stroke-dasharray: 0.5;`,
|
120
|
+
// juncLine: `stroke-width: 0.2; stroke-opacity: 0.8;`,
|
121
|
+
// }
|
122
|
+
// }
|
123
|
+
}
|
124
|
+
|
125
|
+
export default dims;
|
package/src/{Form → Box}/Box.js
RENAMED
@@ -3,7 +3,7 @@ import putRect from "../common/putRect.js";
|
|
3
3
|
import putText from "../common/putText.js";
|
4
4
|
const svgNS = "http://www.w3.org/2000/svg";
|
5
5
|
|
6
|
-
export default class
|
6
|
+
export default class Box {
|
7
7
|
constructor({ container }) {
|
8
8
|
this.container = container;
|
9
9
|
}
|
@@ -21,6 +21,7 @@ export default class TextBox {
|
|
21
21
|
style = `
|
22
22
|
/* font-family: Arial, Helvetica, sans-serif !important; */
|
23
23
|
font-size: 1mm;
|
24
|
+
white-space: break-spaces;
|
24
25
|
/* font-weight: bold; */
|
25
26
|
direction: rtl !important;
|
26
27
|
user-select: none;
|
@@ -76,7 +77,29 @@ export default class TextBox {
|
|
76
77
|
|
77
78
|
update(data) {
|
78
79
|
this.inputs.forEach(input => {
|
79
|
-
|
80
|
+
let value = data?.[input.name];
|
81
|
+
const textInput = this.container.querySelector(`text[data-name=${input.name}]`)
|
82
|
+
|
83
|
+
// پیدا کردن کاراکترهای رفتن به سرخط در متن
|
84
|
+
const textLines = value.toString().split(/\n|\r|\r\n/);
|
85
|
+
const x = textInput.getAttribute('x')
|
86
|
+
// اگر متن چند خطی بود
|
87
|
+
if (textLines.length >= 2) {
|
88
|
+
let y = 5;
|
89
|
+
textLines.forEach(value => {
|
90
|
+
putTspan({ container: textInput, value, x, y });
|
91
|
+
y += 6;
|
92
|
+
})
|
93
|
+
} else textInput.innerHTML = value || "";
|
80
94
|
});
|
81
95
|
}
|
82
|
-
}
|
96
|
+
}
|
97
|
+
|
98
|
+
function putTspan({ container, value, x , y = 5, dx = 0, dy = 0, style }) {
|
99
|
+
const tspan = document.createElementNS(svgNS, "tspan");
|
100
|
+
tspan.setAttribute('x', x);
|
101
|
+
tspan.setAttribute('y', y)
|
102
|
+
tspan.textContent = value;
|
103
|
+
container && container.appendChild(tspan)
|
104
|
+
return tspan;
|
105
|
+
}
|
package/src/Form/Form.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
// import Symbols from "../Symbol/Symbols.js";
|
2
|
-
import Box from "
|
3
|
-
import Header from "
|
4
|
-
import Reflex from "
|
2
|
+
import Box from "../Box/Box.js";
|
3
|
+
import Header from "../Header/Header.js";
|
4
|
+
import Reflex from "../Reflex/Reflex.js";
|
5
5
|
import Sections from "./Sections.js";
|
6
|
-
import Speech from "
|
7
|
-
import Tympanogram from "
|
6
|
+
import Speech from "../Speech/Speech.js";
|
7
|
+
import Tympanogram from "../Tympanogram/Tympanogram.js";
|
8
8
|
import putRect from "../common/putRect.js";
|
9
9
|
import AudiogramChart from "../Audiogram/Audiogram.js";
|
10
10
|
const svgNS = "http://www.w3.org/2000/svg";
|
@@ -49,6 +49,8 @@ export default class Form {
|
|
49
49
|
side: 'R',
|
50
50
|
events: false
|
51
51
|
});
|
52
|
+
console.log(template.RAudiogram);
|
53
|
+
|
52
54
|
}
|
53
55
|
if (sections.LAudiogram) {
|
54
56
|
this.LAudiogram = new AudiogramChart({
|
@@ -76,18 +78,16 @@ export default class Form {
|
|
76
78
|
}
|
77
79
|
if (sections.RTympanogram) {
|
78
80
|
this.RTympanogram = new Tympanogram({ container: sections.RTympanogram, side: 'R' })
|
79
|
-
this.RTympanogram.draw({ dims: template.RTympanogram });
|
81
|
+
this.RTympanogram.draw({ dims: template.RTympanogram });
|
80
82
|
}
|
81
83
|
if (sections.LTympanogram) {
|
82
84
|
this.LTympanogram = new Tympanogram({ container: sections.LTympanogram, side: 'L' })
|
83
85
|
this.LTympanogram.draw({ dims: template.LTympanogram });
|
84
86
|
}
|
85
|
-
|
86
87
|
if (sections['Reflex Titles']) {
|
87
88
|
const titles = new Box({ container: sections['Reflex Titles'] });
|
88
89
|
titles.draw({ dims: template['Reflex Titles'] });
|
89
90
|
}
|
90
|
-
|
91
91
|
if (sections.RReflex) {
|
92
92
|
this.RReflex = new Reflex({ container: sections.RReflex, side: 'R' })
|
93
93
|
this.RReflex.draw({ dims: template.RReflex });
|
@@ -0,0 +1,194 @@
|
|
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";
|
7
|
+
import putRect from "../common/putRect.js";
|
8
|
+
import Audiogram from "../Audiogram/Audiogram_N.js";
|
9
|
+
import mainTemplate from "../../assets/templates/mainTemplate.js";
|
10
|
+
import putSVG from "../common/putSVG.js";
|
11
|
+
import MultiText from "../MultiText/MultiText.js";
|
12
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
13
|
+
|
14
|
+
export default class Form {
|
15
|
+
constructor({ container, template } = {}) {
|
16
|
+
this.template = mainTemplate;
|
17
|
+
this.container = container;
|
18
|
+
this.data = {};
|
19
|
+
let { width, height, margin, paper, sections } = mainTemplate;
|
20
|
+
|
21
|
+
this.form = this.create({ paper, margin }); // Printable Area
|
22
|
+
|
23
|
+
this.form.style.display = 'none'; // فرم نامرئی ایجاد میشود و بعدا مرئی میشود
|
24
|
+
// رسم مارجین های فرم
|
25
|
+
this.drawMarginLines({ container: this.form, width, height });
|
26
|
+
|
27
|
+
sections.forEach(section => {
|
28
|
+
this.createSection(section)
|
29
|
+
this.createBox(section)
|
30
|
+
|
31
|
+
const box = section.box
|
32
|
+
|
33
|
+
switch (section.name) {
|
34
|
+
case 'header':
|
35
|
+
const header = new Header({ box })
|
36
|
+
break;
|
37
|
+
case 'patientInfo':
|
38
|
+
const patientInfo = new MultiText({ box })
|
39
|
+
break;
|
40
|
+
case 'history':
|
41
|
+
break;
|
42
|
+
case 'RAudiogram':
|
43
|
+
const RAudiogram = new Audiogram({ box, side: 'R', events: false })
|
44
|
+
break;
|
45
|
+
case 'LAudiogram':
|
46
|
+
// const LAudiogram = new Audiogram({ container: box.container, side: 'L', dims: box, events: false })
|
47
|
+
break;
|
48
|
+
case 'RSpeech':
|
49
|
+
const RSpeech = new Speech({ box })
|
50
|
+
break;
|
51
|
+
|
52
|
+
default:
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// this.createBox(sections[0])
|
58
|
+
// this.createElements(sections[0].box)
|
59
|
+
// let box = sections[0].box
|
60
|
+
|
61
|
+
// const header = new Header({ box })
|
62
|
+
|
63
|
+
// box = sections[1].box
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
this.container.appendChild(this.form);
|
68
|
+
}
|
69
|
+
|
70
|
+
// Sections With Brown Color Border
|
71
|
+
createSection(section) {
|
72
|
+
// console.log(dims);
|
73
|
+
const { width, height, top, left } = section;
|
74
|
+
const style = ['fill: transparent', 'stroke: brown', 'stroke-width: 0.2'].join(';')
|
75
|
+
const container = putSVG({ container: this.form, x: left, y: top, width, height })
|
76
|
+
|
77
|
+
putRect({ container, x: 0, y: 0, width, height, style })
|
78
|
+
// اضافه کردن پراپرتی اسویجی به آبجکت سکشن
|
79
|
+
section['container'] = container;
|
80
|
+
// console.log(section);
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
// Boxes Width Blue Color Border
|
85
|
+
createBox(section) {
|
86
|
+
const { width, height, margin } = section.box
|
87
|
+
const style = ['fill: transparent', 'stroke: blue', 'stroke-width: 0.2'].join(';')
|
88
|
+
const container = putSVG({ container: section.container, x: margin.left, y: margin.top, width, height })
|
89
|
+
putRect({ container, x: 0, y: 0, width, height, style })
|
90
|
+
|
91
|
+
section.box.container = container
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
create({ paper, margin }) {
|
97
|
+
const { width, height } = paper;
|
98
|
+
const { left, top } = margin;
|
99
|
+
|
100
|
+
const backgroundImage = this.template.backgroundImage;
|
101
|
+
|
102
|
+
let svg = document.createElementNS(svgNS, "svg");
|
103
|
+
svg.setAttribute("viewBox", [-left, -top, width, height])
|
104
|
+
svg.setAttribute("style", "background-color: BlanchedAlmond");
|
105
|
+
if (backgroundImage) {
|
106
|
+
let image = document.createElementNS(svgNS, "image")
|
107
|
+
image.setAttribute('class', 'no-print')
|
108
|
+
image.setAttribute('width', width)
|
109
|
+
// image.setAttribute('height', height)
|
110
|
+
|
111
|
+
image.setAttribute('x', 0)
|
112
|
+
image.setAttribute('y', 0)
|
113
|
+
// image.setAttribute('height', height);
|
114
|
+
image.setAttribute('href', backgroundImage)
|
115
|
+
|
116
|
+
svg.appendChild(image)
|
117
|
+
}
|
118
|
+
return svg
|
119
|
+
}
|
120
|
+
|
121
|
+
update({ data, officeData, patientData, sessionIndex = 0 }) {
|
122
|
+
|
123
|
+
/*
|
124
|
+
const session = patientData.sessions[sessionIndex]
|
125
|
+
// Prevent undefined error
|
126
|
+
if (!data) {
|
127
|
+
data = {
|
128
|
+
common: {
|
129
|
+
audiometer: "",
|
130
|
+
tympanometers: "",
|
131
|
+
},
|
132
|
+
header: {
|
133
|
+
officeName: officeData.name,
|
134
|
+
officeLogo: officeData.logo,
|
135
|
+
createDate: patientData.sessions[sessionIndex]?.createDate,
|
136
|
+
},
|
137
|
+
patient: {
|
138
|
+
name: patientData.name,
|
139
|
+
lastName: patientData.lastName,
|
140
|
+
gender: patientData?.gender,
|
141
|
+
// خط زیر محاسبه درست سن هست. موقتا کامنت میشود تا در اپ اصلی فیلد سن رو در سشن ها قرار دهیم
|
142
|
+
// age: patientData.sessions[sessionIndex]?.age,
|
143
|
+
age: patientData?.age,
|
144
|
+
referrer: patientData.sessions[sessionIndex]?.referrer,
|
145
|
+
date: new Date().toLocaleDateString('fa-IR'),
|
146
|
+
|
147
|
+
},
|
148
|
+
footer: {
|
149
|
+
address: officeData.addresses[0],
|
150
|
+
tel: officeData.tels[0],
|
151
|
+
},
|
152
|
+
id: +sessionIndex + 1,
|
153
|
+
};
|
154
|
+
// data = { audiogram: {}, common: {}, footer: {}, header: {}, patient: {}, reflex: {}, report: {}, speech: {}, tympanometry: {} }
|
155
|
+
}
|
156
|
+
// get array of keys (audiogram, header, footer, ...)
|
157
|
+
let keys = Object.keys(data)
|
158
|
+
this.header?.update(data.header)
|
159
|
+
this.patient?.update(data.patient)
|
160
|
+
this.history?.update(session?.history)
|
161
|
+
this.data.history = session.history;
|
162
|
+
this.RAudiogram?.update({ data: session.audiogram?.R, side: 'R' })
|
163
|
+
this.LAudiogram?.update({ data: session.audiogram?.L, side: 'L' })
|
164
|
+
this.data.audiogram = session.audiogram
|
165
|
+
this.RSpeech?.update(session.speech?.R)
|
166
|
+
this.LSpeech?.update(session.speech?.L)
|
167
|
+
this.data.speech = session.speech
|
168
|
+
this.RTympanogram?.update(session.tympanogram?.R)
|
169
|
+
this.LTympanogram?.update(session.tympanogram?.L)
|
170
|
+
this.data.tympanogram = session.tympanogram;
|
171
|
+
this.RReflex?.update(session.reflex?.R)
|
172
|
+
this.LReflex?.update(session.reflex?.L)
|
173
|
+
this.data.tympanogram = session.reflex;
|
174
|
+
this.report?.update(session.report)
|
175
|
+
this.data.report = session.report;
|
176
|
+
this.footer?.update(data?.footer)
|
177
|
+
this.data.footer = data.footer;
|
178
|
+
*/
|
179
|
+
}
|
180
|
+
|
181
|
+
// خطوط نقطه چین مارجین فرم
|
182
|
+
drawMarginLines({ container, width, height }) {
|
183
|
+
|
184
|
+
const style = `
|
185
|
+
stroke: black;
|
186
|
+
stroke-width: 0.3;
|
187
|
+
stroke-opacity: 0.5;
|
188
|
+
stroke-dasharray: 0.5;
|
189
|
+
fill: transparent;
|
190
|
+
`;
|
191
|
+
|
192
|
+
putRect({ container, x: 0, y: 0, width, height, style, className: 'no-print' })
|
193
|
+
}
|
194
|
+
}
|
package/src/Form/Forms.js
CHANGED
@@ -47,8 +47,6 @@ export default class Forms {
|
|
47
47
|
this.selectedForm = this.forms[selectedIndex];
|
48
48
|
(this.mode == 'develop') && (btns[selectedIndex].style.backgroundColor = ' #1c15e1');
|
49
49
|
|
50
|
-
console.log(this.mode);
|
51
|
-
|
52
50
|
if (this.mode == 'develop') {
|
53
51
|
|
54
52
|
const printBtn = this.putButton({ container: div, text: 'چاپ', className });
|
package/src/Form/Sections.js
CHANGED
@@ -6,19 +6,13 @@ export default class Sections {
|
|
6
6
|
// console.log(this.dims.sections);
|
7
7
|
this.container = container;
|
8
8
|
this.margins = dims.margin;
|
9
|
-
|
10
9
|
this.width = dims.width;
|
11
10
|
this.height = dims.height;
|
12
|
-
|
13
11
|
this.left = 0; // برای این فعلا برنامه ای ندارم وقتی دو سکشن در یک خط لازم شد میام سراغش
|
14
12
|
this.top = 0;
|
15
13
|
// از پایینی برای رسم تاپ لایر استفاده میکنم
|
16
14
|
this.cords = []; // آرایه نگهداری مختصات و طول و عرض هر سکشن
|
17
|
-
|
18
15
|
this.sectionBorders = dims.sectionBorders;
|
19
|
-
console.log(this.sectionBorders);
|
20
|
-
|
21
|
-
|
22
16
|
// یک حلقه آرایه ایجاد میکنیم همه سکشن ها رسم شود
|
23
17
|
this.create()
|
24
18
|
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import putRect from "../common/putRect";
|
2
|
+
|
3
|
+
export default class Sections {
|
4
|
+
constructor({ container, dims }) {
|
5
|
+
this.dims = dims
|
6
|
+
// console.log(this.dims.sections);
|
7
|
+
this.container = container;
|
8
|
+
this.margins = dims.margin;
|
9
|
+
this.width = dims.width;
|
10
|
+
this.height = dims.height;
|
11
|
+
this.left = 0; // برای این فعلا برنامه ای ندارم وقتی دو سکشن در یک خط لازم شد میام سراغش
|
12
|
+
this.top = 0;
|
13
|
+
// از پایینی برای رسم تاپ لایر استفاده میکنم
|
14
|
+
this.cords = []; // آرایه نگهداری مختصات و طول و عرض هر سکشن
|
15
|
+
this.sectionBorders = dims.sectionBorders;
|
16
|
+
// یک حلقه آرایه ایجاد میکنیم همه سکشن ها رسم شود
|
17
|
+
this.create()
|
18
|
+
}
|
19
|
+
// ایجاد سکشنها
|
20
|
+
create() {
|
21
|
+
// console.log(this.dims.sections);
|
22
|
+
const margins = this.margins;
|
23
|
+
|
24
|
+
this.dims.sections.forEach(section => {
|
25
|
+
let name = section.name;
|
26
|
+
let width = section.w;
|
27
|
+
let height = section.h;
|
28
|
+
const display = section.display;
|
29
|
+
// اگر مقدار دیسپلی اینلاین بود به بلوک بعد نمیره
|
30
|
+
|
31
|
+
// یک کادر چهارگوش با نام
|
32
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
33
|
+
// const w = dims.header.width, h = dims.header.height;
|
34
|
+
const svg = document.createElementNS(svgNS, "svg");
|
35
|
+
svg.setAttribute("data-name", name);
|
36
|
+
svg.setAttribute("width", width);
|
37
|
+
svg.setAttribute("height", height);
|
38
|
+
svg.setAttribute("x", this.left);
|
39
|
+
svg.setAttribute("y", this.top);
|
40
|
+
|
41
|
+
// نگهداری مختصات رسم بوردر هر سکشن برای استفاده در متد داخلی رسم بودر تاپ لایر
|
42
|
+
this.cords.push({ name, width, height, x: this.left, y: this.top });
|
43
|
+
|
44
|
+
// Section Border
|
45
|
+
(this.sectionBorders == 'display') &&
|
46
|
+
putRect({
|
47
|
+
container: svg, x: 0, y: 0, width, height,
|
48
|
+
style: 'fill: transparent; stroke: blue; stroke-width: 0.2',
|
49
|
+
className: 'no-print', name: 'guide-border'
|
50
|
+
});
|
51
|
+
|
52
|
+
this[name] = svg;
|
53
|
+
this.container.appendChild(svg)
|
54
|
+
|
55
|
+
// به روز کردن ارتفاع نقطه خالی برای رسم سکشن بعدی
|
56
|
+
// با توجه بلاک یا اینلاین بودن سکشن بالا و چپ را تغییر بده
|
57
|
+
// else { this.left = margins.left; this.top += height; }
|
58
|
+
if (display === 'block') { this.left = 0; this.top += height; }
|
59
|
+
if (display === 'inline') { this.left += width; }
|
60
|
+
|
61
|
+
|
62
|
+
// if (this.left >= this.width) { this.left = margins.left; this.top += height; }
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
}
|
@@ -4,13 +4,12 @@ import putSVG from "../common/putSVG.js";
|
|
4
4
|
import putText from "../common/putText.js";
|
5
5
|
const svgNS = "http://www.w3.org/2000/svg";
|
6
6
|
|
7
|
-
|
8
7
|
export default class Header {
|
9
8
|
constructor({ container }) {
|
10
9
|
this.container = container;
|
11
10
|
}
|
12
11
|
|
13
|
-
draw({ dims
|
12
|
+
draw({ dims }) {
|
14
13
|
|
15
14
|
this.inputs = dims.inputs
|
16
15
|
let value;
|
@@ -76,7 +75,5 @@ export default class Header {
|
|
76
75
|
this.container.querySelector("[data-name=officeName]").innerHTML = data?.officeName || "";
|
77
76
|
this.container.querySelector("[data-name=date]").innerHTML = data?.createDate || "";
|
78
77
|
this.container.querySelector("[data-name=officeLogo]").setAttribute("href", data?.officeLogo || "");
|
79
|
-
|
80
78
|
}
|
81
|
-
|
82
79
|
}
|
@@ -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
|
+
}
|