@nixweb/nixloc-ui 0.0.283 → 0.0.285

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.283",
3
+ "version": "0.0.285",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -66,12 +66,19 @@ export default {
66
66
  font-size: 13px;
67
67
  height: 32px;
68
68
  margin: 4px 8px 4px 0;
69
- width: 100%;
70
69
  outline: none;
71
70
  padding: 0 6px 0 16px;
72
71
  position: relative;
73
72
  white-space: nowrap;
74
73
  cursor: pointer;
74
+
75
+ }
76
+
77
+ .title-tag {
78
+ max-width: 400px;
79
+ white-space: nowrap;
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
75
82
  }
76
83
 
77
84
  .div-tag {
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <div>
3
+ <Button _key="btnFields" color="black" backGroundColor="#F0F0F0" title="Campos"
4
+ classIcon="fa-sharp fa-solid fa-text-size" size="small" :clicked="open" />
5
+
6
+ <Modal title="Campos" :width="600" :height="200" v-if="showModal('fields')">
7
+ <b-row>
8
+ <b-col sm="6">
9
+ <ScrollBar :minHeight="300" :maxHeight="300">
10
+ <div v-for="item in data">
11
+ <b-form-checkbox v-model="item.show" :value="true" :unchecked-value="false">
12
+ <span class="title">{{ item.title }}</span>
13
+ </b-form-checkbox>
14
+ </div>
15
+ </ScrollBar>
16
+ </b-col>
17
+ <b-col sm="6">
18
+ <RadioGroup :options="[
19
+ { text: 'Crescente', value: 'asc' },
20
+ { text: 'Decrescente', value: 'desc' },
21
+ ]" v-model="ordering" />
22
+ <SelectStatic title="Ordenar" :initialValue="initialValue" fieldTarget="order" :data="options"
23
+ v-model="fieldOrdering" />
24
+ </b-col>
25
+ </b-row>
26
+
27
+ <div class="text-center">
28
+ <Button _key="btnApply" backGroundColor="#017AFF" color="white" title="Aplicar" size="small"
29
+ :clicked="apply" />
30
+ </div>
31
+ </Modal>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+
37
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
38
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
39
+ import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
40
+ import CheckboxSimple from "@nixweb/nixloc-ui/src/component/forms/CheckboxSimple.vue";
41
+ import SelectStatic from "@nixweb/nixloc-ui/src/component/forms/SelectStatic";
42
+ import RadioGroup from "@nixweb/nixloc-ui/src/component/forms/RadioGroup";
43
+
44
+ import { mapState, mapGetters, mapMutations } from "vuex";
45
+
46
+ export default {
47
+ name: "Fields",
48
+ props: ["data", "value"],
49
+ components: {
50
+ Modal,
51
+ Button,
52
+ ScrollBar,
53
+ CheckboxSimple,
54
+ RadioGroup,
55
+ SelectStatic
56
+ },
57
+ data() {
58
+ return {
59
+ initialValue: {},
60
+ ordering: "asc",
61
+ fieldOrdering: {},
62
+ }
63
+ },
64
+ created() {
65
+ this.initialValue = { content: this.data[0].title, id: this.data[0].fieldOrderBy };
66
+ this.$emit("input", { ordering: this.ordering, field: this.data[0].fieldOrderBy });
67
+ },
68
+ computed: {
69
+ ...mapGetters("generic", ["showModal"]),
70
+ options() {
71
+ let data = [];
72
+ this.data.forEach(item => {
73
+ var obj = { content: item.title, id: item.fieldOrderBy }
74
+ data.push(obj);
75
+ });
76
+ return data;
77
+ }
78
+ },
79
+ methods: {
80
+ ...mapMutations("generic", ["addEvent", "openModal", "hideModal", "removeLoading"]),
81
+ open() {
82
+ this.openModal("fields");
83
+ this.removeLoading(["btnFields"]);
84
+ },
85
+ apply() {
86
+ this.removeLoading(["btnApply"]);
87
+ this.hideModal();
88
+ this.addEvent({ name: "orderedFilter" });
89
+ }
90
+ },
91
+ watch: {
92
+ fieldOrdering: {
93
+ handler() {
94
+ this.$emit("input", { ordering: this.ordering, field: this.fieldOrdering.id });
95
+ },
96
+ deep: true,
97
+ },
98
+ ordering: {
99
+ handler() {
100
+ this.$emit("input", { ordering: this.ordering, field: this.fieldOrdering.id });
101
+ },
102
+ deep: true,
103
+ },
104
+ },
105
+ }
106
+
107
+ </script>
@@ -0,0 +1,276 @@
1
+ <template>
2
+ <div class="main">
3
+ <Panel :module="module" layout="large" :title="name" :showVerticalFilter="false" :showSearch="false"
4
+ :showButtons="false">
5
+ <div slot="content-main">
6
+ <br>
7
+ <div class="div-btn">
8
+ <Molded>
9
+ <div class="div-filter">
10
+ <div class="side-by-side">
11
+ <div class="div-filter">
12
+ <Button _key="btnSearchReport" :disabled="loading || !isValid" type="primary"
13
+ title="Buscar" classIcon="fas fa-file-search" size="medium" :clicked="getAll" />
14
+ </div>
15
+ </div>
16
+ <div class="side-by-side">
17
+ <Fields :data="header" v-model="ordering" />
18
+ </div>
19
+ <div class="side-by-side">
20
+ <FilterQuery :filters="filters" v-model="stringFilter" />
21
+ </div>
22
+ </div>
23
+ </Molded>
24
+ </div>
25
+ <div v-if="liveTotalRecords != totalRecords">
26
+ <ProgressBar :text="`Carregando ${liveTotalRecords} registros de ${totalRecords}`"
27
+ :value="liveTotalRecords" :max="totalRecords" size="medium" />
28
+ </div>
29
+ <div v-if="!isValid">
30
+ <Alert type="info">
31
+ <span>
32
+ É necessário informar o filtro <b>{{ fieldsRequired }}</b>, clique no botão <b> <i
33
+ class="div-icon-btn fa-sharp fa-solid fa-filters" aria-hidden="true"></i> Filtros
34
+ </b>para
35
+ adicionar.
36
+ </span>
37
+ </Alert>
38
+ </div>
39
+ <div v-if="show" class="preview">
40
+ <div class="toolbar">
41
+ <div class="icon-toolbar" v-print="'#printMe'">
42
+ <i class="fas fa-print"></i>
43
+ </div>
44
+ <div class="icon-toolbar icon-excel">
45
+ <ExportExcel :nameFile="name" :header="dataConditional" :data="data" />
46
+ </div>
47
+ <div v-if="loading" class="icon-toolbar">
48
+ <vue-loading type="bubbles" color="orange" :size="{ width: '26px', height: '26px' }">
49
+ </vue-loading>
50
+ </div>
51
+ </div>
52
+ <ScrollBar :minHeight="400" :maxHeight="820">
53
+ <br />
54
+ <div id="printMe" :style="'min-height:' + minHeight + 'px'" class="a4 footer">
55
+ <HeaderReport :title="name" />
56
+ <div>
57
+ <span>Total de <b> {{ totalRecords }}</b> registro(s) </span>
58
+ </div>
59
+ <ReportTable :header="dataConditional" :data="data" />
60
+ <Totalization :totalization="totalization" />
61
+ </div>
62
+ </ScrollBar>
63
+ </div>
64
+ </div>
65
+ </Panel>
66
+ <br>
67
+ <br>
68
+ </div>
69
+ </template>
70
+
71
+ <script>
72
+
73
+ import Molded from "@nixweb/nixloc-ui/src/component/layout/Molded";
74
+ import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
75
+ import Loading from "@nixweb/nixloc-ui/src/component/shared/Loading.vue";
76
+ import HeaderReport from "../shared/HeaderReport.vue";
77
+ import ExportExcel from "@nixweb/nixloc-ui/src/component/shared/ExportExcel";
78
+ import ReportTable from "@nixweb/nixloc-ui/src/component/report/ReportTable.vue";
79
+ import Totalization from "@nixweb/nixloc-ui/src/component/report/Totalization.vue";
80
+ import FilterQuery from '@nixweb/nixloc-ui/src/component/shared/filter-builder/FilterQuery.vue'
81
+ import ProgressBar from "@nixweb/nixloc-ui/src/component/shared/ProgressBar";
82
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
83
+ import Fields from "@nixweb/nixloc-ui/src/component/report/Fields.vue";
84
+ import Panel from "@nixweb/nixloc-ui/src/component/layout/Panel.vue";
85
+ import Alert from "@nixweb/nixloc-ui/src/component/layout/Alert";
86
+
87
+ import print from "vue-print-nb";
88
+
89
+ import { mapMutations, mapActions, mapGetters } from "vuex";
90
+
91
+
92
+ export default {
93
+ directives: {
94
+ print,
95
+ },
96
+ props: ["name", "module", "urlGet", "header", "filters", "minHeight"],
97
+ components: { ScrollBar, HeaderReport, Alert, ExportExcel, ReportTable, Molded, FilterQuery, Button, Fields, Panel, Loading, Totalization, ProgressBar },
98
+ data() {
99
+ return {
100
+ loading: false,
101
+ show: false,
102
+ data: [],
103
+ totalization: [],
104
+ ordering: {},
105
+ stringFilter: [],
106
+ totalRecords: 0,
107
+ currentPage: 1,
108
+ totalPerPage: 50,
109
+ pagination: []
110
+ }
111
+ },
112
+ mounted() {
113
+ this.removeLoading(["panel"]);
114
+ },
115
+ computed: {
116
+ ...mapGetters("generic", ["event"]),
117
+ dataConditional() {
118
+ return this.header.filter(item => item.show);
119
+ },
120
+ liveTotalRecords() {
121
+ return this.data.length;
122
+ },
123
+ isValid() {
124
+ var hasRequired = this.filters.some(item => item.required);
125
+ if (hasRequired) {
126
+ return this.stringFilter.some(item => item.required == true && item.value !== "");
127
+ } else {
128
+ return true;
129
+ }
130
+ },
131
+ fieldsRequired() {
132
+ let title = "";
133
+ var filter = this.filters.filter(item => item.required);
134
+ filter.forEach(item => {
135
+ title += item.title + ' ou '
136
+ });
137
+ return title.replace(/ ou\s*$/, '');
138
+ }
139
+ },
140
+ methods: {
141
+ ...mapMutations("generic", ["removeLoading"]),
142
+ ...mapActions("generic", ["getApi"]),
143
+ getAll() {
144
+ if (this.isValid) {
145
+ this.removeLoading(["btnSearchReport"]);
146
+ this.loading = true;
147
+ let params = {
148
+ url: this.urlGet,
149
+ obj:
150
+ {
151
+ stringFilter: JSON.stringify(this.stringFilter),
152
+ fieldOrder: this.ordering.field,
153
+ ordering: this.ordering.ordering,
154
+ currentPage: this.currentPage,
155
+ totalPerPage: this.totalPerPage,
156
+ noPaginated: true
157
+ }
158
+ };
159
+
160
+ this.getApi(params).then((response) => {
161
+ let self = this;
162
+ this.totalization = response.content.totalization;
163
+ this.totalRecords = response.content.totalRecords;
164
+
165
+ if (this.pagination.length == 0) {
166
+ this.currentPage = 1;
167
+ this.data = [];
168
+ }
169
+
170
+ if (this.pagination.length == 0) {
171
+ var pagination = response.content.totalRecords / this.totalPerPage;
172
+ var arr = Math.ceil(pagination);
173
+ for (var i = 1; i <= arr; i++) {
174
+ self.pagination.push(i);
175
+ }
176
+ } else {
177
+ this.pagination.pop();
178
+ }
179
+
180
+ response.content.data.forEach(item => {
181
+ self.data.push(item);
182
+ });
183
+
184
+ this.show = true;
185
+ setTimeout(function () {
186
+ self.loading = false;
187
+
188
+ }, 500);
189
+
190
+ this.verifyIfPagination();
191
+ });
192
+ }
193
+ },
194
+ verifyIfPagination() {
195
+ if (this.pagination.length > 0) {
196
+ this.currentPage++;
197
+
198
+ let self = this;
199
+ setTimeout(function () {
200
+ self.getAll();
201
+ }, 500);
202
+ } else {
203
+ this.currentPage = 1;
204
+ }
205
+ }
206
+ },
207
+ watch: {
208
+ event: {
209
+ handler(event) {
210
+ if (this.show) {
211
+ if (event.name == "stringFilter" || event.name == "orderedFilter") {
212
+ let self = this;
213
+ setTimeout(function () {
214
+ self.getAll();
215
+ }, 500);
216
+ }
217
+ }
218
+ },
219
+ deep: true,
220
+ },
221
+ },
222
+ };
223
+ </script>
224
+
225
+ <style scoped>
226
+ .main {
227
+ margin-bottom: 30px;
228
+ }
229
+
230
+ .div-btn {
231
+ margin-bottom: 30px;
232
+ }
233
+
234
+ .preview {
235
+ background-color: #fafafa;
236
+ padding-bottom: 20px;
237
+ border: 1px solid #e4e6ec;
238
+ height: 100%;
239
+ }
240
+
241
+ .toolbar {
242
+ height: 40px;
243
+ border-bottom: 1px hsl(0, 0%, 82.7%) solid;
244
+ overflow: hidden;
245
+ }
246
+
247
+ .icon-toolbar {
248
+ width: 20px;
249
+ font-size: 18px;
250
+ margin-left: 10px;
251
+ margin-top: 2px;
252
+ cursor: pointer;
253
+ display: inline-block;
254
+ }
255
+
256
+ .a4 {
257
+ max-width: 1200px;
258
+ padding: 20px;
259
+ border-radius: var(--ck-border-radius);
260
+ background: white;
261
+ box-shadow: 0 0 5px hsl(0deg 0% 0% / 10%);
262
+ margin: 0 auto;
263
+ }
264
+
265
+ .div-filter {
266
+ margin-bottom: -12px;
267
+ }
268
+
269
+ .footer {
270
+ margin-bottom: 10px;
271
+ }
272
+
273
+ .icon-excel {
274
+ color: green;
275
+ }
276
+ </style>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <div>
3
+ <table class="table table-responsive-md">
4
+ <thead>
5
+ <tr>
6
+ <th v-for="(obj, ind) in header" :key="ind">
7
+ <div class="title-margem" :class="obj.classCssTitle" :style="obj.styleHeader">
8
+ <i class="fas fa-search" v-if="obj.iconSearch"></i>
9
+ <span class="title-header"> {{ obj.title }}</span>
10
+ </div>
11
+ </th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <tr v-for="(row, index) in data" :key="index" :style="row.rowCss">
16
+ <td v-for="(obj, ind) in header" :key="ind">
17
+ <div :style="obj.styleBody" @click="sendEvent(obj.eventName, row)"
18
+ :class="convertClass(row[obj.fieldComparison], obj.classCssBody)">
19
+ {{ row[obj.field] }}
20
+ </div>
21
+ </td>
22
+ </tr>
23
+ </tbody>
24
+ <tbody v-show="data.length == 0">
25
+ <tr>
26
+ <td colspan="12">
27
+ <span>Nenhum registro encontrado!</span>
28
+ </td>
29
+ </tr>
30
+ </tbody>
31
+ </table>
32
+ </div>
33
+
34
+ </template>
35
+ <script>
36
+
37
+ import { mapMutations } from "vuex";
38
+
39
+ export default {
40
+ name: "ReportTable",
41
+ props: ["header", "data"],
42
+ methods: {
43
+ ...mapMutations("generic", ["addEvent"]),
44
+ convertClass(fieldComparison, classCssBody) {
45
+ if (Array.isArray(classCssBody)) {
46
+ let ret = [];
47
+ classCssBody.forEach(function (value) {
48
+ let classCss = value.classCss;
49
+ let condition = value.fieldComparison == fieldComparison;
50
+ let obj = { [classCss]: condition };
51
+ ret.push(obj);
52
+ });
53
+ return ret;
54
+ } else {
55
+ return classCssBody;
56
+ }
57
+ },
58
+ sendEvent(eventName, data) {
59
+ if (eventName) this.addEvent({ name: eventName, data: data });
60
+ }
61
+ },
62
+ }
63
+
64
+ </script>
65
+ <style scoped>
66
+ table tbody tr td {
67
+ max-width: 350px;
68
+ }
69
+
70
+ .table thead tr {
71
+ border-top: 1px solid black;
72
+ border-bottom: 1px solid black;
73
+ }
74
+
75
+ .table th,
76
+ .table td {
77
+ height: 10px !important;
78
+ padding-left: 0px !important;
79
+ padding-top: 0px !important;
80
+ padding-bottom: 0px !important;
81
+ padding-right: 5px !important;
82
+ border-bottom: 0px !important;
83
+ border-top: 0px !important;
84
+ font-size: 13px !important;
85
+ }
86
+
87
+ .title-header {
88
+ font-size: 12px;
89
+ color: #757d8c;
90
+ font-weight: 400;
91
+ text-transform: uppercase;
92
+ }
93
+
94
+ .table-number {
95
+ font-size: 12px;
96
+ font-weight: bold;
97
+ }
98
+
99
+ .table-main {
100
+ color: #757d8c;
101
+ max-width: 200px;
102
+ }
103
+
104
+ .table-currency {
105
+ font-size: 12px;
106
+ min-width: 100px;
107
+ }
108
+ </style>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <div>
3
+ <hr class="hr-report" />
4
+ <div class="text-right" v-for="item in totalization" :key="item.title">
5
+ <b-row>
6
+ <b-col sm="10">
7
+ <span>
8
+ <span class="title-report-header">
9
+ {{ item.title }} ..................
10
+ </span>
11
+ </span>
12
+ </b-col>
13
+ <b-col sm="2">
14
+ {{ item.value }}
15
+ </b-col>
16
+ </b-row>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ name: "Totalization",
24
+ props: ["totalization"],
25
+
26
+ }
27
+
28
+ </script>
29
+ <style scoped>
30
+ .hr-report {
31
+ background: black !important;
32
+ height: 0px !important;
33
+ }
34
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <download-excel :fields="column" :data="data" :before-finish="exportFinished" worksheet="Planilha"
4
- :name="`${fileName}.xls`">
4
+ :name="`${nameFile}.xls`">
5
5
  <i class="fas fa-file-excel"></i>
6
6
  </download-excel>
7
7
  </div>
@@ -17,6 +17,7 @@ export default {
17
17
  props: {
18
18
  header: Array,
19
19
  data: Array,
20
+ nameFile: String
20
21
  },
21
22
  components: {
22
23
  Button,
@@ -48,7 +49,7 @@ export default {
48
49
  return object;
49
50
  },
50
51
  fileName() {
51
- return this.$route.matched[0].props.default.report;
52
+ return this.nameFile;
52
53
  },
53
54
  },
54
55
  };
@@ -34,7 +34,8 @@
34
34
  v-model="item.value" />
35
35
  </div>
36
36
  </div>
37
- <InputText v-if="item.type == 'text'" :title="item.title" v-model="item.value" />
37
+ <InputText v-if="item.type == 'text' || item.type == 'patrimony'" :title="item.title"
38
+ v-model="item.value" />
38
39
  </b-col>
39
40
  <b-col sm="1">
40
41
  <div class="icon-remove" @click="removeItem(item.field)">
@@ -99,6 +100,7 @@ export default {
99
100
  type: filter.type,
100
101
  url: filter.url,
101
102
  value: filter.value,
103
+ required: filter.required,
102
104
  propsParams: filter.propsParams
103
105
  });
104
106
  });
@@ -111,6 +113,7 @@ export default {
111
113
  field: item.field,
112
114
  type: item.type,
113
115
  originalValue: item.value,
116
+ required: item.required,
114
117
  value: item.type == "decimal" ? [item.valueStart, item.valueEnd].join(',') : Array.isArray(item.value) ? item.value.join(',') : item.value
115
118
  }));
116
119
  },