-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* first plugging in of dynamic types text * update to include fallback * add dynamic text area dynamic type * Apply eslint-fixer changes * Automatic frontend build --------- Co-authored-by: xIrusux <[email protected]>
- Loading branch information
Showing
34 changed files
with
2,378 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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
27 changes: 27 additions & 0 deletions
27
...les/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-abstract.tsx
This file contains 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,27 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import { type ReactElement } from 'react' | ||
import { type DynamicTypeAbstract } from '../../registry/dynamic-type-registry-abstract' | ||
import { | ||
type BatchEdit | ||
} from '@Pimcore/modules/asset/editor/types/folder/tab-manager/tabs/list/toolbar/tools/batch-edit-modal/batch-edit-provider' | ||
|
||
export interface AbstractBatchEditDefinition { | ||
batchEdit: BatchEdit | ||
} | ||
|
||
export abstract class DynamicTypeBatchEditAbstract implements DynamicTypeAbstract { | ||
abstract readonly id: string | ||
abstract getBatchEditComponent (props: AbstractBatchEditDefinition): ReactElement<AbstractBatchEditDefinition> | ||
} |
27 changes: 27 additions & 0 deletions
27
...ules/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-registry.ts
This file contains 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,27 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import { type ReactElement } from 'react' | ||
import { injectable } from 'inversify' | ||
import { DynamicTypeRegistryAbstract } from '../../registry/dynamic-type-registry-abstract' | ||
import { | ||
type AbstractBatchEditDefinition, | ||
type DynamicTypeBatchEditAbstract | ||
} from '@Pimcore/modules/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-abstract' | ||
|
||
@injectable() | ||
export class DynamicTypeBatchEditRegistry extends DynamicTypeRegistryAbstract<DynamicTypeBatchEditAbstract> { | ||
getComponent (id: string, props: AbstractBatchEditDefinition): ReactElement<AbstractBatchEditDefinition> { | ||
return this.getDynamicType(id).getBatchEditComponent(props) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...fintinitions/batch-edits/types/components/dynamic-type-batch-edit-text-area-component.tsx
This file contains 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,45 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import React, { useEffect, useState } from 'react' | ||
import { | ||
type AbstractBatchEditDefinition | ||
} from '@Pimcore/modules/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-abstract' | ||
import { | ||
useBatchEdit | ||
} from '@Pimcore/modules/asset/editor/types/folder/tab-manager/tabs/list/toolbar/tools/batch-edit-modal/hooks/use-batch-edit' | ||
import TextArea from 'antd/es/input/TextArea' | ||
export interface DynamicTypeBatchEditTextAreaProps extends AbstractBatchEditDefinition {} | ||
|
||
export const DynamicTypeBatchEditTextAreaComponent = ({ batchEdit }: DynamicTypeBatchEditTextAreaProps): React.JSX.Element => { | ||
const { addOrUpdateBatchEdit } = useBatchEdit() | ||
const { key, type, frontendType, locale, localizable, value: batchEditValue } = batchEdit | ||
const [_value, setValue] = useState(batchEditValue) | ||
|
||
useEffect(() => { | ||
setValue(batchEditValue) | ||
}, [batchEditValue]) | ||
|
||
const onBlur = (): void => { | ||
addOrUpdateBatchEdit(key, type, frontendType, locale, localizable, _value) | ||
} | ||
|
||
return ( | ||
<TextArea | ||
autoSize={ { minRows: 2 } } | ||
onBlur={ onBlur } | ||
onChange={ (event) => { setValue(event.target.value) } } | ||
value={ _value } | ||
/> | ||
) | ||
} |
45 changes: 45 additions & 0 deletions
45
...es/defintinitions/batch-edits/types/components/dynamic-type-batch-edit-text-component.tsx
This file contains 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,45 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import React, { useEffect, useState } from 'react' | ||
import { Input } from 'antd' | ||
import { | ||
type AbstractBatchEditDefinition | ||
} from '@Pimcore/modules/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-abstract' | ||
import { | ||
useBatchEdit | ||
} from '@Pimcore/modules/asset/editor/types/folder/tab-manager/tabs/list/toolbar/tools/batch-edit-modal/hooks/use-batch-edit' | ||
export interface DynamicTypeBatchEditTextProps extends AbstractBatchEditDefinition {} | ||
|
||
export const DynamicTypeBatchEditTextComponent = ({ batchEdit }: DynamicTypeBatchEditTextProps): React.JSX.Element => { | ||
const { addOrUpdateBatchEdit } = useBatchEdit() | ||
const { key, type, frontendType, locale, localizable, value: batchEditValue } = batchEdit | ||
const [_value, setValue] = useState(batchEditValue) | ||
|
||
useEffect(() => { | ||
setValue(batchEditValue) | ||
}, [batchEditValue]) | ||
|
||
const onBlur = (): void => { | ||
addOrUpdateBatchEdit(key, type, frontendType, locale, localizable, _value) | ||
} | ||
|
||
return ( | ||
<Input | ||
onBlur={ onBlur } | ||
onChange={ (event) => { setValue(event.target.value) } } | ||
type='text' | ||
value={ _value } | ||
/> | ||
) | ||
} |
33 changes: 33 additions & 0 deletions
33
...dynamic-types/defintinitions/batch-edits/types/text/dynamic-type-batch-edit-text-area.tsx
This file contains 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,33 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import React, { type ReactElement } from 'react' | ||
import { injectable } from 'inversify' | ||
import { | ||
type DynamicTypeBatchEditAbstract | ||
} from '@Pimcore/modules/element/dynamic-types/defintinitions/batch-edits/dynamic-type-batch-edit-abstract' | ||
import { | ||
DynamicTypeBatchEditTextAreaComponent, | ||
type DynamicTypeBatchEditTextAreaProps | ||
} from '@Pimcore/modules/element/dynamic-types/defintinitions/batch-edits/types/components/dynamic-type-batch-edit-text-area-component' | ||
|
||
@injectable() | ||
export class DynamicTypeBatchEditTextArea implements DynamicTypeBatchEditAbstract { | ||
id = 'textarea' | ||
|
||
getBatchEditComponent (props: DynamicTypeBatchEditTextAreaProps): ReactElement<DynamicTypeBatchEditTextAreaProps> { | ||
return ( | ||
<DynamicTypeBatchEditTextAreaComponent { ...props } /> | ||
) | ||
} | ||
} |
Oops, something went wrong.