@nixweb/nixloc-ui 0.0.236 → 0.0.238

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.236",
3
+ "version": "0.0.238",
4
4
  "description": "Componentes UI",
5
5
  "author": "Fábio Ávila <fabio@nixweb.com.br>",
6
6
  "private": false,
@@ -2,14 +2,10 @@
2
2
  <div>
3
3
  <div>
4
4
  <b-button-group size="sm">
5
- <b-button
6
- v-for="option in options"
7
- :class="{ selected: option.title == selected }"
8
- class="btn-group"
9
- @click="execute(option)"
10
- :key="option.title"
11
- >
5
+ <b-button v-for="option in options" :class="{ selected: option.title == selected }" class="btn-group"
6
+ @click="execute(option)" :key="option.title">
12
7
  {{ option.title }}
8
+ <div v-if="option.badge" class="badge-button">{{ option.badge }}</div>
13
9
  </b-button>
14
10
  </b-button-group>
15
11
  </div>
@@ -53,7 +49,17 @@ export default {
53
49
  border-color: #e9e9e9 !important;
54
50
  outline: none !important;
55
51
  }
52
+
56
53
  .selected {
57
54
  background-color: #f5f5f5 !important;
58
55
  }
56
+
57
+ .badge-button {
58
+ width: 20px;
59
+ height: 20px;
60
+ background-color: red;
61
+ border-radius: 20px;
62
+ margin-left: 10px;
63
+ color: white;
64
+ }
59
65
  </style>
@@ -0,0 +1,171 @@
1
+ <template>
2
+ <div>
3
+ <div v-if="multiSelected">
4
+ <div class="side-by-side icon-filter" @click="show = true">
5
+ <i class="fa-solid fa-circle-plus "></i>
6
+ <span v-if="currentValueFilter.length == 0"> Todos usuários</span>
7
+ </div>
8
+ <div class="side-by-side" v-for="user in currentValueFilter">
9
+ <img class="img-current" :src="baseUrl + user.photo" alt="">
10
+ <div class="side-by-side icon-close" @click="remove(user)">
11
+ <i class="fa-solid fa-do-not-enter"></i>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ <div v-else class="div-current" @click="show = true">
16
+ <img class="img-current" :src="baseUrl + currentValue.photo" alt="">
17
+ </div>
18
+ <div v-if="show" class="main-select" @mouseleave="show = false">
19
+ <div v-for="item in data">
20
+ <div class="div-frame" @click="select(item)">
21
+ <b-row>
22
+ <b-col sm="3">
23
+ <img class="img-card" :src="baseUrl + item.photo" alt="">
24
+ </b-col>
25
+ <b-col sm="9">
26
+ <div class="title-name">{{ item.name }}</div>
27
+ </b-col>
28
+ </b-row>
29
+ </div>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ </template>
34
+ <script>
35
+
36
+ import { mapActions } from "vuex";
37
+
38
+ export default {
39
+ name: "Select",
40
+ props: {
41
+ genericId: String,
42
+ responsibleUser: Object,
43
+ multiSelected: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ title: String,
48
+ urlGet: String,
49
+ urlUpdate: String,
50
+ value: Array
51
+ },
52
+ components: {
53
+
54
+ },
55
+ data() {
56
+ return {
57
+ baseUrl: "https://espaco.blob.core.windows.net/nixloc-photo-user/",
58
+ currentValue: {},
59
+ currentValueFilter: [],
60
+ data: [],
61
+ show: false,
62
+ baseParams: {
63
+ search: "",
64
+ currentPage: 1,
65
+ totalPerPage: 20,
66
+ },
67
+ };
68
+ },
69
+ mounted() {
70
+ this.getAll();
71
+ },
72
+ methods: {
73
+ ...mapActions("generic", ["getApi", "putApi"]),
74
+ getAll() {
75
+ let obj = { ...this.baseParams };
76
+ let params = { url: this.urlGet, obj: obj };
77
+ this.loading = true;
78
+ this.getApi(params).then((response) => {
79
+ this.data = response.content.data;
80
+ });
81
+ },
82
+ updateResponsibleUser() {
83
+ let params = {
84
+ url: this.urlUpdate,
85
+ obj: { id: this.genericId, userId: this.currentValue.id },
86
+ notNotifyToast: true
87
+ };
88
+ this.putApi(params).then((response) => { });
89
+ },
90
+ select(item) {
91
+ if (!this.multiSelected) {
92
+ this.currentValue = item;
93
+ } else {
94
+ const exists = this.currentValueFilter.some(x => x.id === item.id);
95
+ if (!exists)
96
+ this.currentValueFilter.push(item);
97
+ this.$emit("input", this.currentValueFilter);
98
+ }
99
+
100
+ if (this.genericId)
101
+ this.updateResponsibleUser();
102
+
103
+ this.show = false;
104
+ },
105
+ remove(item) {
106
+ this.currentValueFilter = this.currentValueFilter.filter(x => x.id !== item.id);
107
+ }
108
+ },
109
+ watch: {
110
+ responsibleUser: {
111
+ handler(responsibleUser) {
112
+ this.currentValue = responsibleUser;
113
+ },
114
+ deep: true,
115
+ },
116
+ }
117
+ };
118
+ </script>
119
+
120
+ <style scoped>
121
+ .main-select {
122
+ position: fixed;
123
+ margin-left: 20px;
124
+ min-width: 250px;
125
+ background-color: white !important;
126
+ padding: 15px;
127
+ border: 1px solid #E8EAED;
128
+ border-radius: 10px;
129
+ cursor: pointer;
130
+ z-index: 1000 !important;
131
+ }
132
+
133
+ .div-frame:hover {
134
+ background-color: #F8F9FA !important;
135
+ border-radius: 10px;
136
+ }
137
+
138
+ .div-current {
139
+ cursor: pointer;
140
+ }
141
+
142
+ .title-name {
143
+ margin-top: 13px;
144
+ font-size: 13px;
145
+ }
146
+
147
+ .img-card {
148
+ width: 35px;
149
+ height: 35px;
150
+ margin: 5px;
151
+ border-radius: 50px;
152
+ }
153
+
154
+ .img-current {
155
+ width: 30px;
156
+ height: 30px;
157
+ border-radius: 50px;
158
+ }
159
+
160
+ .icon-filter {
161
+ font-size: 15px;
162
+ cursor: pointer;
163
+ }
164
+
165
+ .icon-close {
166
+ color: red;
167
+ font-size: 13px;
168
+ cursor: pointer;
169
+ }
170
+ </style>
171
+