Skip to content

Commit ddbcfc0

Browse files
committed
logical CSS properties for rtl
1 parent 2b41970 commit ddbcfc0

24 files changed

+404
-324
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"sinon": "^11.1.2",
5959
"typescript": "^4.4.4",
6060
"vite": "^2.6.13",
61-
"vue": "^3.2.20",
61+
"vue": "^3.5.13",
6262
"vue-jest": "^5.0.0-0",
6363
"vuepress": "^2.0.0-rc.15",
6464
"webpack-node-externals": "^3.0.0"

src/components/VgtGlobalSearch.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<template>
22
<div v-if="showControlBar" class="vgt-global-search vgt-clearfix">
3-
<div class="vgt-global-search__input vgt-pull-left">
3+
<div class="vgt-global-search__input vgt-pull-start">
44
<form @submit.prevent v-if="searchEnabled" role="search">
55
<label :for="id">
66
<span aria-hidden="true" class="input__icon">
7-
<div class="magnifying-glass"></div>
7+
<div class="magnifying-glass"></div>
88
</span>
99
<span class="sr-only">Search</span>
1010
</label>
1111
<input
1212
:id="id"
1313
type="text"
14-
class="vgt-input vgt-pull-left"
14+
class="vgt-input vgt-pull-start"
1515
:placeholder="globalSearchPlaceholder"
1616
:value="value"
1717
@input="updateValue($event.target.value)"

src/components/VgtHeaderRow.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,24 @@
5555
>
5656
<th
5757
v-if="headerRow.mode !== 'span' && !column.hidden"
58-
class="vgt-row-header"
59-
:class="getClasses(i, 'td')"
58+
class="vgt-row-header"
59+
:class="getClasses(i, 'td')"
6060
@click="columnCollapsable(i) ? $emit('vgtExpand', !headerRow.vgtIsExpanded) : () => {}"
6161
>
62-
<span v-if="columnCollapsable(i)" class="triangle" :class="{ 'expand': headerRow.vgtIsExpanded }"></span>
63-
<slot
62+
<span v-if="columnCollapsable(i)" class="triangle" :class="{ 'expand': headerRow.vgtIsExpanded }"></span>
63+
<slot
6464
name="table-header-row"
65-
:row="headerRow"
66-
:column="column"
67-
:formattedRow="formattedRow(headerRow, true)"
65+
:row="headerRow"
66+
:column="column"
67+
:formattedRow="formattedRow(headerRow, true)"
6868
>
69-
<span v-if="!column.html">
70-
{{ collectFormatted(headerRow, column, true) }}
71-
</span>
72-
<span v-if="column.html" v-html="collectFormatted(headerRow, column, true)">
73-
</span>
74-
</slot>
75-
</th>
69+
<span v-if="!column.html">
70+
{{ collectFormatted(headerRow, column, true) }}
71+
</span>
72+
<span v-if="column.html" v-html="collectFormatted(headerRow, column, true)">
73+
</span>
74+
</slot>
75+
</th>
7676
</template>
7777
</tr>
7878
</template>

src/components/pagination/VgtPagination.vue

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,28 @@
3232
:page-text="pageText"
3333
:info-fn="infoFn"
3434
:mode="mode" />
35+
<button
36+
v-if="jumpFirstOrLast"
37+
type="button"
38+
aria-controls="vgt-table"
39+
class="footer__navigation__page-btn"
40+
:class="{ disabled: !firstIsPossible }"
41+
@click.prevent.stop="firstPage"
42+
>
43+
<span
44+
aria-hidden="true"
45+
class="chevron start"
46+
></span>
47+
<span>{{ firstText }}</span>
48+
</button>
49+
3550
<button
3651
type="button"
3752
aria-controls="vgt-table"
3853
class="footer__navigation__page-btn"
3954
:class="{ disabled: !prevIsPossible }"
4055
@click.prevent.stop="previousPage">
41-
<span aria-hidden="true" class="chevron" v-bind:class="{ 'left': !rtl, 'right': rtl }"></span>
56+
<span aria-hidden="true" class="chevron start"></span>
4257
<span>{{prevText}}</span>
4358
</button>
4459

@@ -49,7 +64,22 @@
4964
:class="{ disabled: !nextIsPossible }"
5065
@click.prevent.stop="nextPage">
5166
<span>{{nextText}}</span>
52-
<span aria-hidden="true" class="chevron" v-bind:class="{ 'right': !rtl, 'left': rtl }"></span>
67+
<span aria-hidden="true" class="chevron end"></span>
68+
</button>
69+
70+
<button
71+
v-if="jumpFirstOrLast"
72+
type="button"
73+
aria-controls="vgt-table"
74+
class="footer__navigation__page-btn"
75+
:class="{ disabled: !lastIsPossible }"
76+
@click.prevent.stop="lastPage"
77+
>
78+
<span>{{ lastText }}</span>
79+
<span
80+
aria-hidden="true"
81+
class="chevron end"
82+
></span>
5383
</button>
5484
</div>
5585
</div>
@@ -73,8 +103,11 @@ export default {
73103
customRowsPerPageDropdown: { default() { return []; } },
74104
paginateDropdownAllowAll: { default: true },
75105
mode: { default: PAGINATION_MODES.Records },
106+
jumpFirstOrLast: { default: false },
76107
77108
// text options
109+
firstText: { default: "First" },
110+
lastText: { default: "Last" },
78111
nextText: { default: 'Next' },
79112
prevText: { default: 'Prev' },
80113
rowsPerPageText: { default: 'Rows per page:' },
@@ -104,8 +137,8 @@ export default {
104137
105138
customRowsPerPageDropdown: {
106139
handler() {
107-
this.handlePerPage();
108-
},
140+
this.handlePerPage();
141+
},
109142
deep: true,
110143
},
111144
@@ -121,12 +154,26 @@ export default {
121154
computed: {
122155
// Number of pages
123156
pagesCount() {
157+
// if the setting is set to 'all'
158+
if(this.currentPerPage === -1) {
159+
return 1;
160+
}
124161
const quotient = Math.floor(this.total / this.currentPerPage);
125162
const remainder = this.total % this.currentPerPage;
126163
127164
return remainder === 0 ? quotient : quotient + 1;
128165
},
129166
167+
// Can go to first page
168+
firstIsPossible() {
169+
return this.currentPage > 1;
170+
},
171+
172+
// Can go to last page
173+
lastIsPossible() {
174+
return this.currentPage < Math.ceil(this.total / this.currentPerPage);
175+
},
176+
130177
// Can go to next page
131178
nextIsPossible() {
132179
return this.currentPage < this.pagesCount;
@@ -151,6 +198,24 @@ export default {
151198
}
152199
},
153200
201+
// Go to first page
202+
firstPage() {
203+
if (this.firstIsPossible) {
204+
this.currentPage = 1;
205+
this.prevPage = 0;
206+
this.pageChanged();
207+
}
208+
},
209+
210+
// Go to last page
211+
lastPage() {
212+
if (this.lastIsPossible) {
213+
this.currentPage = this.pagesCount;
214+
this.prev = this.currentPage - 1;
215+
this.pageChanged();
216+
}
217+
},
218+
154219
// Go to next page
155220
nextPage() {
156221
if (this.nextIsPossible) {

src/components/pagination/VgtPaginationPageInfo.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ export default {
7070
return ((this.currentPage - 1) * this.currentPerPage) + 1;
7171
},
7272
lastRecordOnPage() {
73+
// if the setting is set to 'all'
74+
if(this.currentPerPage === -1) {
75+
return this.totalRecords;
76+
}
7377
return Math.min(this.totalRecords, this.currentPage * this.currentPerPage);
7478
},
7579
recordInfo() {
@@ -93,7 +97,7 @@ export default {
9397
lastRecordOnPage: last,
9498
totalRecords: this.totalRecords,
9599
currentPage: this.currentPage,
96-
totalPages: this.lastPage,
100+
totalPage: this.lastPage,
97101
};
98102
},
99103
},

src/components/types/date.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,10 @@ const date = Object.assign({}, def);
55

66
date.isRight = true;
77

8-
/**
9-
* Compare the two dates and return 1 if the first date is after the second, -1 if the first date is before the second or 0 if dates are equal.
10-
* @param {*} x Date 1
11-
* @param {*} y Date 2
12-
* @param {Object} column Additional parameters (e.g. dateInputFormat, dateOutputFormat)
13-
* @returns
14-
*/
158
date.compare = function (x, y, column) {
169
function cook(d) {
1710
if (column && column.dateInputFormat) {
1811
return parse(`${d}`, `${column.dateInputFormat}`, new Date());
19-
} else if (typeof d === 'string') {
20-
try {
21-
return Date.parse(d);
22-
} catch(err) {
23-
return d;
24-
}
2512
}
2613
return d;
2714
}

src/styles/_bordered.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
@use "variables";
2+
13
.vgt-table{
24
&.bordered td, &.bordered th {
3-
border: 1px solid $border-color;
5+
border: 1px solid variables.$border-color;
46
}
57
&.bordered th.vgt-row-header{
6-
border-bottom: 3px solid $border-color;
8+
border-bottom: 3px solid variables.$border-color;
79
}
810
}

src/styles/_compact.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
&:before {
2424
content: attr(data-label);
2525
position: relative;
26-
float: left;
26+
float: inline-start;
2727
left: 0;
2828
width: 40%;
2929
padding-left: 10px;

src/styles/_control-bar.scss

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
@use "variables";
2+
@use 'sass:color';
3+
14
.vgt-global-search{
25
padding: 5px 0px;
36
display: flex;
47
flex-wrap: nowrap;
58
align-items: stretch;
6-
border: 1px solid $border-color;
9+
border: 1px solid variables.$border-color;
710
border-bottom: 0px;
8-
background: linear-gradient($thead-bg-color-1, $thead-bg-color-2);
11+
background: linear-gradient(variables.$thead-bg-color-1, variables.$thead-bg-color-2);
912
form {
1013
display: flex;
1114
label {
@@ -56,13 +59,13 @@
5659
}
5760

5861
.vgt-selection-info-row{
59-
background: $notify-bg-color;
62+
background: variables.$notify-bg-color;
6063
padding: 5px 16px;
6164
font-size: 13px;
62-
border-top: 1px solid $border-color;
63-
border-left: 1px solid $border-color;
64-
border-right: 1px solid $border-color;
65-
color: lighten($notify-fg-color, 10%);
65+
border-top: 1px solid variables.$border-color;
66+
border-left: 1px solid variables.$border-color;
67+
border-right: 1px solid variables.$border-color;
68+
color: color.adjust(variables.$notify-fg-color, $lightness: 10%);
6669
font-weight: bold;
6770
a{
6871
font-weight: bold;

src/styles/_input.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use "variables";
2+
13

24
.vgt-input, .vgt-select{
35
width: 100%;
@@ -7,20 +9,20 @@
79
font-size: 14px;
810
font-weight: normal;
911
padding: 6px 12px;
10-
color: $text-color;
12+
color: variables.$text-color;
1113
border-radius: 4px;
1214
box-sizing: border-box;
1315
background-image: none;
1416
background-color: #fff;
15-
border: 1px solid $input-border-color;
17+
border: 1px solid variables.$input-border-color;
1618
transition: border-color .2s cubic-bezier(.645,.045,.355,1);
1719
&::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
18-
color: $text-color;
20+
color: variables.$text-color;
1921
opacity: 0.3; /* Firefox */
2022
}
2123
&:focus{
2224
outline: none;
23-
border-color: $link-color;
25+
border-color: variables.$link-color;
2426
}
2527
}
2628

0 commit comments

Comments
 (0)