Skip to content

Commit

Permalink
feat: pass property.custom to all edit renderers
Browse files Browse the repository at this point in the history
It allow now to define let say placeholder or set borderless

fixes #258
  • Loading branch information
wojtek-krysiak committed Oct 7, 2020
1 parent fe543d2 commit 7592239
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Expand Up @@ -7,7 +7,8 @@
"codecov", "bulma", "unmount", "testid", "woff", "iife", "sourcemap", "Roboto",
"camelize", "datepicker", "camelcase", "fullwidth", "wysiwig", "Helvetica", "Neue",
"Arial", "nowrap", "textfield", "scrollable", "flexbox", "treal", "xxxl",
"adminbro", "Checkmark", "overridable", "Postgres", "Hana", "Wojtek", "Krysiak", "bigint"
"adminbro", "Checkmark", "overridable", "Postgres", "Hana", "Wojtek", "Krysiak", "bigint",
"borderless"
],
"ignorePaths": [
"src/frontend/assets/**/*"
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/property-type/boolean/edit.tsx
Expand Up @@ -25,6 +25,7 @@ const Edit: React.FC<EditPropertyProps> = (props) => {
onChange={handleChange}
checked={value}
disabled={property.isDisabled}
{...property.custom}
/>
<Label
inline
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/components/property-type/default-type/edit.tsx
Expand Up @@ -42,6 +42,7 @@ const SelectEdit: FC<CombinedProps> = (props) => {
options={property.availableValues}
onChange={s => onChange(property.name, s?.value ?? '')}
isDisabled={property.isDisabled}
{...property.custom}
/>
)
}
Expand All @@ -67,6 +68,7 @@ const TextEdit: FC<CombinedProps> = (props) => {
onKeyDown={e => e.keyCode === 13 && onChange(property.name, value)}
value={value}
disabled={property.isDisabled}
{...property.custom}
/>
)
}
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/property-type/password/edit.tsx
Expand Up @@ -37,6 +37,7 @@ const Edit: React.FC<EditPropertyProps> = (props) => {
onKeyDown={e => e.keyCode === 13 && onChange(property.name, value)}
value={value ?? ''}
disabled={property.isDisabled}
{...property.custom}
/>
<Button
variant={isInput ? 'primary' : 'text'}
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/property-type/reference/edit.tsx
Expand Up @@ -90,6 +90,7 @@ const Edit: FC<CombinedProps> = (props) => {
isClearable
isDisabled={property.isDisabled}
isLoading={loadingRecord}
{...property.custom}
/>
<FormMessage>{error?.message}</FormMessage>
</FormGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/frontend/components/property-type/richtext/edit.tsx
Expand Up @@ -14,6 +14,10 @@ import {
import { EditPropertyProps } from '../base-property-props'
import { recordPropertyIsEqual } from '../record-property-is-equal'

type CustomType = {
borderless?: boolean;
quill?: QuillOptions;
}

const Edit: FC<EditPropertyProps> = (props) => {
const { property, record, onChange } = props
Expand All @@ -22,7 +26,7 @@ const Edit: FC<EditPropertyProps> = (props) => {

const { custom } = property

const quill = custom as QuillOptions || {}
const { quill = {}, ...customProps } = custom as CustomType || {}
quill.theme = quill.theme || 'snow'
quill.modules = {
toolbar: DefaultQuillToolbarOptions,
Expand All @@ -38,6 +42,7 @@ const Edit: FC<EditPropertyProps> = (props) => {
{property.label}
</Label>
<RichText
{...customProps}
value={value}
onChange={content => onChange(property.name, content)}
quill={quill}
Expand Down
1 change: 1 addition & 0 deletions src/frontend/components/property-type/textarea/edit.tsx
Expand Up @@ -34,6 +34,7 @@ const Edit: FC<EditPropertyProps> = (props) => {
onBlur={() => onChange(property.name, value)}
value={value}
disabled={property.isDisabled}
{...property.custom}
/>
<FormMessage>{error && error.message}</FormMessage>
</FormGroup>
Expand Down

0 comments on commit 7592239

Please sign in to comment.