@gitlab/ui 93.4.0 → 94.0.0

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,45 @@
1
+ # [94.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v93.4.0...v94.0.0) (2024-09-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **GlTable:** do not override CSS utils styling ([9c3ce10](https://gitlab.com/gitlab-org/gitlab-ui/commit/9c3ce1079e76a547dea0f78c981631cd4d15fdfc))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * **GlTable:** This rewrites how `GlTable`'s `TH` elements text
12
+ alignment is applied. If you were previously passing `gl-text-right` to
13
+ a table's `thClass` field option, you should migrate to the
14
+ `thAlignRight` option instead. Not migrating could cause rendering
15
+ issues in right-aligned sortable columns.
16
+
17
+ Before:
18
+
19
+ ```js
20
+ const fields = [
21
+ {
22
+ key: "column_one",
23
+ label: __("First column"),
24
+ sortable: true,
25
+ thClass: 'gl-text-right',
26
+ },
27
+ ];
28
+ ```
29
+
30
+ After:
31
+
32
+ ```js
33
+ const fields = [
34
+ {
35
+ key: "column_one",
36
+ label: __("First column"),
37
+ sortable: true,
38
+ thAlignRight: true,
39
+ },
40
+ ];
41
+ ```
42
+
1
43
  # [93.4.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v93.3.0...v93.4.0) (2024-09-20)
2
44
 
3
45
 
@@ -58,6 +58,27 @@ var script = {
58
58
  },
59
59
  headSlots() {
60
60
  return ['head()', ...Object.keys(this.$scopedSlots).filter(slotName => slotName.startsWith('head('))];
61
+ },
62
+ computedFields() {
63
+ var _this$fields;
64
+ return (_this$fields = this.fields) === null || _this$fields === void 0 ? void 0 : _this$fields.map(field => {
65
+ if (typeof field === 'string') {
66
+ return field;
67
+ }
68
+ const {
69
+ thAlignRight,
70
+ thClass = '',
71
+ ...rest
72
+ } = field;
73
+ const computedThClass = Array.isArray(thClass) ? thClass : thClass.split(' ');
74
+ if (thAlignRight) {
75
+ computedThClass.push('gl-table-th-align-right');
76
+ }
77
+ return {
78
+ ...rest,
79
+ thClass: computedThClass
80
+ };
81
+ });
61
82
  }
62
83
  },
63
84
  mounted() {
@@ -104,7 +125,7 @@ var script = {
104
125
  const __vue_script__ = script;
105
126
 
106
127
  /* template */
107
- 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,"no-sort-reset":""},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-flex"},[_vm._t(headSlotName,function(){return [_c('span',[_vm._v(_vm._s(scope.label))])]},null,scope),(_vm.isSortable(scope))?[_c('div',{staticClass:"gl-ml-2 gl-flex gl-w-5 gl-justify-center"},[_c('span',{class:{ 'gl-hidden': !_vm.activeSortingColumn(scope) },attrs:{"name":"sort-icon","data-testid":"sort-icon"}},[_vm._v("\n "+_vm._s(_vm.getSortingIcon(scope))+"\n ")])])]:_vm._e()],2)]}}})],null,true)},'b-table',_vm.$attrs,false),_vm.$listeners))};
128
+ 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.computedFields,"sort-by":_vm.localSortBy,"sort-desc":_vm.localSortDesc,"no-sort-reset":""},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-flex"},[_vm._t(headSlotName,function(){return [_c('span',[_vm._v(_vm._s(scope.label))])]},null,scope),(_vm.isSortable(scope))?[_c('div',{staticClass:"gl-table-th-sort-icon-wrapper gl-flex gl-w-5 gl-justify-center"},[_c('span',{class:{ 'gl-hidden': !_vm.activeSortingColumn(scope) },attrs:{"name":"sort-icon","data-testid":"sort-icon"}},[_vm._v("\n "+_vm._s(_vm.getSortingIcon(scope))+"\n ")])])]:_vm._e()],2)]}}})],null,true)},'b-table',_vm.$attrs,false),_vm.$listeners))};
108
129
  var __vue_staticRenderFns__ = [];
109
130
 
110
131
  /* style */