Skip to content

Commit

Permalink
Add widget manager actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vin0401 committed Mar 22, 2024
1 parent 6059ae6 commit 2d8ac65
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 3 deletions.
21 changes: 21 additions & 0 deletions assets/js/src/modules/asset-tree/search/search-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { type TreeSearchProps } from '@Pimcore/components/tree/tree'
import { Input } from 'antd'

const { Search } = Input

const SearchContainer = (props: TreeSearchProps): React.JSX.Element => {
const { setAdditionalQueryParams } = props

function onSearch (searchTerm: string): void {
setAdditionalQueryParams!({
idSearchTerm: searchTerm
})
}

return (
<Search onSearch={onSearch} size='small' />
)
}

export { SearchContainer }
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react'
import { Button, Space } from 'antd'
import { useWidgetManager } from '@Pimcore/modules/widget-manager/hooks/use-widget-manager'
import { Icon } from '@Pimcore/components/icon/icon'

export const WidgetManagerActions = (): React.JSX.Element => {
const { openMainWidget, openBottomWidget, openLeftWidget, openRightWidget } = useWidgetManager()

function onOpenMainWidgetClick (): void {
openMainWidget({
component: 'widget-manager-actions',
name: 'Widget Manager Actions'
})
}

function onOpenBottomWidgetClick (): void {
openBottomWidget({
component: 'widget-manager-actions',
name: 'Widget Manager Actions'
})
}

function onOpenLeftWidgetClick (): void {
openLeftWidget({
component: 'widget-manager-actions',
name: 'Widget Manager Actions'
})
}

function onOpenRightWidgetClick (): void {
openRightWidget({
component: 'widget-manager-actions',
name: 'Widget Manager Actions'
})
}

return (
<>
<Space style={{ padding: '8px' }}>
<Button type="primary" icon={<Icon name='folder' options={{ width: 12, height: 12 }}/>} onClick={onOpenMainWidgetClick}>Open Main Widget</Button>
<Button type="default" icon={<Icon name='camera' options={{ width: 12, height: 12 }} />} onClick={onOpenBottomWidgetClick}>Open Bottom Widget</Button>
<Button type="text" icon={<Icon name='folder' options={{ width: 12, height: 12 }} />} onClick={onOpenLeftWidgetClick}>Open Left Widget</Button>
<Button type="dashed" icon={<Icon name='camera' options={{ width: 12, height: 12 }} />} onClick={onOpenRightWidgetClick}>Open Right Widget</Button>
</Space>
</>
)
}
6 changes: 6 additions & 0 deletions assets/js/src/modules/example/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { registerWidget } from '../widget-manager/utils/widget-registry'
import { Example } from './containers/example'
import { WidgetManagerActions } from './containers/widget-manager-actions'

registerWidget({
name: 'example',
component: Example
})

registerWidget({
name: 'widget-manager-actions',
component: WidgetManagerActions
})
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ export const getInitialModelJson = (): IJsonModel => {
config: {
id: 288
}
},

{
type: 'tab',
name: 'actions',
component: 'widget-manager-actions',
enableClose: false
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion public/build/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"main": {
"js": [
"/bundles/pimcorestudioui/build/480.002396ce.js",
"/bundles/pimcorestudioui/build/main.e0b73daf.js"
"/bundles/pimcorestudioui/build/main.e85e3607.js"
],
"css": [
"/bundles/pimcorestudioui/build/main.3691bcd8.css"
Expand Down
1 change: 0 additions & 1 deletion public/build/main.e0b73daf.js

This file was deleted.

1 change: 1 addition & 0 deletions public/build/main.e85e3607.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/build/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"bundles/pimcorestudioui/build/main.css": "/bundles/pimcorestudioui/build/main.3691bcd8.css",
"bundles/pimcorestudioui/build/main.js": "/bundles/pimcorestudioui/build/main.e0b73daf.js",
"bundles/pimcorestudioui/build/main.js": "/bundles/pimcorestudioui/build/main.e85e3607.js",
"bundles/pimcorestudioui/build/58.9cf6e23a.js": "/bundles/pimcorestudioui/build/58.9cf6e23a.js",
"bundles/pimcorestudioui/build/678.c220b736.js": "/bundles/pimcorestudioui/build/678.c220b736.js",
"bundles/pimcorestudioui/build/625.b487b20e.js": "/bundles/pimcorestudioui/build/625.b487b20e.js",
Expand Down

0 comments on commit 2d8ac65

Please sign in to comment.