|
8 | 8 | * @type {{ |
9 | 9 | * item: any, |
10 | 10 | * columns: import('$commonTypes').TableItemConfig[], |
11 | | - * detailKey?: string | null, |
12 | 11 | * useJsonDisplay?: boolean, |
13 | 12 | * open?: boolean |
14 | 13 | * }} |
15 | 14 | */ |
16 | 15 | let { |
17 | 16 | item, |
18 | 17 | columns, |
19 | | - detailKey = null, |
20 | 18 | useJsonDisplay = false, |
21 | 19 | open = $bindable(false) |
22 | 20 | } = $props(); |
|
49 | 47 | {/if} |
50 | 48 | <td class="knowledge-op"> |
51 | 49 | <ul class="list-unstyled hstack gap-1 mb-0 knowledge-op-list"> |
52 | | - {#if detailKey} |
53 | 50 | <li data-bs-toggle="tooltip" data-bs-placement="top" title="View Detail"> |
54 | 51 | <button |
55 | 52 | class="btn btn-sm btn-soft-primary" |
|
62 | 59 | {/if} |
63 | 60 | </button> |
64 | 61 | </li> |
65 | | - {/if} |
66 | 62 | </ul> |
67 | 63 | </td> |
68 | 64 | </tr> |
|
94 | 90 | in:fly={{ y: -5, duration: 300 }} |
95 | 91 | out:fly={{ y: -5, duration: 200 }} |
96 | 92 | > |
97 | | - {#if detailKey && item[detailKey]} |
98 | | - {#if useJsonDisplay} |
99 | | - <JSONTree |
100 | | - value={formatObject(item[detailKey])} |
101 | | - defaultExpandedLevel={1} |
102 | | - --json-tree-number-color="var(--bs-info)" |
103 | | - --json-tree-boolean-color="var(--bs-info)" |
104 | | - --json-tree-string-color="var(--bs-info)" |
105 | | - /> |
106 | | - {:else} |
107 | | - {#each Object.keys(item[detailKey]) as key, idx (idx)} |
108 | | - <li class="more-detail-item wrappable"> |
109 | | - <span>{splitTextByCase(key)}: </span> |
110 | | - <span>{item[detailKey][key]}</span> |
111 | | - </li> |
112 | | - {/each} |
113 | | - {/if} |
| 93 | + {#if useJsonDisplay} |
| 94 | + <JSONTree |
| 95 | + value={formatObject(item)} |
| 96 | + defaultExpandedLevel={1} |
| 97 | + --json-tree-number-color="var(--bs-info)" |
| 98 | + --json-tree-boolean-color="var(--bs-info)" |
| 99 | + --json-tree-string-color="var(--bs-info)" |
| 100 | + /> |
| 101 | + {:else} |
| 102 | + {#each Object.keys(item).filter(key => !columns.some(col => col.dataName === key)) as key, idx (idx)} |
| 103 | + <li class="more-detail-item wrappable"> |
| 104 | + <span>{splitTextByCase(key)}: </span> |
| 105 | + <span>{item[key]}</span> |
| 106 | + </li> |
| 107 | + {/each} |
114 | 108 | {/if} |
115 | 109 | </ul> |
116 | 110 | {/if} |
|
0 commit comments