@gitlab/ui 106.2.1 → 107.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 +20 -0
- package/dist/components/base/new_dropdowns/disclosure/disclosure_dropdown.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +1 -1
- package/dist/tokens/build/js/tokens.js +1 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/json/tokens.dark.json +5 -2
- package/dist/tokens/json/tokens.json +5 -2
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/disclosure/disclosure_dropdown.vue +1 -1
- package/src/index.js +0 -1
- package/src/tokens/build/css/tokens.css +1 -1
- package/src/tokens/build/css/tokens.dark.css +1 -1
- package/src/tokens/build/js/tokens.dark.js +1 -1
- package/src/tokens/build/js/tokens.js +1 -1
- package/src/tokens/build/json/tokens.dark.json +5 -2
- package/src/tokens/build/json/tokens.json +5 -2
- package/src/tokens/build/scss/_tokens.dark.scss +1 -1
- package/src/tokens/build/scss/_tokens.scss +1 -1
- package/src/tokens/contextual/link.tokens.json +4 -1
- package/dist/components/base/paginated_list/paginated_list.js +0 -180
- package/src/components/base/paginated_list/paginated_list.md +0 -1
- package/src/components/base/paginated_list/paginated_list.vue +0 -179
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import GlPagination from '../pagination/pagination';
|
|
2
|
-
import GlSearchBoxByType from '../search_box_by_type/search_box_by_type';
|
|
3
|
-
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
4
|
-
|
|
5
|
-
var script = {
|
|
6
|
-
name: 'GlPaginatedList',
|
|
7
|
-
components: {
|
|
8
|
-
GlSearchBoxByType,
|
|
9
|
-
GlPagination
|
|
10
|
-
},
|
|
11
|
-
props: {
|
|
12
|
-
list: {
|
|
13
|
-
type: Array,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
perPage: {
|
|
17
|
-
type: Number,
|
|
18
|
-
required: false,
|
|
19
|
-
default: 10
|
|
20
|
-
},
|
|
21
|
-
page: {
|
|
22
|
-
type: Number,
|
|
23
|
-
required: false,
|
|
24
|
-
default: 1
|
|
25
|
-
},
|
|
26
|
-
filterable: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
required: false,
|
|
29
|
-
default: true
|
|
30
|
-
},
|
|
31
|
-
itemKey: {
|
|
32
|
-
type: String,
|
|
33
|
-
required: false,
|
|
34
|
-
default: 'id'
|
|
35
|
-
},
|
|
36
|
-
filter: {
|
|
37
|
-
type: [String, Function],
|
|
38
|
-
required: false,
|
|
39
|
-
default: 'id'
|
|
40
|
-
},
|
|
41
|
-
emptyMessage: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: false,
|
|
44
|
-
default: 'There are currently no items in this list.'
|
|
45
|
-
},
|
|
46
|
-
emptySearchMessage: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: false,
|
|
49
|
-
default: 'Sorry, your filter produced no results.'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
pageIndex: this.page,
|
|
55
|
-
queryStr: ''
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
computed: {
|
|
59
|
-
filteredList() {
|
|
60
|
-
if (typeof this.filter === 'function') {
|
|
61
|
-
return this.list.filter(listItem => this.filter(listItem, this.queryStr));
|
|
62
|
-
}
|
|
63
|
-
return this.list.filter(listItem => listItem[this.filter].toLowerCase().includes(this.queryStr.toLowerCase()));
|
|
64
|
-
},
|
|
65
|
-
paginatedList() {
|
|
66
|
-
const offset = (this.pageIndex - 1) * this.perPage;
|
|
67
|
-
return this.filteredList.slice(offset, offset + this.perPage);
|
|
68
|
-
},
|
|
69
|
-
pageInfo() {
|
|
70
|
-
return {
|
|
71
|
-
perPage: this.perPage,
|
|
72
|
-
total: this.filterTotal,
|
|
73
|
-
page: this.pageIndex
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
total() {
|
|
77
|
-
return this.list.length;
|
|
78
|
-
},
|
|
79
|
-
filterTotal() {
|
|
80
|
-
return this.filteredList.length;
|
|
81
|
-
},
|
|
82
|
-
/**
|
|
83
|
-
* Determine if the original list had 0 items
|
|
84
|
-
*
|
|
85
|
-
* @return {Boolean} - If we started with an empty list
|
|
86
|
-
*
|
|
87
|
-
*/
|
|
88
|
-
zeroTotal() {
|
|
89
|
-
return this.total === 0;
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* Determine if our search yields an empty list
|
|
93
|
-
*
|
|
94
|
-
* @return {Boolean} - If we have an empty search list
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
zeroSearchResults() {
|
|
98
|
-
return this.total > 0 && this.filterTotal === 0;
|
|
99
|
-
},
|
|
100
|
-
/**
|
|
101
|
-
* Determine if we originally had 0 results or 0 search results
|
|
102
|
-
*
|
|
103
|
-
* @return {Boolean} - If we have an empty search list
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
emptyList() {
|
|
107
|
-
return this.zeroTotal || this.zeroSearchResults;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
watch: {
|
|
111
|
-
/**
|
|
112
|
-
* In GitLab UI storybook, when a user changes the page knob,
|
|
113
|
-
* we update the current page index.
|
|
114
|
-
*
|
|
115
|
-
* @param {Number} newPage - A string param
|
|
116
|
-
* @return {undefined} - Nothing is returned
|
|
117
|
-
*
|
|
118
|
-
*/
|
|
119
|
-
page(newPage) {
|
|
120
|
-
this.pageIndex = newPage;
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* In GitLab UI storybook, when a user changes the perPage knob,
|
|
124
|
-
* we reset the paginated list to the first page.
|
|
125
|
-
*
|
|
126
|
-
* @return {undefined} - Nothing is returned
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
perPage() {
|
|
130
|
-
this.pageIndex = 1;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
methods: {
|
|
134
|
-
change(page) {
|
|
135
|
-
this.pageIndex = page;
|
|
136
|
-
},
|
|
137
|
-
query(queryStr) {
|
|
138
|
-
this.pageIndex = 1;
|
|
139
|
-
this.queryStr = queryStr;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/* script */
|
|
145
|
-
const __vue_script__ = script;
|
|
146
|
-
|
|
147
|
-
/* template */
|
|
148
|
-
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:"gl-flex-row-reverse gl-justify-between sm:gl-flex"},[_vm._t("header"),_vm._v(" "),(_vm.filterable)?_c('gl-search-box-by-type',{on:{"input":_vm.query}}):_vm._e()],2),_vm._v(" "),_vm._t("subheader"),_vm._v(" "),_c('ul',{staticClass:"gl-m-0 gl-grid gl-list-none gl-grid-cols-1 gl-divide-x-0 gl-divide-y gl-divide-solid gl-divide-default gl-p-0"},_vm._l((_vm.paginatedList),function(listItem){return _c('li',{key:listItem[_vm.itemKey],staticClass:"gl-px-5 gl-py-4"},[_vm._t("default",function(){return [_vm._v(_vm._s(listItem.id))]},{"listItem":listItem,"query":_vm.queryStr})],2)}),0),_vm._v(" "),(!_vm.emptyList)?_c('gl-pagination',_vm._b({attrs:{"align":"center","per-page":_vm.pageInfo.perPage,"value":_vm.pageInfo.page,"total-items":_vm.pageInfo.total},on:{"input":_vm.change}},'gl-pagination',_vm.$attrs,false)):_vm._e(),_vm._v(" "),(_vm.emptyList)?_c('div',{staticClass:"bs-callout bs-callout-warning empty-message gl-mt-5",class:{ 'empty-message': _vm.zeroTotal, 'empty-search': _vm.zeroSearchResults }},[_vm._v(_vm._s(_vm.zeroTotal ? _vm.emptyMessage : _vm.emptySearchMessage))]):_vm._e()],2)};
|
|
149
|
-
var __vue_staticRenderFns__ = [];
|
|
150
|
-
|
|
151
|
-
/* style */
|
|
152
|
-
const __vue_inject_styles__ = undefined;
|
|
153
|
-
/* scoped */
|
|
154
|
-
const __vue_scope_id__ = undefined;
|
|
155
|
-
/* module identifier */
|
|
156
|
-
const __vue_module_identifier__ = undefined;
|
|
157
|
-
/* functional template */
|
|
158
|
-
const __vue_is_functional_template__ = false;
|
|
159
|
-
/* style inject */
|
|
160
|
-
|
|
161
|
-
/* style inject SSR */
|
|
162
|
-
|
|
163
|
-
/* style inject shadow dom */
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const __vue_component__ = __vue_normalize__(
|
|
168
|
-
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
169
|
-
__vue_inject_styles__,
|
|
170
|
-
__vue_script__,
|
|
171
|
-
__vue_scope_id__,
|
|
172
|
-
__vue_is_functional_template__,
|
|
173
|
-
__vue_module_identifier__,
|
|
174
|
-
false,
|
|
175
|
-
undefined,
|
|
176
|
-
undefined,
|
|
177
|
-
undefined
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
export default __vue_component__;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
The paginated list component allows the easy creation of list with pagination and client side sorting.
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import GlPagination from '../pagination/pagination.vue';
|
|
3
|
-
import GlSearchBoxByType from '../search_box_by_type/search_box_by_type.vue';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
name: 'GlPaginatedList',
|
|
7
|
-
components: {
|
|
8
|
-
GlSearchBoxByType,
|
|
9
|
-
GlPagination,
|
|
10
|
-
},
|
|
11
|
-
props: {
|
|
12
|
-
list: {
|
|
13
|
-
type: Array,
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
perPage: {
|
|
17
|
-
type: Number,
|
|
18
|
-
required: false,
|
|
19
|
-
default: 10,
|
|
20
|
-
},
|
|
21
|
-
page: {
|
|
22
|
-
type: Number,
|
|
23
|
-
required: false,
|
|
24
|
-
default: 1,
|
|
25
|
-
},
|
|
26
|
-
filterable: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
required: false,
|
|
29
|
-
default: true,
|
|
30
|
-
},
|
|
31
|
-
itemKey: {
|
|
32
|
-
type: String,
|
|
33
|
-
required: false,
|
|
34
|
-
default: 'id',
|
|
35
|
-
},
|
|
36
|
-
filter: {
|
|
37
|
-
type: [String, Function],
|
|
38
|
-
required: false,
|
|
39
|
-
default: 'id',
|
|
40
|
-
},
|
|
41
|
-
emptyMessage: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: false,
|
|
44
|
-
default: 'There are currently no items in this list.',
|
|
45
|
-
},
|
|
46
|
-
emptySearchMessage: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: false,
|
|
49
|
-
default: 'Sorry, your filter produced no results.',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
data() {
|
|
53
|
-
return {
|
|
54
|
-
pageIndex: this.page,
|
|
55
|
-
queryStr: '',
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
computed: {
|
|
59
|
-
filteredList() {
|
|
60
|
-
if (typeof this.filter === 'function') {
|
|
61
|
-
return this.list.filter((listItem) => this.filter(listItem, this.queryStr));
|
|
62
|
-
}
|
|
63
|
-
return this.list.filter((listItem) =>
|
|
64
|
-
listItem[this.filter].toLowerCase().includes(this.queryStr.toLowerCase())
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
paginatedList() {
|
|
68
|
-
const offset = (this.pageIndex - 1) * this.perPage;
|
|
69
|
-
return this.filteredList.slice(offset, offset + this.perPage);
|
|
70
|
-
},
|
|
71
|
-
pageInfo() {
|
|
72
|
-
return { perPage: this.perPage, total: this.filterTotal, page: this.pageIndex };
|
|
73
|
-
},
|
|
74
|
-
total() {
|
|
75
|
-
return this.list.length;
|
|
76
|
-
},
|
|
77
|
-
filterTotal() {
|
|
78
|
-
return this.filteredList.length;
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Determine if the original list had 0 items
|
|
82
|
-
*
|
|
83
|
-
* @return {Boolean} - If we started with an empty list
|
|
84
|
-
*
|
|
85
|
-
*/
|
|
86
|
-
zeroTotal() {
|
|
87
|
-
return this.total === 0;
|
|
88
|
-
},
|
|
89
|
-
/**
|
|
90
|
-
* Determine if our search yields an empty list
|
|
91
|
-
*
|
|
92
|
-
* @return {Boolean} - If we have an empty search list
|
|
93
|
-
*
|
|
94
|
-
*/
|
|
95
|
-
zeroSearchResults() {
|
|
96
|
-
return this.total > 0 && this.filterTotal === 0;
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* Determine if we originally had 0 results or 0 search results
|
|
100
|
-
*
|
|
101
|
-
* @return {Boolean} - If we have an empty search list
|
|
102
|
-
*
|
|
103
|
-
*/
|
|
104
|
-
emptyList() {
|
|
105
|
-
return this.zeroTotal || this.zeroSearchResults;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
watch: {
|
|
109
|
-
/**
|
|
110
|
-
* In GitLab UI storybook, when a user changes the page knob,
|
|
111
|
-
* we update the current page index.
|
|
112
|
-
*
|
|
113
|
-
* @param {Number} newPage - A string param
|
|
114
|
-
* @return {undefined} - Nothing is returned
|
|
115
|
-
*
|
|
116
|
-
*/
|
|
117
|
-
page(newPage) {
|
|
118
|
-
this.pageIndex = newPage;
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* In GitLab UI storybook, when a user changes the perPage knob,
|
|
122
|
-
* we reset the paginated list to the first page.
|
|
123
|
-
*
|
|
124
|
-
* @return {undefined} - Nothing is returned
|
|
125
|
-
*
|
|
126
|
-
*/
|
|
127
|
-
perPage() {
|
|
128
|
-
this.pageIndex = 1;
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
methods: {
|
|
132
|
-
change(page) {
|
|
133
|
-
this.pageIndex = page;
|
|
134
|
-
},
|
|
135
|
-
query(queryStr) {
|
|
136
|
-
this.pageIndex = 1;
|
|
137
|
-
this.queryStr = queryStr;
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
</script>
|
|
142
|
-
|
|
143
|
-
<template>
|
|
144
|
-
<div>
|
|
145
|
-
<div class="gl-flex-row-reverse gl-justify-between sm:gl-flex">
|
|
146
|
-
<slot name="header"></slot>
|
|
147
|
-
<gl-search-box-by-type v-if="filterable" @input="query" />
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<slot name="subheader"></slot>
|
|
151
|
-
|
|
152
|
-
<ul
|
|
153
|
-
class="gl-m-0 gl-grid gl-list-none gl-grid-cols-1 gl-divide-x-0 gl-divide-y gl-divide-solid gl-divide-default gl-p-0"
|
|
154
|
-
>
|
|
155
|
-
<li v-for="listItem in paginatedList" :key="listItem[itemKey]" class="gl-px-5 gl-py-4">
|
|
156
|
-
<slot :list-item="listItem" :query="queryStr">{{ listItem.id }}</slot>
|
|
157
|
-
</li>
|
|
158
|
-
</ul>
|
|
159
|
-
|
|
160
|
-
<gl-pagination
|
|
161
|
-
v-if="!emptyList"
|
|
162
|
-
align="center"
|
|
163
|
-
:per-page="pageInfo.perPage"
|
|
164
|
-
v-bind="$attrs"
|
|
165
|
-
:value="pageInfo.page"
|
|
166
|
-
:total-items="pageInfo.total"
|
|
167
|
-
@input="change"
|
|
168
|
-
/>
|
|
169
|
-
<!-- Prettier will insert extra line-break which will result in render differences between Vue.js 2 and Vue.js 3 -->
|
|
170
|
-
<!-- See https://gitlab.com/gitlab-org/gitlab-ui/-/issues/2004 for details -->
|
|
171
|
-
<!-- display: inline -->
|
|
172
|
-
<div
|
|
173
|
-
v-if="emptyList"
|
|
174
|
-
class="bs-callout bs-callout-warning empty-message gl-mt-5"
|
|
175
|
-
:class="{ 'empty-message': zeroTotal, 'empty-search': zeroSearchResults }"
|
|
176
|
-
>{{ zeroTotal ? emptyMessage : emptySearchMessage }}</div
|
|
177
|
-
>
|
|
178
|
-
</div>
|
|
179
|
-
</template>
|