@gitlab/ui 74.9.1 → 74.9.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/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [74.9.2](https://gitlab.com/gitlab-org/gitlab-ui/compare/v74.9.1...v74.9.2) (2024-02-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Align left margin for inactive state ([5e20544](https://gitlab.com/gitlab-org/gitlab-ui/commit/5e205440d96b613fdec9f324f70dfc8a0bb11692))
7
+ * Decrease left margin for icon ([1b2e829](https://gitlab.com/gitlab-org/gitlab-ui/commit/1b2e829d1b810521b864ac23f878a88ca2fc6ff7))
8
+ * Make icon darker again ([6350e75](https://gitlab.com/gitlab-org/gitlab-ui/commit/6350e7530835496fb3c68dba8e68b0251574a146))
9
+ * Move icon sort position in table ([28f2599](https://gitlab.com/gitlab-org/gitlab-ui/commit/28f25991ec085bf3100d3b1bab380c50547995d2))
10
+ * Simplify if statements and width ([21bc5b2](https://gitlab.com/gitlab-org/gitlab-ui/commit/21bc5b2d3bc4a9fcfc4bcfba512ca6a329f0c95f))
11
+
1
12
  ## [74.9.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v74.9.0...v74.9.1) (2024-02-20)
2
13
 
3
14
 
@@ -1,4 +1,5 @@
1
1
  import { BTable } from 'bootstrap-vue/esm/index.js';
2
+ import GlIcon from '../icon/icon';
2
3
  import { isDev, logWarning } from '../../../utils/utils';
3
4
  import { tableFullProps, tableFullSlots, glTableLiteWarning } from './constants';
4
5
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
@@ -17,7 +18,8 @@ const {
17
18
  var script = {
18
19
  name: 'GlTable',
19
20
  components: {
20
- BTable
21
+ BTable,
22
+ GlIcon
21
23
  },
22
24
  inheritAttrs: false,
23
25
  props: {
@@ -31,14 +33,33 @@ var script = {
31
33
  type: Boolean,
32
34
  default: false,
33
35
  required: false
36
+ },
37
+ sortBy: {
38
+ type: String,
39
+ required: false,
40
+ default: undefined
41
+ },
42
+ sortDesc: {
43
+ type: Boolean,
44
+ required: false,
45
+ default: false
34
46
  }
35
47
  },
48
+ data() {
49
+ return {
50
+ localSortBy: this.sortBy,
51
+ localSortDesc: this.sortDesc
52
+ };
53
+ },
36
54
  computed: {
37
55
  stickyHeaderClass() {
38
56
  return this.stickyHeader ? 'gl-table--sticky-header' : null;
39
57
  },
40
58
  localTableClass() {
41
59
  return ['gl-table', this.tableClass, this.stickyHeaderClass];
60
+ },
61
+ headSlots() {
62
+ return ['head()', ...Object.keys(this.$scopedSlots).filter(slotName => slotName.startsWith('head('))];
42
63
  }
43
64
  },
44
65
  mounted() {
@@ -47,6 +68,23 @@ var script = {
47
68
  if (isDev() && !shouldUseFullTable(this)) {
48
69
  logWarning(glTableLiteWarning, this.$el);
49
70
  }
71
+ },
72
+ methods: {
73
+ isSortable(_ref2) {
74
+ let {
75
+ field
76
+ } = _ref2;
77
+ return field === null || field === void 0 ? void 0 : field.sortable;
78
+ },
79
+ getSortingIcon(_ref3) {
80
+ let {
81
+ field
82
+ } = _ref3;
83
+ if (this.localSortBy !== (field === null || field === void 0 ? void 0 : field.key)) {
84
+ return null;
85
+ }
86
+ return this.localSortDesc ? 'arrow-down' : 'arrow-up';
87
+ }
50
88
  }
51
89
  };
52
90
 
@@ -54,7 +92,7 @@ var script = {
54
92
  const __vue_script__ = script;
55
93
 
56
94
  /* template */
57
- var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-table',_vm._g(_vm._b({attrs:{"table-class":_vm.localTableClass,"fields":_vm.fields},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$scopedSlots)),function(slot){return {key:slot,fn:function(scope){return [_vm._t(slot,null,null,scope)]}}})],null,true)},'b-table',_vm.$attrs,false),_vm.$listeners))};
95
+ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-table',_vm._g(_vm._b({attrs:{"table-class":_vm.localTableClass,"fields":_vm.fields,"sort-by":_vm.localSortBy,"sort-desc":_vm.localSortDesc},on:{"update:sortBy":function($event){_vm.localSortBy=$event;},"update:sort-by":function($event){_vm.localSortBy=$event;},"update:sortDesc":function($event){_vm.localSortDesc=$event;},"update:sort-desc":function($event){_vm.localSortDesc=$event;}},scopedSlots:_vm._u([_vm._l((Object.keys(_vm.$scopedSlots)),function(slotName){return {key:slotName,fn:function(scope){return [_vm._t(slotName,null,null,scope)]}}}),_vm._l((_vm.headSlots),function(headSlotName){return {key:headSlotName,fn:function(scope){return [_c('div',{key:headSlotName,staticClass:"gl-display-flex gl-align-items-center"},[_vm._t(headSlotName,function(){return [_vm._v(_vm._s(scope.label))]},null,scope),(_vm.isSortable(scope))?[(_vm.getSortingIcon(scope))?_c('gl-icon',{staticClass:"gl-ml-3 gl-min-w-5 gl-text-gray-900",attrs:{"name":_vm.getSortingIcon(scope)}}):_c('div',{staticClass:"gl-display-inline-block gl-w-5 gl-h-5 gl-ml-3"})]:_vm._e()],2)]}}})],null,true)},'b-table',_vm.$attrs,false),_vm.$listeners))};
58
96
  var __vue_staticRenderFns__ = [];
59
97
 
60
98
  /* style */