@nixweb/nixloc-ui 0.0.267 → 0.0.269

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.267",
3
+ "version": "0.0.269",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -12,7 +12,7 @@
12
12
  danger: type === 'danger',
13
13
  disabled: disabled,
14
14
  }" :disabled="disabled" @click="execute()">
15
- <i class="title" :class="classIcon" v-if="!isLoading(this._key) && classIcon"></i>
15
+ <i :class="classIcon" v-if="!isLoading(this._key) && classIcon"></i>
16
16
  <span v-if="!isLoading(this._key)">{{ title }}</span>
17
17
  <vue-loading v-if="isLoading(this._key)" type="bubbles" color="#fff"
18
18
  :size="{ width: '26px', height: '26px' }"></vue-loading>
@@ -83,11 +83,13 @@ export default {
83
83
  },
84
84
  executeConfirm() {
85
85
  if (this.range) {
86
- let obj = {
87
- fieldTarget: this.fieldTarget,
88
- value: { start: this.valueLocal[0], end: this.valueLocal[1] },
89
- };
90
- this.addFilter(obj);
86
+ if (this.fieldTarget) {
87
+ let obj = {
88
+ fieldTarget: this.fieldTarget,
89
+ value: { start: this.valueLocal[0], end: this.valueLocal[1] },
90
+ };
91
+ this.addFilter(obj);
92
+ }
91
93
  }
92
94
  },
93
95
  close() {
@@ -22,6 +22,7 @@ import { mapMutations } from "vuex";
22
22
  export default {
23
23
  name: "IncrementDecrement",
24
24
  props: [
25
+ "name",
25
26
  "title",
26
27
  "initialValue",
27
28
  "value",
@@ -80,7 +81,7 @@ export default {
80
81
  if (this.triggerEvent)
81
82
  this.addEvent({
82
83
  name: "updateIncrementDecrement",
83
- data: this.number,
84
+ data: { name: this.name, value: this.number },
84
85
  });
85
86
  },
86
87
  deep: true,
@@ -4,16 +4,16 @@
4
4
  :precision="precision" field="discount" :required="required" :formName="formName" _style="color:red;"
5
5
  :disabled="disabled" v-model="discount.discount">
6
6
  <div class="glyphicon margin-button">
7
- <Button _key="btnDiscount" backGroundColor="#F36944" color="white" classIcon="fa-solid fa-brazilian-real-sign"
8
- size="small" :disabled="disabled" :clicked="change" />
7
+ <Button _key="btnDiscount" type="danger" classIcon="fa-solid fa-brazilian-real-sign" size="small"
8
+ :disabled="disabled" :clicked="change" />
9
9
  </div>
10
10
  </InputDecimal>
11
11
  <InputNumber v-if="discount.discountByPercentage" :markFormDirty="markFormDirty" :title="title" field="discount"
12
12
  :formName="formName" :required="false" :disabled="disabled" _style="color:red;" :maxLength="5" type="float"
13
13
  v-model="discount.discount">
14
14
  <div class="glyphicon margin-button">
15
- <Button _key="btnDiscount" backGroundColor="#F36944" color="white" :disabled="disabled"
16
- classIcon="fa-solid fa-percent" size="small" :clicked="change" />
15
+ <Button _key="btnDiscount" type="danger" :disabled="disabled" classIcon="fa-solid fa-percent" size="small"
16
+ :clicked="change" />
17
17
  </div>
18
18
  </InputNumber>
19
19
  </div>
@@ -9,7 +9,8 @@
9
9
  <i v-if="notifications.length > 0 && formDirty" class="required glyphicon fas fa-exclamation-triangle"></i>
10
10
 
11
11
  <textarea :disabled="disabled" rows="4" cols="50" type="text" :placeholder="placeholder" v-bind:value="value"
12
- v-on:input="$emit('input', $event.target.value)" :class="{ 'is-invalid': notifications.length > 0 && formDirty }">
12
+ v-on:input="$emit('input', $event.target.value)"
13
+ :class="{ 'is-invalid': notifications.length > 0 && formDirty }">
13
14
  </textarea>
14
15
  </div>
15
16
 
@@ -119,7 +120,7 @@ textarea {
119
120
  font-size: 14px;
120
121
  }
121
122
 
122
- textarea:disabled{
123
+ textarea:disabled {
123
124
  background-color: white !important;
124
125
  opacity: 0.5;
125
126
  }
@@ -19,14 +19,23 @@ export default {
19
19
  value: String,
20
20
  eventName: String,
21
21
  eventData: Object,
22
+ clickedRemove: Function,
23
+ clickedBody: Function,
24
+ params: Object,
22
25
  showButtonClose: {
23
26
  type: Boolean,
24
27
  default: true
28
+ },
29
+ tagRemoved: {
30
+ type: Boolean,
31
+ default: true
25
32
  }
26
33
  },
27
34
  methods: {
28
35
  ...mapMutations("generic", ["addEvent"]),
29
36
  execute() {
37
+ if (this.clickedBody) this.clickedBody(this.params);
38
+
30
39
  if (this.eventName)
31
40
  this.addEvent({
32
41
  nome: this.eventName,
@@ -34,10 +43,14 @@ export default {
34
43
  });
35
44
  },
36
45
  remove() {
37
- this.addEvent({
38
- name: "tagRemoved",
39
- data: this.eventData ? this.eventData : this._key,
40
- });
46
+ if (this.clickedRemove) this.clickedRemove(this.params);
47
+
48
+ if (this.tagRemoved) {
49
+ this.addEvent({
50
+ name: "tagRemoved",
51
+ data: this.eventData ? this.eventData : this._key,
52
+ });
53
+ }
41
54
  },
42
55
  },
43
56
  };
@@ -9,11 +9,8 @@
9
9
  <vue-loading type="bubbles" color="#FCA944" :size="{ width: '26px', height: '26px' }"></vue-loading>
10
10
  </span>
11
11
  <span v-else>
12
- <div v-if="currentPage < totalPages">
13
- {{ currentPage }} de {{ totalPages }}
14
- </div>
15
- <div v-else>
16
- 1 de 1
12
+ <div>
13
+ <span class="title"> {{ currentPage }} de {{ totalPages }}</span>
17
14
  </div>
18
15
  </span>
19
16
  </div>
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div>
3
+ <b-row>
4
+ <b-col sm="9">
5
+ <SelectStatic title="Tipo" :onlyQuery="true" :data="options" :markFormDirty="true"
6
+ v-model="filterSelected" />
7
+ </b-col>
8
+ <b-col sm="3">
9
+ <div class="div-btn">
10
+ <Button _key="btnAddFilter" backGroundColor="#156EBE" color="white"
11
+ classIcon="fa-regular fa-plus-large" size="small" :clicked="add" />
12
+ </div>
13
+ </b-col>
14
+ </b-row>
15
+ <div>
16
+ <div v-for="item in filtersAdded">
17
+ <div class="molded">
18
+ <b-row>
19
+ <b-col sm="11">
20
+ <CheckboxGroup v-if="item.type == 'options'" :title="item.title" :options="item.options"
21
+ v-model="item.value" />
22
+
23
+ <div class="div-date">
24
+ <DateTime v-if="item.type == 'date' || item.type == 'dateRange'" :title="item.title"
25
+ format="DD/MM/YYYY" type="date" :range="true" :confirm="true" confirmText="Ok"
26
+ placeholder v-model="item.value" />
27
+ </div>
28
+
29
+ <div v-if="item.type == 'decimal'">
30
+ <b-row>
31
+ <b-col sm="6">
32
+ <InputDecimal title="Valor Inicial" v-model="item.valueStart" />
33
+ </b-col>
34
+ <b-col sm="6">
35
+ <InputDecimal title="Valor Final" v-model="item.valueEnd" />
36
+ </b-col>
37
+ </b-row>
38
+ </div>
39
+
40
+
41
+ <InputText v-if="item.type == 'text'" :title="item.title" v-model="item.value" />
42
+ </b-col>
43
+ <b-col sm="1">
44
+ <div class="icon-remove" @click="removeItem(item.field)">
45
+ <i class="fas fa-times"></i>
46
+ </div>
47
+ </b-col>
48
+ </b-row>
49
+ </div>
50
+ </div>
51
+ <div class="text-center">
52
+ <Button _key="btnApply" title="Aplicar" backGroundColor="#156EBE" color="white" size="small"
53
+ :clicked="apply" />
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </template>
58
+
59
+ <script>
60
+
61
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
62
+ import InputText from "@nixweb/nixloc-ui/src/component/forms/InputText";
63
+ import InputDecimal from "@nixweb/nixloc-ui/src/component/forms/InputDecimal";
64
+ import SelectStatic from "@nixweb/nixloc-ui/src/component/forms/SelectStatic";
65
+ import CheckboxGroup from "@nixweb/nixloc-ui/src/component/forms/CheckboxGroup";
66
+ import ScrollBar from "@nixweb/nixloc-ui/src/component/layout/ScrollBar.vue";
67
+ import DateTime from "@nixweb/nixloc-ui/src/component/forms/DateTime";
68
+
69
+ import { mapMutations, mapGetters } from "vuex";
70
+
71
+ export default {
72
+ name: "FilterBuilder",
73
+ props: ["filters", "value"],
74
+ components: { SelectStatic, Button, CheckboxGroup, InputText, ScrollBar, DateTime, InputDecimal },
75
+ data() {
76
+ return {
77
+ filterSelected: {},
78
+ filtersAdded: [],
79
+ }
80
+ },
81
+ computed: {
82
+ ...mapGetters("generic", ["event"]),
83
+ options() {
84
+ let options = [];
85
+ this.filters.forEach(filter => {
86
+ options.push(
87
+ {
88
+ id: filter.type,
89
+ content: filter.title,
90
+ field: filter.field,
91
+ options: filter.options,
92
+ title: filter.title,
93
+ type: filter.type,
94
+ value: filter.value
95
+ });
96
+ });
97
+ return options;
98
+ },
99
+ filterFinal() {
100
+ return this.filtersAdded.map(item => ({
101
+ title: item.title,
102
+ field: item.field,
103
+ type: item.type,
104
+ originalValue: item.value,
105
+ value: item.type == "decimal" ? [item.valueStart, item.valueEnd].join(',') : Array.isArray(item.value) ? item.value.join(',') : item.value
106
+ }));
107
+ },
108
+ },
109
+ methods: {
110
+ ...mapMutations("generic", ["addEvent", "hideModal", "removeLoading"]),
111
+ add() {
112
+ if (this.filterSelected.id && !this.contentExists(this.filterSelected.field)) {
113
+ this.filtersAdded.push(this.filterSelected);
114
+ this.filterSelected = { content: "", id: "" };
115
+ }
116
+ this.removeLoading(["btnAddFilter"]);
117
+ },
118
+ contentExists(field) {
119
+ return this.filtersAdded.some(item => item.field === field);
120
+ },
121
+ removeItem(field) {
122
+ this.filtersAdded = this.filtersAdded.filter(item => item.field !== field);
123
+ },
124
+ apply() {
125
+ this.addEvent({ name: "stringFilter", data: this.filterFinal });
126
+ this.hideModal();
127
+ this.removeLoading(["btnApply"]);
128
+ }
129
+ },
130
+ watch: {
131
+ event: {
132
+ handler(event) {
133
+ if (event.name == "tagFilterRemove") {
134
+ this.removeItem(event.data.field);
135
+ this.addEvent({ name: "stringFilter" });
136
+ }
137
+ },
138
+ deep: true,
139
+ },
140
+ filterFinal: {
141
+ handler(filterFinal) {
142
+ this.$emit("input", filterFinal);
143
+ },
144
+ deep: true,
145
+ },
146
+ },
147
+ }
148
+
149
+
150
+ </script>
151
+
152
+ <style scoped>
153
+ .div-btn {
154
+ margin-top: 38px;
155
+ }
156
+
157
+ .div-date {
158
+ width: 300px;
159
+ }
160
+
161
+ .molded {
162
+ border: 1px solid #e8eaed;
163
+ background-color: white;
164
+ border-radius: 8px !important;
165
+ padding-left: 10px;
166
+ padding-right: 10px;
167
+ padding-top: 10px;
168
+ margin-bottom: 10px;
169
+ }
170
+
171
+ .icon-remove {
172
+ color: #F0134D;
173
+ cursor: pointer;
174
+ margin-top: 15px;
175
+ font-size: 17px;
176
+ }
177
+ </style>
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <div class="div-main">
3
+ <div>
4
+ <Button _key="btnFilter" tooltip="Aplicar Filtros" color="black" backGroundColor="#F0F0F0" title="Filtros"
5
+ classIcon="fa-sharp fa-solid fa-filters" size="small" :clicked="openFilter" />
6
+ </div>
7
+
8
+ <div class="side-by-side" v-for="item in tags">
9
+ <div class="side-by-side div-tag">
10
+ <Tag v-if="item.value" eventName="eventName" :params="item" eventData="tag" :clickedBody="openFilter"
11
+ :clickedRemove="removeTag" :title="item.title" :value="item.value" :tagRemoved="false" />
12
+ </div>
13
+ </div>
14
+
15
+ <Modal title="Filtros" :width="700" :height="750" v-if="showModal('filter')">
16
+ <FilterBuilder :filters="filters" v-model="filterFinal" />
17
+ </Modal>
18
+ </div>
19
+ </template>
20
+
21
+ <script>
22
+
23
+ import Button from "@nixweb/nixloc-ui/src/component/forms/Button";
24
+ import Modal from "@nixweb/nixloc-ui/src/component/forms/Modal";
25
+ import FilterBuilder from "./FilterBuilder.vue";
26
+ import Tag from "@nixweb/nixloc-ui/src/component/layout/Tag";
27
+
28
+ import { mapGetters, mapMutations } from "vuex";
29
+
30
+
31
+ export default {
32
+ name: "FilterQuery",
33
+ props: ["filters", "value"],
34
+ components: {
35
+ Button, Modal, FilterBuilder, Tag
36
+ },
37
+ data() {
38
+ return {
39
+ filterFinal: [],
40
+ tags: [],
41
+ }
42
+ },
43
+ computed: {
44
+ ...mapGetters("generic", ["showModal", "event"]),
45
+ },
46
+ methods: {
47
+ ...mapMutations("generic", ["openModal", "addEvent", "removeLoading"]),
48
+ openFilter() {
49
+ this.openModal("filter");
50
+ this.removeLoading(["btnFilter"]);
51
+ },
52
+ removeTag(params) {
53
+ this.tags = this.tags.filter(item => item.field !== params.field);
54
+ this.addEvent({ name: "tagFilterRemove", data: params });
55
+ }
56
+ },
57
+ watch: {
58
+ event: {
59
+ handler(event) {
60
+ if (event.name == "stringFilter") {
61
+ var data = JSON.stringify(event.data);
62
+ this.tags = JSON.parse(data);
63
+ }
64
+ },
65
+ deep: true,
66
+ },
67
+ filterFinal: {
68
+ handler(filterFinal) {
69
+ this.$emit("input", filterFinal);
70
+ },
71
+ deep: true,
72
+ },
73
+ },
74
+
75
+ }
76
+
77
+ </script>.
78
+ <style>
79
+ .div-main {
80
+ margin-bottom: 20px;
81
+ }
82
+
83
+ .div-tag {
84
+ margin-left: 2px;
85
+ }
86
+ </style>
@@ -1,12 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <div class="side-by-side div-tag" v-for="tag in tagsLocal" :key="tag.id">
4
- <Tag
5
- :eventName="eventName"
6
- :eventData="tag"
7
- :title="tag.title"
8
- :value="tag.value"
9
- />
4
+ <Tag :eventName="eventName" :eventData="tag" :title="tag.title" :value="tag.value" />
10
5
  </div>
11
6
  </div>
12
7
  </template>
@@ -312,6 +312,10 @@ export default {
312
312
  handler(event) {
313
313
  if (event.name == "tableDragAndDrop") this.orderAll(event.data);
314
314
 
315
+ if (event.name == "stringFilter") {
316
+ this.getAll();
317
+ }
318
+
315
319
  if (event.name == "tagRemoved") {
316
320
 
317
321
  this.removeTag(event.data);