2025-05-06 06:45:49 +00:00
|
|
|
|
import Container from '@/components/shared/Container'
|
|
|
|
|
|
import { Dialog, Notification, toast } from '@/components/ui'
|
|
|
|
|
|
import { DX_CLASSNAMES } from '@/constants/app.constant'
|
|
|
|
|
|
import {
|
|
|
|
|
|
DbTypeEnum,
|
|
|
|
|
|
EditingFormItemDto,
|
|
|
|
|
|
GridDto,
|
|
|
|
|
|
ListFormCustomizationTypeEnum,
|
|
|
|
|
|
PlatformEditorTypes,
|
2025-08-12 08:39:06 +00:00
|
|
|
|
} from '@/proxy/form/models'
|
2025-05-06 06:45:49 +00:00
|
|
|
|
import {
|
|
|
|
|
|
getListFormCustomization,
|
|
|
|
|
|
postListFormCustomization,
|
2025-08-12 08:39:06 +00:00
|
|
|
|
} from '@/services/list-form-customization.service'
|
2025-05-06 06:45:49 +00:00
|
|
|
|
import { useListFormColumns } from '@/shared/useListFormColumns'
|
|
|
|
|
|
import { useListFormCustomDataSource } from '@/shared/useListFormCustomDataSource'
|
|
|
|
|
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
|
|
|
|
|
import useResponsive from '@/utils/hooks/useResponsive'
|
|
|
|
|
|
import { Template } from 'devextreme-react/core/template'
|
|
|
|
|
|
import DataGrid, {
|
|
|
|
|
|
ColumnChooser,
|
|
|
|
|
|
ColumnFixing,
|
|
|
|
|
|
DataGridTypes,
|
|
|
|
|
|
Editing,
|
|
|
|
|
|
Export,
|
|
|
|
|
|
FilterPanel,
|
|
|
|
|
|
FilterRow,
|
|
|
|
|
|
Grouping,
|
|
|
|
|
|
GroupItem as GroupItemDx,
|
|
|
|
|
|
GroupPanel,
|
|
|
|
|
|
HeaderFilter,
|
|
|
|
|
|
IStateStoringProps,
|
|
|
|
|
|
LoadPanel,
|
|
|
|
|
|
Pager,
|
|
|
|
|
|
Scrolling,
|
|
|
|
|
|
SearchPanel,
|
|
|
|
|
|
Selection,
|
|
|
|
|
|
Sorting,
|
|
|
|
|
|
Summary,
|
|
|
|
|
|
Toolbar,
|
2025-07-28 12:48:30 +00:00
|
|
|
|
TotalItem,
|
2025-05-06 06:45:49 +00:00
|
|
|
|
} from 'devextreme-react/data-grid'
|
|
|
|
|
|
import { Item } from 'devextreme-react/toolbar'
|
|
|
|
|
|
import { DataType } from 'devextreme/common'
|
|
|
|
|
|
import { captionize } from 'devextreme/core/utils/inflector'
|
|
|
|
|
|
import CustomStore from 'devextreme/data/custom_store'
|
|
|
|
|
|
import { GroupItem } from 'devextreme/ui/form'
|
|
|
|
|
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
|
|
|
|
import { Helmet } from 'react-helmet'
|
|
|
|
|
|
import SubForms from '../form/SubForms'
|
|
|
|
|
|
import { RowMode, SimpleItemWithColData } from '../form/types'
|
2025-09-18 22:09:58 +00:00
|
|
|
|
import { GridColumnData } from './GridColumnData'
|
2025-05-06 06:45:49 +00:00
|
|
|
|
import GridFilterDialogs from './GridFilterDialogs'
|
|
|
|
|
|
import {
|
|
|
|
|
|
addCss,
|
|
|
|
|
|
addJs,
|
|
|
|
|
|
controlStyleCondition,
|
2025-09-18 22:09:58 +00:00
|
|
|
|
GridExtraFilterState,
|
2025-05-06 06:45:49 +00:00
|
|
|
|
setFormEditingExtraItemValues,
|
|
|
|
|
|
setGridPanelColor,
|
|
|
|
|
|
} from './Utils'
|
|
|
|
|
|
import { GridBoxEditorComponent } from './editors/GridBoxEditorComponent'
|
|
|
|
|
|
import { TagBoxEditorComponent } from './editors/TagBoxEditorComponent'
|
|
|
|
|
|
import { useFilters } from './useFilters'
|
|
|
|
|
|
import { useToolbar } from './useToolbar'
|
2025-08-11 06:34:44 +00:00
|
|
|
|
import { ImportDashboard } from '@/components/importManager/ImportDashboard'
|
2025-09-12 11:26:35 +00:00
|
|
|
|
import WidgetGroup from '@/components/ui/Widget/WidgetGroup'
|
2025-09-17 14:13:48 +00:00
|
|
|
|
import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
|
2025-09-23 19:52:08 +00:00
|
|
|
|
import { getList } from '@/services/form.service'
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
interface GridProps {
|
|
|
|
|
|
listFormCode: string
|
|
|
|
|
|
searchParams?: URLSearchParams
|
|
|
|
|
|
isSubForm?: boolean
|
|
|
|
|
|
level?: number
|
|
|
|
|
|
refreshData?: () => Promise<void>
|
2025-09-22 14:08:42 +00:00
|
|
|
|
gridDto?: GridDto
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const statedGridPanelColor = 'rgba(50, 200, 200, 0.5)' // kullanici tanimli gridState ile islem gormus gridin paneline ait renk
|
|
|
|
|
|
|
|
|
|
|
|
const Grid = (props: GridProps) => {
|
2025-09-23 19:52:08 +00:00
|
|
|
|
const { listFormCode, searchParams, isSubForm, level, gridDto: extGridDto } = props
|
2025-05-06 06:45:49 +00:00
|
|
|
|
const { translate } = useLocalization()
|
|
|
|
|
|
const { smaller } = useResponsive()
|
|
|
|
|
|
|
|
|
|
|
|
const gridRef = useRef<DataGrid>()
|
|
|
|
|
|
const refListFormCode = useRef('')
|
|
|
|
|
|
|
|
|
|
|
|
const [gridDataSource, setGridDataSource] = useState<CustomStore<any, any>>()
|
|
|
|
|
|
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
|
|
|
|
|
const [formData, setFormData] = useState<any>()
|
|
|
|
|
|
const [mode, setMode] = useState<RowMode>('view')
|
2025-09-17 14:13:48 +00:00
|
|
|
|
const [extraFilters, setExtraFilters] = useState<GridExtraFilterState[]>([])
|
2025-09-23 19:52:08 +00:00
|
|
|
|
const [gridDto, setGridDto] = useState<GridDto>()
|
2025-11-07 19:28:09 +00:00
|
|
|
|
const [isPopupFullScreen, setIsPopupFullScreen] = useState(false)
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
2025-08-18 14:55:51 +00:00
|
|
|
|
const preloadExportLibs = () => {
|
|
|
|
|
|
import('exceljs')
|
|
|
|
|
|
import('file-saver')
|
|
|
|
|
|
import('devextreme/excel_exporter')
|
|
|
|
|
|
import('jspdf')
|
|
|
|
|
|
import('devextreme/pdf_exporter')
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-24 17:46:03 +00:00
|
|
|
|
type EditorOptionsWithButtons = {
|
|
|
|
|
|
buttons?: any[]
|
|
|
|
|
|
} & Record<string, any>
|
|
|
|
|
|
|
2025-09-22 14:08:42 +00:00
|
|
|
|
const defaultSearchParams = useRef<string | null>(null)
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-09-23 19:52:08 +00:00
|
|
|
|
const initializeGrid = async () => {
|
|
|
|
|
|
const response = await getList({ listFormCode })
|
|
|
|
|
|
setGridDto(response.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (extGridDto === undefined) {
|
|
|
|
|
|
initializeGrid()
|
|
|
|
|
|
} else {
|
|
|
|
|
|
setGridDto(extGridDto)
|
|
|
|
|
|
}
|
|
|
|
|
|
}, [listFormCode, extGridDto])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-09-22 14:08:42 +00:00
|
|
|
|
if (!defaultSearchParams.current) {
|
|
|
|
|
|
defaultSearchParams.current = searchParams?.get('filter') ?? null
|
2025-09-19 13:30:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
}, [searchParams])
|
|
|
|
|
|
|
2025-05-06 06:45:49 +00:00
|
|
|
|
const { toolbarData, toolbarModalData, setToolbarModalData } = useToolbar({
|
|
|
|
|
|
gridDto,
|
|
|
|
|
|
listFormCode,
|
|
|
|
|
|
getSelectedRowKeys,
|
|
|
|
|
|
getSelectedRowsData,
|
|
|
|
|
|
refreshData,
|
|
|
|
|
|
getFilter,
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const { filterToolbarData, ...filterData } = useFilters({
|
|
|
|
|
|
gridDto,
|
|
|
|
|
|
gridRef,
|
|
|
|
|
|
listFormCode,
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const { createSelectDataSource } = useListFormCustomDataSource({ gridRef })
|
|
|
|
|
|
const { getBandedColumns } = useListFormColumns({
|
|
|
|
|
|
gridDto,
|
|
|
|
|
|
listFormCode,
|
|
|
|
|
|
isSubForm,
|
2025-10-16 22:15:34 +00:00
|
|
|
|
gridRef,
|
2025-05-06 06:45:49 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
2025-09-19 18:30:39 +00:00
|
|
|
|
function extractSearchParamsFields(filter: any): [string, string, any][] {
|
|
|
|
|
|
if (!Array.isArray(filter)) return []
|
|
|
|
|
|
|
|
|
|
|
|
// [field, op, val] formu mu?
|
|
|
|
|
|
if (filter.length === 3 && typeof filter[0] === 'string') {
|
|
|
|
|
|
return [filter as [string, string, any]]
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// içinde başka filter array’leri olabilir
|
|
|
|
|
|
return filter.flatMap((f) => extractSearchParamsFields(f))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-06 06:45:49 +00:00
|
|
|
|
async function getSelectedRowKeys() {
|
|
|
|
|
|
const grd = gridRef.current?.instance
|
|
|
|
|
|
if (!grd) {
|
|
|
|
|
|
return []
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return await grd.getSelectedRowKeys()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getSelectedRowsData() {
|
|
|
|
|
|
const grd = gridRef.current?.instance
|
|
|
|
|
|
if (!grd) {
|
|
|
|
|
|
return []
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return grd.getSelectedRowsData()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function refreshData() {
|
|
|
|
|
|
gridRef.current?.instance.refresh()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getFilter() {
|
|
|
|
|
|
const grd = gridRef.current?.instance
|
|
|
|
|
|
if (!grd) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return grd.getCombinedFilter()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onSelectionChanged(data: any) {
|
|
|
|
|
|
const grdOpt = gridDto?.gridOptions
|
|
|
|
|
|
const grd = gridRef.current?.instance
|
|
|
|
|
|
if (!grdOpt || !grd) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// kullanicinin yetkisi varsa ve birden fazla kayit secili ise coklu silme gorunsun
|
|
|
|
|
|
if (grdOpt.editingOptionDto?.allowDeleting) {
|
|
|
|
|
|
// && abp.auth.isGranted(grdOpt.permissionDto?.d)
|
|
|
|
|
|
// kullanicinin silme yetkisi var ise
|
|
|
|
|
|
const opt = grd.option('toolbar')
|
|
|
|
|
|
const deleteSelectedRecordsIndex = opt?.items
|
|
|
|
|
|
?.map((e: any) => e.name)
|
|
|
|
|
|
.indexOf('deleteSelectedRecords')
|
|
|
|
|
|
// deleteSelectedRecords ismindeki custom butonun index degerini bul
|
|
|
|
|
|
|
|
|
|
|
|
grd.option(
|
|
|
|
|
|
`toolbar.items[${deleteSelectedRecordsIndex}].options.visible`,
|
|
|
|
|
|
data.selectedRowsData.length > 1,
|
|
|
|
|
|
) // birden fazla kayit secilmis ise gorunsun
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SubForm'ları gösterebilmek için secili satiri formData'ya at
|
|
|
|
|
|
if (data.selectedRowsData.length) {
|
|
|
|
|
|
setFormData(data.selectedRowsData[0])
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onCellPrepared(e: any) {
|
|
|
|
|
|
const columnFormats = gridDto?.columnFormats
|
|
|
|
|
|
if (!columnFormats) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// satir, hucre yada header vb. kisimlara conditional style uygulamak icin
|
|
|
|
|
|
for (let indxCol = 0; indxCol < columnFormats.length; indxCol++) {
|
|
|
|
|
|
const colFormat = columnFormats[indxCol]
|
|
|
|
|
|
for (let indxStyl = 0; indxStyl < colFormat.columnStylingDto.length; indxStyl++) {
|
|
|
|
|
|
const colStyle = colFormat.columnStylingDto[indxStyl] // uygulanacak style
|
|
|
|
|
|
if (e.rowType == colStyle.rowType) {
|
|
|
|
|
|
// header, filter, data, group, summaries ..her birisine style uygulanabilir
|
|
|
|
|
|
// style bütün satıra uygulansın olarak seçili ise yada sadece ilgili field üzerinde ise
|
|
|
|
|
|
if (colStyle.useRow || e.column.dataField == colFormat.fieldName) {
|
|
|
|
|
|
if (
|
|
|
|
|
|
!colStyle.conditionValue ||
|
|
|
|
|
|
controlStyleCondition(e.data, colFormat.fieldName, colStyle)
|
|
|
|
|
|
) {
|
|
|
|
|
|
// css sınıf ismi var ise uygula
|
|
|
|
|
|
if (colStyle.cssClassName) {
|
|
|
|
|
|
e.cellElement.addClass(colStyle.cssClassName)
|
|
|
|
|
|
}
|
|
|
|
|
|
// css inline style var ise uygula
|
|
|
|
|
|
if (colStyle.cssStyles) {
|
|
|
|
|
|
e.cellElement.attr('style', e.cellElement.attr('style') + ';' + colStyle.cssStyles)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onInitNewRow(e: any) {
|
|
|
|
|
|
if (!gridDto?.columnFormats) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setMode('new')
|
2025-11-07 19:28:09 +00:00
|
|
|
|
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
for (const colFormat of gridDto?.columnFormats) {
|
|
|
|
|
|
if (!colFormat.fieldName) {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Grid'den gelen columnFormat'ları kullanarak default değerleri set et
|
|
|
|
|
|
if (colFormat.defaultValue != null) {
|
2025-10-26 20:27:01 +00:00
|
|
|
|
console.log('Setting default value for', colFormat.fieldName, colFormat.defaultValue)
|
2025-05-06 06:45:49 +00:00
|
|
|
|
e.data[colFormat.fieldName] = colFormat.defaultValue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-19 18:30:39 +00:00
|
|
|
|
// ExtraFilters içerisinde ilgili Field varsa, default değerleri set etme
|
|
|
|
|
|
if (extraFilters.some((f) => f.fieldName === colFormat.fieldName)) {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-05-06 06:45:49 +00:00
|
|
|
|
// URL'den veya Component Prop'dan gelen parametreleri set et
|
|
|
|
|
|
if (!searchParams) {
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
2025-09-19 18:30:39 +00:00
|
|
|
|
const rawFilter = searchParams?.get('filter')
|
|
|
|
|
|
if (rawFilter) {
|
|
|
|
|
|
const parsed = JSON.parse(rawFilter)
|
|
|
|
|
|
const filters = extractSearchParamsFields(parsed)
|
|
|
|
|
|
|
|
|
|
|
|
const hasFilter = filters.some(([field, op, val]) => field === colFormat.fieldName)
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
2025-09-19 18:30:39 +00:00
|
|
|
|
if (hasFilter) {
|
|
|
|
|
|
const fieldMatch = filters.find(([field, op, val]) => field === colFormat.fieldName)
|
|
|
|
|
|
|
|
|
|
|
|
if (fieldMatch) {
|
|
|
|
|
|
const [, , val] = fieldMatch
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
|
|
|
|
|
const dType = colFormat.dataType as DataType
|
2025-09-19 18:30:39 +00:00
|
|
|
|
|
2025-09-19 13:30:19 +00:00
|
|
|
|
switch (dType) {
|
|
|
|
|
|
case 'date':
|
|
|
|
|
|
case 'datetime':
|
|
|
|
|
|
e.data[colFormat.fieldName] = new Date(val)
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'number':
|
|
|
|
|
|
e.data[colFormat.fieldName] = Number(val)
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'boolean':
|
|
|
|
|
|
e.data[colFormat.fieldName] = val === true || val === 'true'
|
|
|
|
|
|
break
|
|
|
|
|
|
case 'object':
|
|
|
|
|
|
try {
|
|
|
|
|
|
e.data[colFormat.fieldName] = JSON.parse(val)
|
|
|
|
|
|
} catch {}
|
|
|
|
|
|
break
|
|
|
|
|
|
default:
|
|
|
|
|
|
e.data[colFormat.fieldName] = val
|
|
|
|
|
|
break
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}
|
2025-09-19 13:30:19 +00:00
|
|
|
|
}
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onRowInserting(e: DataGridTypes.RowInsertingEvent<any, any>) {
|
|
|
|
|
|
e.data = setFormEditingExtraItemValues(e.data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onRowUpdating(e: DataGridTypes.RowUpdatingEvent<any, any>) {
|
|
|
|
|
|
if (gridDto?.gridOptions.editingOptionDto?.sendOnlyChangedFormValuesUpdate) {
|
|
|
|
|
|
if (Object.keys(e.newData).some((a) => a.includes(':'))) {
|
|
|
|
|
|
Object.keys(e.oldData).forEach((col) => {
|
|
|
|
|
|
if (col.includes(':')) {
|
|
|
|
|
|
e.newData[col] = e.newData[col] ?? e.oldData[col]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
e.newData = setFormEditingExtraItemValues(e.newData)
|
|
|
|
|
|
} else {
|
|
|
|
|
|
let newData = { ...e.oldData, ...e.newData }
|
|
|
|
|
|
newData = setFormEditingExtraItemValues(newData)
|
|
|
|
|
|
Object.keys(newData).forEach((key) => {
|
|
|
|
|
|
if (key.includes(':')) {
|
|
|
|
|
|
delete newData[key]
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
e.newData = newData
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (gridDto?.gridOptions.keyFieldName) {
|
|
|
|
|
|
delete e.newData[gridDto?.gridOptions.keyFieldName]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onEditingStart(e: DataGridTypes.EditingStartEvent<any, any>) {
|
|
|
|
|
|
setMode('edit')
|
2025-11-07 19:28:09 +00:00
|
|
|
|
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
2025-05-06 06:45:49 +00:00
|
|
|
|
const columns = e.component.option('columns') as GridColumnData[]
|
|
|
|
|
|
// FormEditingExtraItem field ise datayı doldur
|
|
|
|
|
|
columns?.forEach((col) => {
|
|
|
|
|
|
if (!col.dataField?.includes(':')) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const field = col.dataField.split(':')
|
|
|
|
|
|
if (!e.data[field[0]]) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
const json = JSON.parse(e.data[field[0]])
|
|
|
|
|
|
e.data[col.dataField] = json[field[1]]
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onDataErrorOccurred(e: DataGridTypes.DataErrorOccurredEvent<any, any>) {
|
|
|
|
|
|
toast.push(
|
|
|
|
|
|
<Notification type="danger" duration={2000}>
|
|
|
|
|
|
{e.error?.message}
|
|
|
|
|
|
</Notification>,
|
|
|
|
|
|
{
|
2025-09-01 14:07:03 +00:00
|
|
|
|
placement: 'top-end',
|
2025-05-06 06:45:49 +00:00
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const customSaveState = useCallback(
|
|
|
|
|
|
(state: any) =>
|
|
|
|
|
|
postListFormCustomization({
|
|
|
|
|
|
listFormCode: listFormCode,
|
|
|
|
|
|
customizationType: ListFormCustomizationTypeEnum.GridState,
|
|
|
|
|
|
filterName: `list-${gridRef.current?.instance.option('stateStoring')?.storageKey ?? ''}`,
|
|
|
|
|
|
customizationData: JSON.stringify(state),
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
setGridPanelColor(statedGridPanelColor)
|
|
|
|
|
|
}),
|
|
|
|
|
|
[listFormCode],
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const customLoadState = useCallback(
|
|
|
|
|
|
() =>
|
|
|
|
|
|
getListFormCustomization(
|
|
|
|
|
|
listFormCode,
|
|
|
|
|
|
ListFormCustomizationTypeEnum.GridState,
|
|
|
|
|
|
`list-${gridRef.current?.instance.option('stateStoring')?.storageKey ?? ''}`,
|
|
|
|
|
|
).then((response: any) => {
|
|
|
|
|
|
setGridPanelColor(statedGridPanelColor)
|
|
|
|
|
|
if (response.data?.length > 0) {
|
|
|
|
|
|
return JSON.parse(response.data[0].customizationData)
|
|
|
|
|
|
}
|
|
|
|
|
|
}),
|
|
|
|
|
|
[listFormCode],
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (gridRef?.current) {
|
|
|
|
|
|
gridRef.current.instance.option('columns', undefined)
|
|
|
|
|
|
gridRef.current.instance.option('remoteOperations', false)
|
|
|
|
|
|
gridRef.current.instance.option('dataSource', undefined)
|
|
|
|
|
|
gridRef.current.instance.state(null)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-23 19:52:08 +00:00
|
|
|
|
if (refListFormCode.current !== listFormCode) {
|
2025-09-22 09:11:15 +00:00
|
|
|
|
setExtraFilters([])
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
}, [listFormCode])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
if (!gridDto) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set js and css
|
|
|
|
|
|
const grdOpt = gridDto.gridOptions
|
|
|
|
|
|
if (grdOpt.customJsSources.length) {
|
|
|
|
|
|
for (const js of grdOpt.customJsSources) {
|
|
|
|
|
|
addJs(js)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (grdOpt.customStyleSources.length) {
|
|
|
|
|
|
for (const css of grdOpt.customStyleSources) {
|
|
|
|
|
|
addCss(css)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
|
|
|
|
|
if (gridDto?.gridOptions.extraFilterDto) {
|
|
|
|
|
|
setExtraFilters(
|
|
|
|
|
|
gridDto.gridOptions.extraFilterDto.map((f) => ({
|
|
|
|
|
|
fieldName: f.fieldName,
|
|
|
|
|
|
operator: f.operator,
|
|
|
|
|
|
controlType: f.controlType,
|
|
|
|
|
|
value: f.defaultValue ?? '',
|
|
|
|
|
|
})),
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
2025-11-07 19:28:09 +00:00
|
|
|
|
|
|
|
|
|
|
if (gridDto.gridOptions.editingOptionDto?.popup) {
|
|
|
|
|
|
setIsPopupFullScreen(gridDto.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
|
|
|
|
|
}
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}, [gridDto])
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-09-18 21:12:08 +00:00
|
|
|
|
if (!gridDto) return
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
const cols = getBandedColumns()
|
|
|
|
|
|
setColumnData(cols)
|
|
|
|
|
|
|
2025-10-09 09:44:28 +00:00
|
|
|
|
cols?.forEach((col) => {
|
|
|
|
|
|
const eo = col.editorOptions
|
|
|
|
|
|
|
|
|
|
|
|
// Sadece phoneGlobal formatlı kolonlarda çalış
|
|
|
|
|
|
if (eo?.format === 'phoneGlobal') {
|
|
|
|
|
|
// DevExtreme bazen string tipinde formatter'ı çağırmaz
|
|
|
|
|
|
// Bu yüzden her durumda çalışması için customizeText ekleyeceğiz
|
|
|
|
|
|
col.dataType = 'string'
|
|
|
|
|
|
|
|
|
|
|
|
const formatter = (value: any) => {
|
|
|
|
|
|
if (!value) return ''
|
|
|
|
|
|
|
|
|
|
|
|
// string'e dönüştür ve sadece rakamları al
|
|
|
|
|
|
let digits = String(value).replace(/\D/g, '')
|
|
|
|
|
|
|
|
|
|
|
|
// +90, 0090, 0 gibi ülke kodu veya ön ekleri atla
|
|
|
|
|
|
if (digits.startsWith('90') && digits.length > 10) digits = digits.slice(-10)
|
|
|
|
|
|
if (digits.startsWith('0') && digits.length > 10) digits = digits.slice(-10)
|
|
|
|
|
|
if (digits.length > 10) digits = digits.slice(-10)
|
|
|
|
|
|
|
|
|
|
|
|
// 🔒 Eğer 10 haneli değilse geçersiz → boş göster
|
|
|
|
|
|
if (digits.length !== 10) return ''
|
|
|
|
|
|
|
|
|
|
|
|
// (XXX) XXX-XXXX formatında göster
|
|
|
|
|
|
const match = digits.match(/^(\d{3})(\d{3})(\d{4})$/)
|
|
|
|
|
|
return match ? `(${match[1]}) ${match[2]}-${match[3]}` : digits
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 1️⃣ Normal format nesnesi
|
|
|
|
|
|
col.format = { formatter }
|
|
|
|
|
|
|
|
|
|
|
|
// 2️⃣ CustomizeText fallback — bazı durumlarda zorunlu
|
|
|
|
|
|
col.customizeText = (cellInfo: any) => formatter(cellInfo?.value)
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-09-19 13:30:19 +00:00
|
|
|
|
const dataSource = createSelectDataSource(gridDto.gridOptions, listFormCode, searchParams, cols)
|
|
|
|
|
|
setGridDataSource(dataSource)
|
|
|
|
|
|
}, [gridDto, searchParams])
|
2025-09-17 14:13:48 +00:00
|
|
|
|
|
2025-09-19 13:30:19 +00:00
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
const activeFilters = extraFilters.filter((f) => f.value)
|
|
|
|
|
|
|
2025-09-22 09:11:15 +00:00
|
|
|
|
let base: any = null
|
2025-09-22 14:08:42 +00:00
|
|
|
|
if (defaultSearchParams.current) {
|
|
|
|
|
|
base = JSON.parse(defaultSearchParams.current)
|
2025-09-22 09:11:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Default filter tripletlerini çıkar
|
|
|
|
|
|
const baseTriplets = extractSearchParamsFields(base)
|
|
|
|
|
|
|
|
|
|
|
|
// Extra filter tripletleri hazırla
|
|
|
|
|
|
const extraTriplets = activeFilters.map(
|
|
|
|
|
|
(f) => [f.fieldName, f.operator, f.value] as [string, string, any],
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Tripletleri birleştir, aynı field+op varsa sonuncuyu al
|
|
|
|
|
|
const merged = [...baseTriplets, ...extraTriplets].reduce(
|
|
|
|
|
|
(acc, cur) => {
|
|
|
|
|
|
const [field, op] = cur
|
|
|
|
|
|
const idx = acc.findIndex((a) => a[0] === field && a[1] === op)
|
|
|
|
|
|
if (idx >= 0) {
|
|
|
|
|
|
acc[idx] = cur // varsa üzerine yaz
|
|
|
|
|
|
} else {
|
|
|
|
|
|
acc.push(cur)
|
|
|
|
|
|
}
|
|
|
|
|
|
return acc
|
|
|
|
|
|
},
|
|
|
|
|
|
[] as [string, string, any][],
|
|
|
|
|
|
)
|
2025-09-19 13:30:19 +00:00
|
|
|
|
|
2025-09-22 09:11:15 +00:00
|
|
|
|
// Tek filtre varsa direkt yaz
|
|
|
|
|
|
let filter: any = null
|
|
|
|
|
|
if (merged.length === 1) {
|
|
|
|
|
|
filter = merged[0]
|
|
|
|
|
|
} else if (merged.length > 1) {
|
|
|
|
|
|
filter = merged.reduce((acc, f, idx) => {
|
|
|
|
|
|
if (idx === 0) return f
|
|
|
|
|
|
return [acc, 'and', f]
|
2025-09-19 13:30:19 +00:00
|
|
|
|
}, null as any)
|
2025-09-18 21:12:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-19 13:30:19 +00:00
|
|
|
|
if (filter) {
|
|
|
|
|
|
searchParams?.set('filter', JSON.stringify(filter))
|
2025-09-18 21:12:08 +00:00
|
|
|
|
} else {
|
2025-09-22 09:11:15 +00:00
|
|
|
|
searchParams?.delete('filter')
|
2025-09-17 14:13:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-19 13:30:19 +00:00
|
|
|
|
gridRef.current?.instance.refresh()
|
|
|
|
|
|
}, [extraFilters])
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
refListFormCode.current = listFormCode
|
|
|
|
|
|
if (!gridRef?.current) {
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gridRef.current.instance.option('remoteOperations', { groupPaging: true })
|
|
|
|
|
|
gridRef.current.instance.option('columns', columnData)
|
|
|
|
|
|
gridRef.current.instance.option('dataSource', gridDataSource)
|
|
|
|
|
|
|
|
|
|
|
|
const stateStoring: IStateStoringProps = {
|
|
|
|
|
|
enabled: gridDto?.gridOptions.stateStoringDto?.enabled,
|
|
|
|
|
|
type: gridDto?.gridOptions.stateStoringDto?.type,
|
|
|
|
|
|
savingTimeout: gridDto?.gridOptions.stateStoringDto?.savingTimeout,
|
|
|
|
|
|
storageKey: gridDto?.gridOptions.stateStoringDto?.storageKey,
|
|
|
|
|
|
}
|
|
|
|
|
|
if (
|
|
|
|
|
|
gridDto?.gridOptions.stateStoringDto?.enabled &&
|
|
|
|
|
|
gridDto?.gridOptions.stateStoringDto?.type === 'custom'
|
|
|
|
|
|
) {
|
|
|
|
|
|
stateStoring.customSave = customSaveState
|
|
|
|
|
|
stateStoring.customLoad = customLoadState
|
|
|
|
|
|
}
|
|
|
|
|
|
gridRef.current.instance.option('stateStoring', stateStoring)
|
|
|
|
|
|
}, [columnData])
|
|
|
|
|
|
|
2025-08-18 14:55:51 +00:00
|
|
|
|
const onExporting = async (e: DataGridTypes.ExportingEvent) => {
|
|
|
|
|
|
// DevExtreme’in varsayılan export davranışını iptal ediyoruz; kendi akışımızı çalıştıracağız
|
|
|
|
|
|
e.cancel = true
|
|
|
|
|
|
|
|
|
|
|
|
const grid = gridRef?.current?.instance
|
|
|
|
|
|
if (!grid) return
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (e.format === 'xlsx' || e.format === 'csv') {
|
|
|
|
|
|
// exceljs + file-saver + devextreme excel exporter => ihtiyaç anında yükle
|
|
|
|
|
|
const [{ Workbook }, { saveAs }, { exportDataGrid: exportDataExcel }] = await Promise.all([
|
|
|
|
|
|
import('exceljs'),
|
|
|
|
|
|
import('file-saver'),
|
|
|
|
|
|
import('devextreme/excel_exporter'),
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
const workbook = new Workbook()
|
|
|
|
|
|
const worksheet = workbook.addWorksheet(`${listFormCode}_sheet`)
|
|
|
|
|
|
|
|
|
|
|
|
await exportDataExcel({
|
|
|
|
|
|
component: grid,
|
|
|
|
|
|
worksheet,
|
|
|
|
|
|
autoFilterEnabled: true,
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if (e.format === 'xlsx') {
|
|
|
|
|
|
const buffer = await workbook.xlsx.writeBuffer()
|
2025-07-28 12:48:30 +00:00
|
|
|
|
saveAs(
|
|
|
|
|
|
new Blob([buffer], { type: 'application/octet-stream' }),
|
|
|
|
|
|
`${listFormCode}_export.xlsx`,
|
|
|
|
|
|
)
|
2025-08-18 14:55:51 +00:00
|
|
|
|
} else {
|
|
|
|
|
|
const buffer = await workbook.csv.writeBuffer()
|
2025-07-28 12:48:30 +00:00
|
|
|
|
saveAs(
|
|
|
|
|
|
new Blob([buffer], { type: 'application/octet-stream' }),
|
|
|
|
|
|
`${listFormCode}_export.csv`,
|
|
|
|
|
|
)
|
2025-08-18 14:55:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
} else if (e.format === 'pdf') {
|
|
|
|
|
|
// jspdf + devextreme pdf exporter => ihtiyaç anında yükle
|
|
|
|
|
|
const [jspdfMod, { exportDataGrid: exportDataPdf }] = await Promise.all([
|
|
|
|
|
|
import('jspdf'),
|
|
|
|
|
|
import('devextreme/pdf_exporter'),
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
// jsPDF bazı paketlemelerde default, bazılarında named export olarak gelir
|
|
|
|
|
|
const JsPDFCtor = (jspdfMod as any).default ?? (jspdfMod as any).jsPDF
|
|
|
|
|
|
const doc = new JsPDFCtor({})
|
|
|
|
|
|
|
|
|
|
|
|
await exportDataPdf({
|
|
|
|
|
|
jsPDFDocument: doc,
|
|
|
|
|
|
component: grid,
|
|
|
|
|
|
indent: 5,
|
2025-05-06 06:45:49 +00:00
|
|
|
|
})
|
2025-08-18 14:55:51 +00:00
|
|
|
|
|
|
|
|
|
|
doc.save(`${listFormCode}_export.pdf`)
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('Export error:', err)
|
|
|
|
|
|
toast.push(
|
|
|
|
|
|
<Notification type="danger" duration={2500}>
|
|
|
|
|
|
{translate('::App.Common.ExportError') ?? 'Dışa aktarma sırasında hata oluştu.'}
|
|
|
|
|
|
</Notification>,
|
2025-09-01 14:07:03 +00:00
|
|
|
|
{ placement: 'top-end' },
|
2025-08-18 14:55:51 +00:00
|
|
|
|
)
|
2025-05-06 06:45:49 +00:00
|
|
|
|
}
|
2025-07-28 12:48:30 +00:00
|
|
|
|
}
|
2025-05-06 06:45:49 +00:00
|
|
|
|
|
|
|
|
|
|
return (
|
2025-09-12 11:26:35 +00:00
|
|
|
|
<>
|
2025-09-22 09:11:15 +00:00
|
|
|
|
<WidgetGroup widgetGroups={gridDto?.widgets ?? []} />
|
2025-09-12 11:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
<Container className={DX_CLASSNAMES}>
|
|
|
|
|
|
{!isSubForm && (
|
|
|
|
|
|
<Helmet
|
2025-11-03 11:25:05 +00:00
|
|
|
|
titleTemplate="%s | Erp Platform"
|
2025-09-12 11:26:35 +00:00
|
|
|
|
title={translate('::' + gridDto?.gridOptions.title)}
|
2025-11-03 11:25:05 +00:00
|
|
|
|
defaultTitle="Erp Platform"
|
2025-09-12 11:26:35 +00:00
|
|
|
|
></Helmet>
|
|
|
|
|
|
)}
|
|
|
|
|
|
{gridDto && columnData && (
|
2025-09-17 14:13:48 +00:00
|
|
|
|
<>
|
|
|
|
|
|
<div className="p-1">
|
|
|
|
|
|
<DataGrid
|
|
|
|
|
|
ref={gridRef as any}
|
|
|
|
|
|
id={'Grid-' + listFormCode}
|
|
|
|
|
|
//dataSource={gridDataSource}
|
|
|
|
|
|
//remoteOperations={{ groupPaging: true }}
|
|
|
|
|
|
//remoteOperations={false}
|
2025-11-07 19:39:40 +00:00
|
|
|
|
height={gridDto.gridOptions.height || 'calc(100vh - 150px)'}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
width={gridDto.gridOptions.width || '100%'}
|
|
|
|
|
|
allowColumnResizing={gridDto.gridOptions.columnOptionDto?.allowColumnResizing}
|
|
|
|
|
|
allowColumnReordering={gridDto.gridOptions.columnOptionDto?.allowColumnReordering}
|
|
|
|
|
|
showBorders={gridDto.gridOptions.columnOptionDto?.showBorders}
|
|
|
|
|
|
showRowLines={gridDto.gridOptions.columnOptionDto?.showRowLines}
|
|
|
|
|
|
showColumnLines={gridDto.gridOptions.columnOptionDto?.showColumnLines}
|
|
|
|
|
|
columnResizingMode={gridDto.gridOptions.columnOptionDto?.columnResizingMode}
|
|
|
|
|
|
columnAutoWidth={gridDto.gridOptions.columnOptionDto?.columnAutoWidth}
|
|
|
|
|
|
rtlEnabled={gridDto.gridOptions.columnOptionDto?.rtlEnabled}
|
|
|
|
|
|
rowAlternationEnabled={gridDto.gridOptions.columnOptionDto?.rowAlternationEnabled}
|
2025-10-08 20:35:47 +00:00
|
|
|
|
onRowPrepared={(e) => {
|
2025-10-09 13:17:54 +00:00
|
|
|
|
//header, filter, data, group, summaries
|
2025-10-08 20:35:47 +00:00
|
|
|
|
if (e.rowType === 'data') {
|
|
|
|
|
|
e.rowElement.style.height = gridDto.gridOptions?.rowDto.rowHeight
|
|
|
|
|
|
e.rowElement.style.whiteSpace = gridDto.gridOptions?.rowDto.whiteSpace
|
|
|
|
|
|
e.rowElement.style.overflowWrap = gridDto.gridOptions?.rowDto.overflowWrap
|
|
|
|
|
|
}
|
|
|
|
|
|
}}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
hoverStateEnabled={gridDto.gridOptions.columnOptionDto?.hoverStateEnabled}
|
|
|
|
|
|
columnHidingEnabled={gridDto.gridOptions.columnOptionDto?.columnHidingEnabled}
|
|
|
|
|
|
focusedRowEnabled={gridDto.gridOptions.columnOptionDto?.focusedRowEnabled}
|
|
|
|
|
|
showColumnHeaders={gridDto.gridOptions.columnOptionDto?.showColumnHeaders}
|
|
|
|
|
|
filterSyncEnabled={true}
|
|
|
|
|
|
onSelectionChanged={onSelectionChanged}
|
|
|
|
|
|
onInitNewRow={onInitNewRow}
|
|
|
|
|
|
onCellPrepared={onCellPrepared}
|
|
|
|
|
|
onRowInserting={onRowInserting}
|
|
|
|
|
|
onRowUpdating={onRowUpdating}
|
|
|
|
|
|
onEditingStart={onEditingStart}
|
|
|
|
|
|
onDataErrorOccurred={onDataErrorOccurred}
|
|
|
|
|
|
onExporting={onExporting}
|
|
|
|
|
|
onEditCanceled={() => {
|
|
|
|
|
|
setMode('view')
|
2025-11-07 19:28:09 +00:00
|
|
|
|
setIsPopupFullScreen(false)
|
2025-09-17 14:13:48 +00:00
|
|
|
|
}}
|
|
|
|
|
|
onSaved={() => {
|
|
|
|
|
|
setMode('view')
|
2025-11-07 19:28:09 +00:00
|
|
|
|
setIsPopupFullScreen(false)
|
2025-09-17 14:13:48 +00:00
|
|
|
|
}}
|
|
|
|
|
|
onRowInserted={() => {
|
|
|
|
|
|
props.refreshData?.()
|
2025-09-12 11:26:35 +00:00
|
|
|
|
}}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
onRowUpdated={() => {
|
|
|
|
|
|
props.refreshData?.()
|
|
|
|
|
|
}}
|
|
|
|
|
|
onRowRemoved={() => {
|
|
|
|
|
|
props.refreshData?.()
|
|
|
|
|
|
}}
|
2025-09-24 17:46:03 +00:00
|
|
|
|
onEditorPreparing={(editor) => {
|
|
|
|
|
|
if (editor.parentType === 'dataRow' && editor.dataField) {
|
|
|
|
|
|
const formItem = gridDto.gridOptions.editingFormDto
|
|
|
|
|
|
.flatMap((group) => group.items || [])
|
|
|
|
|
|
.find((i) => i.dataField === editor.dataField)
|
|
|
|
|
|
|
2025-10-22 14:58:27 +00:00
|
|
|
|
if (formItem?.editorScript) {
|
2025-09-24 17:46:03 +00:00
|
|
|
|
const prevHandler = editor.editorOptions.onValueChanged // varsa önceki handler'ı sakla
|
|
|
|
|
|
|
|
|
|
|
|
editor.editorOptions.onValueChanged = (e: any) => {
|
|
|
|
|
|
// yeni handler
|
|
|
|
|
|
if (prevHandler) prevHandler(e)
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const grid = editor.component
|
|
|
|
|
|
const rowKey = grid.option('editing.editRowKey')
|
|
|
|
|
|
const rowIndex = grid.getRowIndexByKey(rowKey)
|
|
|
|
|
|
|
|
|
|
|
|
// formData → aktif satırın datası
|
|
|
|
|
|
const formData =
|
|
|
|
|
|
grid.getVisibleRows().find((r) => r.key === rowKey)?.data || {}
|
|
|
|
|
|
|
|
|
|
|
|
// setFormData → komple yeni obje vererek güncelleme
|
|
|
|
|
|
const setFormData = (newData: any) => {
|
|
|
|
|
|
if (rowIndex >= 0) {
|
|
|
|
|
|
Object.keys(newData).forEach((field) => {
|
|
|
|
|
|
grid.cellValue(rowIndex, field, newData[field])
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-22 14:58:27 +00:00
|
|
|
|
eval(formItem.editorScript!)
|
2025-09-24 17:46:03 +00:00
|
|
|
|
//setFormData({ ...formData, Path: e.value, Authority: e.value })
|
|
|
|
|
|
|
|
|
|
|
|
// editor.component.cellValue(
|
|
|
|
|
|
// editor.component.getRowIndexByKey(
|
|
|
|
|
|
// editor.component.option('editing.editRowKey'),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
// 'Path',
|
|
|
|
|
|
// e.value,
|
|
|
|
|
|
// )
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('Script exec error', formItem.dataField, err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (editor.editorOptions?.buttons) {
|
|
|
|
|
|
editor.editorOptions.buttons = editor.editorOptions.buttons.map(
|
|
|
|
|
|
(btn: any) => {
|
|
|
|
|
|
if (btn?.options?.onClick && typeof btn.options.onClick === 'function') {
|
|
|
|
|
|
const origClick = btn.options.onClick
|
|
|
|
|
|
btn.options.onClick = (e: any) => {
|
|
|
|
|
|
const grid = editor.component
|
|
|
|
|
|
const rowKey = grid.option('editing.editRowKey')
|
|
|
|
|
|
const rowIndex = grid.getRowIndexByKey(rowKey)
|
|
|
|
|
|
const formData =
|
|
|
|
|
|
grid.getVisibleRows().find((r) => r.key === rowKey)?.data || {}
|
|
|
|
|
|
|
|
|
|
|
|
origClick({
|
|
|
|
|
|
...e,
|
|
|
|
|
|
formData,
|
|
|
|
|
|
fieldName: editor.dataField,
|
|
|
|
|
|
rowKey,
|
|
|
|
|
|
rowIndex,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return btn
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
>
|
|
|
|
|
|
<Export
|
|
|
|
|
|
enabled={true}
|
|
|
|
|
|
allowExportSelectedData={false}
|
|
|
|
|
|
formats={['pdf', 'xlsx', 'csv']}
|
|
|
|
|
|
/>
|
|
|
|
|
|
<Editing
|
|
|
|
|
|
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
|
|
|
|
|
|
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
|
|
|
|
|
|
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
|
|
|
|
|
|
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating}
|
|
|
|
|
|
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
|
|
|
|
|
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
|
|
|
|
|
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
|
|
|
|
|
newRowPosition={gridDto.gridOptions.editingOptionDto?.newRowPosition}
|
|
|
|
|
|
selectTextOnEditStart={
|
|
|
|
|
|
gridDto.gridOptions.editingOptionDto?.selectTextOnEditStart
|
|
|
|
|
|
}
|
|
|
|
|
|
startEditAction={gridDto.gridOptions.editingOptionDto?.startEditAction}
|
|
|
|
|
|
popup={{
|
2025-11-07 19:28:09 +00:00
|
|
|
|
title: (mode === 'new' ? '✚ ' : '🖊️ ') + translate('::' + gridDto.gridOptions.editingOptionDto?.popup?.title),
|
2025-09-17 14:13:48 +00:00
|
|
|
|
showTitle: gridDto.gridOptions.editingOptionDto?.popup?.showTitle,
|
|
|
|
|
|
hideOnOutsideClick:
|
|
|
|
|
|
gridDto.gridOptions.editingOptionDto?.popup?.hideOnOutsideClick,
|
|
|
|
|
|
width: gridDto.gridOptions.editingOptionDto?.popup?.width,
|
|
|
|
|
|
height: gridDto.gridOptions.editingOptionDto?.popup?.height,
|
2025-11-07 19:28:09 +00:00
|
|
|
|
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),
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
],
|
2025-09-17 14:13:48 +00:00
|
|
|
|
}}
|
|
|
|
|
|
form={{
|
2025-11-07 19:28:09 +00:00
|
|
|
|
colCount: 1,
|
2025-09-24 17:46:03 +00:00
|
|
|
|
onFieldDataChanged: (e) => {
|
|
|
|
|
|
if (e.dataField) {
|
|
|
|
|
|
const formItem = gridDto.gridOptions.editingFormDto
|
|
|
|
|
|
.flatMap((group) => group.items || [])
|
|
|
|
|
|
.find((i) => i.dataField === e.dataField)
|
2025-10-22 14:58:27 +00:00
|
|
|
|
if (formItem?.editorScript) {
|
2025-09-24 17:46:03 +00:00
|
|
|
|
try {
|
2025-10-22 14:58:27 +00:00
|
|
|
|
eval(formItem.editorScript)
|
2025-09-24 17:46:03 +00:00
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error('Script exec error', err)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-09-17 14:13:48 +00:00
|
|
|
|
items:
|
|
|
|
|
|
gridDto.gridOptions.editingFormDto?.length > 0
|
2025-11-07 14:06:17 +00:00
|
|
|
|
? (() => {
|
|
|
|
|
|
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
|
|
|
|
|
.slice()
|
|
|
|
|
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
|
|
|
|
|
|
|
|
|
|
|
// Tabbed item'ları grupla
|
2025-11-07 19:28:09 +00:00
|
|
|
|
const tabbedItems = sortedFormDto.filter(
|
|
|
|
|
|
(e: any) => e.itemType === 'tabbed',
|
|
|
|
|
|
)
|
2025-11-07 14:06:17 +00:00
|
|
|
|
const result: any[] = []
|
|
|
|
|
|
|
|
|
|
|
|
// Helper function: item mapper
|
|
|
|
|
|
const mapFormItem = (i: EditingFormItemDto) => {
|
|
|
|
|
|
let editorOptions: EditorOptionsWithButtons = {}
|
|
|
|
|
|
try {
|
|
|
|
|
|
editorOptions = i.editorOptions && JSON.parse(i.editorOptions)
|
|
|
|
|
|
|
|
|
|
|
|
if (editorOptions?.buttons) {
|
|
|
|
|
|
editorOptions.buttons = (editorOptions?.buttons || []).map(
|
|
|
|
|
|
(btn: any) => {
|
|
|
|
|
|
if (
|
|
|
|
|
|
btn?.options?.onClick &&
|
|
|
|
|
|
typeof btn.options.onClick === 'string'
|
|
|
|
|
|
) {
|
|
|
|
|
|
btn.options.onClick = eval(`(${btn.options.onClick})`)
|
2025-09-24 17:46:03 +00:00
|
|
|
|
}
|
2025-11-07 14:06:17 +00:00
|
|
|
|
return btn
|
|
|
|
|
|
},
|
|
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const rawFilter = searchParams?.get('filter')
|
|
|
|
|
|
if (rawFilter) {
|
|
|
|
|
|
const parsed = JSON.parse(rawFilter)
|
|
|
|
|
|
const filters = extractSearchParamsFields(parsed)
|
|
|
|
|
|
|
|
|
|
|
|
const hasFilter = filters.some(
|
|
|
|
|
|
([field, op, val]) => field === i.dataField,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFilter) {
|
|
|
|
|
|
const existsInExtra = extraFilters.some(
|
|
|
|
|
|
(f) => f.fieldName === i.dataField && !!f.value,
|
2025-09-17 14:13:48 +00:00
|
|
|
|
)
|
2025-11-07 14:06:17 +00:00
|
|
|
|
|
|
|
|
|
|
if (!existsInExtra) {
|
2025-09-17 14:13:48 +00:00
|
|
|
|
editorOptions = {
|
2025-09-12 11:26:35 +00:00
|
|
|
|
...editorOptions,
|
2025-09-17 14:13:48 +00:00
|
|
|
|
readOnly: true,
|
|
|
|
|
|
}
|
2025-09-12 11:26:35 +00:00
|
|
|
|
}
|
2025-11-07 14:06:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch {}
|
|
|
|
|
|
|
|
|
|
|
|
const fieldName = i.dataField.split(':')[0]
|
|
|
|
|
|
const listFormField = gridDto.columnFormats.find(
|
|
|
|
|
|
(x: any) => x.fieldName === fieldName,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if (listFormField?.sourceDbType === DbTypeEnum.Date) {
|
|
|
|
|
|
editorOptions = {
|
|
|
|
|
|
...{
|
|
|
|
|
|
type: 'date',
|
|
|
|
|
|
dateSerializationFormat: 'yyyy-MM-dd',
|
|
|
|
|
|
displayFormat: 'shortDate',
|
|
|
|
|
|
},
|
|
|
|
|
|
...editorOptions,
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (
|
|
|
|
|
|
listFormField?.sourceDbType === DbTypeEnum.DateTime ||
|
|
|
|
|
|
listFormField?.sourceDbType === DbTypeEnum.DateTime2 ||
|
|
|
|
|
|
listFormField?.sourceDbType === DbTypeEnum.DateTimeOffset
|
|
|
|
|
|
) {
|
|
|
|
|
|
editorOptions = {
|
|
|
|
|
|
...{
|
|
|
|
|
|
type: 'datetime',
|
|
|
|
|
|
dateSerializationFormat: 'yyyy-MM-ddTHH:mm:ssxxx',
|
|
|
|
|
|
displayFormat: 'shortDateShortTime',
|
|
|
|
|
|
},
|
|
|
|
|
|
...editorOptions,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const item: SimpleItemWithColData = {
|
|
|
|
|
|
canRead: listFormField?.canRead ?? false,
|
|
|
|
|
|
canUpdate: listFormField?.canUpdate ?? false,
|
|
|
|
|
|
canCreate: listFormField?.canCreate ?? false,
|
|
|
|
|
|
canExport: listFormField?.canExport ?? false,
|
|
|
|
|
|
dataField: i.dataField,
|
|
|
|
|
|
name: i.dataField,
|
|
|
|
|
|
editorType2: i.editorType2,
|
|
|
|
|
|
editorType:
|
|
|
|
|
|
i.editorType2 == PlatformEditorTypes.dxGridBox
|
|
|
|
|
|
? 'dxDropDownBox'
|
|
|
|
|
|
: i.editorType2,
|
|
|
|
|
|
colSpan: i.colSpan,
|
|
|
|
|
|
isRequired: i.isRequired,
|
|
|
|
|
|
editorOptions,
|
|
|
|
|
|
editorScript: i.editorScript,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (i.dataField.indexOf(':') >= 0) {
|
|
|
|
|
|
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
(mode == 'edit' && !item.canUpdate) ||
|
|
|
|
|
|
(mode == 'new' && !item.canCreate)
|
|
|
|
|
|
) {
|
|
|
|
|
|
item.editorOptions = {
|
|
|
|
|
|
...item.editorOptions,
|
|
|
|
|
|
readOnly: true,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return item
|
|
|
|
|
|
}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
|
2025-11-07 14:06:17 +00:00
|
|
|
|
sortedFormDto.forEach((e: any) => {
|
|
|
|
|
|
if (e.itemType !== 'tabbed') {
|
|
|
|
|
|
// colCount: max(endpoint.colCount, max(item.colSpan))
|
|
|
|
|
|
const maxItemColSpan = Math.max(
|
|
|
|
|
|
...(e.items?.map((i: any) => i.colSpan || 1) || [1]),
|
|
|
|
|
|
)
|
2025-11-07 19:28:09 +00:00
|
|
|
|
const effectiveColCount = Math.max(maxItemColSpan, e.colCount || 1)
|
|
|
|
|
|
|
2025-11-07 14:06:17 +00:00
|
|
|
|
result.push({
|
|
|
|
|
|
itemType: e.itemType,
|
|
|
|
|
|
colCount: effectiveColCount,
|
|
|
|
|
|
colSpan: e.colSpan,
|
|
|
|
|
|
caption: e.caption, // Group'larda caption olmalı
|
|
|
|
|
|
items: e.items
|
|
|
|
|
|
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
|
|
|
|
|
.map(mapFormItem)
|
|
|
|
|
|
.filter((a: any) => {
|
|
|
|
|
|
if (mode === 'view') {
|
|
|
|
|
|
return a.canRead
|
|
|
|
|
|
} else if (mode === 'new') {
|
|
|
|
|
|
return a.canCreate || a.canRead
|
|
|
|
|
|
} else if (mode === 'edit') {
|
|
|
|
|
|
return a.canUpdate || a.canRead
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}),
|
|
|
|
|
|
})
|
|
|
|
|
|
} else if (tabbedItems.length > 0 && e === tabbedItems[0]) {
|
|
|
|
|
|
// Tabbed için caption OLMAMALI - sadece tabs array içinde title kullan
|
|
|
|
|
|
result.push({
|
|
|
|
|
|
itemType: 'tabbed',
|
2025-11-07 19:28:09 +00:00
|
|
|
|
colCount: 1,
|
2025-11-07 14:06:17 +00:00
|
|
|
|
colSpan: 1,
|
|
|
|
|
|
// caption kullanma! Tabs içindeki title'lar yeterli
|
|
|
|
|
|
tabs: tabbedItems.map((tabbedItem: any) => {
|
|
|
|
|
|
// Tab için colCount: max(endpoint.colCount, max(item.colSpan))
|
|
|
|
|
|
const maxItemColSpan = Math.max(
|
|
|
|
|
|
...(tabbedItem.items?.map((i: any) => i.colSpan || 1) || [1]),
|
|
|
|
|
|
)
|
|
|
|
|
|
const effectiveColCount = Math.max(
|
|
|
|
|
|
maxItemColSpan,
|
|
|
|
|
|
tabbedItem.colCount || 1,
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
title: tabbedItem.caption, // Her tab'ın title'ı
|
|
|
|
|
|
colCount: effectiveColCount,
|
|
|
|
|
|
items: tabbedItem.items
|
|
|
|
|
|
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
|
|
|
|
|
.map(mapFormItem)
|
|
|
|
|
|
.filter((a: any) => {
|
|
|
|
|
|
if (mode === 'view') {
|
|
|
|
|
|
return a.canRead
|
|
|
|
|
|
} else if (mode === 'new') {
|
|
|
|
|
|
return a.canCreate || a.canRead
|
|
|
|
|
|
} else if (mode === 'edit') {
|
|
|
|
|
|
return a.canUpdate || a.canRead
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false
|
|
|
|
|
|
}
|
|
|
|
|
|
}),
|
2025-09-17 14:13:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
}),
|
2025-11-07 14:06:17 +00:00
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
})
|
2025-11-07 14:06:17 +00:00
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
})()
|
2025-09-17 14:13:48 +00:00
|
|
|
|
: undefined,
|
|
|
|
|
|
}}
|
|
|
|
|
|
></Editing>
|
|
|
|
|
|
<Template name={'cellEditTagBox'} render={TagBoxEditorComponent} />
|
|
|
|
|
|
<Template name={'cellEditGridBox'} render={GridBoxEditorComponent} />
|
|
|
|
|
|
<Template name="extraFilters">
|
|
|
|
|
|
<GridExtraFilterToolbar
|
|
|
|
|
|
filters={gridDto?.gridOptions.extraFilterDto ?? []}
|
|
|
|
|
|
extraFilters={extraFilters}
|
|
|
|
|
|
setExtraFilters={setExtraFilters}
|
|
|
|
|
|
/>
|
|
|
|
|
|
</Template>
|
|
|
|
|
|
<Toolbar visible={toolbarData.length > 0 || filterToolbarData.length > 0}>
|
|
|
|
|
|
{toolbarData.map((item) => (
|
|
|
|
|
|
<Item key={item.name} {...item}></Item>
|
2025-09-12 11:26:35 +00:00
|
|
|
|
))}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
{filterToolbarData.map((item) => (
|
|
|
|
|
|
<Item key={item.name} {...item}></Item>
|
2025-09-12 11:26:35 +00:00
|
|
|
|
))}
|
2025-09-17 14:13:48 +00:00
|
|
|
|
{/* burada özel filtre alanını Template ile bağla */}
|
|
|
|
|
|
{gridDto?.gridOptions.extraFilterDto?.length ? (
|
2025-09-19 13:30:19 +00:00
|
|
|
|
<Item location="before" template="extraFilters" cssClass="no-default" />
|
2025-09-17 14:13:48 +00:00
|
|
|
|
) : null}
|
|
|
|
|
|
</Toolbar>
|
|
|
|
|
|
<Sorting mode={gridDto.gridOptions?.sortMode}></Sorting>
|
|
|
|
|
|
<FilterRow
|
|
|
|
|
|
visible={gridDto.gridOptions.filterRowDto?.visible}
|
|
|
|
|
|
applyFilter={gridDto.gridOptions.filterRowDto?.applyFilter}
|
|
|
|
|
|
></FilterRow>
|
|
|
|
|
|
<FilterPanel visible={gridDto.gridOptions.filterPanelDto.visible}></FilterPanel>
|
|
|
|
|
|
<HeaderFilter visible={gridDto.gridOptions.headerFilterDto.visible}></HeaderFilter>
|
|
|
|
|
|
<SearchPanel
|
|
|
|
|
|
visible={gridDto.gridOptions.searchPanelDto.visible}
|
|
|
|
|
|
width={gridDto.gridOptions.searchPanelDto.width}
|
|
|
|
|
|
></SearchPanel>
|
|
|
|
|
|
<GroupPanel visible={gridDto.gridOptions.groupPanelDto?.visible}></GroupPanel>
|
|
|
|
|
|
<Grouping
|
|
|
|
|
|
autoExpandAll={gridDto.gridOptions.groupPanelDto?.autoExpandAll}
|
|
|
|
|
|
></Grouping>
|
|
|
|
|
|
<Selection
|
|
|
|
|
|
mode={gridDto.gridOptions.selectionDto?.mode}
|
|
|
|
|
|
allowSelectAll={gridDto.gridOptions.selectionDto?.allowSelectAll}
|
|
|
|
|
|
selectAllMode={gridDto.gridOptions.selectionDto?.selectAllMode}
|
|
|
|
|
|
showCheckBoxesMode={gridDto.gridOptions.selectionDto?.showCheckBoxesMode}
|
|
|
|
|
|
></Selection>
|
|
|
|
|
|
{/* <Paging pageSize={gridDto.gridOptions.pageSize ?? 0}></Paging> */}
|
|
|
|
|
|
<Pager
|
|
|
|
|
|
visible={gridDto.gridOptions.pagerOptionDto?.visible}
|
|
|
|
|
|
allowedPageSizes={gridDto.gridOptions.pagerOptionDto?.allowedPageSizes
|
|
|
|
|
|
?.split(',')
|
|
|
|
|
|
.map((a: any) => +a)}
|
|
|
|
|
|
showPageSizeSelector={gridDto.gridOptions.pagerOptionDto?.showPageSizeSelector}
|
|
|
|
|
|
showInfo={gridDto.gridOptions.pagerOptionDto?.showInfo}
|
|
|
|
|
|
showNavigationButtons={gridDto.gridOptions.pagerOptionDto?.showNavigationButtons}
|
|
|
|
|
|
infoText={gridDto.gridOptions.pagerOptionDto?.infoText}
|
|
|
|
|
|
displayMode={gridDto.gridOptions.pagerOptionDto?.displayMode}
|
|
|
|
|
|
></Pager>
|
|
|
|
|
|
<ColumnChooser
|
|
|
|
|
|
enabled={gridDto.gridOptions.columnOptionDto?.columnChooserEnabled}
|
|
|
|
|
|
mode={gridDto.gridOptions.columnOptionDto?.columnChooserMode}
|
|
|
|
|
|
></ColumnChooser>
|
|
|
|
|
|
<ColumnFixing
|
|
|
|
|
|
enabled={gridDto.gridOptions.columnOptionDto?.columnFixingEnabled}
|
|
|
|
|
|
></ColumnFixing>
|
|
|
|
|
|
<Scrolling mode={gridDto.gridOptions.pagerOptionDto?.scrollingMode}></Scrolling>
|
|
|
|
|
|
<LoadPanel
|
|
|
|
|
|
enabled={gridDto.gridOptions.pagerOptionDto?.loadPanelEnabled}
|
|
|
|
|
|
text={gridDto.gridOptions.pagerOptionDto?.loadPanelText}
|
|
|
|
|
|
></LoadPanel>
|
|
|
|
|
|
<Summary>
|
|
|
|
|
|
{gridDto.columnFormats
|
|
|
|
|
|
.filter((x: any) => !!x.columnTotalSummaryDto?.summaryType)
|
|
|
|
|
|
.map((x: any) => (
|
|
|
|
|
|
<TotalItem
|
|
|
|
|
|
key={`Total_${x.fieldName}`}
|
|
|
|
|
|
column={x.fieldName}
|
|
|
|
|
|
summaryType={x.columnTotalSummaryDto.summaryType as any}
|
|
|
|
|
|
showInColumn={x.columnTotalSummaryDto.showInColumn}
|
|
|
|
|
|
valueFormat={x.columnTotalSummaryDto.valueFormat}
|
|
|
|
|
|
displayFormat={x.columnTotalSummaryDto.displayFormat}
|
|
|
|
|
|
/>
|
|
|
|
|
|
))}
|
|
|
|
|
|
{gridDto.columnFormats
|
|
|
|
|
|
.filter((x: any) => !!x.columnGroupSummaryDto?.summaryType)
|
|
|
|
|
|
.map((x: any) => (
|
|
|
|
|
|
<GroupItemDx
|
|
|
|
|
|
key={`Group_${x.fieldName}`}
|
|
|
|
|
|
column={x.fieldName}
|
|
|
|
|
|
summaryType={x.columnGroupSummaryDto.summaryType as any}
|
|
|
|
|
|
showInColumn={x.columnGroupSummaryDto.showInColumn}
|
|
|
|
|
|
valueFormat={x.columnGroupSummaryDto.valueFormat}
|
|
|
|
|
|
displayFormat={x.columnGroupSummaryDto.displayFormat}
|
|
|
|
|
|
/>
|
|
|
|
|
|
))}
|
|
|
|
|
|
</Summary>
|
|
|
|
|
|
</DataGrid>
|
|
|
|
|
|
|
|
|
|
|
|
{gridDto?.gridOptions?.subFormsDto?.length > 0 && (
|
|
|
|
|
|
<>
|
2025-09-19 13:30:19 +00:00
|
|
|
|
<hr className="my-2" />
|
2025-09-17 14:13:48 +00:00
|
|
|
|
<SubForms gridDto={gridDto!} formData={formData} level={level ?? 0} />
|
|
|
|
|
|
</>
|
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<Dialog
|
|
|
|
|
|
width={smaller.md ? '100%' : 1000}
|
|
|
|
|
|
isOpen={filterData.isImportModalOpen || false}
|
|
|
|
|
|
onClose={() => filterData.setIsImportModalOpen(false)}
|
|
|
|
|
|
onRequestClose={() => filterData.setIsImportModalOpen(false)}
|
|
|
|
|
|
>
|
|
|
|
|
|
<ImportDashboard gridDto={gridDto} />
|
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</>
|
2025-09-12 11:26:35 +00:00
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
|
|
<Dialog
|
|
|
|
|
|
isOpen={toolbarModalData?.open || false}
|
|
|
|
|
|
onClose={() => setToolbarModalData(undefined)}
|
|
|
|
|
|
onRequestClose={() => setToolbarModalData(undefined)}
|
|
|
|
|
|
>
|
|
|
|
|
|
{toolbarModalData?.content}
|
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
<GridFilterDialogs gridRef={gridRef} listFormCode={listFormCode} {...filterData} />
|
|
|
|
|
|
</Container>
|
|
|
|
|
|
</>
|
2025-05-06 06:45:49 +00:00
|
|
|
|
)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default Grid
|