hayun-vite 0.3.1 → 0.4.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.
@@ -1,159 +0,0 @@
1
- const svgNS = "http://www.w3.org/2000/svg";
2
-
3
- import printForm from "./printForm.js";
4
- import Template from "./Templates/Template.js";
5
- import Template1 from "./Templates/Template1.js";
6
- import Template2 from "./Templates/Template2.js";
7
- import Template3 from "./Templates/Template3.js";
8
-
9
-
10
- export default class Form {
11
- constructor({ name, container } = {}) {
12
- // ایجاد یک دیو برای قرار دادن دکمه ها و لینک های فرم
13
- const div = document.createElement('div');
14
- div.style = 'border: 1px solid brown; margin: 0; padding: 0;'
15
- container.appendChild(div);
16
- // اضافه کردن دکمه به دیو فرم
17
- const btn1 = this.putButton({ container: div, text: 'Form 1', id: 'template1' });
18
- const btn2 = this.putButton({ container: div, text: 'Form 2', id: 'template2' });
19
- const btn3 = this.putButton({ container: div, text: 'Form 3', id: 'template3' });
20
- const printBtn = this.putButton({ container: div, text: 'Print', id: 'print' });
21
-
22
- // this.container = div;
23
-
24
- // یک دیو تعریف میکنیم که سمت ادیولاگ برای تعریف لیستنر استفاده می‌شود
25
- this.div = document.createElement('div'); // این بخش فقط شامل بخش اس‌وی‌جی هست
26
- container.appendChild(this.div)
27
-
28
- this.template1 = new Template({ container: this.div });
29
- this.template2 = new Template2({ container: this.div });
30
- this.template3 = new Template3({ container: this.div });
31
-
32
- // تعریف رویداد دکمه چاپ فرم نمایشی
33
- printBtn.addEventListener('click', () => { printForm({ container: this.activeForm }) })
34
-
35
- // ایجاد المنت چک باکس با برچسب
36
- // const checkBox = document.createElement('input');
37
- // checkBox.setAttribute('type', 'checkbox');
38
- // checkBox.setAttribute('id', 'chkb');
39
- // const label = document.createElement('label');
40
- // label.innerHTML = 'Select for Print';
41
- // label.setAttribute('for', checkBox.getAttribute('id'))
42
- // div.appendChild(checkBox)
43
- // div.appendChild(label)
44
-
45
- this.draw2();
46
- // نمایش پیش‌فرض فرم شماره یک
47
- this.template1.form.style.display = 'block';
48
- this.activeForm = this.template1.form;
49
-
50
- btn1.addEventListener('click', () => {
51
- this.template2.form.style.display = 'none'
52
- this.template3.form.style.display = 'none'
53
- this.template1.form.style.display = 'block';
54
- this.activeForm = this.template1.form;
55
- console.log(this.activeForm);
56
-
57
- });
58
-
59
- btn2.addEventListener('click', () => {
60
- this.template1.form.style.display = 'none'
61
- this.template3.form.style.display = 'none'
62
- this.template2.form.style.display = 'block';
63
- this.activeForm = this.template2.form;
64
-
65
- });
66
-
67
- btn3.addEventListener('click', () => {
68
- this.template1.form.style.display = 'none'
69
- this.template2.form.style.display = 'none'
70
- this.template3.form.style.display = 'block';
71
- this.activeForm = this.template3.form;
72
-
73
- });
74
- // for Develop
75
- this.event();
76
-
77
- }
78
-
79
- draw2() {
80
- this.template1.draw();
81
- this.template2.draw();
82
- this.template3.draw();
83
-
84
- }
85
-
86
- draw() { }
87
-
88
- event() {
89
- this.div.addEventListener('click', (e) => {
90
- console.log(e.target);
91
- })
92
- }
93
-
94
- update({ template, data, officeData, patientData, sessionIndex = 0 }) {
95
-
96
- this.template1.update({ data, officeData, patientData, sessionIndex })
97
- this.template2.update({ data, officeData, patientData, sessionIndex })
98
- this.template3.update({ data, officeData, patientData, sessionIndex })
99
-
100
- }
101
-
102
- // ایجاد دکمه تاگل خطوط مرزی فرم و سکشن و المان
103
- toggleBorders({ activeForm, container = 'form' }) {
104
-
105
- const borders = activeForm.querySelectorAll(`[data-name="${container}-border"]`);
106
- // آبجکت نگهداری رنگ بوردرها
107
- const color = { form: 'black', section: 'blue', element: 'green' }
108
- borders.forEach(border => {
109
- // console.log(border.style.stroke);
110
- border.style.stroke = (border.style.stroke === 'transparent') ? color[container] : 'transparent';
111
- })
112
- }
113
-
114
- // توابع داخلی ایجاد دکمه و لینک های بالای فرم
115
- putButton({ container, id, text, }) {
116
- let style = `
117
- background-color:rgb(0, 149, 149);
118
- /* Green background */
119
- border: none;
120
- /* Remove borders */
121
- color: white;
122
- /* White text */
123
- padding: 15px 32px;
124
- /* Some padding */
125
- text-align: center;
126
- /* Centered text */
127
- text-decoration: none;
128
- /* Remove underline */
129
- display: inline-block;
130
- /* Make the button inline */
131
- font-size: 16px;
132
- /* Increase font size */
133
- margin: 4px 2px;
134
- /* Add some margin */
135
- cursor: pointer;
136
- /* Pointer cursor on hover */
137
- border-radius: 8px;
138
- /* Rounded corners */
139
- transition: background-color 0.3s;
140
- /* Smooth transition */
141
- `;
142
- const button = document.createElement('button');
143
- button.setAttribute('id', id);
144
- button.setAttribute('style', style);
145
- button.innerHTML = text;
146
-
147
- button.addEventListener('mouseenter', () => {
148
- button.style.backgroundColor = 'rgb(54, 115, 115)'; // Change color on hover
149
- });
150
- button.addEventListener('mouseleave', () => {
151
- button.style.backgroundColor = 'rgb(0, 149, 149)'; // Revert color when not hovering
152
- });
153
-
154
- container.appendChild(button);
155
- return button;
156
-
157
- }
158
-
159
- }
@@ -1,30 +0,0 @@
1
- // A Class for both R & L at same time.
2
- import getAllSymbolsSVG from "./getAllSymbolsSVG.js";
3
- import symbolChart from "./symbolChart.js";
4
-
5
- class Symbols {
6
- constructor() {
7
- // یک آبجکت از ناداس‌وی‌جی همه سمبل‌ها
8
- this.symbolsSVG = getAllSymbolsSVG();
9
- this.chart = {}
10
- this.selected = { R: "R_AC", L: "L_AC" }
11
- }
12
-
13
- draw({ container, side, events = true }) {
14
-
15
- this.chart[side] = symbolChart({ container: container, side: side, symbols: this.symbolsSVG, x: 0, y: 0 , w:700 });
16
- this.selected[side] = side + "_AC"; // default Selected symbol
17
- if (events) this.act(side);
18
- }
19
-
20
- // enable and set events on sybol chart
21
- act(side) {
22
- this.chart[side].addEventListener("click", (e) => {
23
- let v = e.target.getAttribute("data-name"); // Symbol Name earned
24
- // suddenly null ignored
25
- if (v) this.selected[side] = v; // Active symbol or so Selected Symbol
26
- })
27
- }
28
- }
29
-
30
- export default Symbols;
@@ -1,10 +0,0 @@
1
- // تابع قرار دادن سمبل انتخاب شده در نقطه مورد نظر
2
- export default function insertSymbol({ container, symbolNode, x, y, w, h, freq, intens }) {
3
- symbolNode.setAttribute("x", x - w / 2);
4
- symbolNode.setAttribute("y", y - h / 2);
5
- symbolNode.setAttribute("width", w);
6
- symbolNode.setAttribute("height", h);
7
- symbolNode.setAttribute("data-freq", freq);
8
- symbolNode.setAttribute("data-intens", intens);
9
- container.appendChild(symbolNode);
10
- }
@@ -1,47 +0,0 @@
1
- // وارد کردن داده‌های سراسری
2
- // import { r, svgNS } from "../../globalinfo.js";
3
- import insertSymbol from "./insertSymbol.js";
4
- // رسم پنل سمبل ها
5
- const svgNS = "http://www.w3.org/2000/svg";
6
-
7
- export default function symbolChart({ container, side = "R", x, y, symbols }) {
8
-
9
- const w = 240;
10
- const h = 60;
11
- const svg = document.createElementNS(svgNS, "svg");
12
- // svg.setAttribute("id", id);
13
- svg.setAttribute("width", w);
14
- svg.setAttribute("height", h);
15
- svg.setAttribute("viewBox", "-6 -6 48 12");
16
- svg.setAttribute("style", "border: 1px solid blue; user-select: none;");
17
-
18
- let dx = 12
19
- x = 0;
20
- y = 0;
21
-
22
- const symbolNames = {
23
- R: ["R_AC", "R_BC", "R_AC_M", "R_BC_M"],
24
- L: ["L_AC", "L_BC", "L_AC_M", "L_BC_M"]
25
- };
26
- const metadata = side + "SymbolChart";
27
- // اجرای تابع رسم سمبل در چارت در یک حلقه تکرار
28
- for (let i = 0; i < 4; i++) {
29
- const id = `${symbolNames[side][i]}-SymbolChart`;
30
-
31
- insertSymbol({ container: svg, symbolNode: symbols[symbolNames[side][i]], x: x, y: y, w: 12, h: 12 })
32
- // insertSymbol({
33
- // container: svg, metadata: metadata,
34
- // dataID: id, id: id, class: symbolNames[side][i], symbol: symbolNames[side][i],
35
- // x: x, y: y, w: 12, h: 12
36
- // });
37
- x += dx;
38
- }
39
-
40
- container.appendChild(svg);
41
-
42
- return svg;
43
- }
44
-
45
-
46
-
47
-
File without changes