hayun-vite 0.13.0 → 0.15.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 +18 -14
- package/assets/templates/templAudiometry.js +348 -0
- package/assets/templates/{template_combo.js → templCombo.js} +5 -5
- package/index.html +44 -14
- package/index.js +2 -2
- package/package.json +1 -1
- package/src/Audiogram/test.js +37 -0
- package/src/Form/Form.js +89 -73
- package/src/Forms/Forms.js +60 -77
- package/src/Forms/test.js +37 -0
- package/src/Header/Header.js +7 -8
- package/src/MultiText/MultiText.js +15 -13
- package/src/Speech/Speech.js +1 -0
- package/src/Tympanogram/Tympanogram.js +47 -35
- package/src/Tympanogram/test.js +63 -12
- package/src/Tympanogram/units.js +2 -1
- package/src/common/putGrid.js +31 -0
- package/src/main.js +1 -1
- /package/{src/styles.css → styles.css} +0 -0
package/src/Form/Form.js
CHANGED
@@ -9,18 +9,19 @@ import MultiText from "../MultiText/MultiText.js";
|
|
9
9
|
const svgNS = "http://www.w3.org/2000/svg";
|
10
10
|
|
11
11
|
export default class Form {
|
12
|
-
constructor({ container, template } = {}) {
|
12
|
+
constructor({ container, template, mode = "production" } = {}) {
|
13
13
|
this.template = template;
|
14
14
|
this.container = container;
|
15
|
+
this.mode = mode;
|
15
16
|
this.data = {};
|
16
17
|
let { width, height, margin, paper } = template;
|
17
|
-
this.
|
18
|
-
this.
|
18
|
+
this.svg = this.create({ paper, margin }); // اسویجی مادر فرم را صفحه نامگذاری میکنیم بذاریم همون اسویجی؟
|
19
|
+
this.svg.style.display = 'none';
|
19
20
|
let dims;
|
20
21
|
// رسم مارجین های فرم
|
21
|
-
this.drawMarginLines({ container: this.
|
22
|
+
this.drawMarginLines({ container: this.svg, width, height });
|
22
23
|
|
23
|
-
const sections = new Sections({ container: this.
|
24
|
+
const sections = new Sections({ container: this.svg, dims: template });
|
24
25
|
this.sections = sections;
|
25
26
|
|
26
27
|
if (sections.header) {
|
@@ -57,53 +58,54 @@ export default class Form {
|
|
57
58
|
})
|
58
59
|
}
|
59
60
|
if (sections['Speech Titles']) {
|
60
|
-
dims= template['Speech Titles'];
|
61
|
+
dims = template['Speech Titles'];
|
61
62
|
const titles = new MultiText({ container: sections['Speech Titles'], dims });
|
62
63
|
}
|
63
64
|
if (sections['RSpeech']) {
|
64
|
-
dims= template.RSpeech
|
65
|
-
this.RSpeech = new Speech({ container: sections.RSpeech, side: 'R', dims})
|
65
|
+
dims = template.RSpeech
|
66
|
+
this.RSpeech = new Speech({ container: sections.RSpeech, side: 'R', dims })
|
66
67
|
}
|
67
68
|
if (sections.LSpeech) {
|
68
|
-
dims= template.LSpeech
|
69
|
+
dims = template.LSpeech
|
69
70
|
this.LSpeech = new Speech({ container: sections.LSpeech, side: 'L', dims })
|
70
71
|
}
|
71
72
|
if (sections['Tympanogram Titles']) {
|
72
|
-
dims= template['Tympanogram Titles'];
|
73
|
+
dims = template['Tympanogram Titles'];
|
73
74
|
new MultiText({ container: sections['Tympanogram Titles'], dims });
|
74
75
|
}
|
75
76
|
if (sections.RTympanogram) {
|
76
|
-
dims= template.RTympanogram
|
77
|
+
dims = template.RTympanogram
|
77
78
|
this.RTympanogram = new Tympanogram({ container: sections.RTympanogram, side: 'R', dims })
|
78
79
|
}
|
79
80
|
if (sections.LTympanogram) {
|
80
|
-
dims= template.LTympanogram
|
81
|
+
dims = template.LTympanogram
|
81
82
|
this.LTympanogram = new Tympanogram({ container: sections.LTympanogram, side: 'L', dims })
|
82
83
|
}
|
83
84
|
if (sections['Reflex Titles']) {
|
84
|
-
dims= template['Reflex Titles'];
|
85
|
+
dims = template['Reflex Titles'];
|
85
86
|
const titles = new MultiText({ container: sections['Reflex Titles'], dims });
|
86
87
|
}
|
87
88
|
if (sections.RReflex) {
|
88
|
-
dims= template.RReflex
|
89
|
+
dims = template.RReflex
|
89
90
|
this.RReflex = new Reflex({ container: sections.RReflex, side: 'R', dims })
|
90
91
|
}
|
91
92
|
if (sections.LReflex) {
|
92
|
-
dims= template.LReflex
|
93
|
+
dims = template.LReflex
|
93
94
|
this.LReflex = new Reflex({ container: sections.LReflex, side: 'L', dims })
|
94
95
|
}
|
95
96
|
if (sections.report) {
|
96
|
-
dims= template.report;
|
97
|
+
dims = template.report;
|
97
98
|
this.report = new MultiText({ container: sections.report, dims })
|
98
99
|
}
|
99
100
|
if (sections.footer) {
|
100
|
-
dims= template.footer;
|
101
|
-
this.footer = new MultiText({ container: sections.footer, dims})
|
101
|
+
dims = template.footer;
|
102
|
+
this.footer = new MultiText({ container: sections.footer, dims })
|
102
103
|
}
|
103
104
|
|
104
|
-
this.container.appendChild(this.
|
105
|
-
}
|
105
|
+
this.container.appendChild(this.svg);
|
106
106
|
|
107
|
+
this.addEvent()
|
108
|
+
}
|
107
109
|
|
108
110
|
create({ paper, margin }) {
|
109
111
|
const { width, height } = paper;
|
@@ -130,85 +132,91 @@ export default class Form {
|
|
130
132
|
return svg
|
131
133
|
}
|
132
134
|
|
133
|
-
update({
|
135
|
+
update({ officeData, patientData, sessionIndex = 0 }) {
|
134
136
|
|
135
137
|
const session = patientData.sessions[sessionIndex]
|
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
|
-
tel: officeData.tels[0],
|
162
|
-
},
|
163
|
-
id: +sessionIndex + 1,
|
164
|
-
};
|
165
|
-
// data = { audiogram: {}, common: {}, footer: {}, header: {}, patient: {}, reflex: {}, report: {}, speech: {}, tympanometry: {} }
|
166
|
-
}
|
167
|
-
// find which data reach and then call corresponding update function
|
168
|
-
// get array of keys (audiogram, header, footer, ...)
|
169
|
-
let keys = Object.keys(data)
|
138
|
+
|
139
|
+
let data = {
|
140
|
+
header: {
|
141
|
+
officeName: officeData.name,
|
142
|
+
officeLogo: officeData.logos[officeData.selectedLogoIndex],
|
143
|
+
createDate: patientData.sessions[sessionIndex]?.createDate,
|
144
|
+
},
|
145
|
+
patient: {
|
146
|
+
name: patientData.name,
|
147
|
+
lastName: patientData.lastName,
|
148
|
+
gender: patientData?.gender,
|
149
|
+
// خط زیر محاسبه درست سن هست. موقتا کامنت میشود تا در اپ اصلی فیلد سن رو در سشن ها قرار دهیم
|
150
|
+
// age: patientData.sessions[sessionIndex]?.age,
|
151
|
+
age: patientData?.age,
|
152
|
+
referrer: patientData.sessions[sessionIndex]?.referrer,
|
153
|
+
date: new Date().toLocaleDateString('fa-IR'),
|
154
|
+
},
|
155
|
+
footer: {
|
156
|
+
address: officeData.addresses[0],
|
157
|
+
tel: officeData.tels[0],
|
158
|
+
},
|
159
|
+
id: +sessionIndex + 1,
|
160
|
+
};
|
161
|
+
|
162
|
+
// let keys = Object.keys(data)
|
170
163
|
// if (keys.includes("header")) {
|
171
164
|
|
172
|
-
this.header
|
165
|
+
console.log(JSON.stringify(this.data.header) !== JSON.stringify(data.header));
|
166
|
+
|
167
|
+
// console.log(this.data.header, data.header);
|
168
|
+
|
169
|
+
JSON.stringify(this.data.header) !== JSON.stringify(data.header) &&
|
170
|
+
this.header?.update(data.header)
|
171
|
+
this.data.header = data.header
|
173
172
|
// }
|
174
173
|
// if (keys.includes("patient")) {
|
175
|
-
this.patient
|
174
|
+
JSON.stringify(this.data.patient) !== JSON.stringify(data.patient) &&
|
175
|
+
this.patient?.update(data.patient)
|
176
|
+
this.data.patient = data.patient
|
176
177
|
// }
|
177
178
|
// if (keys.includes("history")) {
|
178
|
-
|
179
|
-
|
179
|
+
JSON.stringify(this.data.history) !== JSON.stringify(data.history) &&
|
180
|
+
this.history?.update(session?.history)
|
180
181
|
this.data.history = session.history;
|
181
182
|
// }
|
182
183
|
// if (keys.includes("audiogram")) {
|
183
|
-
this.
|
184
|
-
|
184
|
+
if (JSON.stringify(this.data.audiogram) !== JSON.stringify(data.audiogram)) {
|
185
|
+
this.RAudiogram?.update({ data: session.audiogram?.R, side: 'R' })
|
186
|
+
this.LAudiogram?.update({ data: session.audiogram?.L, side: 'L' })
|
187
|
+
}
|
185
188
|
this.data.audiogram = session.audiogram
|
186
189
|
// }
|
187
190
|
// if (keys.includes("speech")) {
|
188
|
-
this.
|
189
|
-
|
191
|
+
if (JSON.stringify(this.data.speech) !== JSON.stringify(data.speech)) {
|
192
|
+
this.RSpeech?.update(session.speech?.R)
|
193
|
+
this.LSpeech?.update(session.speech?.L)
|
194
|
+
}
|
190
195
|
this.data.speech = session.speech
|
191
196
|
// }
|
192
197
|
// if (keys.includes("tympanogram")) {
|
193
|
-
this.
|
194
|
-
|
198
|
+
if (JSON.stringify(this.data.tympanogram) !== JSON.stringify(data.tympanogram) && data.tympanogram) {
|
199
|
+
this.RTympanogram?.update(session.tympanogram?.R)
|
200
|
+
this.LTympanogram?.update(session.tympanogram?.L)
|
201
|
+
}
|
195
202
|
this.data.tympanogram = session.tympanogram;
|
196
203
|
// }
|
197
204
|
// if (keys.includes("reflex")) {
|
198
|
-
this.
|
199
|
-
|
200
|
-
|
205
|
+
if (JSON.stringify(this.data.reflex) !== JSON.stringify(data.reflex)) {
|
206
|
+
this.RReflex?.update(session.reflex?.R)
|
207
|
+
this.LReflex?.update(session.reflex?.L)
|
208
|
+
}
|
209
|
+
this.data.reflex = session.reflex;
|
201
210
|
// }
|
202
211
|
// if (keys.includes("report")) {
|
203
|
-
this.report
|
212
|
+
JSON.stringify(this.data.report) !== JSON.stringify(data.report) &&
|
213
|
+
this.report?.update(session.report)
|
204
214
|
this.data.report = session.report;
|
205
215
|
// }
|
206
216
|
// if (keys.includes("footer")) {
|
207
|
-
|
208
|
-
|
209
|
-
this.footer?.update(data?.footer)
|
217
|
+
JSON.stringify(this.data.footer) !== JSON.stringify(data.footer) &&
|
218
|
+
this.footer?.update(data?.footer)
|
210
219
|
this.data.footer = data.footer;
|
211
|
-
// }
|
212
220
|
}
|
213
221
|
|
214
222
|
// خطوط نقطه چین مارجین فرم
|
@@ -224,4 +232,12 @@ export default class Form {
|
|
224
232
|
`;
|
225
233
|
putRect({ container, x: 0, y: 0, width, height, style, className: 'no-print' })
|
226
234
|
}
|
235
|
+
|
236
|
+
// افزودن رویداد کلیک روی فرم
|
237
|
+
addEvent({ } = {}) {
|
238
|
+
this.svg.addEventListener("click", e => {
|
239
|
+
console.log(e.target.dataset['name']);
|
240
|
+
|
241
|
+
})
|
242
|
+
}
|
227
243
|
}
|
package/src/Forms/Forms.js
CHANGED
@@ -1,32 +1,28 @@
|
|
1
1
|
// import '../styles.css' // برای تست منتقل شد به فایل ایندکس اصلی اچتیامال و برای توسعه منتقل شده به ایندکس جی اس
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
2
|
+
import printForm from "./printForm.js"
|
3
|
+
import Form from "../Form/Form.js"
|
4
|
+
import putGrid from "../common/putGrid.js"
|
5
5
|
|
6
|
-
const svgNS = "http://www.w3.org/2000/svg"
|
6
|
+
const svgNS = "http://www.w3.org/2000/svg"
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
// import rasaTymp from './templates/rasa_tymp_reflex.js'
|
11
|
-
|
12
|
-
// خط کد زیر لازم هست
|
13
|
-
// import '/fonts/webfonts/Vazirmatn-Regular.woff2'
|
8
|
+
import templCombo from "../../assets/templates/templCombo.js" // این در حقیقیت یک تمپلت هست
|
9
|
+
import templAudiometry from "../../assets/templates/templAudiometry.js"
|
14
10
|
|
15
11
|
// کلاس جدید که فرمهای مختلف را نمایش میدهد
|
16
12
|
export default class Forms {
|
17
13
|
constructor({ assets, container, templates, defaultTemplateIndex = 0, mode = 'production' } = {}) {
|
18
14
|
this.container = container
|
19
15
|
this.mode = mode;
|
20
|
-
|
16
|
+
this.forms = [] // آرایه آبجکت های فرم های مختلف
|
21
17
|
this.addForms({ templates, defaultTemplateIndex })
|
22
18
|
}
|
23
19
|
|
24
20
|
// افزودن فرم
|
25
21
|
addForms({ templates, defaultTemplateIndex }) {
|
22
|
+
const forms = this.forms;
|
26
23
|
const container = this.container
|
27
24
|
// ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
|
28
25
|
const div = document.createElement('div');
|
29
|
-
|
30
26
|
div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
|
31
27
|
container.appendChild(div);
|
32
28
|
|
@@ -34,101 +30,88 @@ export default class Forms {
|
|
34
30
|
let className = 'button-form persian';
|
35
31
|
const btns = [];
|
36
32
|
|
37
|
-
const forms = []; // آرایه آبجکت های فرم های مختلف
|
38
|
-
this.forms = forms;
|
39
|
-
|
40
33
|
templates.
|
41
34
|
forEach((template, index) => {
|
35
|
+
|
42
36
|
this.mode == 'develop' &&
|
43
|
-
(btns[index] = this.putButton({ container: div, text: template.label, className }))
|
44
|
-
this.forms.push(new Form({ container, template }))
|
45
|
-
})
|
37
|
+
(btns[index] = this.putButton({ container: div, text: template.label, className }))
|
38
|
+
this.forms.push(new Form({ container, template, mode: this.mode }))
|
39
|
+
})
|
40
|
+
|
46
41
|
|
47
42
|
// انتخاب فرم پیشفرض
|
48
|
-
let selectedIndex = defaultTemplateIndex
|
49
|
-
|
50
|
-
this.selectedForm = this.forms[selectedIndex];
|
51
|
-
(this.mode == 'develop') && (btns[selectedIndex].style.backgroundColor = ' #1c15e1');
|
43
|
+
let selectedIndex = defaultTemplateIndex
|
44
|
+
this.selectedIndex = selectedIndex // برای استفاده در متد آپدیت
|
52
45
|
|
53
|
-
|
46
|
+
forms[selectedIndex].svg.style.display = 'block'
|
47
|
+
// this.selectedForm = this.forms[selectedIndex] // سمیکالن واجب
|
54
48
|
|
55
|
-
|
56
|
-
//
|
57
|
-
printBtn.addEventListener('click', () => { printForm({ container: this.selectedForm.page }) });
|
49
|
+
this.mode == 'develop' &&
|
50
|
+
(btns[selectedIndex].style.backgroundColor = ' #1c15e1') // اگر عبارت اول توی پرانتز باشه سمیکالن واجب
|
58
51
|
|
52
|
+
// به ازای هر فرم یک دکمه هم به دیو بالای فرم اضافه میکند در حالت دولوپ
|
53
|
+
// افزودن دکمه مربوطه به فرمها به دام
|
54
|
+
this.mode == 'develop' &&
|
59
55
|
btns.forEach((btn, index) => {
|
60
56
|
btn.addEventListener('click', () => {
|
61
57
|
// Hide All forms
|
62
58
|
forms.forEach((form, i) => {
|
63
|
-
form.
|
59
|
+
form.svg.style.display = 'none'
|
64
60
|
btns[i].style.backgroundColor = ' #7472e2'
|
61
|
+
})
|
65
62
|
|
66
|
-
|
67
|
-
|
68
|
-
forms[index].page.style.display = 'block';
|
63
|
+
forms[index].svg.style.display = 'block'
|
69
64
|
btns[index].style.backgroundColor = ' #1c15e1'
|
70
65
|
|
71
|
-
this.selectedForm = forms[index]
|
66
|
+
// this.selectedForm = forms[index]
|
72
67
|
selectedIndex = index
|
73
|
-
this.
|
68
|
+
this.selectedIndex = selectedIndex
|
69
|
+
this.update(this.dataParams)
|
74
70
|
})
|
75
|
-
})
|
71
|
+
}) // سمیکالن واجب
|
76
72
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'section-border' })
|
81
|
-
});
|
82
|
-
|
83
|
-
// دکمه نمایش و پنهان خطوط بوردر
|
84
|
-
this.putButton({ container: div, text: 'Show/Hide Box Borders', className })
|
85
|
-
.addEventListener('click', () => {
|
86
|
-
this.toggleDisplay({ container: forms[selectedIndex].page, borderName: 'box-border' })
|
87
|
-
});
|
88
|
-
|
89
|
-
// دکمه نمایش و پنهان شطرنجی
|
90
|
-
this.putButton({ container: div, text: 'Show/Hide Grid', className })
|
91
|
-
.addEventListener('mouseenter', () => {
|
92
|
-
this.grid({ container: forms[selectedIndex].page })
|
93
|
-
});
|
94
|
-
// فراخوانی تابع شطرنجی در اولین اجرا
|
95
|
-
this.grid({ container: forms[selectedIndex].page })
|
96
|
-
}
|
73
|
+
// افزودن چهار دکمه چاپ صفحه فرم انتخاب شده و تاگل پنهان یا نمایش
|
74
|
+
this.mode == 'develop' &&
|
75
|
+
this.addButtons({ container: div, className, svg: forms[selectedIndex].svg })
|
97
76
|
}
|
98
77
|
|
99
|
-
|
100
|
-
|
101
|
-
const cord = { xStart: -5, yStart: -5, xEnd: 210 - 5, yEnd: 297 - 5, xStep: 1, yStep: 1 }
|
102
|
-
let { xStart, yStart, xEnd, yEnd, xStep, yStep } = cord
|
78
|
+
// افزودن چهار دکمه چاپ صفحه فرم انتخاب شده و تاگل پنهان یا نمایش
|
79
|
+
addButtons({ container, className, svg }) {
|
103
80
|
|
104
|
-
//
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
let x2 = xEnd
|
110
|
-
let y2
|
81
|
+
// تعریف دکمه و رویداد دکمه چاپ صفحه فرم نمایشی
|
82
|
+
this.putButton({ container, text: 'چاپ', className })
|
83
|
+
.addEventListener('click', () => {
|
84
|
+
printForm({ container: this.forms[this.selectedIndex].svg })
|
85
|
+
});
|
111
86
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
87
|
+
// دکمه و رویداد نمایش و پنهان خطوط سکشن
|
88
|
+
this.putButton({ container, text: 'Show/Hide Section Borders', className })
|
89
|
+
.addEventListener('click', () => {
|
90
|
+
this.toggleDisplay({ container: svg, borderName: 'section-border' })
|
91
|
+
});
|
116
92
|
|
117
|
-
//
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
}
|
93
|
+
// دکمه و رویداد نمایش و پنهان خطوط بوردر
|
94
|
+
this.putButton({ container, text: 'Show/Hide Box Borders', className })
|
95
|
+
.addEventListener('click', () => {
|
96
|
+
this.toggleDisplay({ container: svg, borderName: 'box-border' })
|
97
|
+
});
|
123
98
|
|
99
|
+
// دکمه نمایش و پنهان شطرنجی
|
100
|
+
this.putButton({ container, text: 'Show/Hide Grid', className })
|
101
|
+
.addEventListener('mouseenter', () => {
|
102
|
+
putGrid({ container: svg })
|
103
|
+
});
|
104
|
+
// فراخوانی تابع شطرنجی در اولین اجرا
|
105
|
+
// putGrid({ container: forms[selectedIndex].svg })
|
124
106
|
|
125
107
|
}
|
126
108
|
|
127
109
|
// این تابع یک بار از بیرون کلاس فراخوانی میشه و یک بار وقتی از داخل تمپلت فرم را عوض میکنیم
|
128
|
-
update({
|
110
|
+
update({ officeData, patientData, sessionIndex = 0 }) {
|
129
111
|
// ذخیره کل دیتا برای استفاده داخلی آپدیت فرم انتخاب شده
|
130
|
-
this.
|
131
|
-
this.selectedForm.update({
|
112
|
+
this.dataParams = { officeData, patientData, sessionIndex }
|
113
|
+
// this.selectedForm.update({ officeData, patientData, sessionIndex })
|
114
|
+
this.forms[this.selectedIndex].update(this.dataParams)
|
132
115
|
}
|
133
116
|
|
134
117
|
// توابع داخلی ایجاد دکمه و لینک های بالای فرم
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { officeData, patientData } from "../../assets/data/sampleData";
|
2
|
+
import templAudiometry from "../../assets/templates/templAudiometry";
|
3
|
+
import templCombo from "../../assets/templates/templCombo";
|
4
|
+
import Forms from "./Forms";
|
5
|
+
|
6
|
+
document.querySelector('#app').innerHTML = `
|
7
|
+
<div id="test"></div>
|
8
|
+
`;
|
9
|
+
|
10
|
+
const container = document.getElementById('test')
|
11
|
+
|
12
|
+
const forms = new Forms({ container, templates: [templCombo,], mode: 'develop' });
|
13
|
+
|
14
|
+
// forms.update({ officeData, patientData, sessionIndex: 0 })
|
15
|
+
forms.update({ officeData, patientData, sessionIndex: 1 })
|
16
|
+
|
17
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
18
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
19
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
20
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
21
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
22
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
23
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
24
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
25
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
26
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
27
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
28
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
29
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
30
|
+
// forms.update({ officeData, patientData, sessionIndex: 1 })
|
31
|
+
// forms.update({ officeData, patientData, sessionIndex: 0 })
|
32
|
+
// forms.update({ officeData, patientData, sessionIndex: 0 })
|
33
|
+
// forms.update({ officeData, patientData, sessionIndex: 0 })
|
34
|
+
|
35
|
+
// خط برای کپی پیست نقشی در کد ندارد
|
36
|
+
|
37
|
+
|
package/src/Header/Header.js
CHANGED
@@ -6,6 +6,7 @@ const svgNS = "http://www.w3.org/2000/svg";
|
|
6
6
|
|
7
7
|
export default class Header {
|
8
8
|
constructor({ container }) {
|
9
|
+
|
9
10
|
this.container = container;
|
10
11
|
}
|
11
12
|
|
@@ -18,11 +19,11 @@ export default class Header {
|
|
18
19
|
let x = dims.margin.left;
|
19
20
|
let y = dims.margin.top;
|
20
21
|
|
21
|
-
const svg = putSVG({ x, y, width, height, style: 'direction: rtl !important; user-select: none;' })
|
22
|
+
const svg = putSVG({ x, y, width, height, style: 'font-family: Vazir; direction: rtl !important; user-select: none;' })
|
22
23
|
|
23
24
|
// Logo
|
24
25
|
let image = document.createElementNS(svgNS, "image");
|
25
|
-
image.setAttribute("data-name", "officeLogo")
|
26
|
+
image.setAttribute("data-name", "officeLogo") // برای تابع آپدیت استفاده میشود
|
26
27
|
image.setAttribute("width", "17");
|
27
28
|
image.setAttribute("height", height - 1);
|
28
29
|
image.setAttribute("x", width - 16);
|
@@ -30,14 +31,10 @@ export default class Header {
|
|
30
31
|
svg.appendChild(image);
|
31
32
|
|
32
33
|
let style = `
|
33
|
-
user-select: none;
|
34
|
-
direction: rtl;
|
35
|
-
/* text-align: center; */
|
36
|
-
font-family: Vazir;
|
37
34
|
font-size: 0.8mm;
|
38
35
|
font-weight: bolder;
|
39
|
-
text-anchor: start;
|
40
|
-
dominant-baseline: auto;
|
36
|
+
text-anchor: start;
|
37
|
+
dominant-baseline: auto;
|
41
38
|
`;
|
42
39
|
|
43
40
|
// اگر مقدار استروک درست بود لیبل ها را چاپ کن
|
@@ -72,6 +69,8 @@ export default class Header {
|
|
72
69
|
}
|
73
70
|
|
74
71
|
update(data) {
|
72
|
+
console.log('I`m from header.update');
|
73
|
+
|
75
74
|
this.container.querySelector("[data-name=officeName]").innerHTML = data?.officeName || "";
|
76
75
|
this.container.querySelector("[data-name=date]").innerHTML = data?.createDate || "";
|
77
76
|
this.container.querySelector("[data-name=officeLogo]").setAttribute("href", data?.officeLogo || "");
|
@@ -76,9 +76,6 @@ export default class MultiText {
|
|
76
76
|
})
|
77
77
|
|
78
78
|
this.container.appendChild(svg)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
79
|
}
|
83
80
|
|
84
81
|
update(data) {
|
@@ -87,16 +84,21 @@ export default class MultiText {
|
|
87
84
|
const textInput = this.container.querySelector(`text[data-name=${input.name}]`)
|
88
85
|
|
89
86
|
// پیدا کردن کاراکترهای رفتن به سرخط در متن
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
87
|
+
if (value) {
|
88
|
+
const textLines = value.toString().split(/\n|\r|\r\n/);
|
89
|
+
const x = textInput.getAttribute('x')
|
90
|
+
// اگر متن چند خطی بود
|
91
|
+
if (textLines.length >= 2) {
|
92
|
+
// اول از همه هر چی تیاسپن از قبل توی این تکست اینپوت هست پاک کن
|
93
|
+
textInput.textContent = ""
|
94
|
+
|
95
|
+
let y = 5;
|
96
|
+
textLines.forEach(value => {
|
97
|
+
putTspan({ container: textInput, value, x, y });
|
98
|
+
y += 6;
|
99
|
+
})
|
100
|
+
} else textInput.textContent = value || "";
|
101
|
+
}
|
100
102
|
});
|
101
103
|
}
|
102
104
|
}
|