Grid Popupformun Resize ve FullScreen butonu eklenmesi
This commit is contained in:
parent
226e71d1a7
commit
2d8a856626
5 changed files with 59 additions and 20 deletions
|
|
@ -14,4 +14,7 @@ public class GridEditingPopupDto
|
||||||
/// <summary> guncelleme asamasinda popup ekranin disinda bir alana tiklanirsa popup ekran kapansin
|
/// <summary> guncelleme asamasinda popup ekranin disinda bir alana tiklanirsa popup ekran kapansin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HideOnOutsideClick { get; set; } = true;
|
public bool HideOnOutsideClick { get; set; } = true;
|
||||||
|
/// <summary> popup ekranin küçültülüp büyütülebilmesini saglar
|
||||||
|
/// </summary>
|
||||||
|
public bool ResizeEnabled { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4837,6 +4837,12 @@
|
||||||
"en": "Full Screen",
|
"en": "Full Screen",
|
||||||
"tr": "Tam Ekran"
|
"tr": "Tam Ekran"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormEdit.ResizeEnabled",
|
||||||
|
"en": "Resize Enabled",
|
||||||
|
"tr": "Küçültme/Büyütme İzni"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.EditingForm",
|
"key": "ListForms.ListFormEdit.EditingForm",
|
||||||
|
|
|
||||||
|
|
@ -426,6 +426,7 @@ export interface GridEditingPopupDto {
|
||||||
height: number
|
height: number
|
||||||
fullScreen: boolean
|
fullScreen: boolean
|
||||||
hideOnOutsideClick: boolean
|
hideOnOutsideClick: boolean
|
||||||
|
resizeEnabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GridFilterRowDto {
|
export interface GridFilterRowDto {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,5 @@
|
||||||
import { Container } from '@/components/shared'
|
import { Container } from '@/components/shared'
|
||||||
import {
|
import { Button, Card, Checkbox, FormContainer, FormItem, Input, Select } from '@/components/ui'
|
||||||
Button,
|
|
||||||
Card,
|
|
||||||
Checkbox,
|
|
||||||
FormContainer,
|
|
||||||
FormItem,
|
|
||||||
Input,
|
|
||||||
Select,
|
|
||||||
} from '@/components/ui'
|
|
||||||
import { ListFormEditTabs } from '@/proxy/admin/list-form/options'
|
import { ListFormEditTabs } from '@/proxy/admin/list-form/options'
|
||||||
import { useStoreState } from '@/store'
|
import { useStoreState } from '@/store'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
|
|
@ -348,6 +340,20 @@ function FormTabEdit(props: FormEditProps & { listFormCode: string }) {
|
||||||
component={Checkbox}
|
component={Checkbox}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
label={translate('::ListForms.ListFormEdit.ResizeEnabled')}
|
||||||
|
invalid={
|
||||||
|
errors.editingOptionDto?.popup?.resizeEnabled &&
|
||||||
|
touched.editingOptionDto?.popup?.resizeEnabled
|
||||||
|
}
|
||||||
|
errorMessage={errors.editingOptionDto?.popup?.resizeEnabled}
|
||||||
|
>
|
||||||
|
<Field
|
||||||
|
name="editingOptionDto.popup.resizeEnabled"
|
||||||
|
placeholder={translate('::ListForms.ListFormEdit.ResizeEnabled')}
|
||||||
|
component={Checkbox}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
<FormItem
|
<FormItem
|
||||||
label={translate('::ListForms.ListFormEdit.EditingHideOnOutsideClick')}
|
label={translate('::ListForms.ListFormEdit.EditingHideOnOutsideClick')}
|
||||||
invalid={
|
invalid={
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ const Grid = (props: GridProps) => {
|
||||||
const [mode, setMode] = useState<RowMode>('view')
|
const [mode, setMode] = useState<RowMode>('view')
|
||||||
const [extraFilters, setExtraFilters] = useState<GridExtraFilterState[]>([])
|
const [extraFilters, setExtraFilters] = useState<GridExtraFilterState[]>([])
|
||||||
const [gridDto, setGridDto] = useState<GridDto>()
|
const [gridDto, setGridDto] = useState<GridDto>()
|
||||||
|
const [isPopupFullScreen, setIsPopupFullScreen] = useState(false)
|
||||||
|
|
||||||
const preloadExportLibs = () => {
|
const preloadExportLibs = () => {
|
||||||
import('exceljs')
|
import('exceljs')
|
||||||
|
|
@ -262,6 +263,7 @@ const Grid = (props: GridProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMode('new')
|
setMode('new')
|
||||||
|
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
||||||
|
|
||||||
for (const colFormat of gridDto?.columnFormats) {
|
for (const colFormat of gridDto?.columnFormats) {
|
||||||
if (!colFormat.fieldName) {
|
if (!colFormat.fieldName) {
|
||||||
|
|
@ -357,6 +359,7 @@ const Grid = (props: GridProps) => {
|
||||||
|
|
||||||
function onEditingStart(e: DataGridTypes.EditingStartEvent<any, any>) {
|
function onEditingStart(e: DataGridTypes.EditingStartEvent<any, any>) {
|
||||||
setMode('edit')
|
setMode('edit')
|
||||||
|
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
||||||
const columns = e.component.option('columns') as GridColumnData[]
|
const columns = e.component.option('columns') as GridColumnData[]
|
||||||
// FormEditingExtraItem field ise datayı doldur
|
// FormEditingExtraItem field ise datayı doldur
|
||||||
columns?.forEach((col) => {
|
columns?.forEach((col) => {
|
||||||
|
|
@ -452,6 +455,10 @@ const Grid = (props: GridProps) => {
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gridDto.gridOptions.editingOptionDto?.popup) {
|
||||||
|
setIsPopupFullScreen(gridDto.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
||||||
|
}
|
||||||
}, [gridDto])
|
}, [gridDto])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -700,9 +707,11 @@ const Grid = (props: GridProps) => {
|
||||||
onExporting={onExporting}
|
onExporting={onExporting}
|
||||||
onEditCanceled={() => {
|
onEditCanceled={() => {
|
||||||
setMode('view')
|
setMode('view')
|
||||||
|
setIsPopupFullScreen(false)
|
||||||
}}
|
}}
|
||||||
onSaved={() => {
|
onSaved={() => {
|
||||||
setMode('view')
|
setMode('view')
|
||||||
|
setIsPopupFullScreen(false)
|
||||||
}}
|
}}
|
||||||
onRowInserted={() => {
|
onRowInserted={() => {
|
||||||
props.refreshData?.()
|
props.refreshData?.()
|
||||||
|
|
@ -807,13 +816,29 @@ const Grid = (props: GridProps) => {
|
||||||
}
|
}
|
||||||
startEditAction={gridDto.gridOptions.editingOptionDto?.startEditAction}
|
startEditAction={gridDto.gridOptions.editingOptionDto?.startEditAction}
|
||||||
popup={{
|
popup={{
|
||||||
title: translate('::' + gridDto.gridOptions.editingOptionDto?.popup?.title),
|
title: (mode === 'new' ? '✚ ' : '🖊️ ') + translate('::' + gridDto.gridOptions.editingOptionDto?.popup?.title),
|
||||||
showTitle: gridDto.gridOptions.editingOptionDto?.popup?.showTitle,
|
showTitle: gridDto.gridOptions.editingOptionDto?.popup?.showTitle,
|
||||||
hideOnOutsideClick:
|
hideOnOutsideClick:
|
||||||
gridDto.gridOptions.editingOptionDto?.popup?.hideOnOutsideClick,
|
gridDto.gridOptions.editingOptionDto?.popup?.hideOnOutsideClick,
|
||||||
width: gridDto.gridOptions.editingOptionDto?.popup?.width,
|
width: gridDto.gridOptions.editingOptionDto?.popup?.width,
|
||||||
height: gridDto.gridOptions.editingOptionDto?.popup?.height,
|
height: gridDto.gridOptions.editingOptionDto?.popup?.height,
|
||||||
fullScreen: gridDto.gridOptions.editingOptionDto?.popup?.fullScreen,
|
resizeEnabled: gridDto.gridOptions.editingOptionDto?.popup?.resizeEnabled,
|
||||||
|
fullScreen: isPopupFullScreen,
|
||||||
|
toolbarItems: [
|
||||||
|
{
|
||||||
|
widget: 'dxButton',
|
||||||
|
toolbar: 'top',
|
||||||
|
location: 'after',
|
||||||
|
options: {
|
||||||
|
icon: isPopupFullScreen ? 'collapse' : 'fullscreen',
|
||||||
|
hint: isPopupFullScreen
|
||||||
|
? translate('::Normal Boyut')
|
||||||
|
: translate('::Tam Ekran'),
|
||||||
|
stylingMode: 'text',
|
||||||
|
onClick: () => setIsPopupFullScreen(!isPopupFullScreen),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}}
|
}}
|
||||||
form={{
|
form={{
|
||||||
colCount: 1,
|
colCount: 1,
|
||||||
|
|
@ -839,7 +864,9 @@ const Grid = (props: GridProps) => {
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||||
|
|
||||||
// Tabbed item'ları grupla
|
// Tabbed item'ları grupla
|
||||||
const tabbedItems = sortedFormDto.filter((e: any) => e.itemType === 'tabbed')
|
const tabbedItems = sortedFormDto.filter(
|
||||||
|
(e: any) => e.itemType === 'tabbed',
|
||||||
|
)
|
||||||
const result: any[] = []
|
const result: any[] = []
|
||||||
|
|
||||||
// Helper function: item mapper
|
// Helper function: item mapper
|
||||||
|
|
@ -956,10 +983,7 @@ const Grid = (props: GridProps) => {
|
||||||
const maxItemColSpan = Math.max(
|
const maxItemColSpan = Math.max(
|
||||||
...(e.items?.map((i: any) => i.colSpan || 1) || [1]),
|
...(e.items?.map((i: any) => i.colSpan || 1) || [1]),
|
||||||
)
|
)
|
||||||
const effectiveColCount = Math.max(
|
const effectiveColCount = Math.max(maxItemColSpan, e.colCount || 1)
|
||||||
maxItemColSpan,
|
|
||||||
e.colCount || 1,
|
|
||||||
)
|
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
itemType: e.itemType,
|
itemType: e.itemType,
|
||||||
|
|
@ -998,7 +1022,6 @@ const Grid = (props: GridProps) => {
|
||||||
tabbedItem.colCount || 1,
|
tabbedItem.colCount || 1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: tabbedItem.caption, // Her tab'ın title'ı
|
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||||
colCount: effectiveColCount,
|
colCount: effectiveColCount,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue