@kigi/components 1.11.2 → 1.11.3-beta.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.11.2",
3
+ "version": "1.11.3-beta.2",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -8,13 +8,7 @@ class MbgInputNumberController {
8
8
  private ngDisabled
9
9
  private props
10
10
 
11
- constructor(
12
- public $scope,
13
- public $element,
14
- public $attrs,
15
- public $compile,
16
- public $timeout
17
- ) { }
11
+ constructor(public $scope, public $element, public $attrs, public $compile, public $timeout) {}
18
12
 
19
13
  $onInit() {
20
14
  this.$timeout(() => {
@@ -28,7 +22,7 @@ class MbgInputNumberController {
28
22
  placeholder: this.$attrs.placeholder || '',
29
23
  precision: this.$attrs.precision || 0,
30
24
  allowNegative: this.$attrs.allowNegative ? JSON.parse(this.$attrs.allowNegative) : false,
31
- uiHideGroupSep: typeof this.$attrs.uiHideGroupSep !== undefined ? true : undefined
25
+ uiHideGroupSep: typeof this.$attrs.uiHideGroupSep !== undefined ? true : undefined,
32
26
  }
33
27
  if (this.$attrs.min) {
34
28
  this.props.min = this.$attrs.min
@@ -53,19 +47,12 @@ class MbgInputNumberController {
53
47
 
54
48
  onChange() {
55
49
  if (this.ngChange) {
56
- this.ngChange({})
50
+ this.ngChange({ newCount: this.ngModel })
57
51
  }
58
52
  }
59
-
60
53
  }
61
54
 
62
- MbgInputNumberController.$inject = [
63
- '$scope',
64
- '$element',
65
- '$attrs',
66
- '$compile',
67
- '$timeout'
68
- ]
55
+ MbgInputNumberController.$inject = ['$scope', '$element', '$attrs', '$compile', '$timeout']
69
56
 
70
57
  const mbgInputNumber = {
71
58
  bindings: {
@@ -76,7 +63,7 @@ const mbgInputNumber = {
76
63
  ngBlur: '&?',
77
64
  ngFocus: '&?',
78
65
  positive: '=?',
79
- ngModelOptions: '=?'
66
+ ngModelOptions: '=?',
80
67
  },
81
68
  template,
82
69
  controller: MbgInputNumberController,
@@ -6,7 +6,8 @@
6
6
  <span ng-show="$ctrl.placeholder && !$ctrl.ngModel"
7
7
  class="place">{{ $ctrl.placeholder }}</span>
8
8
  <span ng-show="$ctrl.ngModel"
9
- class="mbg-select-value">{{ $ctrl.labelValue ? $ctrl.ngValue ? $ctrl.inputNgValue :
9
+ class="mbg-select-value">{{ $ctrl.strMountValue ? $ctrl.strMountValue : $ctrl.labelValue ? $ctrl.ngValue ?
10
+ $ctrl.inputNgValue :
10
11
  $ctrl.ngModel[$ctrl.labelValue] : $ctrl.ngModel }}</span>
11
12
  </div>
12
13
  <!-- <mbg-input-text ng-model="$ctrl.inputValue"
@@ -45,6 +45,9 @@ class MbgSelectController {
45
45
  private getCustomModel: Function
46
46
  private capitalize
47
47
  private manyFavorite: boolean
48
+ private executeAfterOnInit: Function
49
+ private mountValue
50
+ private strMountValue
48
51
 
49
52
  constructor(
50
53
  public $scope,
@@ -568,25 +571,29 @@ class MbgSelectController {
568
571
 
569
572
  updateInputValue() {
570
573
  this.$timeout(() => {
571
- if (this.ngValue && this.ngModel) {
572
- this.executeFetch((data) => {
573
- const item = (data || []).find((i) => i[this.ngValue] === this.ngModel)
574
- if (item) {
575
- this.inputValue = item[this.labelValue]
576
- this.inputNgValue = item[this.labelValue]
577
- }
578
- })
574
+ if (this.mountValue) {
575
+ this.strMountValue = this.mountValue({ value: this.ngModel })
579
576
  } else {
580
- if (this.labelValue && this.ngModel) {
581
- this.inputValue = this.ngModel[this.labelValue]
577
+ if (this.ngValue && this.ngModel) {
578
+ this.executeFetch((data) => {
579
+ const item = (data || []).find((i) => i[this.ngValue] === this.ngModel)
580
+ if (item) {
581
+ this.inputValue = item[this.labelValue]
582
+ this.inputNgValue = item[this.labelValue]
583
+ }
584
+ })
582
585
  } else {
583
- if (this.ngModel) {
584
- this.inputValue = this.ngModel
586
+ if (this.labelValue && this.ngModel) {
587
+ this.inputValue = this.ngModel[this.labelValue]
588
+ } else {
589
+ if (this.ngModel) {
590
+ this.inputValue = this.ngModel
591
+ }
592
+ }
593
+ if (!this.ngModel) {
594
+ delete this.inputValue
595
+ delete this.inputNgValue
585
596
  }
586
- }
587
- if (!this.ngModel) {
588
- delete this.inputValue
589
- delete this.inputNgValue
590
597
  }
591
598
  }
592
599
  })
@@ -602,6 +609,9 @@ class MbgSelectController {
602
609
  favorite = MbgCookie.get(this.getFavoriteKey())
603
610
  if (favorite && this.enableFavorite && !this.ngModel) {
604
611
  this.selectOption(favorite)
612
+ if (this.executeAfterOnInit) {
613
+ this.executeAfterOnInit()
614
+ }
605
615
  }
606
616
  }, 300)
607
617
  }
@@ -699,6 +709,8 @@ const mbgSelect = {
699
709
  getCustomModel: '&?',
700
710
  capitalize: '=?',
701
711
  manyFavorite: '=?',
712
+ executeAfterOnInit: '&?',
713
+ mountValue: '&?',
702
714
  },
703
715
  controller: MbgSelectController,
704
716
  template,