@nixweb/nixloc-ui 0.0.308 → 0.0.310

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nixweb/nixloc-ui",
3
- "version": "0.0.308",
3
+ "version": "0.0.310",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -68,7 +68,7 @@
68
68
  </span>
69
69
  <span class="div-new"
70
70
  v-if="item.showNewUntil && showNewUntil(item.showNewUntil)">
71
- Novo
71
+ Novo
72
72
  </span>
73
73
  </span>
74
74
  </b-col>
@@ -204,9 +204,11 @@ export default {
204
204
  let filter = [];
205
205
  let self = this;
206
206
  let userLogged = this.userLogged.user.userName;
207
+ let companyId = this.userLogged.companyId;
207
208
  this.menu.items.forEach(function (obj) {
208
209
  if (obj.isModule == isModule && obj.module === self.module) {
209
210
  if (obj.isVisible == "all") filter.push(obj);
211
+ if (obj.isVisible == companyId) filter.push(obj);
210
212
 
211
213
  if (obj.isVisible == "support" && userLogged == "UserTemp")
212
214
  filter.push(obj);
@@ -5,14 +5,18 @@
5
5
  <span v-if="showZoomLabel">{{ (zoom * 100).toFixed(0) }}%</span>
6
6
  </transition>
7
7
  </div>
8
- <div class="zoom-area" :style="zoomStyle">
9
- <slot></slot>
8
+
9
+ <div class="zoom-container">
10
+ <div class="zoom-area" :style="zoomStyle">
11
+ <slot></slot>
12
+ </div>
10
13
  </div>
11
14
  </div>
12
15
  </template>
13
16
 
14
17
  <script>
15
- import { mapGetters, mapMutations, mapActions } from "vuex";
18
+
19
+ import { mapGetters } from "vuex";
16
20
 
17
21
  export default {
18
22
  name: 'Zoom',
@@ -32,8 +36,7 @@ export default {
32
36
  return {
33
37
  transform: `scale(${this.zoom})`,
34
38
  transformOrigin: 'top left',
35
- display: 'inline-block',
36
-
39
+ width: `${100 / this.zoom}%`
37
40
  }
38
41
  }
39
42
  },
@@ -55,7 +58,7 @@ export default {
55
58
  clearTimeout(this.zoomTimeout)
56
59
  this.zoomTimeout = setTimeout(() => {
57
60
  this.showZoomLabel = false
58
- }, 3000)
61
+ }, 1000)
59
62
  }
60
63
  },
61
64
  beforeDestroy() {
@@ -82,10 +85,14 @@ export default {
82
85
  gap: 8px;
83
86
  }
84
87
 
85
- .zoom-controls button {
86
- padding: 5px 10px;
87
- font-weight: bold;
88
- cursor: pointer;
88
+ .zoom-container {
89
+ overflow: auto;
90
+ width: 100%;
91
+ height: 100%;
92
+ }
93
+
94
+ .zoom-area {
95
+ background: #fff;
89
96
  }
90
97
 
91
98
  .fade-enter-active,
@@ -101,9 +108,4 @@ export default {
101
108
  .zoom-controls span {
102
109
  font-size: 13px;
103
110
  }
104
-
105
- .zoom-area {
106
- background: #fff;
107
-
108
- }
109
111
  </style>
@@ -47,28 +47,39 @@
47
47
  </div>
48
48
  <div v-if="show" class="preview">
49
49
  <div class="toolbar">
50
- <div v-if="loadingFile" class="icon-toolbar">
51
- <i class="fa-duotone fa-solid fa-spinner-third loading-icon"></i>
52
- </div>
50
+
53
51
  <div class="icon-toolbar" v-print="'#printMe'">
54
52
  <i class="fas fa-print"></i>
55
53
  </div>
56
- <div @click="generatePDF" class="icon-toolbar">
54
+ <div v-if="loadingFile" class="icon-toolbar">
55
+ <i class="fa-duotone fa-solid fa-spinner-third loading-icon"></i>
56
+ </div>
57
+ <div v-else @click="generatePDF" class="icon-toolbar">
57
58
  <i class="fa-solid fa-file-pdf"></i>
58
59
  </div>
59
60
  <div class="icon-toolbar icon-excel">
60
61
  <ExportExcel :nameFile="name" :header="dataConditional" :data="data" />
61
62
  </div>
63
+ <div class="div-pipe icon-toolbar"></div>
64
+ <div class="icon-toolbar" @click="addEvent({ name: 'zoomIn' })">
65
+ <i class="fa-regular fa-magnifying-glass-plus"></i>
66
+ </div>
67
+
68
+ <div class="icon-toolbar" @click="addEvent({ name: 'zoomOut' })">
69
+ <i class="fa-regular fa-magnifying-glass-minus"></i>
70
+ </div>
62
71
  </div>
63
72
  <ScrollBar :minHeight="400" :maxHeight="820">
64
73
  <br />
65
74
  <div id="printMe" :style="'min-height:' + minHeight + 'px'" class="a4 footer">
66
- <HeaderReport :title="name" />
67
- <div>
68
- <span>Total de <b> {{ totalRecords }}</b> registro(s) </span>
69
- </div>
70
- <ReportTable :header="dataConditional" :data="data" />
71
- <Totalization :totalization="totalization" />
75
+ <Zoom>
76
+ <HeaderReport :title="name" />
77
+ <div>
78
+ <span>Total de <b> {{ totalRecords }}</b> registro(s) </span>
79
+ </div>
80
+ <ReportTable :header="dataConditional" :data="data" />
81
+ <Totalization :totalization="totalization" />
82
+ </Zoom>
72
83
  </div>
73
84
  </ScrollBar>
74
85
  </div>
@@ -94,10 +105,10 @@ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
94
105
  import Fields from "@nixweb/nixloc-ui/src/component/report/Fields.vue";
95
106
  import Panel from "@nixweb/nixloc-ui/src/component/layout/Panel.vue";
96
107
  import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
108
+ import Zoom from "@nixweb/nixloc-ui/src/component/layout/Zoom";
97
109
 
98
110
  import print from "vue-print-nb";
99
- import jsPDF from 'jspdf'
100
- import html2canvas from 'html2canvas'
111
+ import html2pdf from 'html2pdf.js'
101
112
 
102
113
  import { mapMutations, mapActions, mapGetters } from "vuex";
103
114
 
@@ -107,7 +118,7 @@ export default {
107
118
  print,
108
119
  },
109
120
  props: ["name", "module", "urlGet", "header", "filters", "minHeight"],
110
- components: { ScrollBar, HeaderReport, Alert, ExportExcel, ReportTable, Molded, FilterQuery, Button, Fields, Panel, Loading, Totalization, ProgressBar },
121
+ components: { ScrollBar, HeaderReport, Alert, Zoom, ExportExcel, ReportTable, Molded, FilterQuery, Button, Fields, Panel, Loading, Totalization, ProgressBar },
111
122
  data() {
112
123
  return {
113
124
  loading: false,
@@ -153,7 +164,7 @@ export default {
153
164
  }
154
165
  },
155
166
  methods: {
156
- ...mapMutations("generic", ["removeLoading"]),
167
+ ...mapMutations("generic", ["addEvent", "removeLoading"]),
157
168
  ...mapActions("generic", ["getApi"]),
158
169
  executeSearch() {
159
170
  this.cancel = false;
@@ -215,24 +226,29 @@ export default {
215
226
  }
216
227
  },
217
228
  async generatePDF() {
218
- this.loadingFile = true;
219
- const tabela = document.getElementById('printMe')
220
- const canvas = await html2canvas(tabela, {
221
- scale: 4
222
- })
223
- const imgData = canvas.toDataURL('image/png')
224
-
225
- const pdf = new jsPDF('l', 'mm', 'a4')
226
- const pageWidth = pdf.internal.pageSize.getWidth()
227
- const pageHeight = pdf.internal.pageSize.getHeight()
228
-
229
- const imgProps = pdf.getImageProperties(imgData)
230
- const pdfWidth = pageWidth
231
- const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width
232
-
233
- pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight)
234
- pdf.save(this.name + '.pdf')
235
- this.loadingFile = false;
229
+ try {
230
+ this.loadingFile = true;
231
+
232
+ const element = document.getElementById('printMe');
233
+
234
+ const opt = {
235
+ margin: 0,
236
+ filename: this.name + '.pdf',
237
+ image: { type: 'jpeg', quality: 0.98 },
238
+ html2canvas: { scale: 2 },
239
+ jsPDF: { unit: 'mm', format: 'a4', orientation: 'landscape' }
240
+ };
241
+
242
+ await html2pdf()
243
+ .set(opt)
244
+ .from(element)
245
+ .save();
246
+
247
+ } catch (error) {
248
+ console.error('Erro ao gerar PDF:', error);
249
+ } finally {
250
+ this.loadingFile = false;
251
+ }
236
252
  },
237
253
  verifyIfPagination() {
238
254
  if (this.pagination.length > 0) {
@@ -284,6 +300,13 @@ export default {
284
300
  margin-bottom: 30px;
285
301
  }
286
302
 
303
+ .div-pipe {
304
+ border-left: 1.5px solid rgb(189, 189, 189);
305
+ margin: 0px -15px -6px 0px;
306
+ height: 25px;
307
+ }
308
+
309
+
287
310
  .preview {
288
311
  background-color: #fafafa;
289
312
  padding-bottom: 20px;
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div class="preview">
3
3
  <div class="toolbar">
4
- <div v-if="loadingFile" class="icon-toolbar">
5
- <i class="fa-duotone fa-solid fa-spinner-third loading-icon"></i>
6
- </div>
7
4
  <div class="icon-toolbar" v-print="'#printMeSub'">
8
5
  <i class="fas fa-print"></i>
9
6
  </div>
10
- <div @click="generatePDF" class="icon-toolbar">
7
+ <div v-if="loadingFile" class="icon-toolbar">
8
+ <i class="fa-duotone fa-solid fa-spinner-third loading-icon"></i>
9
+ </div>
10
+ <div v-else @click="generatePDF" class="icon-toolbar">
11
11
  <i class="fa-solid fa-file-pdf"></i>
12
12
  </div>
13
13
  <div class="icon-toolbar icon-excel">
@@ -74,9 +74,8 @@ import HeaderReport from "../shared/HeaderReport.vue";
74
74
  import TotalizationReport from "../shared/TotalizationReport.vue";
75
75
  import ExportExcel from "@nixweb/nixloc-ui/src/component/shared/ExportExcel";
76
76
 
77
- import jsPDF from 'jspdf'
78
- import html2canvas from 'html2canvas'
79
77
  import print from "vue-print-nb";
78
+ import html2pdf from 'html2pdf.js'
80
79
 
81
80
  import { mapMutations } from "vuex";
82
81
 
@@ -111,24 +110,29 @@ export default {
111
110
  if (eventName) this.addEvent({ name: eventName, data: data });
112
111
  },
113
112
  async generatePDF() {
114
- this.loadingFile = true;
115
- const tabela = document.getElementById('printMeSub')
116
- const canvas = await html2canvas(tabela, {
117
- scale: 4
118
- })
119
- const imgData = canvas.toDataURL('image/png')
120
-
121
- const pdf = new jsPDF('l', 'mm', 'a4')
122
- const pageWidth = pdf.internal.pageSize.getWidth()
123
- const pageHeight = pdf.internal.pageSize.getHeight()
124
-
125
- const imgProps = pdf.getImageProperties(imgData)
126
- const pdfWidth = pageWidth
127
- const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width
128
-
129
- pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight)
130
- pdf.save(this.name + '.pdf')
131
- this.loadingFile = false;
113
+ try {
114
+ this.loadingFile = true;
115
+
116
+ const element = document.getElementById('printMeSub');
117
+
118
+ const opt = {
119
+ margin: 0,
120
+ filename: this.name + '.pdf',
121
+ image: { type: 'jpeg', quality: 0.98 },
122
+ html2canvas: { scale: 2 },
123
+ jsPDF: { unit: 'mm', format: 'a4', orientation: 'landscape' }
124
+ };
125
+
126
+ await html2pdf()
127
+ .set(opt)
128
+ .from(element)
129
+ .save();
130
+
131
+ } catch (error) {
132
+ console.error('Erro ao gerar PDF:', error);
133
+ } finally {
134
+ this.loadingFile = false;
135
+ }
132
136
  },
133
137
  },
134
138
  };