@kigi/components 1.19.0-beta.2 → 1.19.0-beta.3

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": "@kigi/components",
3
- "version": "1.19.0-beta.2",
3
+ "version": "1.19.0-beta.3",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -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
- ? this.address.uf.initial
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,14 +236,14 @@ class MbgAddressController {
236
236
 
237
237
  createFullName() {
238
238
  if (this.address.premisse) {
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}`
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
  }
244
+ console.log('this.address.neighbourhood', this.address.neighbourhood);
245
+ console.log('this.address.neighbourhood', this.ngModel.neighbourhood);
246
+
247
247
  }
248
248
 
249
249
  getPremisseType(str) {
@@ -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()"></mbg-input-search>
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()"></mbg-input-search>
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.label || '').split(',')
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.$inject = [
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,