@kigi/components 1.11.5 → 1.14.0-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.5",
3
+ "version": "1.14.0-beta.2",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -97,4 +97,4 @@
97
97
  "webpack": "^2.5.1",
98
98
  "webpack-dev-server": "^2.6.1"
99
99
  }
100
- }
100
+ }
@@ -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"
@@ -46,6 +46,8 @@ class MbgSelectController {
46
46
  private capitalize
47
47
  private manyFavorite: boolean
48
48
  private executeAfterOnInit: Function
49
+ private mountValue
50
+ private strMountValue
49
51
 
50
52
  constructor(
51
53
  public $scope,
@@ -569,25 +571,29 @@ class MbgSelectController {
569
571
 
570
572
  updateInputValue() {
571
573
  this.$timeout(() => {
572
- if (this.ngValue && this.ngModel) {
573
- this.executeFetch((data) => {
574
- const item = (data || []).find((i) => i[this.ngValue] === this.ngModel)
575
- if (item) {
576
- this.inputValue = item[this.labelValue]
577
- this.inputNgValue = item[this.labelValue]
578
- }
579
- })
574
+ if (this.mountValue) {
575
+ this.strMountValue = this.mountValue({ value: this.ngModel })
580
576
  } else {
581
- if (this.labelValue && this.ngModel) {
582
- 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
+ })
583
585
  } else {
584
- if (this.ngModel) {
585
- 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
586
596
  }
587
- }
588
- if (!this.ngModel) {
589
- delete this.inputValue
590
- delete this.inputNgValue
591
597
  }
592
598
  }
593
599
  })
@@ -704,6 +710,7 @@ const mbgSelect = {
704
710
  capitalize: '=?',
705
711
  manyFavorite: '=?',
706
712
  executeAfterOnInit: '&?',
713
+ mountValue: '&?',
707
714
  },
708
715
  controller: MbgSelectController,
709
716
  template,