5 | @php
6 | $uniqid = uniqid();
7 | $is_default = ! $getEditorMode() && ! $getViewerMode();
8 | $display = $getViewerMode() ? 'viewer' : 'editor';
9 | @endphp
10 |
11 | $is_default,
14 | 'border-radius: 0' => $getEditorMode() === true,
15 | 'border-radius: 0.5rem;' => $getViewerMode() === true,
16 | 'box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);',
17 | 'overflow: hidden;'
18 | ])
19 | x-data="{
20 | id: {{ \Illuminate\Support\Js::from($uniqid) }},
21 | state: $wire.entangle({{ \Illuminate\Support\Js::from($getStatePath()) }}),
22 | get prettyJson() {
23 | try {
24 | return window.prettyPrint(JSON.parse(this.state));
25 | } catch {
26 | return window.prettyPrint(this.state);
27 | }
28 | },
29 | display: {{ \Illuminate\Support\Js::from($is_default ? 'viewer' : $display) }}
30 | }"
31 | >
32 | @if($is_default)
33 | @include('filament-json-column::components.json-toggle')
34 | @endif
35 | @if($is_default || $getEditorMode())
36 | @include('filament-json-column::components.json-editor-content',
37 | ['uniqid' => $uniqid, 'height' => $getEditorHeight(), 'modes' => $getModes()]
38 | )
39 | @endif
40 | @if($is_default || $getViewerMode())
41 | @include('filament-json-column::components.json-viewer',
42 | ['uniqid' => $uniqid, 'height' => $getViewerHeight()]
43 | )
44 | @endif
45 |
46 |
51 |
52 |
--------------------------------------------------------------------------------
/resources/views/components/json-editor-content.blade.php:
--------------------------------------------------------------------------------
1 | @props(['uniqid', 'height', 'modes'])
2 |
3 |