From 5c049e0465ca27ed078e3ffda4c5c91998ba97cd Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 1 Nov 2023 13:54:18 +0000 Subject: [PATCH 01/12] LongFormField readonly prop --- .../bbui/src/Form/Core/RichTextField.svelte | 2 ++ packages/bbui/src/Form/Core/TextArea.svelte | 2 ++ .../bbui/src/Markdown/MarkdownEditor.svelte | 5 ++- packages/client/manifest.json | 33 +++++++++++++++++++ .../components/app/forms/LongFormField.svelte | 3 ++ .../components/app/forms/StringField.svelte | 2 ++ 6 files changed, 46 insertions(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/RichTextField.svelte b/packages/bbui/src/Form/Core/RichTextField.svelte index f964405f0d..3e0b0caf4d 100644 --- a/packages/bbui/src/Form/Core/RichTextField.svelte +++ b/packages/bbui/src/Form/Core/RichTextField.svelte @@ -4,6 +4,7 @@ export let value = "" export let placeholder = null export let disabled = false + export let readonly = false export let error = null export let height = null export let id = null @@ -20,6 +21,7 @@ {fullScreenOffset} {disabled} {easyMDEOptions} + {readonly} on:change /> diff --git a/packages/bbui/src/Form/Core/TextArea.svelte b/packages/bbui/src/Form/Core/TextArea.svelte index 465212cd44..be7eed466d 100644 --- a/packages/bbui/src/Form/Core/TextArea.svelte +++ b/packages/bbui/src/Form/Core/TextArea.svelte @@ -5,6 +5,7 @@ export let value = "" export let placeholder = null export let disabled = false + export let readonly = false export let error = null export let id = null export let height = null @@ -61,6 +62,7 @@ class="spectrum-Textfield-input" style={align ? `text-align: ${align}` : ""} {disabled} + {readonly} {id} on:focus={() => (focus = true)} on:blur={onChange} diff --git a/packages/bbui/src/Markdown/MarkdownEditor.svelte b/packages/bbui/src/Markdown/MarkdownEditor.svelte index 7fb6414ad8..27035d8033 100644 --- a/packages/bbui/src/Markdown/MarkdownEditor.svelte +++ b/packages/bbui/src/Markdown/MarkdownEditor.svelte @@ -8,6 +8,7 @@ export let id = null export let fullScreenOffset = 0 export let disabled = false + export let readonly = false export let easyMDEOptions const dispatch = createEventDispatcher() @@ -19,6 +20,7 @@ // control $: checkValue(value) $: mde?.codemirror.on("change", debouncedUpdate) + $: mde?.codemirror.setOption("readOnly", readonly) const checkValue = val => { if (mde && val !== latestValue) { @@ -43,7 +45,7 @@ const debouncedUpdate = debounce(update, 250) -{#key height} +{#key (height, readonly)} diff --git a/packages/client/manifest.json b/packages/client/manifest.json index eef1e50b7c..6e175c44de 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -2589,6 +2589,17 @@ "key": "disabled", "defaultValue": false }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, { "type": "text", "label": "Initial form step", @@ -2738,6 +2749,17 @@ "key": "disabled", "defaultValue": false }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, { "type": "validation/string", "label": "Validation", @@ -3427,6 +3449,17 @@ "key": "disabled", "defaultValue": false }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, { "type": "validation/string", "label": "Validation", diff --git a/packages/client/src/components/app/forms/LongFormField.svelte b/packages/client/src/components/app/forms/LongFormField.svelte index 8d94f83319..8482a6a68e 100644 --- a/packages/client/src/components/app/forms/LongFormField.svelte +++ b/packages/client/src/components/app/forms/LongFormField.svelte @@ -8,6 +8,7 @@ export let label export let placeholder export let disabled = false + export let readonly = false export let validation export let defaultValue = "" export let format = "auto" @@ -71,6 +72,7 @@ value={fieldState.value} on:change={handleChange} disabled={fieldState.disabled} + {readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} @@ -88,6 +90,7 @@ value={fieldState.value} on:change={handleChange} disabled={fieldState.disabled} + {readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} diff --git a/packages/client/src/components/app/forms/StringField.svelte b/packages/client/src/components/app/forms/StringField.svelte index 26136b5d8d..624611c733 100644 --- a/packages/client/src/components/app/forms/StringField.svelte +++ b/packages/client/src/components/app/forms/StringField.svelte @@ -11,6 +11,7 @@ export let defaultValue = "" export let align export let onChange + export let readonly = false let fieldState let fieldApi @@ -44,6 +45,7 @@ {placeholder} {type} {align} + {readonly} /> {/if} From 5c36d70a0116624acadc20865a7bba6f76d46d1d Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 1 Nov 2023 14:56:28 +0000 Subject: [PATCH 02/12] Pickers readonly prop --- .../bbui/src/Form/Core/CheckboxGroup.svelte | 6 +++++ packages/bbui/src/Form/Core/RadioGroup.svelte | 6 +++++ packages/client/manifest.json | 22 +++++++++++++++++++ .../app/forms/MultiFieldSelect.svelte | 3 +++ .../components/app/forms/OptionsField.svelte | 3 +++ 5 files changed, 40 insertions(+) diff --git a/packages/bbui/src/Form/Core/CheckboxGroup.svelte b/packages/bbui/src/Form/Core/CheckboxGroup.svelte index 2b8a1e438a..faf37f3ad8 100644 --- a/packages/bbui/src/Form/Core/CheckboxGroup.svelte +++ b/packages/bbui/src/Form/Core/CheckboxGroup.svelte @@ -8,6 +8,7 @@ export let options = [] export let error = null export let disabled = false + export let readonly = false export let getOptionLabel = option => option export let getOptionValue = option => option @@ -40,6 +41,11 @@ > { + if (readonly) { + e.preventDefault() + } + }} type="checkbox" class="spectrum-Checkbox-input" value={optionValue} diff --git a/packages/bbui/src/Form/Core/RadioGroup.svelte b/packages/bbui/src/Form/Core/RadioGroup.svelte index f7afc10bbc..fc99fafd40 100644 --- a/packages/bbui/src/Form/Core/RadioGroup.svelte +++ b/packages/bbui/src/Form/Core/RadioGroup.svelte @@ -8,6 +8,7 @@ export let options = [] export let error = null export let disabled = false + export let readonly = false export let getOptionLabel = option => option export let getOptionValue = option => option export let getOptionTitle = option => option @@ -43,6 +44,11 @@ > { + if (readonly) { + e.preventDefault() + } + }} bind:group={value} value={getOptionValue(option)} type="radio" diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 6e175c44de..90c897139c 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3071,6 +3071,17 @@ "key": "disabled", "defaultValue": false }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, { "type": "select", "label": "Options source", @@ -3196,6 +3207,17 @@ "key": "disabled", "defaultValue": false }, + { + "type": "boolean", + "label": "Read only", + "key": "readonly", + "defaultValue": false, + "dependsOn": { + "setting": "disabled", + "value": true, + "invert": true + } + }, { "type": "select", "label": "Type", diff --git a/packages/client/src/components/app/forms/MultiFieldSelect.svelte b/packages/client/src/components/app/forms/MultiFieldSelect.svelte index 88e1ec5a8e..cb4879f86e 100644 --- a/packages/client/src/components/app/forms/MultiFieldSelect.svelte +++ b/packages/client/src/components/app/forms/MultiFieldSelect.svelte @@ -6,6 +6,7 @@ export let label export let placeholder export let disabled = false + export let readonly = false export let validation export let defaultValue export let optionsSource = "schema" @@ -71,6 +72,7 @@ getOptionValue={flatOptions ? x => x : x => x.value} id={fieldState.fieldId} disabled={fieldState.disabled} + {readonly} on:change={handleChange} {placeholder} {options} @@ -81,6 +83,7 @@ value={fieldState.value || []} id={fieldState.fieldId} disabled={fieldState.disabled} + {readonly} error={fieldState.error} {options} {direction} diff --git a/packages/client/src/components/app/forms/OptionsField.svelte b/packages/client/src/components/app/forms/OptionsField.svelte index 3c229c0509..c01827471a 100644 --- a/packages/client/src/components/app/forms/OptionsField.svelte +++ b/packages/client/src/components/app/forms/OptionsField.svelte @@ -6,6 +6,7 @@ export let label export let placeholder export let disabled = false + export let readonly = false export let optionsType = "select" export let validation export let defaultValue @@ -58,6 +59,7 @@ value={fieldState.value} id={fieldState.fieldId} disabled={fieldState.disabled} + {readonly} error={fieldState.error} {options} {placeholder} @@ -72,6 +74,7 @@ value={fieldState.value} id={fieldState.fieldId} disabled={fieldState.disabled} + {readonly} error={fieldState.error} {options} {direction} From 56d5a0b8f6fbc0e265bdc0068f253d601d56c62a Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 1 Nov 2023 16:01:45 +0000 Subject: [PATCH 03/12] Further read only settings --- packages/bbui/src/Form/Core/Checkbox.svelte | 6 ++ packages/bbui/src/Form/Core/DatePicker.svelte | 4 +- packages/bbui/src/Form/DatePicker.svelte | 2 + packages/client/manifest.json | 57 ++++++++++++++++++- .../components/app/forms/BooleanField.svelte | 2 + .../components/app/forms/DateTimeField.svelte | 2 + .../src/components/app/forms/JSONField.svelte | 2 + .../app/forms/RelationshipField.svelte | 2 + 8 files changed, 75 insertions(+), 2 deletions(-) diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte index 3efc737bfb..3eaaf4dede 100644 --- a/packages/bbui/src/Form/Core/Checkbox.svelte +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -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} diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index 7ce15292be..786aee40b6 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -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 @@ >
option._id} From 33e37261b2e8a16404efb68467eb27eea7e42ac7 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 1 Nov 2023 16:27:52 +0000 Subject: [PATCH 04/12] Use fieldState --- .../client/src/components/app/forms/AttachmentField.svelte | 4 +++- packages/client/src/components/app/forms/BooleanField.svelte | 3 ++- .../client/src/components/app/forms/CodeScannerField.svelte | 4 +++- .../client/src/components/app/forms/DateTimeField.svelte | 3 ++- packages/client/src/components/app/forms/Field.svelte | 2 ++ packages/client/src/components/app/forms/Form.svelte | 4 +++- packages/client/src/components/app/forms/InnerForm.svelte | 3 +++ packages/client/src/components/app/forms/JSONField.svelte | 3 ++- .../client/src/components/app/forms/LongFormField.svelte | 5 +++-- .../client/src/components/app/forms/MultiFieldSelect.svelte | 5 +++-- packages/client/src/components/app/forms/OptionsField.svelte | 5 +++-- .../client/src/components/app/forms/RelationshipField.svelte | 3 ++- packages/client/src/components/app/forms/StringField.svelte | 5 +++-- 13 files changed, 34 insertions(+), 15 deletions(-) diff --git a/packages/client/src/components/app/forms/AttachmentField.svelte b/packages/client/src/components/app/forms/AttachmentField.svelte index e24115ebc0..861d881733 100644 --- a/packages/client/src/components/app/forms/AttachmentField.svelte +++ b/packages/client/src/components/app/forms/AttachmentField.svelte @@ -6,6 +6,7 @@ export let field export let label export let disabled = false + export let readonly = false export let compact = false export let validation export let extensions @@ -71,6 +72,7 @@ {label} {field} {disabled} + {readonly} {validation} type="attachment" bind:fieldState @@ -81,7 +83,7 @@ {#if fieldState} { @@ -205,6 +207,7 @@ error: initialError, disabled: disabled || fieldDisabled || (isAutoColumn && !editAutoColumns), + readonly: readonly || fieldReadOnly, defaultValue, validator, lastUpdate: Date.now(), diff --git a/packages/client/src/components/app/forms/JSONField.svelte b/packages/client/src/components/app/forms/JSONField.svelte index 1ee09c8460..cf96f54a23 100644 --- a/packages/client/src/components/app/forms/JSONField.svelte +++ b/packages/client/src/components/app/forms/JSONField.svelte @@ -49,6 +49,7 @@ {label} {field} {disabled} + {readonly} {validation} {defaultValue} type="json" @@ -61,7 +62,7 @@ value={serialiseValue(fieldState.value)} on:change={handleChange} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} diff --git a/packages/client/src/components/app/forms/LongFormField.svelte b/packages/client/src/components/app/forms/LongFormField.svelte index 8482a6a68e..a9087a0a9c 100644 --- a/packages/client/src/components/app/forms/LongFormField.svelte +++ b/packages/client/src/components/app/forms/LongFormField.svelte @@ -59,6 +59,7 @@ {label} {field} {disabled} + {readonly} {validation} {defaultValue} type="longform" @@ -72,7 +73,7 @@ value={fieldState.value} on:change={handleChange} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} @@ -90,7 +91,7 @@ value={fieldState.value} on:change={handleChange} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} diff --git a/packages/client/src/components/app/forms/MultiFieldSelect.svelte b/packages/client/src/components/app/forms/MultiFieldSelect.svelte index cb4879f86e..4ee691061a 100644 --- a/packages/client/src/components/app/forms/MultiFieldSelect.svelte +++ b/packages/client/src/components/app/forms/MultiFieldSelect.svelte @@ -56,6 +56,7 @@ {field} {label} {disabled} + {readonly} {validation} defaultValue={expandedDefaultValue} type="array" @@ -72,7 +73,7 @@ getOptionValue={flatOptions ? x => x : x => x.value} id={fieldState.fieldId} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} on:change={handleChange} {placeholder} {options} @@ -83,7 +84,7 @@ value={fieldState.value || []} id={fieldState.fieldId} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} {options} {direction} diff --git a/packages/client/src/components/app/forms/OptionsField.svelte b/packages/client/src/components/app/forms/OptionsField.svelte index c01827471a..dc18df8dbe 100644 --- a/packages/client/src/components/app/forms/OptionsField.svelte +++ b/packages/client/src/components/app/forms/OptionsField.svelte @@ -46,6 +46,7 @@ {field} {label} {disabled} + {readonly} {validation} {defaultValue} type="options" @@ -59,7 +60,7 @@ value={fieldState.value} id={fieldState.fieldId} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} {options} {placeholder} @@ -74,7 +75,7 @@ value={fieldState.value} id={fieldState.fieldId} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} {options} {direction} diff --git a/packages/client/src/components/app/forms/RelationshipField.svelte b/packages/client/src/components/app/forms/RelationshipField.svelte index 9d2d6adf0f..10fcaa904f 100644 --- a/packages/client/src/components/app/forms/RelationshipField.svelte +++ b/packages/client/src/components/app/forms/RelationshipField.svelte @@ -184,6 +184,7 @@ {label} {field} {disabled} + {readonly} {validation} defaultValue={expandedDefaultValue} {type} @@ -201,7 +202,7 @@ on:loadMore={loadMore} id={fieldState.fieldId} disabled={fieldState.disabled} - {readonly} + readonly={fieldState.readonly} error={fieldState.error} getOptionLabel={getDisplayName} getOptionValue={option => option._id} diff --git a/packages/client/src/components/app/forms/StringField.svelte b/packages/client/src/components/app/forms/StringField.svelte index 624611c733..674be9f1b2 100644 --- a/packages/client/src/components/app/forms/StringField.svelte +++ b/packages/client/src/components/app/forms/StringField.svelte @@ -7,11 +7,11 @@ export let placeholder export let type = "text" export let disabled = false + export let readonly = false export let validation export let defaultValue = "" export let align export let onChange - export let readonly = false let fieldState let fieldApi @@ -28,6 +28,7 @@ {label} {field} {disabled} + {readonly} {validation} {defaultValue} type={type === "number" ? "number" : "string"} @@ -40,12 +41,12 @@ value={fieldState.value} on:change={handleChange} disabled={fieldState.disabled} + readonly={fieldState.readonly} error={fieldState.error} id={fieldState.fieldId} {placeholder} {type} {align} - {readonly} /> {/if} From 5923ae2983d588d1f1d5a5fd3550a04cda47d671 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Wed, 1 Nov 2023 16:40:23 +0000 Subject: [PATCH 05/12] Make form block view readonly --- packages/bbui/src/Markdown/MarkdownEditor.svelte | 2 +- packages/client/manifest.json | 7 +------ .../src/components/app/blocks/form/InnerFormBlock.svelte | 3 ++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/bbui/src/Markdown/MarkdownEditor.svelte b/packages/bbui/src/Markdown/MarkdownEditor.svelte index 27035d8033..225d25a0eb 100644 --- a/packages/bbui/src/Markdown/MarkdownEditor.svelte +++ b/packages/bbui/src/Markdown/MarkdownEditor.svelte @@ -56,7 +56,7 @@ easyMDEOptions={{ initialValue: value, placeholder, - toolbar: readonly ? false : undefined, + toolbar: disabled || readonly ? false : undefined, ...easyMDEOptions, }} /> diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 7559825267..749e2cf194 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -5640,12 +5640,7 @@ "type": "boolean", "label": "Disabled", "key": "disabled", - "defaultValue": false, - "dependsOn": { - "setting": "actionType", - "value": "View", - "invert": true - } + "defaultValue": false } ] }, diff --git a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte index f7e9a0d2ed..b2c9888c73 100644 --- a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte +++ b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte @@ -136,7 +136,8 @@ actionType: actionType === "Create" ? "Create" : "Update", dataSource, size, - disabled: disabled || actionType === "View", + disabled, + readonly: !disabled && actionType === "View", }} styles={{ normal: { From 738082dc27e564530e7af107c99beb7c27956733 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 2 Nov 2023 15:49:16 +0000 Subject: [PATCH 06/12] Remove readonly key --- packages/bbui/src/Markdown/MarkdownEditor.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/Markdown/MarkdownEditor.svelte b/packages/bbui/src/Markdown/MarkdownEditor.svelte index 225d25a0eb..6c711c9d28 100644 --- a/packages/bbui/src/Markdown/MarkdownEditor.svelte +++ b/packages/bbui/src/Markdown/MarkdownEditor.svelte @@ -45,7 +45,7 @@ const debouncedUpdate = debounce(update, 250) -{#key (height, readonly)} +{#key height} Date: Fri, 3 Nov 2023 14:08:46 +0000 Subject: [PATCH 07/12] Toggle preview --- packages/bbui/src/Markdown/MarkdownEditor.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/bbui/src/Markdown/MarkdownEditor.svelte b/packages/bbui/src/Markdown/MarkdownEditor.svelte index 6c711c9d28..888187c8da 100644 --- a/packages/bbui/src/Markdown/MarkdownEditor.svelte +++ b/packages/bbui/src/Markdown/MarkdownEditor.svelte @@ -20,7 +20,9 @@ // control $: checkValue(value) $: mde?.codemirror.on("change", debouncedUpdate) - $: mde?.codemirror.setOption("readOnly", readonly) + $: if (readonly || disabled) { + mde?.togglePreview() + } const checkValue = val => { if (mde && val !== latestValue) { From c43bfda45df9acac45ca136156a41046547283b3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 6 Nov 2023 12:38:10 +0000 Subject: [PATCH 08/12] Fix for user invitations throwing a 501 error due to the way the search was being performed. --- .../app/[application]/_components/BuilderSidePanel.svelte | 4 ++-- packages/frontend-core/src/fetch/UserFetch.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index f9a40b09a6..a67c2d3c61 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -112,9 +112,9 @@ } await usersFetch.update({ query: { - appId: query || !filterByAppAccess ? null : prodAppId, - email: query, + string: { email: query }, }, + appId: query || !filterByAppAccess ? null : prodAppId, limit: 50, paginate: query || !filterByAppAccess ? null : false, }) diff --git a/packages/frontend-core/src/fetch/UserFetch.js b/packages/frontend-core/src/fetch/UserFetch.js index b1478c3a6d..65bfe36058 100644 --- a/packages/frontend-core/src/fetch/UserFetch.js +++ b/packages/frontend-core/src/fetch/UserFetch.js @@ -33,7 +33,7 @@ export default class UserFetch extends DataFetch { let finalQuery // convert old format to new one - we now allow use of the lucene format const { appId, paginated, ...rest } = query - if (!LuceneUtils.hasFilters(query) && rest.email) { + if (!LuceneUtils.hasFilters(query) && rest.email != null) { finalQuery = { string: { email: rest.email } } } else { finalQuery = rest From c169a7376499747dace7471320737cb22c121319 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 7 Nov 2023 09:19:29 +0000 Subject: [PATCH 09/12] readonly css --- packages/bbui/src/Form/Core/Checkbox.svelte | 9 ++++----- packages/bbui/src/Form/Core/CheckboxGroup.svelte | 9 ++++----- packages/bbui/src/Form/Core/RadioGroup.svelte | 9 ++++----- packages/client/src/components/app/forms/Field.svelte | 4 ++++ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte index 3eaaf4dede..e24f5669eb 100644 --- a/packages/bbui/src/Form/Core/Checkbox.svelte +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -25,16 +25,12 @@ class:is-invalid={!!error} class:checked={value} class:is-indeterminate={indeterminate} + class:readonly > { - if (readonly) { - e.preventDefault() - } - }} type="checkbox" class="spectrum-Checkbox-input" {id} @@ -74,4 +70,7 @@ .spectrum-Checkbox-input { opacity: 0; } + .readonly { + pointer-events: none; + } diff --git a/packages/bbui/src/Form/Core/CheckboxGroup.svelte b/packages/bbui/src/Form/Core/CheckboxGroup.svelte index faf37f3ad8..66ac55561b 100644 --- a/packages/bbui/src/Form/Core/CheckboxGroup.svelte +++ b/packages/bbui/src/Form/Core/CheckboxGroup.svelte @@ -35,17 +35,13 @@ title={getOptionLabel(option)} class="spectrum-Checkbox spectrum-FieldGroup-item" class:is-invalid={!!error} + class:readonly >