@kigi/components 1.48.1 → 1.49.0

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.48.1",
3
+ "version": "1.49.0",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -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
  }
@@ -610,15 +621,34 @@ class MbgSelectController {
610
621
  }
611
622
 
612
623
  checkFavorite() {
613
- let favorite
624
+ let favorite = null
614
625
  this.$timeout(() => {
615
626
  favorite = MbgCookie.get(this.getFavoriteKey())
616
627
  if (favorite && this.enableFavorite && !this.ngModel) {
617
628
  this.selectOption(favorite)
629
+
630
+ if (this.callBackFavorite) {
631
+ this.callBackFavorite({ value: favorite })
632
+ }
633
+
618
634
  if (this.executeAfterOnInit) {
619
635
  this.executeAfterOnInit()
620
636
  }
621
637
  }
638
+ if (this.callBackFavorite) {
639
+ this.callBackFavorite({ value: favorite })
640
+ }
641
+ }, 300)
642
+ }
643
+
644
+ getCheckFavoriteModel(viewFavorite) {
645
+ this.$timeout(() => {
646
+ if (!this.productKitList) return
647
+ this.favoriteModel = MbgCookie.get(this.getFavoriteKey())
648
+ if (this.callBackFavorite && this.favoriteModel) {
649
+ this.callBackFavorite({ value: this.favoriteModel })
650
+ }
651
+ this.onInputBlur(viewFavorite)
622
652
  }, 300)
623
653
  }
624
654
 
@@ -640,6 +670,7 @@ class MbgSelectController {
640
670
  }
641
671
  } else {
642
672
  MbgCookie.set(this.getFavoriteKey(), item)
673
+ this.getCheckFavoriteModel(true)
643
674
  }
644
675
  }
645
676
 
@@ -683,7 +714,7 @@ class MbgSelectController {
683
714
  }
684
715
  }
685
716
 
686
- MbgSelectController.$inject = [
717
+ MbgSelectController['$inject'] = [
687
718
  '$scope',
688
719
  '$element',
689
720
  '$attrs',
@@ -717,6 +748,8 @@ const mbgSelect = {
717
748
  manyFavorite: '=?',
718
749
  executeAfterOnInit: '&?',
719
750
  mountValue: '&?',
751
+ callBackFavorite: '&?',
752
+ productKitList: '=?',
720
753
  },
721
754
  controller: MbgSelectController,
722
755
  template,
@@ -77,7 +77,7 @@
77
77
  ng-repeat="item in $ctrl.threeMonthInterval">
78
78
  <div class="segment-item">
79
79
  <span class="rank">{{ $index + 1 }}°</span>
80
- <span class="name"
80
+ <span class="description-top-selling-name"
81
81
  ng-if="$ctrl.hideValue && !$ctrl.isBlockValuesTopSellingsProducts"
82
82
  uib-tooltip="{{ item.reference }} - {{ item.nameProduct }}"
83
83
  tooltip-placement="{{$index === 0 || $index === 1 || item.nameProduct.length > 30 ? 'bottom' :'top' }}">{{
@@ -115,7 +115,7 @@
115
115
  ng-repeat="item in $ctrl.oneYearInterval">
116
116
  <div class="segment-item">
117
117
  <span class="rank">{{ $index + 1 }}°</span>
118
- <span class="name"
118
+ <span class="description-top-selling-name"
119
119
  ng-if="$ctrl.hideValue && !$ctrl.isBlockValuesTopSellingsProducts"
120
120
  uib-tooltip="{{ item.reference }} - {{ item.nameProduct }}"
121
121
  tooltip-placement="{{$index === 0 || $index === 1 || item.nameProduct.length > 30 ? 'bottom' :'top' }}">{{
@@ -195,4 +195,4 @@
195
195
  <div class="fake-chart"
196
196
  ng-if="$ctrl.loadingChart">
197
197
  <mbg-skeleton></mbg-skeleton>
198
- </div>
198
+ </div>