Grid ve Tree için Popup açılırken state çalışmamalı
This commit is contained in:
parent
566da635c6
commit
bd56bbde9b
5 changed files with 44 additions and 9 deletions
|
|
@ -286,4 +286,17 @@ public static class LookupQueryValues
|
|||
$"(\"MovementTypeName\" = N'{movementTypeName}') " +
|
||||
$"AND \"IsDeleted\" = 'false' " +
|
||||
$"ORDER BY \"Name\";";
|
||||
|
||||
public static string RouteKeyValues =
|
||||
$@"SELECT
|
||||
""Path"" AS ""Key"",
|
||||
""Path"" AS ""Name""
|
||||
FROM ""{FullNameTable(TableNameEnum.Route)}""
|
||||
GROUP BY ""Path""
|
||||
UNION
|
||||
SELECT
|
||||
'/admin/list/' + ""ListFormCode"" AS ""Key"",
|
||||
'/admin/list/' + ""ListFormCode"" AS ""Name""
|
||||
FROM ""{FullNameTable(TableNameEnum.ListForm)}""
|
||||
GROUP BY ""ListFormCode"";";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2268,7 +2268,7 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
|||
ExportJson = DefaultExportJson,
|
||||
IsSubForm = false,
|
||||
ShowNote = true,
|
||||
LayoutJson = DefaultLayoutJson(),
|
||||
LayoutJson = DefaultLayoutJson("tree"),
|
||||
CultureName = LanguageCodes.En,
|
||||
ListFormCode = listFormName,
|
||||
Name = listFormName,
|
||||
|
|
@ -2302,7 +2302,7 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
|||
new EditingFormItemDto { Order = 1, DataField = "Code", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 2, DataField = "DisplayName", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxAutocomplete, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 3, DataField = "Order", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxNumberBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Url", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 4, DataField = "Url", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 5, DataField = "Icon", ColSpan = 1, IsRequired = true, EditorType2=EditorTypes.dxTextBox },
|
||||
new EditingFormItemDto { Order = 6, DataField = "ParentCode", ColSpan = 1, EditorType2=EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||
new EditingFormItemDto { Order = 7, DataField = "CssClass", ColSpan = 1, EditorType2=EditorTypes.dxTextBox },
|
||||
|
|
@ -2412,6 +2412,12 @@ public class ListFormSeeder_Saas : IDataSeedContributor, ITransientDependency
|
|||
IsActive = true,
|
||||
IsDeleted = false,
|
||||
AllowSearch = true,
|
||||
LookupJson = JsonSerializer.Serialize(new LookupDto {
|
||||
DataSourceType = UiLookupDataSourceTypeEnum.Query,
|
||||
DisplayExpr = "Name",
|
||||
ValueExpr = "Key",
|
||||
LookupQuery = LookupQueryValues.RouteKeyValues
|
||||
}),
|
||||
ColumnCustomizationJson = DefaultColumnCustomizationJson,
|
||||
PermissionJson = DefaultFieldPermissionJson(listForm.Name),
|
||||
PivotSettingsJson = DefaultPivotSettingsJson
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ const Grid = (props: GridProps) => {
|
|||
const gridRef = useRef<DataGridRef>()
|
||||
const refListFormCode = useRef('')
|
||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||
// Edit popup state kaydetmeyi engellemek için flag
|
||||
const isEditingRef = useRef(false)
|
||||
|
||||
const [gridDataSource, setGridDataSource] = useState<CustomStore<any, any>>()
|
||||
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
||||
|
|
@ -358,6 +360,7 @@ const Grid = (props: GridProps) => {
|
|||
}
|
||||
|
||||
function onEditingStart(e: DataGridTypes.EditingStartEvent<any, any>) {
|
||||
isEditingRef.current = true
|
||||
setMode('edit')
|
||||
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
||||
const columns = e.component.option('columns') as GridColumnData[]
|
||||
|
|
@ -516,6 +519,9 @@ const Grid = (props: GridProps) => {
|
|||
|
||||
const customSaveState = useCallback(
|
||||
(state: any) => {
|
||||
if (isEditingRef.current) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
return postListFormCustomization({
|
||||
listFormCode: listFormCode,
|
||||
customizationType: ListFormCustomizationTypeEnum.GridState,
|
||||
|
|
@ -926,10 +932,12 @@ const Grid = (props: GridProps) => {
|
|||
onDataErrorOccurred={onDataErrorOccurred}
|
||||
onExporting={onExporting}
|
||||
onEditCanceled={() => {
|
||||
isEditingRef.current = false
|
||||
setMode('view')
|
||||
setIsPopupFullScreen(false)
|
||||
}}
|
||||
onSaved={() => {
|
||||
isEditingRef.current = false
|
||||
setMode('view')
|
||||
setIsPopupFullScreen(false)
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,8 @@ const Tree = (props: TreeProps) => {
|
|||
const gridRef = useRef<TreeListRef>()
|
||||
const refListFormCode = useRef('')
|
||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||
// Edit popup state kaydetmeyi engellemek için flag
|
||||
const isEditingRef = useRef(false)
|
||||
|
||||
const [treeListDataSource, setTreeListDataSource] = useState<CustomStore<any, any>>()
|
||||
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
||||
|
|
@ -378,6 +380,7 @@ const Tree = (props: TreeProps) => {
|
|||
}
|
||||
|
||||
function onEditingStart(e: TreeListTypes.EditingStartEvent) {
|
||||
isEditingRef.current = true
|
||||
setMode('edit')
|
||||
setIsPopupFullScreen(gridDto?.gridOptions.editingOptionDto?.popup?.fullScreen ?? false)
|
||||
const columns = e.component.option('columns') as GridColumnData[]
|
||||
|
|
@ -534,15 +537,19 @@ const Tree = (props: TreeProps) => {
|
|||
}
|
||||
|
||||
const customSaveState = useCallback(
|
||||
(state: any) =>
|
||||
postListFormCustomization({
|
||||
(state: any) => {
|
||||
if (isEditingRef.current) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
return postListFormCustomization({
|
||||
listFormCode: listFormCode,
|
||||
customizationType: ListFormCustomizationTypeEnum.GridState,
|
||||
filterName: `tree-${gridRef.current?.instance().option('stateStoring')?.storageKey ?? ''}`,
|
||||
customizationData: JSON.stringify(state),
|
||||
}).then(() => {
|
||||
setGridPanelColor(statedGridPanelColor)
|
||||
}),
|
||||
})
|
||||
},
|
||||
[listFormCode],
|
||||
)
|
||||
|
||||
|
|
@ -801,10 +808,12 @@ const Tree = (props: TreeProps) => {
|
|||
onEditingStart={onEditingStart}
|
||||
onDataErrorOccurred={onDataErrorOccurred}
|
||||
onEditCanceled={() => {
|
||||
isEditingRef.current = false
|
||||
setMode('view')
|
||||
setIsPopupFullScreen(false)
|
||||
}}
|
||||
onSaved={() => {
|
||||
isEditingRef.current = false
|
||||
setMode('view')
|
||||
setIsPopupFullScreen(false)
|
||||
}}
|
||||
|
|
@ -840,6 +849,7 @@ const Tree = (props: TreeProps) => {
|
|||
selectTextOnEditStart={gridDto.gridOptions.editingOptionDto?.selectTextOnEditStart}
|
||||
startEditAction={gridDto.gridOptions.editingOptionDto?.startEditAction}
|
||||
popup={{
|
||||
animation: {},
|
||||
title:
|
||||
(mode === 'new' ? '✚ ' : '🖊️ ') +
|
||||
translate('::' + gridDto.gridOptions.editingOptionDto?.popup?.title),
|
||||
|
|
@ -1154,9 +1164,7 @@ const Tree = (props: TreeProps) => {
|
|||
enabled={gridDto.gridOptions.columnOptionDto?.columnFixingEnabled}
|
||||
></ColumnFixing>
|
||||
<Scrolling
|
||||
mode="virtual"
|
||||
rowRenderingMode="virtual"
|
||||
showScrollbar="always"
|
||||
mode={gridDto.gridOptions.pagerOptionDto?.scrollingMode}
|
||||
></Scrolling>
|
||||
<LoadPanel
|
||||
enabled={gridDto.gridOptions.pagerOptionDto?.loadPanelEnabled}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export const MenuManager = () => {
|
|||
defaultTitle="Erp Platform"
|
||||
></Helmet>
|
||||
|
||||
<div className="bg-white rounded px-4 sm:px-4 lg:px-6 py-6">
|
||||
<div className="bg-white rounded px-2 sm:px-2 lg:px-3 py-3">
|
||||
<div className="flex items-center justify-between mb-6 flex-wrap gap-4">
|
||||
{/* Sol kısım: Başlık */}
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
|||
Loading…
Reference in a new issue