@kigi/components 1.19.0 → 1.19.2
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 +1 -1
- package/src/components/mbg-address/mbg-address.ts +15 -9
- package/src/components/mbg-multi-select/mbg-multi-select.html +10 -2
- package/src/components/mbg-multi-select/mbg-multi-select.scss +231 -150
- package/src/components/mbg-multi-select/mbg-multi-select.ts +4 -0
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.html +23 -2
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.scss +8 -0
- package/src/components/mbg-select-multi-list/mbg-select-multi-list.ts +21 -6
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ class MbgAddressController {
|
|
|
50
50
|
public $timeout,
|
|
51
51
|
public mbgAddressService: MbgAddressService,
|
|
52
52
|
public $uibModal,
|
|
53
|
-
) {
|
|
53
|
+
) {}
|
|
54
54
|
|
|
55
55
|
$onInit() {
|
|
56
56
|
if (this.capitalize && this.address) {
|
|
@@ -93,8 +93,8 @@ class MbgAddressController {
|
|
|
93
93
|
state: this.address.state
|
|
94
94
|
? this.address.state
|
|
95
95
|
: this.address.uf && this.address.uf.initial
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
? this.address.uf.initial
|
|
97
|
+
: '',
|
|
98
98
|
}
|
|
99
99
|
if (this.ngModel) {
|
|
100
100
|
this.ngModel.EX = (this.ngModel.country || '').toLowerCase() !== 'brasil'
|
|
@@ -236,11 +236,17 @@ class MbgAddressController {
|
|
|
236
236
|
|
|
237
237
|
createFullName() {
|
|
238
238
|
if (this.address.premisse) {
|
|
239
|
-
this.fullAddress = `${
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
this.fullAddress = `${
|
|
240
|
+
this.address.premisse ? this.address.premisse : this.ngModel.premisse
|
|
241
|
+
} - ${
|
|
242
|
+
this.address.neighbourhood ? this.address.neighbourhood : this.ngModel.neighbourhood
|
|
243
|
+
}, ${this.address.localization ? this.address.localization : this.ngModel.localization} - ${
|
|
244
|
+
this.ngModel.state
|
|
245
|
+
}, ${this.ngModel.country}`
|
|
243
246
|
}
|
|
247
|
+
console.log('this.address.neighbourhood', this.address.neighbourhood);
|
|
248
|
+
console.log('this.address.neighbourhood', this.ngModel.neighbourhood);
|
|
249
|
+
|
|
244
250
|
}
|
|
245
251
|
|
|
246
252
|
getPremisseType(str) {
|
|
@@ -286,8 +292,8 @@ class MbgAddressController {
|
|
|
286
292
|
countryCode: this.ngModel.countryCode,
|
|
287
293
|
zipCode: this.address.zipCode ? this.address.zipCode : this.ngModel.zipCode.replace('-', ''),
|
|
288
294
|
neighbourhood: this.address.neighbourhood
|
|
289
|
-
? this.
|
|
290
|
-
: this.
|
|
295
|
+
? this.address.neighbourhood
|
|
296
|
+
: this.ngModel.neighbourhood,
|
|
291
297
|
localization: this.ngModel.localization,
|
|
292
298
|
premisse: this.address.premisse
|
|
293
299
|
? this.address.premisse
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
<div class="mbg-multi-select-wrapper">
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
<span ng-if="$ctrl.showScrollArrows"
|
|
4
|
+
class="arrow-left"
|
|
5
|
+
ng-click="$ctrl.scrollToLeft()">
|
|
3
6
|
<i class="fas fa-chevron-circle-left"></i>
|
|
4
7
|
</span>
|
|
8
|
+
|
|
5
9
|
<div class="mbg-multi-select-scroll"
|
|
6
10
|
ng-class="{'disabled': $ctrl.ngDisabled, 'inline-mode-wrapper': $ctrl.inlineMode}">
|
|
11
|
+
|
|
7
12
|
<div class="mbg-multi-select-content">
|
|
8
13
|
<ul class="items-selected">
|
|
9
14
|
<li ng-repeat="item in $ctrl.ngModel track by $index"
|
|
@@ -37,7 +42,10 @@
|
|
|
37
42
|
label="{{ $ctrl.label }}"></mbg-select>
|
|
38
43
|
</div>
|
|
39
44
|
</div>
|
|
40
|
-
|
|
45
|
+
|
|
46
|
+
<span ng-if="$ctrl.showScrollArrows"
|
|
47
|
+
class="arrow-right"
|
|
48
|
+
ng-click="$ctrl.scrollToRight()">
|
|
41
49
|
<i class="fas fa-chevron-circle-right"></i>
|
|
42
50
|
</span>
|
|
43
51
|
</div>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
.mbg-multi-select-wrapper {
|
|
2
2
|
|
|
3
3
|
position: relative;
|
|
4
|
-
|
|
5
4
|
display: flex;
|
|
6
5
|
align-items: center;
|
|
7
6
|
|
|
@@ -24,188 +23,270 @@
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
.arrow-left {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
transform: translateX(-40px);
|
|
30
|
-
}
|
|
26
|
+
animation: left-exit .2s linear forwards ;
|
|
27
|
+
}
|
|
31
28
|
|
|
32
29
|
.arrow-right {
|
|
33
|
-
|
|
34
|
-
transition: transform .5s;
|
|
35
|
-
transform: translateX(40px);
|
|
30
|
+
animation: right-exit .2s linear forwards ;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
|
|
39
33
|
&:hover {
|
|
40
34
|
.arrow-left {
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
animation: left-enter .3s linear forwards;
|
|
36
|
+
|
|
43
37
|
}
|
|
44
38
|
.arrow-right {
|
|
45
|
-
|
|
46
|
-
transform: translateX(-8px);
|
|
39
|
+
animation: right-enter .3s linear forwards;
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
43
|
+
.mbg-multi-select-scroll {
|
|
44
|
+
border: 1px solid #ddd;
|
|
45
|
+
background: #fff;
|
|
46
|
+
border-radius: 5px;
|
|
47
|
+
padding: 8px;
|
|
48
|
+
-ms-flex: 1 1;
|
|
49
|
+
flex: 1 1;
|
|
50
|
+
outline: none;
|
|
51
|
+
width: inherit;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
height: 44px;
|
|
54
|
+
align-items: center;
|
|
55
|
+
overflow: visible;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
overflow: scroll;
|
|
58
|
+
overflow: -moz-scrollbars-none;
|
|
59
|
+
-ms-overflow-style: none;
|
|
60
|
+
scrollbar-width: none;
|
|
61
|
+
padding-top: 0;
|
|
62
|
+
padding-bottom: 0;
|
|
63
|
+
width: 100%;
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
&.inline-mode-wrapper {
|
|
66
|
+
height: auto;
|
|
67
|
+
max-height: 284px;
|
|
75
68
|
|
|
76
|
-
|
|
69
|
+
.mbg-multi-select-content {
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
width: 100%;
|
|
72
|
+
|
|
73
|
+
mbg-select {
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ul {
|
|
77
78
|
flex-direction: column;
|
|
78
79
|
width: 100%;
|
|
80
|
+
max-height: 234px;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
overflow-x: hidden;
|
|
79
83
|
|
|
80
|
-
|
|
84
|
+
li {
|
|
81
85
|
width: 100%;
|
|
82
|
-
|
|
86
|
+
margin-top: 4px;
|
|
87
|
+
position: relative;
|
|
88
|
+
min-height: 28px;
|
|
83
89
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
position: relative;
|
|
95
|
-
min-height: 28px;
|
|
96
|
-
|
|
97
|
-
svg {
|
|
98
|
-
position: absolute;
|
|
99
|
-
right: 6px;
|
|
100
|
-
}
|
|
90
|
+
svg {
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: 6px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
label {
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
padding-right: 14px;
|
|
101
100
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
word-wrap: break-word;
|
|
123
|
-
display: block;
|
|
124
|
-
color: #666;
|
|
125
|
-
font-weight: 500;
|
|
126
|
-
margin-top: -20px;
|
|
127
|
-
z-index: 100;
|
|
128
|
-
}
|
|
101
|
+
&:hover {
|
|
102
|
+
&::after {
|
|
103
|
+
content: attr(data-text);
|
|
104
|
+
overflow: visible;
|
|
105
|
+
text-overflow: inherit;
|
|
106
|
+
background: #fff;
|
|
107
|
+
position: absolute;
|
|
108
|
+
width: auto;
|
|
109
|
+
max-width: 25rem;
|
|
110
|
+
border: 1px solid #eaebec;
|
|
111
|
+
border-radius: 4px;
|
|
112
|
+
padding: 0 1rem;
|
|
113
|
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
|
114
|
+
white-space: normal;
|
|
115
|
+
word-wrap: break-word;
|
|
116
|
+
display: block;
|
|
117
|
+
color: #666;
|
|
118
|
+
font-weight: 500;
|
|
119
|
+
margin-top: -20px;
|
|
120
|
+
z-index: 100;
|
|
129
121
|
}
|
|
130
122
|
}
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
125
|
}
|
|
134
126
|
}
|
|
127
|
+
}
|
|
135
128
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
&.disabled {
|
|
130
|
+
background-color: #f5f5f5;
|
|
131
|
+
border: 1px solid #ddd !important;
|
|
132
|
+
}
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
134
|
+
&::-webkit-scrollbar {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
.mbg-multi-select-content {
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
}
|
|
141
|
+
input {
|
|
142
|
+
width: 100%;
|
|
143
|
+
border: none;
|
|
144
|
+
background-color: transparent;
|
|
145
|
+
padding: 0 0 0 10px;
|
|
146
|
+
&:focus {
|
|
147
|
+
outline: none;
|
|
148
|
+
box-shadow: none;
|
|
157
149
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
}
|
|
151
|
+
ul {
|
|
152
|
+
&.items-selected {
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
list-style: none;
|
|
156
|
+
display: flex;
|
|
157
|
+
width: fit-content;
|
|
158
|
+
min-width: fit-content;
|
|
159
|
+
li {
|
|
165
160
|
min-width: fit-content;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
background: #e6e6e6;
|
|
162
|
+
border-radius: 4px;
|
|
163
|
+
height: 28px;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
padding: 0px 5px 0px 8px;
|
|
168
|
+
color: #666;
|
|
169
|
+
margin-right: 8px;
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
width: max-content;
|
|
172
|
+
cursor: move;
|
|
173
|
+
font-weight: 500;
|
|
174
|
+
* {
|
|
175
|
+
user-select: none;
|
|
176
|
+
}
|
|
177
|
+
svg {
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
width: 14px;
|
|
180
|
+
fill: currentColor;
|
|
181
|
+
margin-left: 4px;
|
|
171
182
|
display: flex;
|
|
172
183
|
align-items: center;
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
font-weight: 500;
|
|
181
|
-
* {
|
|
182
|
-
user-select: none;
|
|
183
|
-
}
|
|
184
|
-
svg {
|
|
185
|
-
cursor: pointer;
|
|
186
|
-
width: 14px;
|
|
187
|
-
fill: currentColor;
|
|
188
|
-
margin-left: 4px;
|
|
189
|
-
display: flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
pointer-events: all;
|
|
192
|
-
}
|
|
193
|
-
&.dragging {
|
|
194
|
-
opacity: 0.6;
|
|
195
|
-
}
|
|
196
|
-
&.over {
|
|
197
|
-
background: red;
|
|
198
|
-
}
|
|
184
|
+
pointer-events: all;
|
|
185
|
+
}
|
|
186
|
+
&.dragging {
|
|
187
|
+
opacity: 0.6;
|
|
188
|
+
}
|
|
189
|
+
&.over {
|
|
190
|
+
background: red;
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
193
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
194
|
+
}
|
|
195
|
+
.mbg-select-input-fake {
|
|
196
|
+
flex: 1;
|
|
197
|
+
min-width: 191.03px;
|
|
198
|
+
border: none;
|
|
199
|
+
}
|
|
200
|
+
.mbg-select-wrapper .mbg-icon-select {
|
|
201
|
+
display: none;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@keyframes right-enter {
|
|
206
|
+
0% {
|
|
207
|
+
opacity: 0;
|
|
208
|
+
right: 0px;
|
|
209
|
+
}
|
|
210
|
+
25% {
|
|
211
|
+
right: 2px;
|
|
212
|
+
}
|
|
213
|
+
50% {
|
|
214
|
+
right: 4px;
|
|
215
|
+
}
|
|
216
|
+
75% {
|
|
217
|
+
right: 6px;
|
|
218
|
+
}
|
|
219
|
+
100% {
|
|
220
|
+
opacity: 1;
|
|
221
|
+
right: 8px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes right-exit {
|
|
226
|
+
0% {
|
|
227
|
+
opacity: 0;
|
|
228
|
+
right: 8px;
|
|
229
|
+
}
|
|
230
|
+
25% {
|
|
231
|
+
right: 6px;
|
|
232
|
+
opacity: .5;
|
|
233
|
+
}
|
|
234
|
+
50% {
|
|
235
|
+
right: 4px;
|
|
236
|
+
opacity: .3;
|
|
237
|
+
}
|
|
238
|
+
75% {
|
|
239
|
+
right: 2px;
|
|
240
|
+
opacity: .1;
|
|
241
|
+
|
|
242
|
+
}
|
|
243
|
+
100% {
|
|
244
|
+
right: 0px;
|
|
245
|
+
opacity: 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@keyframes left-enter {
|
|
250
|
+
0% {
|
|
251
|
+
opacity: 0;
|
|
252
|
+
left: 0px;
|
|
253
|
+
}
|
|
254
|
+
25% {
|
|
255
|
+
left: 2px;
|
|
256
|
+
}
|
|
257
|
+
50% {
|
|
258
|
+
left: 4px;
|
|
259
|
+
}
|
|
260
|
+
75% {
|
|
261
|
+
left: 6px;
|
|
262
|
+
}
|
|
263
|
+
100% {
|
|
264
|
+
opacity: 1;
|
|
265
|
+
left: 8px;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@keyframes left-exit {
|
|
270
|
+
0% {
|
|
271
|
+
opacity: 0;
|
|
272
|
+
left: 8px;
|
|
273
|
+
}
|
|
274
|
+
25% {
|
|
275
|
+
left: 6px;
|
|
276
|
+
opacity: .5;
|
|
277
|
+
}
|
|
278
|
+
50% {
|
|
279
|
+
left: 4px;
|
|
280
|
+
opacity: .3;
|
|
281
|
+
}
|
|
282
|
+
75% {
|
|
283
|
+
left: 2px;
|
|
284
|
+
opacity: .1;
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
100% {
|
|
288
|
+
left: 0px;
|
|
289
|
+
opacity: 0;
|
|
210
290
|
}
|
|
211
291
|
}
|
|
292
|
+
}
|
|
@@ -266,6 +266,10 @@ class MbgMultiSelectController {
|
|
|
266
266
|
this.ngModel = Array.from(this.$element.find('ul.items-selected li')).map(
|
|
267
267
|
(liElement: HTMLElement) => angular.element(liElement).scope().item,
|
|
268
268
|
)
|
|
269
|
+
|
|
270
|
+
if (this.ngChange) {
|
|
271
|
+
this.ngChange({ value: this.ngModel })
|
|
272
|
+
}
|
|
269
273
|
})
|
|
270
274
|
}
|
|
271
275
|
}
|
|
@@ -12,7 +12,15 @@
|
|
|
12
12
|
<mbg-input-search ng-model="$ctrl.inputValue"
|
|
13
13
|
placeholder="$ctrl.placeholderLeft"
|
|
14
14
|
ng-model-options="{ debounce: 300 }"
|
|
15
|
-
ng-change="$ctrl.executeFetch()"
|
|
15
|
+
ng-change="$ctrl.executeFetch()">
|
|
16
|
+
<select ng-model="$ctrl.selectOptionLeft"
|
|
17
|
+
ng-change="$ctrl.executeFetch()">
|
|
18
|
+
<option ng-repeat="option in $ctrl.selectOptions"
|
|
19
|
+
ng-value="option.key">
|
|
20
|
+
{{option.label}}
|
|
21
|
+
</option>
|
|
22
|
+
</select>
|
|
23
|
+
</mbg-input-search>
|
|
16
24
|
<div ng-if="$ctrl.listHeaderDataTransclude"
|
|
17
25
|
mbg-dynamic-html="$ctrl.listHeaderDataTransclude"></div>
|
|
18
26
|
<div class="mbg-multi-list-wrapper"
|
|
@@ -48,9 +56,22 @@
|
|
|
48
56
|
<mbg-input-search ng-model="$ctrl.inputValueResult"
|
|
49
57
|
ng-model-options="{ debounce: 300 }"
|
|
50
58
|
placeholder="$ctrl.placeholderRight"
|
|
51
|
-
ng-change="$ctrl.searchNgModel()"
|
|
59
|
+
ng-change="$ctrl.searchNgModel()">
|
|
60
|
+
<select ng-model="$ctrl.selectOptionRight"
|
|
61
|
+
ng-change="$ctrl.searchNgModel()">
|
|
62
|
+
<option ng-repeat="option in $ctrl.selectOptions"
|
|
63
|
+
ng-value="option.key">
|
|
64
|
+
{{option.label}}
|
|
65
|
+
</option>
|
|
66
|
+
</select>
|
|
67
|
+
</mbg-input-search>
|
|
52
68
|
<div ng-if="$ctrl.listHeaderResultTransclude"
|
|
53
69
|
mbg-dynamic-html="$ctrl.listHeaderResultTransclude"></div>
|
|
70
|
+
<div ng-if="$ctrl.dataModel.length <= 0">
|
|
71
|
+
<label class="mbg-label input-label message-text"
|
|
72
|
+
ng-if="$ctrl.dataModel.length <= 0">{{$ctrl.message}}
|
|
73
|
+
</label>
|
|
74
|
+
</div>
|
|
54
75
|
<div class="mbg-multi-list-wrapper result-multi-list-wrapper"
|
|
55
76
|
ng-show="$ctrl.dataModel.length > 0">
|
|
56
77
|
<div ng-if="$ctrl.listRowTransclude"
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
.mbg-select-multi-list-wrapper {
|
|
2
|
+
.message-text{
|
|
3
|
+
display: flex;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
padding-top: 102px;
|
|
7
|
+
margin-bottom: 152px;
|
|
8
|
+
}
|
|
9
|
+
|
|
2
10
|
mbg-input-search .mbg-input-search-wrapper .input-group-search {
|
|
3
11
|
border: none;
|
|
4
12
|
border-radius: 5px;
|
|
@@ -22,6 +22,10 @@ export class MbgSelectMultiListController {
|
|
|
22
22
|
private pagination
|
|
23
23
|
private order
|
|
24
24
|
private fieldOrder
|
|
25
|
+
private selectOptions
|
|
26
|
+
private selectOptionLeft
|
|
27
|
+
private selectOptionRight
|
|
28
|
+
private message
|
|
25
29
|
|
|
26
30
|
constructor(
|
|
27
31
|
public $scope,
|
|
@@ -30,9 +34,14 @@ export class MbgSelectMultiListController {
|
|
|
30
34
|
public $timeout,
|
|
31
35
|
public $compile,
|
|
32
36
|
public $transclude,
|
|
33
|
-
) {}
|
|
37
|
+
) { }
|
|
34
38
|
|
|
35
39
|
$onInit() {
|
|
40
|
+
if (this.selectOptions && !!this.selectOptions.length) {
|
|
41
|
+
this.selectOptionRight = this.selectOptions[0].key
|
|
42
|
+
this.selectOptionLeft = this.selectOptions[0].key
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
this.placeholderLeft = this.placeholderLeft || ''
|
|
37
46
|
this.placeholderRight = this.placeholderRight || ''
|
|
38
47
|
this.$scope.$c = this.$scope.$parent
|
|
@@ -87,7 +96,7 @@ export class MbgSelectMultiListController {
|
|
|
87
96
|
|
|
88
97
|
executeFetch() {
|
|
89
98
|
this.$timeout(() => {
|
|
90
|
-
this.fetch({ query: this.inputValue || '' })
|
|
99
|
+
this.fetch({ query: this.inputValue || '', selectOption: this.selectOptionLeft })
|
|
91
100
|
})
|
|
92
101
|
}
|
|
93
102
|
|
|
@@ -108,7 +117,7 @@ export class MbgSelectMultiListController {
|
|
|
108
117
|
this.dataModel.push(copyRow)
|
|
109
118
|
this.data.splice(index, 1)
|
|
110
119
|
this.$timeout(() => {
|
|
111
|
-
;(this.ngModel || []).forEach((model) => {
|
|
120
|
+
; (this.ngModel || []).forEach((model) => {
|
|
112
121
|
delete model._uid
|
|
113
122
|
})
|
|
114
123
|
}, 500)
|
|
@@ -129,10 +138,12 @@ export class MbgSelectMultiListController {
|
|
|
129
138
|
|
|
130
139
|
searchNgModel() {
|
|
131
140
|
this.$timeout(() => {
|
|
132
|
-
const search = (this.
|
|
141
|
+
const search = (this.selectOptionRight !== "all" ? this.selectOptionRight : this.label).split(',')
|
|
133
142
|
const keys = search.map((word) => word.trim())
|
|
134
143
|
const dataModel = JSON.parse(JSON.stringify(this.ngModel))
|
|
135
144
|
const options = {
|
|
145
|
+
isCaseSensitive: false,
|
|
146
|
+
includeScore: false,
|
|
136
147
|
shouldSort: true,
|
|
137
148
|
threshold: 0.3,
|
|
138
149
|
location: 0,
|
|
@@ -143,7 +154,10 @@ export class MbgSelectMultiListController {
|
|
|
143
154
|
}
|
|
144
155
|
const fuse = new Fuse(dataModel, options)
|
|
145
156
|
const result = fuse.search(this.inputValueResult)
|
|
146
|
-
this.dataModel = result.length > 0 ? result : dataModel
|
|
157
|
+
this.dataModel = result.length > 0 ? result : this.inputValueResult ? [] : dataModel
|
|
158
|
+
if (this.dataModel.length === 0) {
|
|
159
|
+
this.message = `Nenhum resultado encontrado pela pesquisa: "${this.inputValueResult}"`
|
|
160
|
+
}
|
|
147
161
|
})
|
|
148
162
|
}
|
|
149
163
|
|
|
@@ -172,7 +186,7 @@ export class MbgSelectMultiListController {
|
|
|
172
186
|
}
|
|
173
187
|
}
|
|
174
188
|
|
|
175
|
-
MbgSelectMultiListController
|
|
189
|
+
MbgSelectMultiListController['$inject'] = [
|
|
176
190
|
'$scope',
|
|
177
191
|
'$element',
|
|
178
192
|
'$attrs',
|
|
@@ -195,6 +209,7 @@ const mbgSelectMultiList = {
|
|
|
195
209
|
data: '=?',
|
|
196
210
|
isLoading: '=?',
|
|
197
211
|
pagination: '=?',
|
|
212
|
+
selectOptions: '=?',
|
|
198
213
|
},
|
|
199
214
|
template,
|
|
200
215
|
controller: MbgSelectMultiListController,
|