@kigi/components 1.18.0 → 1.19.0-beta.1
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 +10 -12
- package/src/components/mbg-address/modals/mbg-address-manual/mbg-address-manual.html +61 -25
- package/src/components/mbg-address/modals/mbg-address-manual/mbg-address-manual.ts +9 -7
- package/src/components/mbg-multi-select/mbg-multi-select.html +10 -2
- package/src/components/mbg-multi-select/mbg-multi-select.scss +239 -150
- package/src/components/mbg-multi-select/mbg-multi-select.ts +19 -4
- package/src/components/mbg-select/mbg-select.ts +4 -2
- package/src/helpers/interfaces/confirm-alert.ts +1 -0
- package/src/helpers/modals/mbg-confirm/mbg-confirm-alert.html +1 -0
- package/src/helpers/modals/mbg-confirm/mbg-confirm-alert.scss +17 -0
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,13 +236,10 @@ class MbgAddressController {
|
|
|
236
236
|
|
|
237
237
|
createFullName() {
|
|
238
238
|
if (this.address.premisse) {
|
|
239
|
-
this.fullAddress = `${
|
|
240
|
-
this.address.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}, ${this.address.localization ? this.address.localization : this.ngModel.localization} - ${
|
|
244
|
-
this.ngModel.state
|
|
245
|
-
}, ${this.ngModel.country}`
|
|
239
|
+
this.fullAddress = `${this.address.premisse ? this.address.premisse : this.ngModel.premisse
|
|
240
|
+
} - ${this.address.neighbourhood ? this.address.neighbourhood : this.ngModel.neighbourhood
|
|
241
|
+
}, ${this.address.localization ? this.address.localization : this.ngModel.localization} - ${this.ngModel.state
|
|
242
|
+
}, ${this.ngModel.country}`
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
245
|
|
|
@@ -289,8 +286,8 @@ class MbgAddressController {
|
|
|
289
286
|
countryCode: this.ngModel.countryCode,
|
|
290
287
|
zipCode: this.address.zipCode ? this.address.zipCode : this.ngModel.zipCode.replace('-', ''),
|
|
291
288
|
neighbourhood: this.address.neighbourhood
|
|
292
|
-
? this.
|
|
293
|
-
: this.
|
|
289
|
+
? this.ngModel.neighbourhood
|
|
290
|
+
: this.address.neighbourhood,
|
|
294
291
|
localization: this.ngModel.localization,
|
|
295
292
|
premisse: this.address.premisse
|
|
296
293
|
? this.address.premisse
|
|
@@ -575,6 +572,7 @@ class MbgAddressController {
|
|
|
575
572
|
response.zipCode = response.zipCode || ''
|
|
576
573
|
this.address.country = response.country || 'Brasil'
|
|
577
574
|
this.address.premisse = response.premisse || this.address.premisse
|
|
575
|
+
this.address.neighbourhood = response.neighbourhood || 'Centro'
|
|
578
576
|
this.ngModel = response
|
|
579
577
|
if (!EX) {
|
|
580
578
|
this.$timeout(() => this.searchAddressInfo(JSON.parse(JSON.stringify(response))))
|
|
@@ -1,76 +1,112 @@
|
|
|
1
1
|
<div class="mbg-address-manual-wrapper">
|
|
2
2
|
|
|
3
3
|
<form name="manualAddress">
|
|
4
|
-
<div class="row"
|
|
4
|
+
<div class="row"
|
|
5
|
+
ng-if="$ctrl.EX">
|
|
5
6
|
<div class="col-md-6">
|
|
6
7
|
<label>País</label>
|
|
7
|
-
<mbg-select ng-model="$ctrl.entity.country"
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
<mbg-select ng-model="$ctrl.entity.country"
|
|
9
|
+
placeholder="Brasil"
|
|
10
|
+
ng-if="$ctrl.countries"
|
|
11
|
+
on-select="$ctrl.selectCountry(value)"
|
|
12
|
+
on-unselect="$ctrl.unselectCountry()"
|
|
13
|
+
label="label"
|
|
14
|
+
ng-value="label"
|
|
15
|
+
fetch="$ctrl.countries"></mbg-select>
|
|
10
16
|
</div>
|
|
11
17
|
<div class="col-md-6">
|
|
12
18
|
<label>CEP</label>
|
|
13
19
|
<div class="mbg-input-wrapper input-cep-wrapper">
|
|
14
|
-
<input type="text"
|
|
15
|
-
|
|
20
|
+
<input type="text"
|
|
21
|
+
ng-model="$ctrl.entity.zipCode"
|
|
22
|
+
ng-change="$ctrl.validateLenth($event)"
|
|
23
|
+
placeholder="99999" />
|
|
16
24
|
</div>
|
|
17
25
|
</div>
|
|
18
26
|
</div>
|
|
19
27
|
<div class="row">
|
|
20
|
-
<div class="col-md-4"
|
|
28
|
+
<div class="col-md-4"
|
|
29
|
+
ng-if="!$ctrl.EX">
|
|
21
30
|
<label>CEP</label>
|
|
22
31
|
<div class="mbg-input-wrapper input-cep-wrapper">
|
|
23
|
-
<input autocomplete="{{ $ctrl.autocompleteValue }}"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
<input autocomplete="{{ $ctrl.autocompleteValue }}"
|
|
33
|
+
autocorrect="{{ $ctrl.autocompleteValue }}"
|
|
34
|
+
ng-class="{'mbg-error': (!$ctrl.entity.zipCode && $ctrl.inputErrors) || $ctrl.notFoundCep}"
|
|
35
|
+
mbg-error="!$ctrl.entity.zipCode || $ctrl.notFoundCep"
|
|
36
|
+
mbg-error-when="$ctrl.inputErrors"
|
|
37
|
+
mbg-error-message="É necessário informar o CEP"
|
|
38
|
+
spellcheck="false"
|
|
39
|
+
type="text"
|
|
40
|
+
ng-change="$ctrl.onChangeCep()"
|
|
41
|
+
ng-model="$ctrl.entity.zipCode"
|
|
42
|
+
placeholder="99999-999"
|
|
43
|
+
ui-br-cep-mask />
|
|
28
44
|
</div>
|
|
29
45
|
</div>
|
|
30
46
|
<div ng-class="$ctrl.EX ? 'col-md-12' : 'col-md-8'">
|
|
31
|
-
<label>
|
|
32
|
-
<mbg-input-text capitalize="true"
|
|
47
|
+
<label>Logradouros</label>
|
|
48
|
+
<mbg-input-text capitalize="true"
|
|
49
|
+
ng-model="$ctrl.entity.premisse"
|
|
50
|
+
placeholder="Ex. Av Duque de Caxias">
|
|
33
51
|
</mbg-input-text>
|
|
34
52
|
</div>
|
|
35
53
|
</div>
|
|
36
54
|
<div class="row">
|
|
37
55
|
<div class="col-md-12">
|
|
38
56
|
<label>Bairro</label>
|
|
39
|
-
<mbg-input-text capitalize="true"
|
|
57
|
+
<mbg-input-text capitalize="true"
|
|
58
|
+
ng-model="$ctrl.entity.neighbourhood"
|
|
59
|
+
placeholder="Ex. Jardim América">
|
|
40
60
|
</mbg-input-text>
|
|
41
61
|
</div>
|
|
42
62
|
</div>
|
|
43
63
|
<div class="row">
|
|
44
|
-
<div class="col-md-6"
|
|
64
|
+
<div class="col-md-6"
|
|
65
|
+
ng-if="!$ctrl.EX">
|
|
45
66
|
<label>Estado</label>
|
|
46
|
-
<mbg-select capitalize="true"
|
|
47
|
-
|
|
67
|
+
<mbg-select capitalize="true"
|
|
68
|
+
ng-model="$ctrl.entity.state"
|
|
69
|
+
fetch="$ctrl.searchState(query)"
|
|
70
|
+
label="name"
|
|
71
|
+
ng-value="shortName"
|
|
72
|
+
placeholder="Ex. Paraná"></mbg-select>
|
|
48
73
|
</div>
|
|
49
|
-
<div class="col-md-6"
|
|
74
|
+
<div class="col-md-6"
|
|
75
|
+
ng-if="$ctrl.EX">
|
|
50
76
|
<label>Estado</label>
|
|
51
|
-
<mbg-input-text capitalize="true"
|
|
77
|
+
<mbg-input-text capitalize="true"
|
|
78
|
+
ng-model="$ctrl.entity.state"
|
|
79
|
+
placeholder="Ex. Maringá"></mbg-input-text>
|
|
52
80
|
</div>
|
|
53
81
|
<div class="col-md-6">
|
|
54
82
|
<label>Cidade</label>
|
|
55
|
-
<mbg-input-text capitalize="true"
|
|
83
|
+
<mbg-input-text capitalize="true"
|
|
84
|
+
ng-model="$ctrl.entity.localization"
|
|
85
|
+
placeholder="Ex. Maringá">
|
|
56
86
|
</mbg-input-text>
|
|
57
87
|
</div>
|
|
58
88
|
</div>
|
|
59
89
|
<div class="row">
|
|
60
90
|
<div class="col-md-4">
|
|
61
91
|
<label>Número</label>
|
|
62
|
-
<mbg-input-text ng-model="$ctrl.entity.number"
|
|
92
|
+
<mbg-input-text ng-model="$ctrl.entity.number"
|
|
93
|
+
placeholder="Ex. 36"></mbg-input-text>
|
|
63
94
|
</div>
|
|
64
95
|
<div class="col-md-8">
|
|
65
96
|
<label>Complemento</label>
|
|
66
|
-
<mbg-input-text capitalize="true"
|
|
97
|
+
<mbg-input-text capitalize="true"
|
|
98
|
+
ng-model="$ctrl.entity.information"
|
|
99
|
+
placeholder="Ex. Restaurante X">
|
|
67
100
|
</mbg-input-text>
|
|
68
101
|
</div>
|
|
69
102
|
</div>
|
|
70
103
|
</form>
|
|
71
104
|
|
|
72
105
|
<div class="content-confirm-upload">
|
|
73
|
-
<mbg-btn-form label="Salvar"
|
|
74
|
-
|
|
106
|
+
<mbg-btn-form label="Salvar"
|
|
107
|
+
loading="$ctrl.loading"
|
|
108
|
+
ng-click="$ctrl.finish(manualAddress.$valid)"></mbg-btn-form>
|
|
109
|
+
<a class="btn-cancel"
|
|
110
|
+
ng-click="$ctrl.dismiss()">Cancelar</a>
|
|
75
111
|
</div>
|
|
76
112
|
</div>
|
|
@@ -38,15 +38,16 @@ class MbgAddressManualController {
|
|
|
38
38
|
public EX,
|
|
39
39
|
public notFound,
|
|
40
40
|
public address,
|
|
41
|
-
) {}
|
|
41
|
+
) { }
|
|
42
42
|
|
|
43
|
-
$onInit() {
|
|
43
|
+
async $onInit() {
|
|
44
44
|
this.navigatorData = detect()
|
|
45
45
|
this.createAutocompleteDisabled()
|
|
46
|
-
this.loadStates()
|
|
46
|
+
await this.loadStates()
|
|
47
47
|
this.loadCountries()
|
|
48
48
|
if (this.address) {
|
|
49
49
|
this.entity = this.address
|
|
50
|
+
this.searchAddressByCEP()
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -116,9 +117,9 @@ class MbgAddressManualController {
|
|
|
116
117
|
this.entity = {
|
|
117
118
|
zipCode: this.entity.zipCode.replace('-', ''),
|
|
118
119
|
neighbourhood: response.data.bairro ? response.data.bairro.trim() : 'Centro',
|
|
119
|
-
localization:
|
|
120
|
-
?
|
|
121
|
-
:
|
|
120
|
+
localization: response.data.localidade
|
|
121
|
+
? (response.data.localidade || '').trim()
|
|
122
|
+
: this.entity.localization,
|
|
122
123
|
premisse: premisse || 'CEP Único',
|
|
123
124
|
number: this.entity.number || '',
|
|
124
125
|
information: this.entity.information || '',
|
|
@@ -148,8 +149,9 @@ class MbgAddressManualController {
|
|
|
148
149
|
)
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
|
|
151
153
|
loadStates = () => {
|
|
152
|
-
this.$http.get(`https://servicodados.ibge.gov.br/api/v1/localidades/estados`).then((resp) => {
|
|
154
|
+
return this.$http.get(`https://servicodados.ibge.gov.br/api/v1/localidades/estados`).then((resp) => {
|
|
153
155
|
this.states = resp.data.map((city) => {
|
|
154
156
|
return {
|
|
155
157
|
id: city.id,
|
|
@@ -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
|
|
|
@@ -9,6 +8,8 @@
|
|
|
9
8
|
position: absolute;
|
|
10
9
|
font-size: 20px;
|
|
11
10
|
|
|
11
|
+
z-index: 10;
|
|
12
|
+
|
|
12
13
|
background: white;
|
|
13
14
|
overflow: hidden;
|
|
14
15
|
height: 20px;
|
|
@@ -21,183 +22,271 @@
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.visibility {
|
|
25
|
-
display: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
&:hover {
|
|
29
|
-
.visibility {
|
|
30
|
-
display: block;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
25
|
.arrow-left {
|
|
35
|
-
|
|
26
|
+
animation: left-exit .2s linear forwards ;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
29
|
.arrow-right {
|
|
39
|
-
|
|
30
|
+
animation: right-exit .2s linear forwards ;
|
|
40
31
|
}
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
33
|
+
&:hover {
|
|
34
|
+
.arrow-left {
|
|
35
|
+
animation: left-enter .3s linear forwards;
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
.arrow-right {
|
|
39
|
+
animation: right-enter .3s linear forwards;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
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%;
|
|
64
|
+
|
|
65
|
+
&.inline-mode-wrapper {
|
|
66
|
+
height: auto;
|
|
67
|
+
max-height: 284px;
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
.mbg-multi-select-content {
|
|
70
|
+
flex-direction: column;
|
|
71
|
+
width: 100%;
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
mbg-select {
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
ul {
|
|
69
78
|
flex-direction: column;
|
|
70
79
|
width: 100%;
|
|
80
|
+
max-height: 234px;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
overflow-x: hidden;
|
|
71
83
|
|
|
72
|
-
|
|
84
|
+
li {
|
|
73
85
|
width: 100%;
|
|
74
|
-
|
|
86
|
+
margin-top: 4px;
|
|
87
|
+
position: relative;
|
|
88
|
+
min-height: 28px;
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
position: relative;
|
|
87
|
-
min-height: 28px;
|
|
88
|
-
|
|
89
|
-
svg {
|
|
90
|
-
position: absolute;
|
|
91
|
-
right: 6px;
|
|
92
|
-
}
|
|
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;
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
word-wrap: break-word;
|
|
115
|
-
display: block;
|
|
116
|
-
color: #666;
|
|
117
|
-
font-weight: 500;
|
|
118
|
-
margin-top: -20px;
|
|
119
|
-
z-index: 100;
|
|
120
|
-
}
|
|
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;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
+
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
&.disabled {
|
|
130
|
+
background-color: #f5f5f5;
|
|
131
|
+
border: 1px solid #ddd !important;
|
|
132
|
+
}
|
|
132
133
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
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;
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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 {
|
|
157
160
|
min-width: fit-content;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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;
|
|
163
182
|
display: flex;
|
|
164
183
|
align-items: center;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
font-weight: 500;
|
|
173
|
-
* {
|
|
174
|
-
user-select: none;
|
|
175
|
-
}
|
|
176
|
-
svg {
|
|
177
|
-
cursor: pointer;
|
|
178
|
-
width: 14px;
|
|
179
|
-
fill: currentColor;
|
|
180
|
-
margin-left: 4px;
|
|
181
|
-
display: flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
pointer-events: all;
|
|
184
|
-
}
|
|
185
|
-
&.dragging {
|
|
186
|
-
opacity: 0.6;
|
|
187
|
-
}
|
|
188
|
-
&.over {
|
|
189
|
-
background: red;
|
|
190
|
-
}
|
|
184
|
+
pointer-events: all;
|
|
185
|
+
}
|
|
186
|
+
&.dragging {
|
|
187
|
+
opacity: 0.6;
|
|
188
|
+
}
|
|
189
|
+
&.over {
|
|
190
|
+
background: red;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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;
|
|
202
290
|
}
|
|
203
291
|
}
|
|
292
|
+
}
|
|
@@ -22,6 +22,8 @@ class MbgMultiSelectController {
|
|
|
22
22
|
private enableFavorite: boolean
|
|
23
23
|
private stepScrollSize: any
|
|
24
24
|
private showScrollArrows: boolean
|
|
25
|
+
private onRemoveItem: Function
|
|
26
|
+
private index
|
|
25
27
|
|
|
26
28
|
constructor(public $scope, public $element, public $attrs, public $timeout) {}
|
|
27
29
|
|
|
@@ -30,6 +32,8 @@ class MbgMultiSelectController {
|
|
|
30
32
|
this.stepScrollSize = 200
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
this.index = this.index || 0
|
|
36
|
+
|
|
33
37
|
this.widthEllipsis = this.widthEllipsis || '154px'
|
|
34
38
|
this.$scope.$watch(
|
|
35
39
|
'$ctrl.ngModel',
|
|
@@ -53,7 +57,7 @@ class MbgMultiSelectController {
|
|
|
53
57
|
|
|
54
58
|
verifyScroll() {
|
|
55
59
|
this.$timeout(() => {
|
|
56
|
-
const elm = angular.element(`.mbg-multi-select-scroll`)[
|
|
60
|
+
const elm = angular.element(`.mbg-multi-select-scroll`)[this.index]
|
|
57
61
|
this.$timeout(() => {
|
|
58
62
|
ScrollAnimate.scrollLeftTo(elm, elm.scrollWidth, 350)
|
|
59
63
|
}, 100)
|
|
@@ -62,7 +66,7 @@ class MbgMultiSelectController {
|
|
|
62
66
|
|
|
63
67
|
scrollToLeft() {
|
|
64
68
|
this.$timeout(() => {
|
|
65
|
-
const elm: Element = angular.element(`.mbg-multi-select-scroll`)[
|
|
69
|
+
const elm: Element = angular.element(`.mbg-multi-select-scroll`)[this.index]
|
|
66
70
|
this.$timeout(() => {
|
|
67
71
|
const value = +elm.scrollLeft - this.stepScrollSize
|
|
68
72
|
elm.scroll({
|
|
@@ -75,8 +79,7 @@ class MbgMultiSelectController {
|
|
|
75
79
|
|
|
76
80
|
scrollToRight() {
|
|
77
81
|
this.$timeout(() => {
|
|
78
|
-
const elm = angular.element(`.mbg-multi-select-scroll`)[
|
|
79
|
-
|
|
82
|
+
const elm = angular.element(`.mbg-multi-select-scroll`)[this.index]
|
|
80
83
|
this.$timeout(() => {
|
|
81
84
|
const value = +elm.scrollLeft + this.stepScrollSize
|
|
82
85
|
elm.scroll({
|
|
@@ -119,6 +122,8 @@ class MbgMultiSelectController {
|
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
remoteItem(index) {
|
|
125
|
+
const item = this.ngModel[index]
|
|
126
|
+
|
|
122
127
|
this.ngModel.splice(index, 1)
|
|
123
128
|
this.verifyScroll()
|
|
124
129
|
this.$timeout(() => {
|
|
@@ -126,6 +131,10 @@ class MbgMultiSelectController {
|
|
|
126
131
|
this.ngChange()
|
|
127
132
|
}
|
|
128
133
|
})
|
|
134
|
+
|
|
135
|
+
if (this.onRemoveItem) {
|
|
136
|
+
this.onRemoveItem({ item, index })
|
|
137
|
+
}
|
|
129
138
|
}
|
|
130
139
|
|
|
131
140
|
stopDragEvents() {
|
|
@@ -257,6 +266,10 @@ class MbgMultiSelectController {
|
|
|
257
266
|
this.ngModel = Array.from(this.$element.find('ul.items-selected li')).map(
|
|
258
267
|
(liElement: HTMLElement) => angular.element(liElement).scope().item,
|
|
259
268
|
)
|
|
269
|
+
|
|
270
|
+
if (this.ngChange) {
|
|
271
|
+
this.ngChange({ value: this.ngModel })
|
|
272
|
+
}
|
|
260
273
|
})
|
|
261
274
|
}
|
|
262
275
|
}
|
|
@@ -279,6 +292,8 @@ const mbgMultiSelect = {
|
|
|
279
292
|
enableFavorite: '=?',
|
|
280
293
|
stepScrollSize: '=?',
|
|
281
294
|
showScrollArrows: '=?',
|
|
295
|
+
onRemoveItem: '&?',
|
|
296
|
+
index: '=?',
|
|
282
297
|
},
|
|
283
298
|
template,
|
|
284
299
|
controller: MbgMultiSelectController,
|
|
@@ -56,7 +56,7 @@ class MbgSelectController {
|
|
|
56
56
|
public $timeout,
|
|
57
57
|
public $compile,
|
|
58
58
|
public $transclude,
|
|
59
|
-
) {}
|
|
59
|
+
) { }
|
|
60
60
|
|
|
61
61
|
$onInit() {
|
|
62
62
|
this.fixedValue = this.ngValue || 'id'
|
|
@@ -409,7 +409,8 @@ class MbgSelectController {
|
|
|
409
409
|
item = isNaN(this.inputValue) ? this.inputValue : Number(this.inputValue)
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
|
|
412
|
+
this.selectOption(item)
|
|
413
|
+
return
|
|
413
414
|
}
|
|
414
415
|
} else {
|
|
415
416
|
await this.updateModelValue(this.inputValue)
|
|
@@ -458,6 +459,7 @@ class MbgSelectController {
|
|
|
458
459
|
value &&
|
|
459
460
|
(!angular.equals(value, this.ngModel) || !angular.equals(value, this.inputValue))
|
|
460
461
|
) {
|
|
462
|
+
this.inputValue = ''
|
|
461
463
|
this.updateInputValue()
|
|
462
464
|
}
|
|
463
465
|
}
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
</svg>
|
|
57
57
|
</div>
|
|
58
58
|
<div class="information-wrapper">
|
|
59
|
+
<button ng-if="$ctrl.config.showCloseButton" class="close-button" ng-click="$ctrl.dismiss()">x</button>
|
|
59
60
|
<h3>{{$ctrl.config.title}}</h3>
|
|
60
61
|
<p ng-if="$ctrl.config.message"
|
|
61
62
|
class="message">{{$ctrl.config.message}}</p>
|
|
@@ -57,6 +57,23 @@
|
|
|
57
57
|
text-align: center;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
.close-button {
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 10px;
|
|
64
|
+
right: 10px;
|
|
65
|
+
|
|
66
|
+
border: none;
|
|
67
|
+
background-color: transparent;
|
|
68
|
+
font-weight: bold;
|
|
69
|
+
color: var(--neutral2);
|
|
70
|
+
border-radius: 999px;
|
|
71
|
+
transition:all .500ms ease-in-out;
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
box-shadow:1px 1px 5px var(--neutral2);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
60
77
|
}
|
|
61
78
|
|
|
62
79
|
.mbg-alert-icon {
|