@nixweb/nixloc-ui 1.15.0 → 1.17.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.
@@ -1,39 +1,88 @@
1
1
  <template>
2
- <div>
3
- <div v-if="selected.length > 50" class="bab-alert">
4
- <i class="fas fa-triangle-exclamation"></i>
5
- <span> Limite máximo de 50 itens!</span>
6
- </div>
7
-
8
- <div v-else>
9
- <ActionButtons :actions="actions" @confirm="confirm" />
10
- </div>
11
-
12
- <Modal title="Tem certeza que deseja executar?" :showValidation="false" :closeOnEsc="false" :closeButton="false"
13
- :width="600" :height="750" v-if="showModal('confirm')">
14
- <ActionlHeader :description="actionSelected.description" :total="selected.length"
15
- :done="selectedDone.length" :errors="errorCount" />
16
-
17
- <ActionItemList :selected="selected" :status="status" :errorsMap="errorsMap"
18
- @show-error="openErrorDetails" />
19
-
20
- <hr class="hr" />
21
-
22
- <ActionFooter :isFinished="isFinished" :processing="processing" :selected="selected" @ok="ok"
23
- @cancel="hideModal" @finish="finished" />
24
- </Modal>
25
-
26
- <Modal v-if="errorDetails.open" :title="`Falha — Item ${errorDetails.index + 1}`" :showValidation="false"
27
- :closeOnEsc="false" :closeButton="false" :width="520" :height="360">
28
- <ActionErrorContent :id="errorDetails.id" :index="errorDetails.index" :messages="errorsMap[errorDetails.id]"
29
- @close="closeErrorDetails" />
30
- </Modal>
31
-
32
- <Modal title="Selecione a opção desejada" :showValidation="false" :closeOnEsc="true" :closeButton="true"
33
- :width="600" :height="750" v-if="showModal('actionsOptions')">
34
- <ActionsOptions :actionSelected="actionSelected" v-model="optionSelected" />
35
- </Modal>
2
+ <div>
3
+ <div
4
+ v-if="selected.length > 50"
5
+ class="bab-alert"
6
+ >
7
+ <i class="fas fa-triangle-exclamation"></i>
8
+ <span> Limite máximo de 50 itens!</span>
36
9
  </div>
10
+
11
+ <div v-else>
12
+ <ActionButtons
13
+ :actions="actions"
14
+ @confirm="confirm"
15
+ />
16
+ </div>
17
+
18
+ <Modal
19
+ title="Tem certeza que deseja executar?"
20
+ :showValidation="false"
21
+ :closeOnEsc="false"
22
+ :closeButton="false"
23
+ :width="600"
24
+ :height="750"
25
+ v-if="showModal('confirm')"
26
+ >
27
+ <ActionlHeader
28
+ :description="actionSelected.description"
29
+ :total="selected.length"
30
+ :done="selectedDone.length"
31
+ :errors="errorCount"
32
+ />
33
+
34
+ <ActionItemList
35
+ :selected="selected"
36
+ :status="status"
37
+ :errorsMap="errorsMap"
38
+ @show-error="openErrorDetails"
39
+ />
40
+
41
+ <hr class="hr" />
42
+
43
+ <ActionFooter
44
+ :isFinished="isFinished"
45
+ :processing="processing"
46
+ :selected="selected"
47
+ :errorCount="errorCount"
48
+ @ok="ok"
49
+ @cancel="hideModal"
50
+ @finish="finished"
51
+ />
52
+ </Modal>
53
+
54
+ <Modal
55
+ v-if="errorDetails.open"
56
+ :title="`Falha — Item ${errorDetails.index + 1}`"
57
+ :showValidation="false"
58
+ :closeOnEsc="false"
59
+ :closeButton="false"
60
+ :width="520"
61
+ :height="360"
62
+ >
63
+ <ActionErrorContent
64
+ :id="errorDetails.id"
65
+ :index="errorDetails.index"
66
+ :messages="errorsMap[errorDetails.id]"
67
+ @close="closeErrorDetails"
68
+ />
69
+ </Modal>
70
+
71
+ <Modal
72
+ title="Selecione a opção desejada"
73
+ :showValidation="false"
74
+ :closeOnEsc="true"
75
+ :closeButton="true"
76
+ :width="600"
77
+ :height="750"
78
+ v-if="showModal('actionsOptions')"
79
+ >
80
+ <ActionsOptions
81
+ :actionSelected="actionSelected"
82
+ v-model="optionSelected"
83
+ />
84
+ </Modal>
85
+ </div>
37
86
  </template>
38
87
 
39
88
  <script>
@@ -51,161 +100,163 @@ import ActionFooter from "./ActionFooter.vue";
51
100
  import { mapGetters, mapMutations, mapActions } from "vuex";
52
101
 
53
102
  export default {
54
- name: "ActionsSelected",
55
- components: {
56
- Button,
57
- Modal,
58
- ScrollBar,
59
- ActionButtons,
60
- ActionlHeader,
61
- ActionsOptions,
62
- ActionItemList,
63
- ActionErrorContent,
64
- ActionFooter,
103
+ name: "ActionsSelected",
104
+ components: {
105
+ Button,
106
+ Modal,
107
+ ScrollBar,
108
+ ActionButtons,
109
+ ActionlHeader,
110
+ ActionsOptions,
111
+ ActionItemList,
112
+ ActionErrorContent,
113
+ ActionFooter,
114
+ },
115
+ props: {
116
+ actions: { type: Array, default: () => [] },
117
+ selected: { type: Array, default: () => [] },
118
+ },
119
+ data() {
120
+ return {
121
+ actionSelected: {},
122
+ optionSelected: "",
123
+ selectedDone: [],
124
+ processing: false,
125
+ status: {},
126
+ errorsMap: {},
127
+ errorDetails: { open: false, id: null, index: -1 },
128
+ errorIds: [],
129
+ };
130
+ },
131
+ computed: {
132
+ ...mapGetters("generic", ["showModal"]),
133
+ errorCount() {
134
+ return Object.values(this.status).filter((s) => s === "error").length;
135
+ },
136
+ isFinished() {
137
+ if (!this.selected.length) return false;
138
+ const statuses = Object.values(this.status);
139
+ return (
140
+ statuses.length === this.selected.length &&
141
+ statuses.every((s) => s === "done" || s === "error")
142
+ );
65
143
  },
66
- props: {
67
- actions: { type: Array, default: () => [] },
68
- selected: { type: Array, default: () => [] },
144
+ },
145
+ methods: {
146
+ ...mapActions("generic", ["putApi", "deleteAllApi"]),
147
+ ...mapMutations("generic", [
148
+ "openModal",
149
+ "hideModal",
150
+ "executedSearch",
151
+ "addSelected",
152
+ "addEvent",
153
+ ]),
154
+ confirm(params) {
155
+ this.actionSelected = params;
156
+ this.selectedDone = [];
157
+ this.processing = false;
158
+ this.status = {};
159
+ this.errorsMap = {};
160
+ this.errorIds = [];
161
+ this.selected.forEach((id) => this.$set(this.status, id, "waiting"));
162
+
163
+ if (params.type != "delete") {
164
+ this.openModal("actionsOptions");
165
+ } else {
166
+ this.openModal("confirm");
167
+ }
168
+ },
169
+ async put(id) {
170
+ const response = await this.putApi({
171
+ url: this.actionSelected.url,
172
+ obj: { id: id, any: this.optionSelected },
173
+ notNotifyToast: true,
174
+ });
175
+ this.addEvent({ name: "actionsUpdated" });
176
+ return response;
177
+ },
178
+ async remove(id) {
179
+ const response = await this.deleteAllApi({
180
+ url: this.actionSelected.url,
181
+ selected: [id],
182
+ notNotifyToast: true,
183
+ });
184
+ this.addEvent({ name: "actionsUpdated" });
185
+ return response;
186
+ },
187
+ async ok() {
188
+ if (this.processing) return;
189
+ this.processing = true;
190
+
191
+ for (let i = 0; i < this.selected.length; i++) {
192
+ const id = this.selected[i];
193
+ this.$set(this.status, id, "running");
194
+
195
+ try {
196
+ let result = null;
197
+ if (this.actionSelected.method == "delete")
198
+ result = await this.remove(id);
199
+
200
+ if (this.actionSelected.method == "put") result = await this.put(id);
201
+
202
+ if (result?.success) {
203
+ this.$set(this.status, id, "done");
204
+ this.selectedDone.push(id);
205
+ } else {
206
+ const msgs = (result?.notifications || [])
207
+ .map((n) => n && n.message)
208
+ .filter(Boolean);
209
+ this.$set(this.errorsMap, id, msgs);
210
+ this.$set(this.status, id, "error");
211
+ this.errorIds.push(id);
212
+ }
213
+ } catch {
214
+ this.$set(this.errorsMap, id, [
215
+ "Falha inesperada ao comunicar com a API.",
216
+ ]);
217
+ this.$set(this.status, id, "error");
218
+ this.errorIds.push(id);
219
+ }
220
+ }
221
+
222
+ this.processing = false;
69
223
  },
70
- data() {
71
- return {
72
- actionSelected: {},
73
- optionSelected: "",
74
- selectedDone: [],
75
- processing: false,
76
- status: {},
77
- errorsMap: {},
78
- errorDetails: { open: false, id: null, index: -1 },
79
- errorIds: [],
80
- };
224
+ openErrorDetails({ id, index }) {
225
+ this.errorDetails = { open: true, id, index };
81
226
  },
82
- computed: {
83
- ...mapGetters("generic", ["showModal"]),
84
- errorCount() {
85
- return Object.values(this.status).filter((s) => s === "error").length;
86
- },
87
- isFinished() {
88
- if (!this.selected.length) return false;
89
- const statuses = Object.values(this.status);
90
- return (
91
- statuses.length === this.selected.length &&
92
- statuses.every((s) => s === "done" || s === "error")
93
- );
94
- },
227
+ closeErrorDetails() {
228
+ this.errorDetails = { open: false, id: null, index: -1 };
95
229
  },
96
- methods: {
97
- ...mapActions("generic", ["putApi", "deleteAllApi"]),
98
- ...mapMutations("generic", ["openModal", "hideModal", "executedSearch", "addSelected", "addEvent"]),
99
- confirm(params) {
100
- this.actionSelected = params;
101
- this.selectedDone = [];
102
- this.processing = false;
103
- this.status = {};
104
- this.errorsMap = {};
105
- this.errorIds = [];
106
- this.selected.forEach((id) => this.$set(this.status, id, "waiting"));
107
-
108
- if (params.type != "delete") {
109
- this.openModal("actionsOptions");
110
- } else {
111
- this.openModal("confirm");
112
- }
113
-
114
- },
115
- async put(id) {
116
- const response = await this.putApi(
117
- {
118
- url: this.actionSelected.url,
119
- obj: { id: id, any: this.optionSelected },
120
- notNotifyToast: true
121
- }
122
- );
123
- this.addEvent({ name: "actionsUpdated" });
124
- return response;
125
- },
126
- async remove(id) {
127
- const response = await this.deleteAllApi(
128
- {
129
- url: this.actionSelected.url,
130
- selected: [id],
131
- notNotifyToast: true
132
- }
133
- );
134
- this.addEvent({ name: "actionsUpdated" });
135
- return response;
136
- },
137
- async ok() {
138
- if (this.processing) return;
139
- this.processing = true;
140
-
141
- for (let i = 0; i < this.selected.length; i++) {
142
- const id = this.selected[i];
143
- this.$set(this.status, id, "running");
144
-
145
- try {
146
- let result = null;
147
- if (this.actionSelected.method == "delete")
148
- result = await this.remove(id);
149
-
150
- if (this.actionSelected.method == "put")
151
- result = await this.put(id);
152
-
153
- if (result?.success) {
154
- this.$set(this.status, id, "done");
155
- this.selectedDone.push(id);
156
- } else {
157
- const msgs = (result?.notifications || [])
158
- .map((n) => n && n.message)
159
- .filter(Boolean);
160
- this.$set(this.errorsMap, id, msgs);
161
- this.$set(this.status, id, "error");
162
- this.errorIds.push(id);
163
- }
164
- } catch {
165
- this.$set(this.errorsMap, id, ["Falha inesperada ao comunicar com a API."]);
166
- this.$set(this.status, id, "error");
167
- this.errorIds.push(id);
168
- }
169
- }
170
-
171
- this.processing = false;
172
- },
173
- openErrorDetails({ id, index }) {
174
- this.errorDetails = { open: true, id, index };
175
- },
176
- closeErrorDetails() {
177
- this.errorDetails = { open: false, id: null, index: -1 };
178
- },
179
- finished() {
180
- this.hideModal();
181
- this.addEvent({ name: "deselectAll" });
182
- this.addSelected(this.errorIds);
183
- this.executedSearch();
184
- },
230
+ finished() {
231
+ this.hideModal();
232
+ this.addEvent({ name: "deselectAll" });
233
+ this.addSelected(this.errorIds);
234
+ this.executedSearch();
185
235
  },
236
+ },
186
237
  };
187
238
  </script>
188
239
 
189
240
  <style scoped>
190
241
  .bab-alert {
191
- box-sizing: border-box;
192
- margin-bottom: 10px;
193
- color: rgba(0, 0, 0, 0.65);
194
- font-size: 14px;
195
- padding: 8px 15px;
196
- border-radius: 10px;
197
- background-color: #fff1f0;
198
- border: 1px solid #ffa39e;
242
+ box-sizing: border-box;
243
+ margin-bottom: 10px;
244
+ color: rgba(0, 0, 0, 0.65);
245
+ font-size: 14px;
246
+ padding: 8px 15px;
247
+ border-radius: 10px;
248
+ background-color: #fff1f0;
249
+ border: 1px solid #ffa39e;
199
250
  }
200
251
 
201
252
  .bab-alert i {
202
- color: #dc2626;
203
- font-size: 15px;
253
+ color: #dc2626;
254
+ font-size: 15px;
204
255
  }
205
256
 
206
257
  .hr {
207
- margin: 14px 0;
208
- border: none;
209
- border-top: 1px solid #eef2f7;
258
+ margin: 14px 0;
259
+ border: none;
260
+ border-top: 1px solid #eef2f7;
210
261
  }
211
262
  </style>
@@ -1,15 +1,35 @@
1
1
  <template>
2
2
  <div>
3
- <Panel :module="panel.module" layout="large" :title="panel.title" :showVerticalFilter="panel.showVerticalFilter"
4
- :showSearch="panel.showSearch" :showButtons="panel.showButtons">
3
+ <Panel
4
+ :module="panel.module"
5
+ layout="large"
6
+ :title="panel.title"
7
+ :showVerticalFilter="panel.showVerticalFilter"
8
+ :showSearch="panel.showSearch"
9
+ :showButtons="panel.showButtons"
10
+ >
5
11
  <div slot="content-main">
6
12
  <br />
7
- <Loading type="line" :center="false" v-show="loadingSearch" />
13
+ <Loading
14
+ type="line"
15
+ :center="false"
16
+ v-show="loadingSearch"
17
+ />
8
18
  <div v-show="!showFilter">
9
- <div class="div-progress" v-if="liveTotalRecords != baseParams.totalRecords && !loadingSearch && !cancel">
10
- <ProgressBar :text="`Carregando ${liveTotalRecords} registros de ${baseParams.totalRecords}`"
11
- :value="liveTotalRecords" :max="baseParams.totalRecords" size="medium" />
12
- <div class="text-center cancel" @click="stop">
19
+ <div
20
+ class="div-progress"
21
+ v-if="liveTotalRecords != baseParams.totalRecords && !loadingSearch && !cancel"
22
+ >
23
+ <ProgressBar
24
+ :text="`Carregando ${liveTotalRecords} registros de ${baseParams.totalRecords}`"
25
+ :value="liveTotalRecords"
26
+ :max="baseParams.totalRecords"
27
+ size="medium"
28
+ />
29
+ <div
30
+ class="text-center cancel"
31
+ @click="stop"
32
+ >
13
33
  <i class="fa-solid fa-ban"></i> Cancelar
14
34
  </div>
15
35
  </div>
@@ -17,25 +37,56 @@
17
37
  <b-row>
18
38
  <b-col sm="6">
19
39
  <div class="side-by-side">
20
- <Button _key="btnSearchReport" type="primary" title="Buscar" classIcon="fas fa-file-search"
21
- :disabled="btnSearchDisabled || !rulesIsValid" size="medium" :clicked="getAll" />
40
+ <Button
41
+ _key="btnSearchReport"
42
+ type="primary"
43
+ title="Buscar"
44
+ classIcon="fas fa-file-search"
45
+ :disabled="btnSearchDisabled || !rulesIsValid"
46
+ size="medium"
47
+ :clicked="getAll"
48
+ />
22
49
  </div>
23
50
  <div class="side-by-side">
24
- <Button _key="btnSaveReport" type="success" title="Salvar" classIcon="fas fa-save" size="small"
51
+ <Button
52
+ _key="btnSaveReport"
53
+ type="success"
54
+ title="Salvar"
55
+ classIcon="fas fa-save"
56
+ size="small"
25
57
  :disabled="isLoading || btnSaveDisabled || !rulesIsValid"
26
- :params="{ name: 'save', title: 'Salvar', width: 550 }" :clicked="executeOpenModal" />
58
+ :params="{ name: 'save', title: 'Salvar', width: 550 }"
59
+ :clicked="executeOpenModal"
60
+ />
27
61
  </div>
28
62
  </b-col>
29
- <b-col class="text-right" sm="6">
63
+ <b-col
64
+ class="text-right"
65
+ sm="6"
66
+ >
30
67
  <div class="side-by-side">
31
- <Button _key="btnExecuteOpenModal" type="info" title="Campos" classIcon="fas fa-database" size="small"
32
- :disabled="isLoading" :params="{ name: 'fields', title: 'Campos', width: 550 }"
33
- :clicked="executeOpenModal" />
68
+ <Button
69
+ _key="btnExecuteOpenModal"
70
+ type="info"
71
+ title="Campos"
72
+ classIcon="fas fa-database"
73
+ size="small"
74
+ :disabled="isLoading"
75
+ :params="{ name: 'fields', title: 'Campos', width: 550 }"
76
+ :clicked="executeOpenModal"
77
+ />
34
78
  </div>
35
79
  <div class="side-by-side">
36
- <Button _key="btnExecuteOpenModal" type="info" title="Filtros" classIcon="fas fa-filter" size="small"
37
- :disabled="isLoading" :params="{ name: 'rules', title: 'Filtros', width: 900 }"
38
- :clicked="executeShowFilter" />
80
+ <Button
81
+ _key="btnExecuteOpenModal"
82
+ type="info"
83
+ title="Filtros"
84
+ classIcon="fas fa-filter"
85
+ size="small"
86
+ :disabled="isLoading"
87
+ :params="{ name: 'rules', title: 'Filtros', width: 900 }"
88
+ :clicked="executeShowFilter"
89
+ />
39
90
  </div>
40
91
  </b-col>
41
92
  </b-row>
@@ -43,36 +94,77 @@
43
94
  <div class="div-tags">
44
95
  <Tags eventName="tagReport" />
45
96
  </div>
46
- <div class="div-required" v-show="!rulesIsValid">
47
- <Alert type="info" v-for="rule in rulesRequired" :key="rule.id">
97
+ <div
98
+ class="div-required"
99
+ v-show="!rulesIsValid"
100
+ >
101
+ <Alert
102
+ type="info"
103
+ v-for="rule in rulesRequired"
104
+ :key="rule.id"
105
+ >
48
106
  É necessário informar o filtro
49
107
  <span class="filter-required">{{ rule.title }}</span>, clique no botão "Filtros" para adicionar.
50
108
  </Alert>
51
109
  </div>
52
- <div class="body-report" v-show="showBodyReport && rulesIsValid">
53
- <Report :minHeight="700" :header="content.headerTable" :data="content.data"
54
- :totalization="content.totalization" />
110
+ <div
111
+ class="body-report"
112
+ v-show="showBodyReport && rulesIsValid"
113
+ >
114
+ <Report
115
+ :minHeight="700"
116
+ :header="content.headerTable"
117
+ :data="content.data"
118
+ :totalization="content.totalization"
119
+ />
55
120
  </div>
56
121
  </div>
57
122
  <div v-show="showFilter">
58
123
  <Rules />
59
124
  <br />
60
125
  <div class="text-center">
61
- <Button _key="btnCancelFilter" type="info" classIcon="fa-solid fa-arrow-left" size="small"
62
- :clicked="executeHideFilter" />
63
- <Button _key="btnApplyFilter" type="primary" title="Aplicar" classIcon="fas fa-filter" size="small"
64
- :clicked="executeHideFilter" />
126
+ <Button
127
+ _key="btnCancelFilter"
128
+ type="info"
129
+ classIcon="fa-solid fa-arrow-left"
130
+ size="small"
131
+ :clicked="executeHideFilter"
132
+ />
133
+ <Button
134
+ _key="btnApplyFilter"
135
+ type="primary"
136
+ title="Aplicar"
137
+ classIcon="fas fa-filter"
138
+ size="small"
139
+ :clicked="executeHideFilter"
140
+ />
65
141
  </div>
66
142
  </div>
67
143
  </div>
68
144
  </Panel>
69
145
 
70
- <Modal :title="modalOptions.title" :width="modalOptions.width" v-show="showModal('templateReport')">
71
- <ReportCreateUpdate :module="panel.module" v-show="modalOptions.name == 'save'" />
146
+ <Modal
147
+ :title="modalOptions.title"
148
+ :width="modalOptions.width"
149
+ v-show="showModal('templateReport')"
150
+ >
151
+ <ReportCreateUpdate
152
+ :module="panel.module"
153
+ v-show="modalOptions.name == 'save'"
154
+ />
72
155
  <Fields v-if="modalOptions.name == 'fields'" />
73
- <div class="text-right btn-apply" v-show="modalOptions.name == 'fields' || modalOptions.name == 'rules'">
74
- <Button _key="btnApplyFieldsAndRules" type="primary" title="Aplicar" classIcon="fas fa-filter" size="small"
75
- :clicked="applyFieldsAndRules" />
156
+ <div
157
+ class="text-right btn-apply"
158
+ v-show="modalOptions.name == 'fields' || modalOptions.name == 'rules'"
159
+ >
160
+ <Button
161
+ _key="btnApplyFieldsAndRules"
162
+ type="primary"
163
+ title="Aplicar"
164
+ classIcon="fas fa-filter"
165
+ size="small"
166
+ :clicked="applyFieldsAndRules"
167
+ />
76
168
  </div>
77
169
  </Modal>
78
170
  </div>
@@ -169,7 +261,6 @@ export default {
169
261
  "addReport",
170
262
  "addInitialReportCustom",
171
263
  "removeInitialReportCustom",
172
-
173
264
  ]),
174
265
  ...mapMutations("generic", [
175
266
  "addEvent",
@@ -177,9 +268,7 @@ export default {
177
268
  "hideModal",
178
269
  "removeLoading",
179
270
  ]),
180
- ...mapMutations("report", [
181
- "clearTotalization"
182
- ]),
271
+ ...mapMutations("report", ["clearTotalization"]),
183
272
  getById() {
184
273
  let params = { url: this.urlGetById, obj: { id: this.id } };
185
274
  this.getApi(params).then((response) => {
@@ -209,7 +298,6 @@ export default {
209
298
  let paramsQuery = { url: this.urlQuery };
210
299
  this.resetData();
211
300
  this.getApiOdata(paramsQuery).then((response) => {
212
-
213
301
  this.isLoading = true;
214
302
  let totalRecords = response["@odata.count"];
215
303
  this.loadingSearch = false;
@@ -303,7 +391,7 @@ export default {
303
391
  this.btnSearchDisabled = false;
304
392
  this.btnSaveDisabled = false;
305
393
  this.isLoading = false;
306
- }
394
+ },
307
395
  },
308
396
  computed: {
309
397
  ...mapGetters("generic", ["showModal", "event"]),
@@ -325,8 +413,9 @@ export default {
325
413
  let query = this.oDataFilter.query
326
414
  ? `$apply=filter(${this.oDataFilter.query.replace("$filter=", "")})/`
327
415
  : "$apply=";
328
- let baseUrl = `${this.templateList.urlGetApi
329
- }?${query}aggregate(${this.oDataFilter.totalization.replace(",", "")})`;
416
+ let baseUrl = `${
417
+ this.templateList.urlGetApi
418
+ }?${query}aggregate(${this.oDataFilter.totalization.replace(",", "")})`;
330
419
  return baseUrl;
331
420
  },
332
421
  liveTotalRecords() {