Skip to content

Commit 77e8da8

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
AdminForth/1651/should-never-appear.-shrinking AdminForth/1651/should-never-appear.-shrinking
2 parents 0be0ee8 + 2d43791 commit 77e8da8

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,29 @@ list: '@/renderers/ZeroStylesRichText.vue',
583583
`ZeroStyleRichText` fits well for tasks like email templates preview fields.
584584
585585
586+
### Sensitive data blur
587+
588+
For fields containing sensitive data (like passwords, API keys, tokens, or other confidential values), use the `SensitiveBlurCell` renderer. It blurs the value by default and reveals it on click.
589+
590+
```ts title='./resources/anyResource.ts'
591+
columns: [
592+
...
593+
{
594+
name: 'api_key',
595+
//diff-add
596+
components: {
597+
//diff-add
598+
show: '@/renderers/SensitiveBlurCell.vue',
599+
//diff-add
600+
list: '@/renderers/SensitiveBlurCell.vue',
601+
//diff-add
602+
},
603+
...
604+
```
605+
606+
The renderer wraps the standard value output and adds a click-to-reveal blur effect. Clicking again hides the value.
607+
608+
586609
### Custom filter component for square meters
587610
588611
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<div class="inline-flex items-center gap-1">
3+
<div
4+
class="overflow-hidden max-w-[200px] max-h-[20px] rounded-default"
5+
:title="show ? $t('Click to hide') : $t('Click to show')"
6+
@click="toggle"
7+
>
8+
<span
9+
class="cursor-pointer select-none transition-all duration-200 text-lightListTableText dark:text-darkListTableText"
10+
:class="{
11+
'blur-[7px] hover:blur-[5px] brightness-50 dark:brightness-150': !show,
12+
}"
13+
>
14+
<ValueRenderer :column="column" :record="record" />
15+
</span>
16+
</div>
17+
</div>
18+
</template>
19+
20+
<script setup lang="ts">
21+
import { ref } from 'vue';
22+
import ValueRenderer from '@/components/ValueRenderer.vue';
23+
import type { AdminForthResourceColumnCommon, AdminForthResourceCommon, AdminUser } from '@/types/Common';
24+
25+
const props = defineProps<{
26+
column: AdminForthResourceColumnCommon;
27+
record: any;
28+
meta: any;
29+
resource: AdminForthResourceCommon;
30+
adminUser: AdminUser;
31+
}>();
32+
33+
const show = ref(false);
34+
35+
function toggle(event: MouseEvent) {
36+
show.value = !show.value;
37+
event.stopPropagation();
38+
}
39+
</script>

0 commit comments

Comments
 (0)