@kigi/components 1.27.9-alpha → 1.28.0-alpha

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.27.9-alpha",
3
+ "version": "1.28.0-alpha",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -8,4 +8,4 @@
8
8
  <span ng-if="$ctrl.loading || $ctrl.virtualDisable"
9
9
  class="mbg-btn-loading"></span>
10
10
  </button>
11
- </div>
11
+ </div>
@@ -23,7 +23,7 @@ class MbgBtnFormController {
23
23
  }
24
24
  }
25
25
  }
26
- MbgBtnFormController.$inject = ['$scope', '$element', '$attrs', '$timeout']
26
+ MbgBtnFormController['$inject'] = ['$scope', '$element', '$attrs', '$timeout']
27
27
 
28
28
  const mbgBtnForm = {
29
29
  bindings: {
@@ -1,73 +1,73 @@
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
- mbg-datepicker />
34
- <!-- between dates -->
35
- <div class="mbg-date-between"
36
- ng-if="$ctrl.between">
37
- <input type="text"
38
- class="mbg-date-between-start"
39
- ng-model="$ctrl.ngModel.start"
40
- ng-change="$ctrl.onChange()"
41
- placeholder="{{ $ctrl.props.placeholderStart }}"
42
- ng-required="$ctrl.ngRequired"
43
- ng-disabled="$ctrl.ngDisabled"
44
- ng-blur="$ctrl.handleBlur({ $event })"
45
- ng-focus="$ctrl.handleFocus({ $event })"
46
- ng-keyup="$ctrl.ngKeyup({ $event })"
47
- ng-keypress="$ctrl.ngKeypress({ $event })"
48
- ng-keydown="$ctrl.ngKeydown({ $event })"
49
- ui-date-mask="{{ $ctrl.format }}"
50
- on-select="$ctrl.onSelectStart()"
51
- only-month-year="$ctrl.onlyMonthYear"
52
- mbg-datepicker />
53
- <div class="mbg-date-between-space">
54
- {{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
55
- </div>
56
- <input type="text"
57
- class="mbg-date-between-end"
58
- ng-model="$ctrl.ngModel.end"
59
- ng-change="$ctrl.onChangeEndDate()"
60
- placeholder="{{ $ctrl.props.placeholderEnd }}"
61
- ng-required="$ctrl.ngRequired"
62
- ng-disabled="$ctrl.ngDisabled"
63
- ng-blur="$ctrl.handleBlur({ $event })"
64
- ng-focus="$ctrl.handleFocus({ $event })"
65
- ng-keyup="$ctrl.ngKeyup({ $event })"
66
- ng-keypress="$ctrl.ngKeypress({ $event })"
67
- ng-keydown="$ctrl.ngKeydown({ $event })"
68
- ui-date-mask="{{ $ctrl.format }}"
69
- on-select="$ctrl.onSelectEnd()"
70
- only-month-year="$ctrl.onlyMonthYear"
71
- mbg-datepicker />
72
- </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
+ <!-- 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
+ mbg-datepicker />
34
+ <!-- between dates -->
35
+ <div class="mbg-date-between"
36
+ ng-if="$ctrl.between">
37
+ <input type="text"
38
+ class="mbg-date-between-start"
39
+ ng-model="$ctrl.ngModel.start"
40
+ ng-change="$ctrl.onChange()"
41
+ placeholder="{{ $ctrl.props.placeholderStart }}"
42
+ ng-required="$ctrl.ngRequired"
43
+ ng-disabled="$ctrl.ngDisabled"
44
+ ng-blur="$ctrl.handleBlur({ $event })"
45
+ ng-focus="$ctrl.handleFocus({ $event })"
46
+ ng-keyup="$ctrl.ngKeyup({ $event })"
47
+ ng-keypress="$ctrl.ngKeypress({ $event })"
48
+ ng-keydown="$ctrl.ngKeydown({ $event })"
49
+ ui-date-mask="{{ $ctrl.format }}"
50
+ on-select="$ctrl.onSelectStart()"
51
+ only-month-year="$ctrl.onlyMonthYear"
52
+ mbg-datepicker />
53
+ <div class="mbg-date-between-space">
54
+ {{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
55
+ </div>
56
+ <input type="text"
57
+ class="mbg-date-between-end"
58
+ ng-model="$ctrl.ngModel.end"
59
+ ng-change="$ctrl.onChangeEndDate()"
60
+ placeholder="{{ $ctrl.props.placeholderEnd }}"
61
+ ng-required="$ctrl.ngRequired"
62
+ ng-disabled="$ctrl.ngDisabled"
63
+ ng-blur="$ctrl.handleBlur({ $event })"
64
+ ng-focus="$ctrl.handleFocus({ $event })"
65
+ ng-keyup="$ctrl.ngKeyup({ $event })"
66
+ ng-keypress="$ctrl.ngKeypress({ $event })"
67
+ ng-keydown="$ctrl.ngKeydown({ $event })"
68
+ ui-date-mask="{{ $ctrl.format }}"
69
+ on-select="$ctrl.onSelectEnd()"
70
+ only-month-year="$ctrl.onlyMonthYear"
71
+ mbg-datepicker />
72
+ </div>
73
73
  </div>
@@ -13,6 +13,10 @@
13
13
  }
14
14
  }
15
15
 
16
+ .mbg-input-wrapper {
17
+ display: block;
18
+ }
19
+
16
20
  body {
17
21
  .datepicker-top-left, .datepicker-top-right {
18
22
  border-top-color: var(--primary);
@@ -111,7 +111,7 @@ class MbgInputDateController {
111
111
  }
112
112
  }
113
113
 
114
- MbgInputDateController.$inject = ['$scope', '$element', '$attrs', '$timeout']
114
+ MbgInputDateController['$inject'] = ['$scope', '$element', '$attrs', '$timeout']
115
115
 
116
116
  const mbgInputDate = {
117
117
  bindings: {
@@ -1,8 +1,8 @@
1
1
  import './mbg-list.scss'
2
2
  import * as angular from 'angular'
3
3
  import template from './mbg-list.html'
4
- import { MbgListColumnController } from './components/mbg-list-column/mbg-list-column'
5
- import { MbgListRowController } from './components/mbg-list-row/mbg-list-row'
4
+ import {MbgListColumnController} from './components/mbg-list-column/mbg-list-column'
5
+ import {MbgListRowController} from './components/mbg-list-row/mbg-list-row'
6
6
 
7
7
  export class MbgListController {
8
8
  public rows: Array<any>
@@ -28,7 +28,8 @@ export class MbgListController {
28
28
  public indexToPush
29
29
  private movementManual
30
30
 
31
- constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
31
+ constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {
32
+ }
32
33
 
33
34
  $onInit() {
34
35
  this.enableOnSelectByRow =
@@ -95,6 +96,7 @@ export class MbgListController {
95
96
  removeCircularJson(json) {
96
97
  const parsed = JSON.parse(json)
97
98
  delete parsed.$json
99
+ delete parsed.$$hashKey
98
100
  return JSON.stringify(parsed)
99
101
  }
100
102
 
@@ -193,7 +195,7 @@ export class MbgListController {
193
195
 
194
196
  isAllSelected() {
195
197
  if (this.checkboxIf) {
196
- const possibleActive = this.list.filter((row) => this.checkboxIf({ $row: row }))
198
+ const possibleActive = this.list.filter((row) => this.checkboxIf({$row: row}))
197
199
  return (
198
200
  possibleActive.filter(
199
201
  (row) => !this.selectedMap[this.removeCircularJson(JSON.stringify(row))],
@@ -209,7 +211,7 @@ export class MbgListController {
209
211
  toogleAll(selectAll) {
210
212
  this.list.forEach((row) => {
211
213
  if (this.checkboxIf) {
212
- if (this.checkboxIf({ $row: row })) {
214
+ if (this.checkboxIf({$row: row})) {
213
215
  this.selectedMap[this.removeCircularJson(JSON.stringify(row))] = selectAll
214
216
  }
215
217
  } else {
@@ -240,7 +242,7 @@ export class MbgListController {
240
242
  if (this.rowsAdicional !== index && (this.checkbox || this.radio) && this.enableOnSelectByRow) {
241
243
  if (this.radio) {
242
244
  if (this.checkboxIf) {
243
- if (this.checkboxIf({ $row: row })) {
245
+ if (this.checkboxIf({$row: row})) {
244
246
  this.toogleRadio(row.$json)
245
247
  }
246
248
  } else {
@@ -248,7 +250,7 @@ export class MbgListController {
248
250
  }
249
251
  } else {
250
252
  if (this.checkboxIf) {
251
- if (this.checkboxIf({ $row: row })) {
253
+ if (this.checkboxIf({$row: row})) {
252
254
  this.selectedMap[row.$json] = !this.selectedMap[row.$json]
253
255
  this.toogleCheckbox()
254
256
  }
@@ -259,7 +261,7 @@ export class MbgListController {
259
261
  }
260
262
  }
261
263
  if (this.onClickRow) {
262
- this.onClickRow({ $row: row })
264
+ this.onClickRow({$row: row})
263
265
  }
264
266
  }
265
267
 
@@ -282,7 +284,7 @@ export class MbgListController {
282
284
  getRowStripedStyle(row, index) {
283
285
  if (row.isAdicional) {
284
286
  const background = this.$element.find(`table tr`)[index].style.backgroundColor
285
- return { background }
287
+ return {background}
286
288
  }
287
289
 
288
290
  return {
@@ -293,7 +295,7 @@ export class MbgListController {
293
295
  r.$json ? r.$json : JSON.stringify(r),
294
296
  )
295
297
  }) %
296
- 2 ===
298
+ 2 ===
297
299
  0
298
300
  ? '#eaeaea'
299
301
  : '#F5F5F5',
@@ -325,4 +327,4 @@ const mbgList = {
325
327
  controller: MbgListController,
326
328
  }
327
329
 
328
- export { mbgList }
330
+ export {mbgList}
@@ -273,7 +273,7 @@ class MbgMultiSelectController {
273
273
  })
274
274
  }
275
275
  }
276
- MbgMultiSelectController.$inject = ['$scope', '$element', '$attrs', '$timeout']
276
+ MbgMultiSelectController['$inject'] = ['$scope', '$element', '$attrs', '$timeout']
277
277
 
278
278
  const mbgMultiSelect = {
279
279
  bindings: {
@@ -0,0 +1,8 @@
1
+ import * as angular from 'angular'
2
+ import { mbgRangeValue } from './mbg-range-value'
3
+
4
+ const mbgRangeValueModule = angular
5
+ .module('mbg.components.mbgRangeValue', [])
6
+ .component('mbgRangeValue', mbgRangeValue).name
7
+
8
+ export { mbgRangeValueModule }
@@ -0,0 +1,35 @@
1
+ <div class="mbg-value-between">
2
+ <input type="text"
3
+ class="mbg-value-between-startValue"
4
+ ng-model="$ctrl.ngModel.startValue"
5
+ ng-change="$ctrl.onChangeStart()"
6
+ ng-model-options="$ctrl.ngModelOptions"
7
+ placeholder="{{ $ctrl.props.placeholderStart }}"
8
+ ng-required="$ctrl.ngRequired"
9
+ ng-disabled="$ctrl.ngDisabled"
10
+ ng-blur="$ctrl.handleBlur({ $event })"
11
+ ng-focus="$ctrl.handleFocus({ $event })"
12
+ ng-keyup="$ctrl.ngKeyup({ $event })"
13
+ ng-keypress="$ctrl.ngKeypress({ $event })"
14
+ ng-keydown="$ctrl.ngKeydown({ $event })"
15
+ ui-money-mask="{{ $ctrl.props.precision }}"
16
+ on-select="$ctrl.onSelectStart()" />
17
+ <div class="mbg-value-between-space">
18
+ {{ $ctrl.betweenText == undefined ? 'Até' : $ctrl.betweenText }}
19
+ </div>
20
+ <input type="text"
21
+ class="mbg-value-between-endValue"
22
+ ng-model="$ctrl.ngModel.endValue"
23
+ ng-change="$ctrl.onChangeEnd()"
24
+ ng-model-options="$ctrl.ngModelOptions"
25
+ placeholder="{{ $ctrl.props.placeholderEnd }}"
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-money-mask="{{ $ctrl.props.precision }}"
34
+ on-select="$ctrl.onSelectEnd()" />
35
+ </div>
@@ -0,0 +1,20 @@
1
+ .mbg-value-between {
2
+ display: flex;
3
+
4
+ input {
5
+ border: 1px solid #ddd;
6
+ border-radius: 5px;
7
+ padding: 8px 14px;
8
+ flex: 1;
9
+ outline: none;
10
+ height: 44px;
11
+ }
12
+
13
+ }
14
+
15
+ .mbg-value-between-space {
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ padding: 0 8px;
20
+ }
@@ -0,0 +1,100 @@
1
+ import './mbg-range-value.scss'
2
+ import template from './mbg-range-value.html'
3
+ declare let $
4
+
5
+ class MbgRangeValueController {
6
+ public ngChange
7
+ public ngModel
8
+ public ngFocus
9
+ public ngBlur
10
+ public ngRequired
11
+ public ngDisabled
12
+ public props
13
+ public betweenText: string
14
+
15
+ constructor(public $scope, public $element, public $attrs, public $timeout) {
16
+ if ($attrs.ngRequired === '') {
17
+ this.ngRequired = true
18
+ }
19
+ if ($attrs.ngDisabled === '') {
20
+ this.ngDisabled = true
21
+ }
22
+ this.props = {
23
+ placeholder: $attrs.placeholder || '',
24
+ placeholderStart: $attrs.placeholderStart || '',
25
+ placeholderEnd: $attrs.placeholderEnd || '',
26
+ prefix: $attrs.prefix || 'R$ ',
27
+ decimal: $attrs.decimal || ',',
28
+ thousands: $attrs.decimal || '.',
29
+ precision: this.$scope.$parent.$eval($attrs.precision) || 2,
30
+ allowNegative: $attrs.allowNegative ? JSON.parse($attrs.allowNegative) : true,
31
+ allowZero: $attrs.allowZero ? JSON.parse($attrs.allowZero) : false,
32
+ allowEmpty: $attrs.allowEmpty ? JSON.parse($attrs.allowEmpty) : false,
33
+ }
34
+ }
35
+
36
+ $onInit() {}
37
+
38
+ onChangeStart() {
39
+ if (this.ngChange) {
40
+ this.ngChange({})
41
+ }
42
+ }
43
+
44
+ onChangeEnd(a) {
45
+ if (this.ngChange) {
46
+ this.ngChange({})
47
+ }
48
+ }
49
+
50
+ handleFocus(props) {
51
+ if (this.ngFocus) {
52
+ this.ngFocus(props)
53
+ }
54
+ }
55
+
56
+ handleBlur(props) {
57
+ if (this.ngBlur) {
58
+ this.ngBlur(props)
59
+ }
60
+ }
61
+
62
+ onSelectStart = () => {
63
+ this.$timeout(() => {
64
+ if (!this.ngModel.endValue) {
65
+ this.$element.find(`.mbg-value-between-endValue`).focus()
66
+ }
67
+ })
68
+ }
69
+
70
+ onSelectEnd = () => {
71
+ this.$timeout(() => {
72
+ if (!this.ngModel.startValue) {
73
+ this.$element.find(`.mbg-value-between-startValue`).focus()
74
+ }
75
+ })
76
+ }
77
+ }
78
+
79
+ MbgRangeValueController['$inject'] = ['$scope', '$element', '$attrs', '$timeout']
80
+
81
+ const mbgRangeValue = {
82
+ bindings: {
83
+ ngModel: '=',
84
+ ngChange: '&?',
85
+ ngRequired: '=?',
86
+ ngDisabled: '=?',
87
+ ngBlur: '&?',
88
+ ngFocus: '&?',
89
+ ngKeyup: '&?',
90
+ ngKeypress: '&?',
91
+ ngKeydown: '&?',
92
+ betweenText: '@?',
93
+ placeholder: '@?',
94
+ ngModelOptions: '=?',
95
+ },
96
+ template,
97
+ controller: MbgRangeValueController,
98
+ }
99
+
100
+ export { mbgRangeValue }