Skip to content

Commit 12b85c0

Browse files
committed
Improve AutoViewForm styles
1 parent 96921e6 commit 12b85c0

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

src/components/AutoViewForm.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
</div>
4242
</div>
4343
</div>
44-
<MarkupModel :value="model" />
44+
<div>
45+
<MarkupModel :value="model" />
46+
</div>
4547
</div>
4648
</div>
4749
<div :class="form.buttonsClass">

src/components/MarkupModel.vue

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<template>
2-
<table class="my-2 w-full">
3-
<tr v-for="(v,k) in basic" class="leading-7">
4-
<th class="px-2 text-left align-top">{{humanize(k as string)}}</th>
5-
<td colspan="align-top"><MarkupFormat :value="v" /></td>
6-
</tr>
7-
<template v-for="(v,k) in complex">
8-
<tr class="my-2 leading-7">
9-
<td colspan="2" class="px-2 bg-indigo-700 text-white">{{humanize(k as string)}}</td>
10-
</tr>
11-
<tr class="leading-7">
12-
<td colspan="2" class="px-2 align-top"><MarkupFormat :value="v" /></td>
13-
</tr>
14-
</template>
2+
<table :class="props.tableClass ?? 'my-2 w-full'">
3+
<tbody>
4+
<tr v-for="(v,k) in basic" :class="props.basicTrClass ?? 'leading-7'">
5+
<th :class="props.basicThClass ?? 'px-2 text-left align-top'">{{humanize(k as string)}}</th>
6+
<td :class="props.basicTdClass ?? 'align-top'"><MarkupFormat :value="v" /></td>
7+
</tr>
8+
<template v-for="(v,k) in complex">
9+
<tr :class="props.complexTitleTrClass ?? 'my-2 leading-7'">
10+
<th colspan="2" :class="props.complexTitleTdClass ?? 'px-2 bg-indigo-700 text-white'">{{humanize(k as string)}}</th>
11+
</tr>
12+
<tr :class="props.complexBodyTrClass ?? 'leading-7'">
13+
<td colspan="2" :class="props.complexBodyTdClass ?? 'px-2 align-top'"><MarkupFormat :value="v" /></td>
14+
</tr>
15+
</template>
16+
</tbody>
1517
</table>
1618
</template>
1719

src/components/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@ export interface MarkupFormatProps {
449449
export interface MarkupModelProps {
450450
value: any,
451451
imageClass?: string
452+
tableClass?: string
453+
basicTrClass?: string
454+
basicThClass?: string
455+
basicTdClass?: string
456+
complexTitleTrClass?: string
457+
complexTitleTdClass?: string
458+
complexBodyTrClass?: string
459+
complexBodyTdClass?: string
452460
}
453461

454462
// Additional Components

0 commit comments

Comments
 (0)