@kigi/components 1.17.1-beta.4 → 1.17.1-beta.5

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.17.1-beta.4",
3
+ "version": "1.17.1-beta.5",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -1,4 +1,7 @@
1
1
  <div class="mbg-multi-select-wrapper">
2
+ <span ng-if="$ctrl.showScrollArrows" class="arrow-left visibility" ng-click="$ctrl.scrollToLeft()">
3
+ <i class="fas fa-chevron-circle-left"></i>
4
+ </span>
2
5
  <div class="mbg-multi-select-scroll"
3
6
  ng-class="{'disabled': $ctrl.ngDisabled, 'inline-mode-wrapper': $ctrl.inlineMode}">
4
7
  <div class="mbg-multi-select-content">
@@ -34,4 +37,7 @@
34
37
  label="{{ $ctrl.label }}"></mbg-select>
35
38
  </div>
36
39
  </div>
40
+ <span ng-if="$ctrl.showScrollArrows" class="arrow-right visibility" ng-click="$ctrl.scrollToRight()">
41
+ <i class="fas fa-chevron-circle-right"></i>
42
+ </span>
37
43
  </div>
@@ -1,4 +1,44 @@
1
1
  .mbg-multi-select-wrapper {
2
+
3
+ position: relative;
4
+
5
+ display: flex;
6
+ align-items: center;
7
+
8
+ .arrow-left, .arrow-right {
9
+ position: absolute;
10
+ font-size: 20px;
11
+
12
+ background: white;
13
+ overflow: hidden;
14
+ height: 20px;
15
+ border-radius: 999px;
16
+
17
+ i {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ }
22
+ }
23
+
24
+ .visibility {
25
+ display: none;
26
+ }
27
+
28
+ &:hover {
29
+ .visibility {
30
+ display: block;
31
+ }
32
+ }
33
+
34
+ .arrow-left {
35
+ left: 8px;
36
+ }
37
+
38
+ .arrow-right {
39
+ right: 8px;
40
+ }
41
+
2
42
  .mbg-multi-select-scroll {
3
43
  border: 1px solid #ddd;
4
44
  background: #fff;
@@ -20,10 +20,16 @@ class MbgMultiSelectController {
20
20
  private inlineMode: boolean
21
21
  private widthEllipsis: string
22
22
  private enableFavorite: boolean
23
+ private stepScrollSize: any
24
+ private showScrollArrows: boolean
23
25
 
24
26
  constructor(public $scope, public $element, public $attrs, public $timeout) {}
25
27
 
26
28
  $onInit() {
29
+ if (this.showScrollArrows && !this.stepScrollSize) {
30
+ this.stepScrollSize = 200
31
+ }
32
+
27
33
  this.widthEllipsis = this.widthEllipsis || '154px'
28
34
  this.$scope.$watch(
29
35
  '$ctrl.ngModel',
@@ -54,6 +60,33 @@ class MbgMultiSelectController {
54
60
  })
55
61
  }
56
62
 
63
+ scrollToLeft() {
64
+ this.$timeout(() => {
65
+ const elm: Element = angular.element(`.mbg-multi-select-scroll`)[0]
66
+ this.$timeout(() => {
67
+ const value = +elm.scrollLeft - this.stepScrollSize
68
+ elm.scroll({
69
+ left: value,
70
+ behavior: 'smooth',
71
+ })
72
+ }, 100)
73
+ })
74
+ }
75
+
76
+ scrollToRight() {
77
+ this.$timeout(() => {
78
+ const elm = angular.element(`.mbg-multi-select-scroll`)[0]
79
+
80
+ this.$timeout(() => {
81
+ const value = +elm.scrollLeft + this.stepScrollSize
82
+ elm.scroll({
83
+ left: value,
84
+ behavior: 'smooth',
85
+ })
86
+ }, 100)
87
+ })
88
+ }
89
+
57
90
  onSelect(item?) {
58
91
  this.$timeout(() => {
59
92
  const currentModel = this.searchModel || item
@@ -244,6 +277,8 @@ const mbgMultiSelect = {
244
277
  inlineMode: '=?',
245
278
  widthEllipsis: '@?',
246
279
  enableFavorite: '=?',
280
+ stepScrollSize: '=?',
281
+ showScrollArrows: '=?',
247
282
  },
248
283
  template,
249
284
  controller: MbgMultiSelectController,