-
Notifications
You must be signed in to change notification settings - Fork 9
Add checkbox
and textarea
to field filters
#1534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Corepex
wants to merge
12
commits into
1.x
Choose a base branch
from
1532-assets---add-textarea-and-checkbox-type-fields-to-filter-selection
base: 1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b69ff36
made `checkbox` available in field filters
Corepex 0357097
add checkbox filter
xIrusux a561bae
add text area filter
xIrusux 587fc0f
make checkbox filter segmented
xIrusux d70d42a
clean up
xIrusux 92a8948
Merge branch '1.x' of github.com:pimcore/studio-ui-bundle into 1532-a…
xIrusux 5badae4
merge
xIrusux bfd164e
fokussed on improving segmented checkbox filter
xIrusux 25a306e
get textarea filter working
xIrusux b58b0b6
ensure initial textarea state works
xIrusux c959d41
fix lint errors and clean
xIrusux 2c7d83c
Automatic frontend build
xIrusux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...pes/definitions/field-filters/components/dynamic-type-field-filter-checkbox-component.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* This source file is available under the terms of the | ||
* Pimcore Open Core License (POCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) | ||
* @license Pimcore Open Core License (POCL) | ||
*/ | ||
|
||
import React, { useEffect } from 'react' | ||
import { type AbstractFieldFilterDefinition } from '../dynamic-type-field-filter-abstract' | ||
import { useDynamicFilter } from '@Pimcore/components/dynamic-filter/provider/use-dynamic-filter' | ||
import { Segmented } from '@sdk/components' | ||
|
||
export interface DynamicTypeFieldFilterCheckboxProps extends AbstractFieldFilterDefinition { | ||
checked?: boolean | ||
} | ||
|
||
export const DynamicTypeFieldFilterCheckboxComponent = (props: DynamicTypeFieldFilterCheckboxProps): React.JSX.Element => { | ||
const { setData, data } = useDynamicFilter() | ||
|
||
useEffect(() => { | ||
setData(false) | ||
}, []) | ||
|
||
const handleChange = (val: 'true' | 'false'): void => { | ||
const boolValue = val === 'true' | ||
setData(boolValue) | ||
} | ||
|
||
return ( | ||
<Segmented | ||
onChange={ handleChange } | ||
options={ [ | ||
{ label: 'True', value: 'true' }, | ||
{ label: 'False', value: 'false' } | ||
] } | ||
value={ (data === true) ? 'true' : 'false' } | ||
/> | ||
|
||
) | ||
} |
41 changes: 41 additions & 0 deletions
41
...es/definitions/field-filters/components/dynamic-type-field-filter-text-area-component.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* This source file is available under the terms of the | ||
* Pimcore Open Core License (POCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) | ||
* @license Pimcore Open Core License (POCL) | ||
*/ | ||
|
||
import React, { useEffect, useState } from 'react' | ||
import { type AbstractFieldFilterDefinition } from '../dynamic-type-field-filter-abstract' | ||
import { useDynamicFilter } from '@Pimcore/components/dynamic-filter/provider/use-dynamic-filter' | ||
import { TextArea } from '@sdk/components' | ||
|
||
export interface DynamicTypeFieldFilterTextAreaProps extends AbstractFieldFilterDefinition {} | ||
|
||
export const DynamicTypeFieldFilterTextAreaComponent = (): React.JSX.Element => { | ||
const { data, setData } = useDynamicFilter() | ||
const [_value, setValue] = useState(data) | ||
|
||
useEffect(() => { | ||
setValue(data) | ||
}, [data]) | ||
|
||
useEffect(() => { | ||
setData('') | ||
}, []) | ||
|
||
return ( | ||
<TextArea | ||
onBlur={ onBlur } | ||
onChange={ (event) => { setValue(event.target.value) } } | ||
value={ _value } | ||
/> | ||
) | ||
|
||
function onBlur (): void { | ||
setData(_value) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...mic-types/definitions/field-filters/types/checkbox/dynamic-type-field-filter-checkbox.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* This source file is available under the terms of the | ||
* Pimcore Open Core License (POCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) | ||
* @license Pimcore Open Core License (POCL) | ||
*/ | ||
|
||
import { injectable } from 'inversify' | ||
import React, { type ReactElement } from 'react' | ||
import { DynamicTypeFieldFilterCheckboxComponent, type DynamicTypeFieldFilterCheckboxProps } from '../../components/dynamic-type-field-filter-checkbox-component' | ||
import { DynamicTypeFieldFilterAbstract } from '../../dynamic-type-field-filter-abstract' | ||
|
||
@injectable() | ||
export class DynamicTypeFieldFilterCheckbox extends DynamicTypeFieldFilterAbstract { | ||
id = 'checkbox' | ||
|
||
getFieldFilterType (): string { | ||
return 'system.string' | ||
} | ||
|
||
getFieldFilterComponent (props: DynamicTypeFieldFilterCheckboxProps): ReactElement<DynamicTypeFieldFilterCheckboxProps> { | ||
return ( | ||
<DynamicTypeFieldFilterCheckboxComponent { ...props } /> | ||
) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...c-types/definitions/field-filters/types/text-area/dynamic-type-field-filter-text-area.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* This source file is available under the terms of the | ||
* Pimcore Open Core License (POCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com) | ||
* @license Pimcore Open Core License (POCL) | ||
*/ | ||
|
||
import { injectable } from 'inversify' | ||
import React, { type ReactElement } from 'react' | ||
import { DynamicTypeFieldFilterTextAreaComponent, type DynamicTypeFieldFilterTextAreaProps } from '../../components/dynamic-type-field-filter-text-area-component' | ||
import { DynamicTypeFieldFilterAbstract } from '../../dynamic-type-field-filter-abstract' | ||
|
||
@injectable() | ||
export class DynamicTypeFieldFilterTextArea extends DynamicTypeFieldFilterAbstract { | ||
id = 'textarea' | ||
|
||
getFieldFilterType (): string { | ||
return 'system.string' | ||
} | ||
|
||
getFieldFilterComponent (props: DynamicTypeFieldFilterTextAreaProps): ReactElement<DynamicTypeFieldFilterTextAreaProps> { | ||
return ( | ||
<DynamicTypeFieldFilterTextAreaComponent { ...props } /> | ||
) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
public/build/567b0ed8-c2d3-4d0c-aa6f-28e1cb44921b/entrypoints.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should work for assets, since he will just fallback to the frontend type "metadata.checkbox".
But not sure how this will behave for data-objects, I guess we need some kind of new filter here:
https://github.com/pimcore/studio-backend-bundle/blob/1.x/doc/03_Grid.md#columnfilter
Something like system.checkbox?
I'm pretty sue @ValeriaMaltseva and @martineiber can help you here.