@kigi/components 1.46.0-beta.6 → 1.46.0-beta.7

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.46.0-beta.6",
3
+ "version": "1.46.0-beta.7",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,74 +1,76 @@
1
1
  <div class="mbg-input-wrapper mb-input-date-wrapper"
2
2
  ng-if="$ctrl.props">
3
- <!-- only mask -->
4
- <input type="text"
5
- ng-if="!$ctrl.calendar && !$ctrl.between"
6
- ng-model="$ctrl.ngModel"
7
- ng-change="$ctrl.onChange()"
8
- placeholder="{{ $ctrl.placeholder }}"
9
- ng-required="$ctrl.ngRequired"
10
- ng-disabled="$ctrl.ngDisabled"
11
- ng-blur="$ctrl.ngBlur({ $event })"
12
- ng-focus="$ctrl.ngFocus({ $event })"
13
- ng-keyup="$ctrl.ngKeyup({ $event })"
14
- ng-keypress="$ctrl.ngKeypress({ $event })"
15
- ng-keydown="$ctrl.ngKeydown({ $event })"
16
- ui-date-mask="{{ $ctrl.format }}" />
17
- <!-- with calendar -->
18
- <input type="text"
19
- class="input-with-calendar"
20
- ng-if="$ctrl.calendar && !$ctrl.between"
21
- ng-model="$ctrl.ngModel"
22
- ng-change="$ctrl.onChange()"
23
- placeholder="{{ $ctrl.placeholder }}"
24
- ng-required="$ctrl.ngRequired"
25
- ng-disabled="$ctrl.ngDisabled"
26
- ng-blur="$ctrl.handleBlur({ $event })"
27
- ng-focus="$ctrl.handleFocus({ $event })"
28
- ng-keyup="$ctrl.ngKeyup({ $event })"
29
- ng-keypress="$ctrl.ngKeypress({ $event })"
30
- ng-keydown="$ctrl.ngKeydown({ $event })"
31
- ui-date-mask="{{ $ctrl.format }}"
32
- only-month-year="$ctrl.onlyMonthYear"
33
- ng-class="{'input-date':$ctrl.titleMode}"
34
- mbg-datepicker />
35
- <!-- between dates -->
36
- <div class="mbg-date-between"
37
- ng-if="$ctrl.between">
38
- <input type="text"
39
- class="mbg-date-between-start"
40
- ng-model="$ctrl.ngModel.start"
41
- ng-change="$ctrl.onChange()"
42
- placeholder="{{ $ctrl.props.placeholderStart }}"
43
- ng-required="$ctrl.ngRequired"
44
- ng-disabled="$ctrl.ngDisabled"
45
- ng-blur="$ctrl.handleBlur({ $event })"
46
- ng-focus="$ctrl.handleFocus({ $event })"
47
- ng-keyup="$ctrl.ngKeyup({ $event })"
48
- ng-keypress="$ctrl.ngKeypress({ $event })"
49
- ng-keydown="$ctrl.ngKeydown({ $event })"
50
- ui-date-mask="{{ $ctrl.format }}"
51
- on-select="$ctrl.onSelectStart()"
52
- only-month-year="$ctrl.onlyMonthYear"
53
- mbg-datepicker />
54
- <div class="mbg-date-between-space">
55
- {{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
56
- </div>
57
- <input type="text"
58
- class="mbg-date-between-end"
59
- ng-model="$ctrl.ngModel.end"
60
- ng-change="$ctrl.onChangeEndDate()"
61
- placeholder="{{ $ctrl.props.placeholderEnd }}"
62
- ng-required="$ctrl.ngRequired"
63
- ng-disabled="$ctrl.ngDisabled"
64
- ng-blur="$ctrl.handleBlur({ $event })"
65
- ng-focus="$ctrl.handleFocus({ $event })"
66
- ng-keyup="$ctrl.ngKeyup({ $event })"
67
- ng-keypress="$ctrl.ngKeypress({ $event })"
68
- ng-keydown="$ctrl.ngKeydown({ $event })"
69
- ui-date-mask="{{ $ctrl.format }}"
70
- on-select="$ctrl.onSelectEnd()"
71
- only-month-year="$ctrl.onlyMonthYear"
72
- mbg-datepicker />
73
- </div>
3
+ <!-- only mask -->
4
+ <input type="text"
5
+ ng-if="!$ctrl.calendar && !$ctrl.between"
6
+ ng-model="$ctrl.ngModel"
7
+ ng-change="$ctrl.onChange()"
8
+ placeholder="{{ $ctrl.placeholder }}"
9
+ ng-required="$ctrl.ngRequired"
10
+ ng-disabled="$ctrl.ngDisabled"
11
+ ng-blur="$ctrl.ngBlur({ $event })"
12
+ ng-focus="$ctrl.ngFocus({ $event })"
13
+ ng-keyup="$ctrl.ngKeyup({ $event })"
14
+ ng-keypress="$ctrl.ngKeypress({ $event })"
15
+ ng-keydown="$ctrl.ngKeydown({ $event })"
16
+ ui-date-mask="{{ $ctrl.format }}" />
17
+ <label class="labelDayOfWeek"
18
+ ng-if="$ctrl.nameOfTheDay">{{$ctrl.changeDay()}}</label>
19
+ <!-- with calendar -->
20
+ <input type="text"
21
+ class="input-with-calendar"
22
+ ng-if="$ctrl.calendar && !$ctrl.between"
23
+ ng-model="$ctrl.ngModel"
24
+ ng-change="$ctrl.onChange()"
25
+ placeholder="{{ $ctrl.placeholder }}"
26
+ ng-required="$ctrl.ngRequired"
27
+ ng-disabled="$ctrl.ngDisabled"
28
+ ng-blur="$ctrl.handleBlur({ $event })"
29
+ ng-focus="$ctrl.handleFocus({ $event })"
30
+ ng-keyup="$ctrl.ngKeyup({ $event })"
31
+ ng-keypress="$ctrl.ngKeypress({ $event })"
32
+ ng-keydown="$ctrl.ngKeydown({ $event })"
33
+ ui-date-mask="{{ $ctrl.format }}"
34
+ only-month-year="$ctrl.onlyMonthYear"
35
+ ng-class="{'input-date':$ctrl.titleMode}"
36
+ mbg-datepicker />
37
+ <!-- between dates -->
38
+ <div class="mbg-date-between"
39
+ ng-if="$ctrl.between">
40
+ <input type="text"
41
+ class="mbg-date-between-start"
42
+ ng-model="$ctrl.ngModel.start"
43
+ ng-change="$ctrl.onChange()"
44
+ placeholder="{{ $ctrl.props.placeholderStart }}"
45
+ ng-required="$ctrl.ngRequired"
46
+ ng-disabled="$ctrl.ngDisabled"
47
+ ng-blur="$ctrl.handleBlur({ $event })"
48
+ ng-focus="$ctrl.handleFocus({ $event })"
49
+ ng-keyup="$ctrl.ngKeyup({ $event })"
50
+ ng-keypress="$ctrl.ngKeypress({ $event })"
51
+ ng-keydown="$ctrl.ngKeydown({ $event })"
52
+ ui-date-mask="{{ $ctrl.format }}"
53
+ on-select="$ctrl.onSelectStart()"
54
+ only-month-year="$ctrl.onlyMonthYear"
55
+ mbg-datepicker />
56
+ <div class="mbg-date-between-space">
57
+ {{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
58
+ </div>
59
+ <input type="text"
60
+ class="mbg-date-between-end"
61
+ ng-model="$ctrl.ngModel.end"
62
+ ng-change="$ctrl.onChangeEndDate()"
63
+ placeholder="{{ $ctrl.props.placeholderEnd }}"
64
+ ng-required="$ctrl.ngRequired"
65
+ ng-disabled="$ctrl.ngDisabled"
66
+ ng-blur="$ctrl.handleBlur({ $event })"
67
+ ng-focus="$ctrl.handleFocus({ $event })"
68
+ ng-keyup="$ctrl.ngKeyup({ $event })"
69
+ ng-keypress="$ctrl.ngKeypress({ $event })"
70
+ ng-keydown="$ctrl.ngKeydown({ $event })"
71
+ ui-date-mask="{{ $ctrl.format }}"
72
+ on-select="$ctrl.onSelectEnd()"
73
+ only-month-year="$ctrl.onlyMonthYear"
74
+ mbg-datepicker />
75
+ </div>
74
76
  </div>
@@ -7,6 +7,13 @@
7
7
  input {
8
8
  width: 100%;
9
9
  }
10
+ .labelDayOfWeek{
11
+ margin-left: 4px;
12
+ margin-top: 4px;
13
+ padding: 6px;
14
+ width: 116px;
15
+ word-break: break-word;
16
+ }
10
17
  .mbg-date-between {
11
18
  display: flex;
12
19
  width: 100%;
@@ -17,7 +17,7 @@ class MbgInputDateController {
17
17
  public betweenText: string
18
18
  public filterDate: Function
19
19
  public onlyMonthYear: boolean
20
-
20
+ private nameOfTheDay
21
21
 
22
22
  constructor(public $scope, public $element, public $attrs, public $timeout) {
23
23
  if ($attrs.ngRequired === '') {
@@ -47,6 +47,10 @@ class MbgInputDateController {
47
47
  }
48
48
  }
49
49
 
50
+ changeDay() {
51
+ return new Intl.DateTimeFormat('pt-BR', { weekday: 'long' }).format(this.ngModel)
52
+ }
53
+
50
54
  onChange() {
51
55
  if (this.ngChange) {
52
56
  this.ngChange({})
@@ -133,6 +137,7 @@ const mbgInputDate = {
133
137
  filterDate: '&?',
134
138
  onlyMonthYear: '=?',
135
139
  titleMode: '=?',
140
+ nameOfTheDay: '=?',
136
141
  },
137
142
  template,
138
143
  controller: MbgInputDateController,
@@ -20,6 +20,7 @@ class MbgInputPasswordController {
20
20
  }
21
21
  }
22
22
  onChange() {
23
+ console.log('this.ngChange', this.ngChange)
23
24
  if (this.ngChange) {
24
25
  this.ngChange({})
25
26
  }
@@ -48,6 +48,9 @@ class MbgSelectController {
48
48
  private executeAfterOnInit: Function
49
49
  private mountValue
50
50
  private strMountValue
51
+ private callBackFavorite: Function
52
+ private favoriteModel
53
+ private productKitList: boolean
51
54
 
52
55
  constructor(
53
56
  public $scope,
@@ -242,15 +245,23 @@ class MbgSelectController {
242
245
  }
243
246
  }
244
247
 
245
- onInputBlur() {
248
+ onInputBlur(viewFavorite) {
246
249
  this.$timeout(() => {
247
250
  this.hasFocus = false
248
251
  this.data = []
249
252
  this.checkPosition()
250
- if (!this.ngModel && this.cacheNgModel) {
253
+ if (!viewFavorite) {
254
+ this.favoriteModel = null
255
+ }
256
+
257
+ if (!this.ngModel && this.cacheNgModel && !this.favoriteModel) {
258
+ this.ngModel = this.cacheNgModel
259
+ } else if (this.favoriteModel && this.favoriteModel.key) {
260
+ this.cacheNgModel = this.favoriteModel.key
251
261
  this.ngModel = this.cacheNgModel
252
262
  }
253
263
  })
264
+
254
265
  if (this.ngBlur) {
255
266
  this.ngBlur()
256
267
  }
@@ -419,6 +430,7 @@ class MbgSelectController {
419
430
  } else {
420
431
  await this.updateModelValue(this.inputValue)
421
432
  }
433
+
422
434
  this.executeCallback()
423
435
  if (this.onSelect) {
424
436
  this.onSelect({ value: this.ngModel })
@@ -598,7 +610,7 @@ class MbgSelectController {
598
610
  }
599
611
  if (!this.ngModel) {
600
612
  delete this.inputValue
601
- delete this.inputNgValue
613
+ this.inputNgValue = ''
602
614
  }
603
615
  }
604
616
  }
@@ -610,15 +622,34 @@ class MbgSelectController {
610
622
  }
611
623
 
612
624
  checkFavorite() {
613
- let favorite
625
+ let favorite = null
614
626
  this.$timeout(() => {
615
627
  favorite = MbgCookie.get(this.getFavoriteKey())
616
628
  if (favorite && this.enableFavorite && !this.ngModel) {
617
629
  this.selectOption(favorite)
630
+
631
+ if (this.callBackFavorite) {
632
+ this.callBackFavorite({ value: favorite })
633
+ }
634
+
618
635
  if (this.executeAfterOnInit) {
619
636
  this.executeAfterOnInit()
620
637
  }
621
638
  }
639
+ if (this.callBackFavorite) {
640
+ this.callBackFavorite({ value: favorite })
641
+ }
642
+ }, 300)
643
+ }
644
+
645
+ getCheckFavoriteModel(viewFavorite) {
646
+ this.$timeout(() => {
647
+ if (!this.productKitList) return
648
+ this.favoriteModel = MbgCookie.get(this.getFavoriteKey())
649
+ if (this.callBackFavorite && this.favoriteModel) {
650
+ this.callBackFavorite({ value: this.favoriteModel })
651
+ }
652
+ this.onInputBlur(viewFavorite)
622
653
  }, 300)
623
654
  }
624
655
 
@@ -640,6 +671,7 @@ class MbgSelectController {
640
671
  }
641
672
  } else {
642
673
  MbgCookie.set(this.getFavoriteKey(), item)
674
+ this.getCheckFavoriteModel(true)
643
675
  }
644
676
  }
645
677
 
@@ -683,7 +715,7 @@ class MbgSelectController {
683
715
  }
684
716
  }
685
717
 
686
- MbgSelectController.$inject = [
718
+ MbgSelectController['$inject'] = [
687
719
  '$scope',
688
720
  '$element',
689
721
  '$attrs',
@@ -717,6 +749,8 @@ const mbgSelect = {
717
749
  manyFavorite: '=?',
718
750
  executeAfterOnInit: '&?',
719
751
  mountValue: '&?',
752
+ callBackFavorite: '&?',
753
+ productKitList: '=?',
720
754
  },
721
755
  controller: MbgSelectController,
722
756
  template,