@kigi/components 1.26.1-alpha → 1.27.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.26.1-alpha",
3
+ "version": "1.27.0-alpha",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -7,52 +7,57 @@
7
7
  }
8
8
 
9
9
  .separator-address-link {
10
- margin:0 8px;
10
+ margin: 0 8px;
11
11
  color: #666;
12
12
  }
13
13
  }
14
14
  }
15
15
 
16
16
  .mbg-address-wrapper {
17
+ @media screen and (max-width: 415px) {
17
18
  display: flex;
18
- .input-cep-wrapper {
19
- width: 108px;
20
- max-width: 108px;
21
- margin-right: 8px;
22
- font-weight: 500;
23
- input {
24
- max-width: 100%;
19
+ flex-direction: column;
20
+ gap: 5px;
21
+ }
22
+ display: flex;
23
+ .input-cep-wrapper {
24
+ width: 108px;
25
+ max-width: 108px;
26
+ margin-right: 8px;
27
+ font-weight: 500;
28
+ input {
29
+ max-width: 100%;
25
30
 
26
- &::placeholder {
27
- color: #888888;
28
- }
29
- }
30
- }
31
- mbg-input-step {
32
- flex: 1;
33
- max-width: 100%;
31
+ &::placeholder {
32
+ color: #888888;
33
+ }
34
34
  }
35
- .input-spacing {
36
- min-width: 8px;
35
+ }
36
+ mbg-input-step {
37
+ flex: 1;
38
+ max-width: 100%;
39
+ }
40
+ .input-spacing {
41
+ min-width: 8px;
42
+ }
43
+ input.mbg-input {
44
+ border: 1px solid #ddd;
45
+ background: #fff;
46
+ border-radius: 5px;
47
+ padding: 8px 14px;
48
+ flex: 7;
49
+ outline: none;
50
+ width: inherit;
51
+ height: 44px;
52
+ max-width: 100%;
53
+ min-width: 0;
54
+ &.input-number {
55
+ flex: none;
56
+ width: 104px;
37
57
  }
38
- input.mbg-input {
39
- border: 1px solid #ddd;
40
- background: #fff;
41
- border-radius: 5px;
42
- padding: 8px 14px;
43
- flex: 7;
44
- outline: none;
45
- width: inherit;
46
- height: 44px;
47
- max-width: 100%;
48
- min-width: 0;
49
- &.input-number {
50
- flex: none;
51
- width: 104px;
52
- }
53
- &.input-information {
54
- min-width: 160px;
55
- flex: .3;
56
- }
58
+ &.input-information {
59
+ min-width: 160px;
60
+ flex: 0.3;
57
61
  }
62
+ }
58
63
  }
@@ -14,6 +14,7 @@ export class MbgListColumnController {
14
14
  private hidden: boolean
15
15
  private columnSort
16
16
  private dinamic
17
+ public markAsLastColumn
17
18
 
18
19
  constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
19
20
 
@@ -23,6 +24,7 @@ export class MbgListColumnController {
23
24
  this.alignRow = this.alignRow || 'left'
24
25
  this.sortable = this.sortable !== undefined ? this.sortable : false
25
26
  this.dinamic = this.dinamic !== undefined ? this.dinamic : false
27
+ this.markAsLastColumn = this.markAsLastColumn !== undefined ? this.markAsLastColumn : false
26
28
  this.mbgList.registerColumn(this)
27
29
  this.generateTemplateColumn()
28
30
  this.generateTemplateRow()
@@ -79,7 +81,7 @@ export class MbgListColumnController {
79
81
  }
80
82
  }
81
83
 
82
- MbgListColumnController.$inject = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
84
+ MbgListColumnController['$inject'] = ['$scope', '$element', '$attrs', '$timeout', '$transclude']
83
85
 
84
86
  const mbgListColumn = {
85
87
  transclude: true,
@@ -96,6 +98,7 @@ const mbgListColumn = {
96
98
  hidden: '=?',
97
99
  sortable: '=?',
98
100
  dinamic: '=?',
101
+ markAsLastColumn: '=?',
99
102
  },
100
103
  template: '',
101
104
  controller: MbgListColumnController,
@@ -24,8 +24,10 @@ export class MbgListController {
24
24
  public columnSort
25
25
  public dinamic
26
26
  public dinamicColumns
27
+ public staticColumns: Array<any>
28
+ public indexToPush
27
29
 
28
- constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) { }
30
+ constructor(public $scope, public $element, public $attrs, public $timeout, public $transclude) {}
29
31
 
30
32
  $onInit() {
31
33
  this.enableOnSelectByRow =
@@ -35,6 +37,8 @@ export class MbgListController {
35
37
  this.columns = []
36
38
  this.mbgRows = []
37
39
  this.selectedMap = {}
40
+ this.staticColumns = []
41
+
38
42
  this.$scope.$watch(
39
43
  '$ctrl.list',
40
44
  (list) => {
@@ -42,6 +46,7 @@ export class MbgListController {
42
46
  this.rows.forEach((row) => {
43
47
  row.$json = row.$json ? row.$json : JSON.stringify(row)
44
48
  })
49
+
45
50
  try {
46
51
  this.checkAll = this.isAllSelected()
47
52
  } catch (e) {
@@ -52,17 +57,34 @@ export class MbgListController {
52
57
  )
53
58
  this.observeOpenedRows()
54
59
  this.observeSelectedValues()
60
+
55
61
  if (this.dinamic) {
56
62
  this.$scope.$watch(
57
63
  '$ctrl.dinamicColumns',
58
64
  () => {
59
- const columnsNames = this.dinamicColumns.map((column) => column.name)
60
- this.columns = this.columns.filter((c: any) => {
61
- if (!c.dinamic) {
62
- return true
65
+ if (this.staticColumns.length == 0) {
66
+ this.staticColumns = this.columns
67
+ }
68
+
69
+ this.indexToPush = this.columns.findIndex((col) => col.markAsLastColumn)
70
+
71
+ let lastColumnItem = this.indexToPush > 0 && this.columns.splice(this.indexToPush, 1)[0]
72
+
73
+ if (this.dinamicColumns.length > 0) {
74
+ const newColumns = this.columns.filter(
75
+ (c: any) => c.dinamic && this.dinamicColumns.some((item) => item.id == c.name),
76
+ )
77
+
78
+ if (lastColumnItem) {
79
+ newColumns.push(lastColumnItem)
80
+ }
81
+ this.columns = this.staticColumns.concat(newColumns)
82
+ } else {
83
+ if (lastColumnItem) {
84
+ this.staticColumns.push(lastColumnItem)
63
85
  }
64
- return columnsNames.includes(c.name)
65
- })
86
+ this.columns = this.staticColumns
87
+ }
66
88
  },
67
89
  true,
68
90
  )
@@ -152,7 +174,14 @@ export class MbgListController {
152
174
  }
153
175
 
154
176
  registerColumn(column: MbgListColumnController) {
155
- this.columns.push(column)
177
+ if (!this.indexToPush || this.indexToPush < 0) return this.columns.push(column)
178
+
179
+ this.columns.splice(this.indexToPush, 0, column)
180
+ this.indexToPush++
181
+
182
+ if (column.markAsLastColumn) {
183
+ this.indexToPush = this.columns.length - 1
184
+ }
156
185
  }
157
186
 
158
187
  registerRow(row: MbgListRowController) {
@@ -264,7 +293,7 @@ export class MbgListController {
264
293
  )
265
294
  }) %
266
295
  2 ===
267
- 0
296
+ 0
268
297
  ? '#eaeaea'
269
298
  : '#F5F5F5',
270
299
  }