Skip to content

Commit d493298

Browse files
authored
chore(docs): add missing table docs for cell scope property fields (bootstrap-vue#4246)
1 parent 694dad7 commit d493298

File tree

3 files changed

+94
-27
lines changed

3 files changed

+94
-27
lines changed

docs/components/componentdoc.vue

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<b-row tag="header" align-v="center">
44
<b-col sm="9">
55
<anchored-heading :id="`comp-ref-${componentName}`" level="3">
6-
<code class="notranslate" translate="no">{{ tag }}</code>
6+
<code class="notranslate bigger" translate="no">{{ tag }}</code>
77
</anchored-heading>
88
<b-badge
99
v-if="componentFunctional"
@@ -21,8 +21,42 @@
2121
</b-col>
2222
</b-row>
2323

24+
<ul class="component-ref-mini-toc my-3">
25+
<li v-if="aliases && aliases.length > 0">
26+
<a :href="`#comp-ref-${componentName}-aliases`">
27+
<code class="notranslate" translate="no">{{ tag }}</code> Component aliases
28+
</a>
29+
</li>
30+
<li v-if="propsItems && propsItems.length > 0">
31+
<a :href="`#comp-ref-${componentName}-props`">
32+
<code class="notranslate" translate="no">{{ tag }}</code> Properties
33+
</a>
34+
</li>
35+
<li v-if="componentVModel">
36+
<a :href="`#comp-ref-${componentName}-v-model`">
37+
<code class="notranslate" translate="no">{{ tag }}</code> v-model
38+
</a>
39+
</li>
40+
<li v-if="slots && slots.length > 0">
41+
<a :href="`#comp-ref-${componentName}-slots`">
42+
<code class="notranslate" translate="no">{{ tag }}</code> Slots
43+
</a>
44+
</li>
45+
<li v-if="events && events.length > 0">
46+
<a :href="`#comp-ref-${componentName}-events`">
47+
<code class="notranslate" translate="no">{{ tag }}</code> Events
48+
</a>
49+
</li>
50+
<li v-if="rootEventListeners && rootEventListeners.length > 0">
51+
<a :href="`#comp-ref-${componentName}-rootEventListeners`">
52+
<code class="notranslate" translate="no">{{ tag }}</code>
53+
<code class="notranslate" translate="no">$root</code> Event Listeners
54+
</a>
55+
</li>
56+
</ul>
57+
2458
<article v-if="aliases && aliases.length > 0" class="bd-content">
25-
<anchored-heading :id="`comp-ref-${componentName}-aliases`" level="4">
59+
<anchored-heading :id="`comp-ref-${componentName}-aliases`" level="4" class="mb-3">
2660
Component aliases
2761
</anchored-heading>
2862
<p><code class="notranslate" translate="no">{{ tag }}</code> can also be used via the following aliases:</p>
@@ -40,7 +74,7 @@
4074
</article>
4175

4276
<article v-if="propsItems && propsItems.length > 0" class="bd-content">
43-
<anchored-heading :id="`comp-ref-${componentName}-props`" level="4">
77+
<anchored-heading :id="`comp-ref-${componentName}-props`" level="4" class="mb-3">
4478
Properties
4579
</anchored-heading>
4680
<b-table
@@ -100,7 +134,7 @@
100134
</article>
101135

102136
<article v-if="componentVModel" class="bd-content">
103-
<anchored-heading :id="`comp-ref-${componentName}-v-model`" level="4">
137+
<anchored-heading :id="`comp-ref-${componentName}-v-model`" level="4" class="mb-3">
104138
v-model
105139
</anchored-heading>
106140
<b-table-lite
@@ -120,7 +154,7 @@
120154
</article>
121155

122156
<article v-if="slots && slots.length > 0" class="bd-content">
123-
<anchored-heading :id="`comp-ref-${componentName}-slots`" level="4">
157+
<anchored-heading :id="`comp-ref-${componentName}-slots`" level="4" class="mb-3">
124158
Slots
125159
</anchored-heading>
126160
<b-table
@@ -132,8 +166,9 @@
132166
sort-icon-left
133167
striped
134168
>
135-
<template v-slot:cell(name)="{ value }">
169+
<template v-slot:cell(name)="{ value, item }">
136170
<code class="text-nowrap notranslate" translate="no">{{ value }}</code>
171+
<b-badge v-if="item.version" variant="secondary">v{{ item.version }}+</b-badge>
137172
</template>
138173
<template v-slot:cell(scope)="{ value, toggleDetails }">
139174
<b-button
@@ -170,8 +205,9 @@
170205
</b-th>
171206
</b-tr>
172207
</template>
173-
<template v-slot:cell(prop)="{ value }">
208+
<template v-slot:cell(prop)="{ value, item }">
174209
<code class="text-nowrap notranslate" translate="no">{{ value }}</code>
210+
<b-badge v-if="item.version" variant="secondary">v{{ item.version }}+</b-badge>
175211
</template>
176212
<template v-slot:cell(type)="{ value }">
177213
<span v-if="value" class="text-nowrap notranslate" translate="no">{{ value }}</span>
@@ -184,7 +220,7 @@
184220
</article>
185221

186222
<article v-if="events && events.length > 0" class="bd-content">
187-
<anchored-heading :id="`comp-ref-${componentName}-events`" level="4">
223+
<anchored-heading :id="`comp-ref-${componentName}-events`" level="4" class="mb-3">
188224
Events
189225
</anchored-heading>
190226
<b-table
@@ -195,8 +231,9 @@
195231
responsive="sm"
196232
striped
197233
>
198-
<template v-slot:cell(event)="{ value }">
234+
<template v-slot:cell(event)="{ value, item }">
199235
<code class="notranslate" translate="no">{{ value }}</code>
236+
<b-badge v-if="item.version" variant="secondary">v{{ item.version }}+</b-badge>
200237
</template>
201238
<template v-slot:cell(args)="{ value, item }">
202239
<p
@@ -214,7 +251,7 @@
214251
</article>
215252

216253
<article v-if="rootEventListeners && rootEventListeners.length > 0" class="bd-content">
217-
<anchored-heading :id="`comp-ref-${componentName}-rootEventListeners`" level="4">
254+
<anchored-heading :id="`comp-ref-${componentName}-rootEventListeners`" level="4" class="mb-3">
218255
<code class="notranslate" translate="no">$root</code> Event Listeners
219256
</anchored-heading>
220257
<p>
@@ -229,8 +266,9 @@
229266
responsive="sm"
230267
striped
231268
>
232-
<template v-slot:cell(event)="{ value }">
269+
<template v-slot:cell(event)="{ value, item }">
233270
<code class="text-nowrap notranslate" translate="no">{{ value }}</code>
271+
<b-badge v-if="item.version" variant="secondary">v{{ item.version }}+</b-badge>
234272
</template>
235273
<template v-slot:cell(args)="{ value, item }">
236274
<p
@@ -257,6 +295,14 @@ h3::before {
257295
content: '';
258296
}
259297
298+
code.bigger {
299+
font-size: 105%;
300+
}
301+
302+
ul.component-ref-mini-toc:empty {
303+
display: none;
304+
}
305+
260306
/deep/ .word-wrap-normal {
261307
white-space: normal !important;
262308
word-break: normal !important;

src/components/table/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ The slot's scope variable (`data` in the above sample) will have the following p
890890
| `item` | Object | The entire raw record data (i.e. `items[index]`) for this row (before any formatter is applied) |
891891
| `value` | Any | The value for this key in the record (`null` or `undefined` if a virtual column), or the output of the field's [`formatter` function](#formatter-callback) |
892892
| `unformatted` | Any | The raw value for this key in the item record (`null` or `undefined` if a virtual column), before being passed to the field's [`formatter` function](#formatter-callback) |
893+
| `field` | Object | The field's normalized field definition object |
893894
| `detailsShowing` | Boolean | Will be `true` if the row's `row-details` scoped slot is visible. See section [Row details support](#row-details-support) below for additional information |
894895
| `toggleDetails` | Function | Can be called to toggle the visibility of the rows `row-details` scoped slot. See section [Row details support](#row-details-support) below for additional information |
895896
| `rowSelected` | Boolean | Will be `true` if the row has been selected. See section [Row select support](#row-select-support) for additional information |

src/components/table/package.json

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@
518518
"prop": "unformatted",
519519
"description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function"
520520
},
521+
{
522+
"prop": "field",
523+
"type": "Object",
524+
"description": "The field's normalized definition object (from the fields prop)"
525+
},
521526
{
522527
"prop": "detailsShowing",
523528
"type": "Boolean",
@@ -557,6 +562,11 @@
557562
"prop": "unformatted",
558563
"description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function"
559564
},
565+
{
566+
"prop": "field",
567+
"type": "Object",
568+
"description": "The field's normalized definition object (from the fields prop)"
569+
},
560570
{
561571
"prop": "detailsShowing",
562572
"type": "Boolean",
@@ -587,7 +597,7 @@
587597
{
588598
"prop": "field",
589599
"type": "Object",
590-
"description": "the field's definition object (from the fields prop)"
600+
"description": "The field's normalized definition object (from the fields prop)"
591601
},
592602
{
593603
"prop": "label",
@@ -623,7 +633,7 @@
623633
{
624634
"prop": "field",
625635
"type": "Object",
626-
"description": "the field's definition object (from the fields prop)"
636+
"description": "The field's normalized definition object (from the fields prop)"
627637
},
628638
{
629639
"prop": "label",
@@ -660,7 +670,7 @@
660670
{
661671
"prop": "field",
662672
"type": "Object",
663-
"description": "the field's definition object (from the fields prop)"
673+
"description": "The field's normalized definition object (from the fields prop)"
664674
},
665675
{
666676
"prop": "label",
@@ -691,7 +701,7 @@
691701
{
692702
"prop": "field",
693703
"type": "Object",
694-
"description": "the field's definition object (from the fields prop)"
704+
"description": "The field's normalized definition object (from the fields prop)"
695705
},
696706
{
697707
"prop": "label",
@@ -721,7 +731,7 @@
721731
{
722732
"prop": "columns",
723733
"type": "Number",
724-
"description": "the number of columns in the table"
734+
"description": "The number of columns in the table"
725735
},
726736
{
727737
"prop": "fields",
@@ -839,7 +849,7 @@
839849
{
840850
"prop": "columns",
841851
"type": "Number",
842-
"description": "the number of columns in the table"
852+
"description": "The number of columns in the table"
843853
},
844854
{
845855
"prop": "fields",
@@ -865,7 +875,7 @@
865875
{
866876
"prop": "columns",
867877
"type": "Number",
868-
"description": "the number of columns in the table"
878+
"description": "The number of columns in the table"
869879
},
870880
{
871881
"prop": "fields",
@@ -881,7 +891,7 @@
881891
{
882892
"prop": "columns",
883893
"type": "Number",
884-
"description": "the number of columns in the table"
894+
"description": "The number of columns in the table"
885895
},
886896
{
887897
"prop": "fields",
@@ -897,7 +907,7 @@
897907
{
898908
"prop": "columns",
899909
"type": "Number",
900-
"description": "the number of columns in the table"
910+
"description": "The number of columns in the table"
901911
},
902912
{
903913
"prop": "fields",
@@ -1224,6 +1234,11 @@
12241234
"prop": "unformatted",
12251235
"description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function"
12261236
},
1237+
{
1238+
"prop": "field",
1239+
"type": "Object",
1240+
"description": "The field's normalized definition object (from the fields prop)"
1241+
},
12271242
{
12281243
"prop": "detailsShowing",
12291244
"type": "Boolean",
@@ -1258,6 +1273,11 @@
12581273
"prop": "unformatted",
12591274
"description": "The raw value for this key in the item record (null or undefined if a virtual column), before being passed to the field's formatter function"
12601275
},
1276+
{
1277+
"prop": "field",
1278+
"type": "Object",
1279+
"description": "The field's normalized definition object (from the fields prop)"
1280+
},
12611281
{
12621282
"prop": "detailsShowing",
12631283
"type": "Boolean",
@@ -1283,7 +1303,7 @@
12831303
{
12841304
"prop": "field",
12851305
"type": "Object",
1286-
"description": "the field's definition object (from the fields prop)"
1306+
"description": "The field's normalized definition object (from the fields prop)"
12871307
},
12881308
{
12891309
"prop": "label",
@@ -1309,7 +1329,7 @@
13091329
{
13101330
"prop": "field",
13111331
"type": "Object",
1312-
"description": "the field's definition object (from the fields prop)"
1332+
"description": "The field's normalized definition object (from the fields prop)"
13131333
},
13141334
{
13151335
"prop": "label",
@@ -1336,7 +1356,7 @@
13361356
{
13371357
"prop": "field",
13381358
"type": "Object",
1339-
"description": "the field's definition object (from the fields prop)"
1359+
"description": "The field's normalized definition object (from the fields prop)"
13401360
},
13411361
{
13421362
"prop": "label",
@@ -1357,7 +1377,7 @@
13571377
{
13581378
"prop": "field",
13591379
"type": "Object",
1360-
"description": "the field's definition object (from the fields prop)"
1380+
"description": "The field's normalized definition object (from the fields prop)"
13611381
},
13621382
{
13631383
"prop": "label",
@@ -1377,7 +1397,7 @@
13771397
{
13781398
"prop": "columns",
13791399
"type": "Number",
1380-
"description": "the number of columns in the table"
1400+
"description": "The number of columns in the table"
13811401
},
13821402
{
13831403
"prop": "fields",
@@ -1419,7 +1439,7 @@
14191439
{
14201440
"prop": "columns",
14211441
"type": "Number",
1422-
"description": "the number of columns in the table"
1442+
"description": "The number of columns in the table"
14231443
},
14241444
{
14251445
"prop": "fields",
@@ -1445,7 +1465,7 @@
14451465
{
14461466
"prop": "columns",
14471467
"type": "Number",
1448-
"description": "the number of columns in the table"
1468+
"description": "The number of columns in the table"
14491469
},
14501470
{
14511471
"prop": "fields",

0 commit comments

Comments
 (0)