Skip to content

Commit feccbeb

Browse files
committed
feat(quasar): Add "wrap-cells" prop to QTable & QMarkupTable
1 parent c9a8358 commit feccbeb

File tree

8 files changed

+28
-11
lines changed

8 files changed

+28
-11
lines changed

docs/build/md-plugin-table.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ module.exports = function (md) {
77
const token = tokens[idx]
88

99
token.tag = 'q-markup-table'
10+
token.attrSet(':wrap-cells', 'true')
11+
1012
return self.renderToken(tokens, idx, options)
1113
}
1214

1315
md.renderer.rules.table_close = (tokens, idx, options, env, self) => {
1416
const token = tokens[idx]
1517

1618
token.tag = 'q-markup-table'
19+
1720
return self.renderToken(tokens, idx, options)
1821
}
1922

docs/src/layouts/Layout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ q-layout.doc-layout(view="hHh LpR lff", @scroll="onScroll")
6363
q-input.q-my-lg(v-model="search", filled, dense)
6464
q-icon(slot="append", name="search")
6565

66-
app-menu
66+
app-menu.q-mb-lg
6767

6868
q-drawer(
6969
v-if="hasDrawer"

quasar/dev/components/components/data-table-part1.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div class="q-layout-padding" style="max-width: 1400px;">
44
<h4>QMarkupTable</h4>
5-
<q-markup-table :separator="separator">
5+
<q-markup-table :separator="separator" wrap-cells>
66
<thead>
77
<tr>
88
<th class="text-left">Dessert (100g serving)</th>

quasar/src/components/table/QMarkupTable.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export default Vue.extend({
1212
type: String,
1313
default: 'horizontal',
1414
validator: v => ['horizontal', 'vertical', 'cell', 'none'].includes(v)
15-
}
15+
},
16+
wrapCells: Boolean
1617
},
1718

1819
computed: {
@@ -22,7 +23,8 @@ export default Vue.extend({
2223
'q-table--dark': this.dark,
2324
'q-table--dense': this.dense,
2425
'q-table--flat': this.flat,
25-
'q-table--bordered': this.bordered
26+
'q-table--bordered': this.bordered,
27+
'q-table--no-wrap': this.wrapCells === false
2628
}
2729
}
2830
},

quasar/src/components/table/QMarkupTable.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
"default": "horizontal",
2323
"values": [ "horizontal", "vertical", "cell", "none" ],
2424
"examples": [ "cell" ]
25+
},
26+
27+
"wrap-cells": {
28+
"type": "Boolean",
29+
"desc": "Wrap text within table cells"
2530
}
2631
},
2732

quasar/src/components/table/QTable.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default Vue.extend({
6060
default: 'horizontal',
6161
validator: v => ['horizontal', 'vertical', 'cell', 'none'].includes(v)
6262
},
63+
wrapCells: Boolean,
6364
binaryStateSort: Boolean,
6465
noDataLabel: String,
6566
noResultsLabel: String,
@@ -169,6 +170,7 @@ export default Vue.extend({
169170
'q-table--dense': this.computedDense,
170171
'q-table--flat': this.flat,
171172
'q-table--bordered': this.bordered,
173+
'q-table--no-wrap': this.wrapCells === false,
172174
[`q-table--${this.separator}-separator`]: true,
173175
fullscreen: this.inFullscreen,
174176
scroll: this.inFullscreen

quasar/src/components/table/QTable.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
"examples": [ "cell" ]
9292
},
9393

94+
"wrap-cells": {
95+
"type": "Boolean",
96+
"desc": "Wrap text within table cells"
97+
},
98+
9499
"binary-state-sort": {
95100
"type": "Boolean",
96101
"desc": "Skip the third state (unsorted) when user toggles column sort direction"

quasar/src/components/table/table.styl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
border-collapse collapse
99
border-spacing 0
1010

11-
thead tr
12-
height 56px
11+
thead tr, tbody td
12+
height 48px
1313

1414
th
1515
font-weight 500
@@ -30,7 +30,6 @@
3030
will-change background
3131

3232
th, td
33-
white-space nowrap
3433
padding 7px 16px
3534
background-color inherit
3635

@@ -39,7 +38,6 @@
3938
border-width 0
4039

4140
tbody td
42-
height 48px
4341
font-weight 400
4442
font-size 13px
4543

@@ -137,6 +135,10 @@
137135
&--bordered
138136
border 1px solid $table-border-color
139137

138+
.q-table--no-wrap
139+
th, td
140+
white-space nowrap
141+
140142
/*
141143
* Separators
142144
*/
@@ -188,9 +190,7 @@
188190
.q-table
189191
th, td
190192
padding 4px 8px
191-
thead tr
192-
height 40px
193-
tbody td
193+
thead tr, tbody tr, tbody td
194194
height 28px
195195
th:first-child, td:first-child
196196
padding-left 16px

0 commit comments

Comments
 (0)