|
142 | 142 | <Panel bind:open variant="unelevated" disabled={!enabled} class={hasRequired ? "has-required" : undefined}> |
143 | 143 | <Header> |
144 | 144 | {#if !hasRequired} |
145 | | - <IconButton type="button" toggle bind:pressed={enabled} size="button" on:click={stop}> |
| 145 | + <IconButton |
| 146 | + type="button" |
| 147 | + toggle |
| 148 | + disabled={$uiOptions.readonly} |
| 149 | + bind:pressed={enabled} |
| 150 | + size="button" |
| 151 | + on:click={stop} |
| 152 | + > |
146 | 153 | <Icon class="material-icons" on>check_box</Icon> |
147 | 154 | <Icon class="material-icons">check_box_outline_blank</Icon> |
148 | 155 | </IconButton> |
149 | 156 | {/if} |
150 | 157 | <span class="control-array-title">{title ?? ""}</span> |
151 | 158 | <svelte:fragment slot="description">{description ?? ""}</svelte:fragment> |
152 | 159 | <div slot="icon"> |
153 | | - {#if canAddItem} |
| 160 | + {#if canAddItem && !$uiOptions.readonly} |
154 | 161 | <IconButton type="button" class="material-icons" on:click={headerAddItem} size="button">add</IconButton> |
155 | 162 | {/if} |
156 | 163 | <IconButton type="button" toggle pressed={open} size="button"> |
|
172 | 179 | force |
173 | 180 | /> |
174 | 181 | </div> |
175 | | - <div class="control-array-item-actions"> |
176 | | - <IconButton |
177 | | - type="button" |
178 | | - on:click={() => moveItemUp(index)} |
179 | | - class="material-icons" |
180 | | - size="button" |
181 | | - disabled={!canMoveItemUp(index)} |
182 | | - >keyboard_arrow_up</IconButton> |
183 | | - <!-- {#if canRemoveItem(index)} |
184 | | - <Fab mini on:click={() => removeItem(index)}> |
185 | | - <Icon class="material-icons">delete</Icon> |
186 | | - </Fab> |
187 | | - {/if} --> |
188 | | - <IconButton |
189 | | - type="button" |
190 | | - on:click={() => removeItem(index)} |
191 | | - class="material-icons" |
192 | | - size="button" |
193 | | - disabled={!canRemoveItem(index)} |
194 | | - >delete</IconButton> |
195 | | - <IconButton |
196 | | - type="button" |
197 | | - on:click={() => moveItemDown(index)} |
198 | | - class="material-icons" |
199 | | - size="button" |
200 | | - disabled={!canMoveItemDown(index)} |
201 | | - >keyboard_arrow_down</IconButton> |
202 | | - </div> |
| 182 | + {#if !$uiOptions.readonly} |
| 183 | + <div class="control-array-item-actions"> |
| 184 | + <IconButton |
| 185 | + type="button" |
| 186 | + on:click={() => moveItemUp(index)} |
| 187 | + class="material-icons" |
| 188 | + size="button" |
| 189 | + disabled={!canMoveItemUp(index)} |
| 190 | + >keyboard_arrow_up</IconButton> |
| 191 | + <!-- {#if canRemoveItem(index)} |
| 192 | + <Fab mini on:click={() => removeItem(index)}> |
| 193 | + <Icon class="material-icons">delete</Icon> |
| 194 | + </Fab> |
| 195 | + {/if} --> |
| 196 | + <IconButton |
| 197 | + type="button" |
| 198 | + on:click={() => removeItem(index)} |
| 199 | + class="material-icons" |
| 200 | + size="button" |
| 201 | + disabled={!canRemoveItem(index)} |
| 202 | + >delete</IconButton> |
| 203 | + <IconButton |
| 204 | + type="button" |
| 205 | + on:click={() => moveItemDown(index)} |
| 206 | + class="material-icons" |
| 207 | + size="button" |
| 208 | + disabled={!canMoveItemDown(index)} |
| 209 | + >keyboard_arrow_down</IconButton> |
| 210 | + </div> |
| 211 | + {/if} |
203 | 212 | </li> |
204 | 213 | {/each} |
205 | 214 | {/if} |
|
0 commit comments