Further read only settings

This commit is contained in:
Mel O'Hagan 2023-11-01 16:01:45 +00:00
parent 5c36d70a01
commit 56d5a0b8f6
8 changed files with 75 additions and 2 deletions

View File

@ -8,6 +8,7 @@
export let id = null
export let text = null
export let disabled = false
export let readonly = false
export let size
export let indeterminate = false
@ -29,6 +30,11 @@
checked={value}
{disabled}
on:change={onChange}
on:click={e => {
if (readonly) {
e.preventDefault()
}
}}
type="checkbox"
class="spectrum-Checkbox-input"
{id}

View File

@ -9,6 +9,7 @@
export let id = null
export let disabled = false
export let readonly = false
export let error = null
export let enableTime = true
export let value = null
@ -186,7 +187,7 @@
>
<div
id={flatpickrId}
class:is-disabled={disabled}
class:is-disabled={disabled || readonly}
class:is-invalid={!!error}
class="flatpickr spectrum-InputGroup spectrum-Datepicker"
class:is-focused={open}
@ -211,6 +212,7 @@
{/if}
<input
{disabled}
{readonly}
data-input
type="text"
class="spectrum-Textfield-input spectrum-InputGroup-input"

View File

@ -7,6 +7,7 @@
export let label = null
export let labelPosition = "above"
export let disabled = false
export let readonly = false
export let error = null
export let enableTime = true
export let timeOnly = false
@ -33,6 +34,7 @@
<DatePicker
{error}
{disabled}
{readonly}
{value}
{placeholder}
{enableTime}

View File

@ -2851,6 +2851,17 @@
"key": "disabled",
"defaultValue": false
},
{
"type": "boolean",
"label": "Read only",
"key": "readonly",
"defaultValue": false,
"dependsOn": {
"setting": "disabled",
"value": true,
"invert": true
}
},
{
"type": "validation/number",
"label": "Validation",
@ -3392,6 +3403,17 @@
"key": "disabled",
"defaultValue": false
},
{
"type": "boolean",
"label": "Read only",
"key": "readonly",
"defaultValue": false,
"dependsOn": {
"setting": "disabled",
"value": true,
"invert": true
}
},
{
"type": "validation/boolean",
"label": "Validation",
@ -3563,6 +3585,17 @@
"key": "disabled",
"defaultValue": false
},
{
"type": "boolean",
"label": "Read only",
"key": "readonly",
"defaultValue": false,
"dependsOn": {
"setting": "disabled",
"value": true,
"invert": true
}
},
{
"type": "validation/datetime",
"label": "Validation",
@ -3836,7 +3869,7 @@
},
{
"type": "boolean",
"label": "Disabled",
"label": "Read only",
"key": "disabled",
"defaultValue": false
},
@ -3912,6 +3945,17 @@
"label": "Disabled",
"key": "disabled",
"defaultValue": false
},
{
"type": "boolean",
"label": "Read only",
"key": "readonly",
"defaultValue": false,
"dependsOn": {
"setting": "disabled",
"value": true,
"invert": true
}
}
]
},
@ -3964,6 +4008,17 @@
"label": "Disabled",
"key": "disabled",
"defaultValue": false
},
{
"type": "boolean",
"label": "Read only",
"key": "readonly",
"defaultValue": false,
"dependsOn": {
"setting": "disabled",
"value": true,
"invert": true
}
}
]
},

View File

@ -6,6 +6,7 @@
export let label
export let text
export let disabled = false
export let readonly = false
export let size
export let validation
export let defaultValue
@ -49,6 +50,7 @@
<CoreCheckbox
value={fieldState.value}
disabled={fieldState.disabled}
{readonly}
error={fieldState.error}
id={fieldState.fieldId}
{size}

View File

@ -6,6 +6,7 @@
export let label
export let placeholder
export let disabled = false
export let readonly = false
export let enableTime = true
export let timeOnly = false
export let time24hr = false
@ -40,6 +41,7 @@
value={fieldState.value}
on:change={handleChange}
disabled={fieldState.disabled}
{readonly}
error={fieldState.error}
id={fieldState.fieldId}
appendTo={document.getElementById("flatpickr-root")}

View File

@ -7,6 +7,7 @@
export let label
export let placeholder
export let disabled = false
export let readonly = false
export let defaultValue = ""
export let onChange
@ -60,6 +61,7 @@
value={serialiseValue(fieldState.value)}
on:change={handleChange}
disabled={fieldState.disabled}
{readonly}
error={fieldState.error}
id={fieldState.fieldId}
{placeholder}

View File

@ -11,6 +11,7 @@
export let label
export let placeholder
export let disabled = false
export let readonly = false
export let validation
export let autocomplete = true
export let defaultValue
@ -200,6 +201,7 @@
on:loadMore={loadMore}
id={fieldState.fieldId}
disabled={fieldState.disabled}
{readonly}
error={fieldState.error}
getOptionLabel={getDisplayName}
getOptionValue={option => option._id}