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.
- package/assets/styles-test.css +90 -90
- package/assets/styles.css +90 -90
- package/data/formData1.js +42 -42
- package/data/officesObjStore.js +56 -56
- package/data/patientsObjStore.js +73 -73
- package/data/sampleData.js +94 -94
- package/index.js +11 -11
- package/package.json +1 -1
- package/src/Audiogram/Audiogram.js +194 -197
- package/src/Audiogram/dims.js +83 -83
- package/src/Form/Form.js +268 -276
- package/src/Form/Form_N.js +158 -158
- package/src/Form/Forms-Test.html +124 -124
- package/src/Form/Forms.js +121 -134
- package/src/Form/Header.js +91 -91
- package/src/Form/Reflex.js +141 -141
- package/src/Form/Sections.js +71 -71
- package/src/Form/Speech.js +132 -132
- package/src/Form/TextBox.js +66 -82
- package/src/Form/Tympanogram.js +355 -355
- package/src/Form/formStyles.css +122 -122
- package/src/Form/globalinfo.js +68 -68
- package/src/Form/grid/drawGrid.js +84 -84
- package/src/Form/grid/hideGrid.js +8 -8
- package/src/Form/printForm.js +122 -75
- package/src/Form/templates/combo.js +248 -248
- package/src/Form/templates/dims.js +204 -204
- package/src/Form/templates/rasaAud.js +287 -287
- package/src/Symbol/Symbols.js +29 -29
- package/src/Symbol/createSymbolSVG.js +240 -240
- package/src/Symbol/getAllSymbolsSVG.js +21 -21
- package/src/Symbol/insertSymbol.js +10 -10
- package/src/Symbol/symbolChart.js +47 -47
- package/src/common/putLine.js +16 -16
- package/src/common/putPoint.js +12 -12
- package/src/common/putRect.js +13 -13
- package/src/common/putText.js +17 -16
- package/src/common/putTopLayer.js +17 -17
- package/src/main.js +88 -87
- package/src/note.css +62 -0
- package/src/style.css +152 -157
- package/src/note.html +0 -1
package/src/Form/Form.js
CHANGED
@@ -1,277 +1,269 @@
|
|
1
|
-
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
const
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
this.
|
27
|
-
this.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
this.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
});
|
68
|
-
}
|
69
|
-
if (sections.
|
70
|
-
this.
|
71
|
-
this.
|
72
|
-
}
|
73
|
-
if (sections.
|
74
|
-
this.
|
75
|
-
this.
|
76
|
-
}
|
77
|
-
if (sections.
|
78
|
-
this.
|
79
|
-
this.
|
80
|
-
}
|
81
|
-
if (sections.
|
82
|
-
this.
|
83
|
-
this.
|
84
|
-
}
|
85
|
-
if (sections.
|
86
|
-
this.
|
87
|
-
this.
|
88
|
-
}
|
89
|
-
if (sections.
|
90
|
-
|
91
|
-
this.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
//
|
122
|
-
//
|
123
|
-
//
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
},
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
//
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
this.
|
200
|
-
// }
|
201
|
-
// if (keys.includes("
|
202
|
-
this.
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
this.
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
this.
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
this.
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
this.
|
223
|
-
|
224
|
-
//
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
//
|
254
|
-
//
|
255
|
-
//
|
256
|
-
//
|
257
|
-
//
|
258
|
-
//
|
259
|
-
//
|
260
|
-
//
|
261
|
-
//
|
262
|
-
//
|
263
|
-
//
|
264
|
-
//
|
265
|
-
//
|
266
|
-
//
|
267
|
-
//
|
268
|
-
|
269
|
-
// x2: width - margin.right, y2: height, style: style, name: 'form-border'
|
270
|
-
// })
|
271
|
-
// // Middle Line
|
272
|
-
// putLine({
|
273
|
-
// container: container, x1: width / 2, y1: 0,
|
274
|
-
// x2: width / 2, y2: height, style: style, name: 'form-border'
|
275
|
-
// })
|
276
|
-
}
|
1
|
+
import Symbols from "../Symbol/Symbols.js";
|
2
|
+
import TextBox from "./TextBox.js";
|
3
|
+
import Header from "./Header.js";
|
4
|
+
import Reflex from "./Reflex.js";
|
5
|
+
import Sections from "./Sections.js";
|
6
|
+
import Speech from "./Speech.js";
|
7
|
+
import Tympanogram from "./Tympanogram.js";
|
8
|
+
import putRect from "../common/putRect.js";
|
9
|
+
import AudiogramChart from "../Audiogram/Audiogram.js";
|
10
|
+
const svgNS = "http://www.w3.org/2000/svg";
|
11
|
+
|
12
|
+
|
13
|
+
export default class Form {
|
14
|
+
constructor({ container, template, image } = {}) {
|
15
|
+
this.image = image;
|
16
|
+
// const dims = template;
|
17
|
+
this.template = template;
|
18
|
+
this.container = container;
|
19
|
+
this.data = {};
|
20
|
+
let { width, height, margin, paper } = template;
|
21
|
+
this.form = this.create({ paper, margin });
|
22
|
+
this.form.style.display = 'none';
|
23
|
+
// رسم مارجین های فرم
|
24
|
+
this.drawMarginLines({ container: this.form, width, height });
|
25
|
+
|
26
|
+
const sections = new Sections({ container: this.form, dims: template });
|
27
|
+
this.sections = sections;
|
28
|
+
|
29
|
+
if (sections.header) {
|
30
|
+
this.header = new Header({ container: sections.header })
|
31
|
+
this.header.draw({ dims: template.header });
|
32
|
+
}
|
33
|
+
|
34
|
+
if (sections.patient) {
|
35
|
+
this.patient = new TextBox({ container: sections.patient });
|
36
|
+
this.patient.draw({ dims: template.patient });
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
if (sections.history) {
|
41
|
+
this.history = new TextBox({ container: sections.history })
|
42
|
+
this.history.draw({ dims: template.history });
|
43
|
+
}
|
44
|
+
|
45
|
+
this.symbols = new Symbols();
|
46
|
+
|
47
|
+
if (sections.RAudiogram) {
|
48
|
+
this.RAudiogram = new AudiogramChart({
|
49
|
+
container: sections.RAudiogram,
|
50
|
+
dims: template.RAudiogram,
|
51
|
+
side: 'R',
|
52
|
+
});
|
53
|
+
}
|
54
|
+
if (sections.LAudiogram) {
|
55
|
+
this.LAudiogram = new AudiogramChart({
|
56
|
+
container: sections.LAudiogram,
|
57
|
+
dims: template.LAudiogram,
|
58
|
+
side: 'L',
|
59
|
+
});
|
60
|
+
}
|
61
|
+
if (sections.RSpeech) {
|
62
|
+
this.RSpeech = new Speech({ container: sections.RSpeech, side: 'R' })
|
63
|
+
this.RSpeech.draw({ dims: template.RSpeech, })
|
64
|
+
}
|
65
|
+
if (sections.LSpeech) {
|
66
|
+
this.LSpeech = new Speech({ container: sections.LSpeech, side: 'L' })
|
67
|
+
this.LSpeech.draw({ dims: template.LSpeech, });
|
68
|
+
}
|
69
|
+
if (sections.RTympanogram) {
|
70
|
+
this.RTympanogram = new Tympanogram({ container: sections.RTympanogram, dims: template.RTympanogram })
|
71
|
+
this.RTympanogram.draw({ dims: template.RTympanogram });
|
72
|
+
}
|
73
|
+
if (sections.LTympanogram) {
|
74
|
+
this.LTympanogram = new Tympanogram({ container: sections.LTympanogram, dims: template.LTympanogram })
|
75
|
+
this.LTympanogram.draw({ dims: template.LTympanogram });
|
76
|
+
}
|
77
|
+
if (sections.RReflex) {
|
78
|
+
this.RReflex = new Reflex({ container: sections.RReflex, dims: template.RReflex })
|
79
|
+
this.RReflex.draw({ dims: template.RReflex });
|
80
|
+
}
|
81
|
+
if (sections.LReflex) {
|
82
|
+
this.LReflex = new Reflex({ container: sections.LReflex, dims: template.LReflex })
|
83
|
+
this.LReflex.draw({ dims: template.LReflex });
|
84
|
+
}
|
85
|
+
if (sections.report) {
|
86
|
+
this.report = new TextBox({ container: sections.report })
|
87
|
+
this.report.draw({ dims: template.report });
|
88
|
+
}
|
89
|
+
if (sections.footer) {
|
90
|
+
|
91
|
+
this.footer = new TextBox({ container: sections.footer })
|
92
|
+
this.footer.draw({ dims: template.footer });
|
93
|
+
}
|
94
|
+
|
95
|
+
this.container.appendChild(this.form);
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
draw() {
|
100
|
+
|
101
|
+
let pad;
|
102
|
+
let style = `
|
103
|
+
user-select: none;
|
104
|
+
direction: ltr !important;
|
105
|
+
/* text-align: center; */
|
106
|
+
font-family: Arial, Helvetica, sans-serif !important;
|
107
|
+
font-size: 1.3mm;
|
108
|
+
font-weight: bold;
|
109
|
+
color: red;
|
110
|
+
text-anchor: middle; /*تراز افقی*/
|
111
|
+
dominant-baseline: middle; /* تراز عمودی*/
|
112
|
+
`;
|
113
|
+
// Draw Titles first
|
114
|
+
// putText({ container: this.sections.audiograms, value: "Right Ear", x: 42.5, y: 4, style: style })
|
115
|
+
// putText({ container: this.sections.speechs, value: "Speech Tests", x: this.sectionWidth / 2, y: 4, style: style })
|
116
|
+
// putText({ container: this.sections.tympanograms, value: "Tympanometry", x: this.sectionWidth / 2, y: 4, style: style })
|
117
|
+
// putText({ container: this.sections.reflexes, value: "Acoustic Reflexes", x: this.sectionWidth / 2, y: 4, style: style })
|
118
|
+
|
119
|
+
|
120
|
+
// برای مخفی کردن بوردرها تابع تاگل بوردر همین جا فراخوانی شود
|
121
|
+
// this.toggleBorders({ container: 'form' })
|
122
|
+
// this.toggleBorders({ container: 'section' })
|
123
|
+
// this.toggleBorders({ container: 'element' })
|
124
|
+
|
125
|
+
|
126
|
+
// بعد از رسم همه المنت ها یک المنت مستطیل تاپ لایر
|
127
|
+
// drawTopLayer({ container: this.form, dims: this.sections.dims });
|
128
|
+
}
|
129
|
+
|
130
|
+
create({ paper, margin }) {
|
131
|
+
const { width, height } = paper;
|
132
|
+
const { left, top } = margin;
|
133
|
+
|
134
|
+
const backgroundImage = this.template.backgroundImage;
|
135
|
+
let svg = document.createElementNS(svgNS, "svg");
|
136
|
+
svg.setAttribute("viewBox", [-left, -top, width, height])
|
137
|
+
svg.setAttribute("style", "background-color: BlanchedAlmond");
|
138
|
+
if (this.image) {
|
139
|
+
let image = document.createElementNS(svgNS, "image");
|
140
|
+
image.setAttribute('width', width);
|
141
|
+
image.setAttribute('height', height);
|
142
|
+
|
143
|
+
image.setAttribute('x', 0)
|
144
|
+
image.setAttribute('y', 0)
|
145
|
+
// image.setAttribute('height', height);
|
146
|
+
image.setAttribute('href', this.image);
|
147
|
+
|
148
|
+
svg.appendChild(image);
|
149
|
+
}
|
150
|
+
|
151
|
+
// div.appendChild(svg);
|
152
|
+
return svg;
|
153
|
+
}
|
154
|
+
|
155
|
+
update({ data, officeData, patientData, sessionIndex = 0 }) {
|
156
|
+
|
157
|
+
const session = patientData.sessions[sessionIndex]
|
158
|
+
// Prevent undefined error
|
159
|
+
if (!data) {
|
160
|
+
data = {
|
161
|
+
common: {
|
162
|
+
audiometer: "",
|
163
|
+
tympanometers: "",
|
164
|
+
},
|
165
|
+
header: {
|
166
|
+
officeName: officeData.name,
|
167
|
+
officeLogo: officeData.logo,
|
168
|
+
createDate: patientData.sessions[sessionIndex]?.createDate,
|
169
|
+
},
|
170
|
+
patient: {
|
171
|
+
name: patientData.name,
|
172
|
+
lastName: patientData.lastName,
|
173
|
+
gender: patientData?.gender,
|
174
|
+
age: patientData.sessions[sessionIndex]?.age,
|
175
|
+
referrer: patientData.sessions[sessionIndex]?.referrer,
|
176
|
+
|
177
|
+
},
|
178
|
+
footer: {
|
179
|
+
address: officeData.addresses[0],
|
180
|
+
tel: officeData.tels[0],
|
181
|
+
},
|
182
|
+
id: +sessionIndex + 1,
|
183
|
+
};
|
184
|
+
// data = { audiogram: {}, common: {}, footer: {}, header: {}, patient: {}, reflex: {}, report: {}, speech: {}, tympanometry: {} }
|
185
|
+
}
|
186
|
+
// find which data reach and then call corresponding update function
|
187
|
+
// get array of keys (audiogram, header, footer, ...)
|
188
|
+
let keys = Object.keys(data)
|
189
|
+
// if (keys.includes("header")) {
|
190
|
+
|
191
|
+
this.header?.update(data.header)
|
192
|
+
// }
|
193
|
+
// if (keys.includes("patient")) {
|
194
|
+
this.patient?.update(data.patient)
|
195
|
+
// }
|
196
|
+
// if (keys.includes("history")) {
|
197
|
+
|
198
|
+
this.history?.update(session?.history)
|
199
|
+
this.data.history = session.history;
|
200
|
+
// }
|
201
|
+
// if (keys.includes("audiogram")) {
|
202
|
+
this.RAudiogram?.update({ data: session.audiogram?.R, side: 'R' })
|
203
|
+
this.LAudiogram?.update({ data: session.audiogram?.L, side: 'L' })
|
204
|
+
this.data.audiogram = session.audiogram
|
205
|
+
// }
|
206
|
+
// if (keys.includes("speech")) {
|
207
|
+
this.RSpeech?.update(session.speech?.R)
|
208
|
+
this.LSpeech?.update(session.speech?.L)
|
209
|
+
this.data.speech = session.speech
|
210
|
+
// }
|
211
|
+
// if (keys.includes("tympanogram")) {
|
212
|
+
this.RTympanogram?.update(session.tympanogram?.R)
|
213
|
+
this.LTympanogram?.update(session.tympanogram?.L)
|
214
|
+
this.data.tympanogram = session.tympanogram;
|
215
|
+
// }
|
216
|
+
// if (keys.includes("reflex")) {
|
217
|
+
this.RReflex?.update(session.reflex?.R)
|
218
|
+
this.LReflex?.update(session.reflex?.L)
|
219
|
+
this.data.tympanogram = session.reflex;
|
220
|
+
// }
|
221
|
+
// if (keys.includes("report")) {
|
222
|
+
this.report?.update(session.report)
|
223
|
+
this.data.report = session.report;
|
224
|
+
// }
|
225
|
+
// if (keys.includes("footer")) {
|
226
|
+
// console.log("footer Data:", data?.footer);
|
227
|
+
|
228
|
+
this.footer?.update(data?.footer)
|
229
|
+
this.data.footer = data.footer;
|
230
|
+
// }
|
231
|
+
}
|
232
|
+
|
233
|
+
// خطوط نقطه چین مارجین فرم
|
234
|
+
drawMarginLines({ container, width, height }) {
|
235
|
+
// console.log(container.attributes.viewBox);
|
236
|
+
|
237
|
+
const style = `
|
238
|
+
stroke: black;
|
239
|
+
stroke-width: 0.3;
|
240
|
+
stroke-opacity: 0.5;
|
241
|
+
stroke-dasharray: 0.5;
|
242
|
+
fill: transparent;
|
243
|
+
`;
|
244
|
+
putRect({ container, x: 0, y: 0, width, height, style })
|
245
|
+
// Horizontal Lines
|
246
|
+
// putLine({
|
247
|
+
// container: container, x1: 0, y1: margin.top,
|
248
|
+
// x2: width, y2: margin.top, style: style, name: 'form-border'
|
249
|
+
// })
|
250
|
+
// putLine({
|
251
|
+
// container: container, x1: 0, y1: height - margin.bottom,
|
252
|
+
// x2: width, y2: height - margin.bottom, style: style, name: 'form-border'
|
253
|
+
// })
|
254
|
+
// // Vertical Lines
|
255
|
+
// putLine({
|
256
|
+
// container: container, x1: margin.left, y1: 0,
|
257
|
+
// x2: margin.left, y2: height, style: style, name: 'form-border'
|
258
|
+
// })
|
259
|
+
// putLine({
|
260
|
+
// container: container, x1: width - margin.right, y1: 0,
|
261
|
+
// x2: width - margin.right, y2: height, style: style, name: 'form-border'
|
262
|
+
// })
|
263
|
+
// // Middle Line
|
264
|
+
// putLine({
|
265
|
+
// container: container, x1: width / 2, y1: 0,
|
266
|
+
// x2: width / 2, y2: height, style: style, name: 'form-border'
|
267
|
+
// })
|
268
|
+
}
|
277
269
|
}
|