Allow Updating -> Allow Editing ve Allow Detail eklendi.
This commit is contained in:
parent
b43fb07e5b
commit
758d87c983
16 changed files with 282 additions and 216 deletions
|
|
@ -13,7 +13,8 @@ public class GridEditingDto
|
||||||
/// <summary>Accepted Values: 'full' | 'reshape' | 'repaint'
|
/// <summary>Accepted Values: 'full' | 'reshape' | 'repaint'
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RefreshMode { get; set; } = "full";
|
public string RefreshMode { get; set; } = "full";
|
||||||
public bool AllowUpdating { get; set; } = false;
|
public bool AllowEditing { get; set; } = false;
|
||||||
|
public bool AllowDetail { get; set; } = false;
|
||||||
public bool AllowDeleting { get; set; } = false;
|
public bool AllowDeleting { get; set; } = false;
|
||||||
public bool AllowAllDeleting { get; set; } = false;
|
public bool AllowAllDeleting { get; set; } = false;
|
||||||
public bool AllowAdding { get; set; } = false;
|
public bool AllowAdding { get; set; } = false;
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class SchedulerOptionDto
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Etkinlik güncellemeye izin verilip verilmediğini belirtir
|
/// Etkinlik güncellemeye izin verilip verilmediğini belirtir
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AllowUpdating { get; set; } = false;
|
public bool AllowEditing { get; set; } = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Etkinlik eklemeye izin verilip verilmediğini belirtir
|
/// Etkinlik eklemeye izin verilip verilmediğini belirtir
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -3998,10 +3998,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.EditingAllowUpdating",
|
"key": "ListForms.ListFormEdit.EditingAllowEditing",
|
||||||
"en": "Allow Editing",
|
"en": "Allow Editing",
|
||||||
"tr": "Güncellemeye İzin Ver"
|
"tr": "Güncellemeye İzin Ver"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormEdit.EditingAllowDetail",
|
||||||
|
"en": "Allow Detail",
|
||||||
|
"tr": "Detaya İzin Ver"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.EditingAllowDeleting",
|
"key": "ListForms.ListFormEdit.EditingAllowDeleting",
|
||||||
|
|
@ -10118,9 +10124,9 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.SchedulerOptions.AllowUpdating",
|
"key": "ListForms.SchedulerOptions.AllowEditing",
|
||||||
"tr": "Güncellemeye İzin Ver",
|
"tr": "Güncellemeye İzin Ver",
|
||||||
"en": "Allow Updating"
|
"en": "Allow Editing"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
|
|
@ -10200,6 +10206,12 @@
|
||||||
"tr": "Düzenle",
|
"tr": "Düzenle",
|
||||||
"en": "Edit"
|
"en": "Edit"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "App.Platform.Detail",
|
||||||
|
"tr": "Detay",
|
||||||
|
"en": "Detail"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "App.Platform.Delete",
|
"key": "App.Platform.Delete",
|
||||||
|
|
|
||||||
|
|
@ -1153,8 +1153,8 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
||||||
{
|
{
|
||||||
Order = 3, Caption="Supply Card", ColCount = 3, ColSpan = 2, ItemType = "group", Items =
|
Order = 3, Caption="Supply Card", ColCount = 3, ColSpan = 2, ItemType = "group", Items =
|
||||||
[
|
[
|
||||||
new EditingFormItemDto { Order = 22, DataField = "CustomerTypeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 22, DataField = "CustomerTypeId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 23, DataField = "CustomerSegmentId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 23, DataField = "CustomerSegmentId", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 24, DataField = "EmployeeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 24, DataField = "EmployeeId", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 25, DataField = "TeamCode", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
new EditingFormItemDto { Order = 25, DataField = "TeamCode", ColSpan = 1, EditorType2 = EditorTypes.dxSelectBox, EditorOptions=EditorOptionValues.ShowClearButton },
|
||||||
new EditingFormItemDto { Order = 26, DataField = "TotalRevenue", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat() },
|
new EditingFormItemDto { Order = 26, DataField = "TotalRevenue", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions=EditorOptionValues.NumberStandartFormat() },
|
||||||
|
|
@ -3321,7 +3321,7 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
||||||
new EditingFormItemDto { Order = 10, DataField="ExchangeRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
new EditingFormItemDto { Order = 10, DataField="ExchangeRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||||
new EditingFormItemDto { Order = 11, DataField="DiscountRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
new EditingFormItemDto { Order = 11, DataField="DiscountRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||||
new EditingFormItemDto { Order = 12, DataField="TaxRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
new EditingFormItemDto { Order = 12, DataField="TaxRate", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox, EditorOptions = EditorOptionValues.NumberStandartFormat() },
|
||||||
new EditingFormItemDto { Order = 13, DataField="SpecialInstructions", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
|
new EditingFormItemDto { Order = 13, DataField="SpecialInstructions", ColSpan = 2, EditorType2 = EditorTypes.dxTextBox },
|
||||||
new EditingFormItemDto { Order = 14, DataField="Notes", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
|
new EditingFormItemDto { Order = 14, DataField="Notes", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea },
|
||||||
]}
|
]}
|
||||||
}),
|
}),
|
||||||
|
|
@ -3336,8 +3336,8 @@ public class ListFormSeeder_Crm : IDataSeedContributor, ITransientDependency
|
||||||
}),
|
}),
|
||||||
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
|
CommandColumnJson = JsonSerializer.Serialize(new CommandColumnDto[] {
|
||||||
new() {
|
new() {
|
||||||
Hint = "Manage",
|
Hint = "Items",
|
||||||
Text ="Manage",
|
Text ="Items",
|
||||||
UrlTarget="_blank",
|
UrlTarget="_blank",
|
||||||
AuthName = listFormName,
|
AuthName = listFormName,
|
||||||
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
Url=$"/admin/form/{SeederUtils.GetDefaultFormCodes(listFormName)}/@Id",
|
||||||
|
|
|
||||||
|
|
@ -2859,7 +2859,7 @@ public class ListFormSeeder_Maintenance : IDataSeedContributor, ITransientDepend
|
||||||
AllowResizing = true,
|
AllowResizing = true,
|
||||||
AllowDragging = true,
|
AllowDragging = true,
|
||||||
AllowDeleting = true,
|
AllowDeleting = true,
|
||||||
AllowUpdating = true,
|
AllowEditing = true,
|
||||||
AllowAdding = true,
|
AllowAdding = true,
|
||||||
}),
|
}),
|
||||||
CultureName = LanguageCodes.En,
|
CultureName = LanguageCodes.En,
|
||||||
|
|
|
||||||
|
|
@ -35,16 +35,18 @@ public static class SeederDefaults
|
||||||
int Height,
|
int Height,
|
||||||
bool AllowDeleting,
|
bool AllowDeleting,
|
||||||
bool AllowAdding,
|
bool AllowAdding,
|
||||||
bool AllowUpdating,
|
bool AllowEditing,
|
||||||
bool ConfirmDelete,
|
bool ConfirmDelete,
|
||||||
bool SendOnlyChangedFormValuesUpdate) => JsonSerializer.Serialize(new GridEditingDto
|
bool SendOnlyChangedFormValuesUpdate,
|
||||||
|
bool AllowDetail = false) => JsonSerializer.Serialize(new GridEditingDto
|
||||||
{
|
{
|
||||||
Popup = new GridEditingPopupDto() { Title = Title, Width = Width, Height = Height },
|
Popup = new GridEditingPopupDto() { Title = Title, Width = Width, Height = Height },
|
||||||
AllowDeleting = AllowDeleting,
|
AllowDeleting = AllowDeleting,
|
||||||
AllowAdding = AllowAdding,
|
AllowAdding = AllowAdding,
|
||||||
AllowUpdating = AllowUpdating,
|
AllowEditing = AllowEditing,
|
||||||
ConfirmDelete = ConfirmDelete,
|
ConfirmDelete = ConfirmDelete,
|
||||||
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate
|
SendOnlyChangedFormValuesUpdate = SendOnlyChangedFormValuesUpdate,
|
||||||
|
AllowDetail = AllowDetail
|
||||||
});
|
});
|
||||||
|
|
||||||
public static readonly string DefaultFilterJson = "\"IsDeleted\" = 'false'";
|
public static readonly string DefaultFilterJson = "\"IsDeleted\" = 'false'";
|
||||||
|
|
|
||||||
|
|
@ -429,7 +429,7 @@ export interface SchedulerOptionDto {
|
||||||
allowResizing?: boolean
|
allowResizing?: boolean
|
||||||
allowDragging?: boolean
|
allowDragging?: boolean
|
||||||
allowDeleting?: boolean
|
allowDeleting?: boolean
|
||||||
allowUpdating?: boolean
|
allowEditing?: boolean
|
||||||
allowAdding?: boolean
|
allowAdding?: boolean
|
||||||
resources?: SchedulerResourceDto[]
|
resources?: SchedulerResourceDto[]
|
||||||
}
|
}
|
||||||
|
|
@ -444,7 +444,8 @@ export interface SchedulerResourceDto {
|
||||||
export interface GridEditingDto {
|
export interface GridEditingDto {
|
||||||
mode?: GridsEditMode
|
mode?: GridsEditMode
|
||||||
refreshMode?: GridsEditRefreshMode
|
refreshMode?: GridsEditRefreshMode
|
||||||
allowUpdating: boolean
|
allowEditing: boolean
|
||||||
|
allowDetail: boolean
|
||||||
allowDeleting: boolean
|
allowDeleting: boolean
|
||||||
allowAllDeleting: boolean
|
allowAllDeleting: boolean
|
||||||
allowAdding: boolean
|
allowAdding: boolean
|
||||||
|
|
|
||||||
|
|
@ -55,18 +55,33 @@ function FormTabEdit(props: FormEditProps & { listFormCode: string }) {
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem
|
||||||
label={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}
|
label={translate('::ListForms.ListFormEdit.EditingAllowEditing')}
|
||||||
invalid={
|
invalid={
|
||||||
errors.editingOptionDto?.allowUpdating && touched.editingOptionDto?.allowUpdating
|
errors.editingOptionDto?.allowEditing && touched.editingOptionDto?.allowEditing
|
||||||
}
|
}
|
||||||
errorMessage={errors.editingOptionDto?.allowUpdating}
|
errorMessage={errors.editingOptionDto?.allowEditing}
|
||||||
>
|
>
|
||||||
<Field
|
<Field
|
||||||
name="editingOptionDto.allowUpdating"
|
name="editingOptionDto.allowEditing"
|
||||||
placeholder={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}
|
placeholder={translate('::ListForms.ListFormEdit.EditingAllowEditing')}
|
||||||
component={Checkbox}
|
component={Checkbox}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
label={translate('::ListForms.ListFormEdit.EditingAllowDetail')}
|
||||||
|
invalid={
|
||||||
|
errors.editingOptionDto?.allowDetail && touched.editingOptionDto?.allowDetail
|
||||||
|
}
|
||||||
|
errorMessage={errors.editingOptionDto?.allowDetail}
|
||||||
|
>
|
||||||
|
<Field
|
||||||
|
name="editingOptionDto.allowDetail"
|
||||||
|
placeholder={translate('::ListForms.ListFormEdit.EditingAllowDetail')}
|
||||||
|
component={Checkbox}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
label={translate('::ListForms.ListFormEdit.EditingAllowDeleting')}
|
label={translate('::ListForms.ListFormEdit.EditingAllowDeleting')}
|
||||||
invalid={
|
invalid={
|
||||||
|
|
|
||||||
|
|
@ -354,8 +354,8 @@ function FormTabScheduler(props: FormEditProps) {
|
||||||
<Field name="schedulerOptionDto.allowAdding" component={Checkbox} />
|
<Field name="schedulerOptionDto.allowAdding" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label={translate('::ListForms.SchedulerOptions.AllowUpdating')}>
|
<FormItem label={translate('::ListForms.SchedulerOptions.AllowEditing')}>
|
||||||
<Field name="schedulerOptionDto.allowUpdating" component={Checkbox} />
|
<Field name="schedulerOptionDto.allowEditing" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label={translate('::ListForms.SchedulerOptions.AllowDeleting')}>
|
<FormItem label={translate('::ListForms.SchedulerOptions.AllowDeleting')}>
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ function FormFieldTabOptions({
|
||||||
>
|
>
|
||||||
<Field name="visible" component={Checkbox} />
|
<Field name="visible" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label={translate('::ListForms.ListFormEdit.EditingAllowUpdating')}>
|
<FormItem label={translate('::ListForms.ListFormEdit.EditingAllowEditing')}>
|
||||||
<Field name="columnEditingDto.allowEditing" component={Checkbox} />
|
<Field name="columnEditingDto.allowEditing" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label={translate('::ListForms.ListFormFieldEdit.HeaderingAllowSearch')}>
|
<FormItem label={translate('::ListForms.ListFormFieldEdit.HeaderingAllowSearch')}>
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ const useGridData = (props: {
|
||||||
checkPermission(gridDto?.gridOptions.permissionDto.c),
|
checkPermission(gridDto?.gridOptions.permissionDto.c),
|
||||||
r: checkPermission(gridDto?.gridOptions.permissionDto.r),
|
r: checkPermission(gridDto?.gridOptions.permissionDto.r),
|
||||||
u:
|
u:
|
||||||
gridDto?.gridOptions.editingOptionDto.allowUpdating === true &&
|
gridDto?.gridOptions.editingOptionDto.allowEditing === true &&
|
||||||
checkPermission(gridDto?.gridOptions.permissionDto.u),
|
checkPermission(gridDto?.gridOptions.permissionDto.u),
|
||||||
d:
|
d:
|
||||||
gridDto?.gridOptions.editingOptionDto.allowDeleting === true &&
|
gridDto?.gridOptions.editingOptionDto.allowDeleting === true &&
|
||||||
|
|
|
||||||
|
|
@ -1151,7 +1151,7 @@ const Grid = (props: GridProps) => {
|
||||||
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
|
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
|
||||||
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
|
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
|
||||||
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
|
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
|
||||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating}
|
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
|
||||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
||||||
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
||||||
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
||||||
|
|
|
||||||
|
|
@ -615,7 +615,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
|
|
||||||
<Editing
|
<Editing
|
||||||
allowAdding={gridDto.gridOptions.schedulerOptionDto?.allowAdding ?? false}
|
allowAdding={gridDto.gridOptions.schedulerOptionDto?.allowAdding ?? false}
|
||||||
allowUpdating={gridDto.gridOptions.schedulerOptionDto?.allowUpdating ?? false}
|
allowUpdating={gridDto.gridOptions.schedulerOptionDto?.allowEditing ?? false}
|
||||||
allowDeleting={gridDto.gridOptions.schedulerOptionDto?.allowDeleting ?? false}
|
allowDeleting={gridDto.gridOptions.schedulerOptionDto?.allowDeleting ?? false}
|
||||||
allowResizing={gridDto.gridOptions.schedulerOptionDto?.allowResizing ?? false}
|
allowResizing={gridDto.gridOptions.schedulerOptionDto?.allowResizing ?? false}
|
||||||
allowDragging={gridDto.gridOptions.schedulerOptionDto?.allowDragging ?? false}
|
allowDragging={gridDto.gridOptions.schedulerOptionDto?.allowDragging ?? false}
|
||||||
|
|
|
||||||
|
|
@ -865,7 +865,7 @@ const Tree = (props: TreeProps) => {
|
||||||
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
|
refreshMode={gridDto.gridOptions.editingOptionDto?.refreshMode}
|
||||||
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
|
mode={smaller.md ? 'form' : gridDto.gridOptions.editingOptionDto?.mode}
|
||||||
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
|
allowDeleting={gridDto.gridOptions.editingOptionDto?.allowDeleting}
|
||||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating}
|
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowEditing}
|
||||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding}
|
||||||
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
useIcons={gridDto.gridOptions.editingOptionDto?.useIcons}
|
||||||
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
confirmDelete={gridDto.gridOptions.editingOptionDto?.confirmDelete}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import { usePWA } from '@/utils/hooks/usePWA'
|
||||||
import { useDialogContext } from '../shared/DialogContext'
|
import { useDialogContext } from '../shared/DialogContext'
|
||||||
import { dynamicFetch } from '@/services/form.service'
|
import { dynamicFetch } from '@/services/form.service'
|
||||||
import { GridColumnData } from './GridColumnData'
|
import { GridColumnData } from './GridColumnData'
|
||||||
|
import { useLocation } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
ColumnFormatDto,
|
ColumnFormatDto,
|
||||||
EditingFormItemDto,
|
EditingFormItemDto,
|
||||||
|
|
@ -115,14 +116,15 @@ const cachedLoader = (key: string, loader: () => Promise<any[]>) => {
|
||||||
const cached = __lookupCache.get(key)
|
const cached = __lookupCache.get(key)
|
||||||
|
|
||||||
// Cache'de var ve süresi dolmamışsa kullan
|
// Cache'de var ve süresi dolmamışsa kullan
|
||||||
if (cached && (now - cached.timestamp) < CACHE_DURATION) {
|
if (cached && now - cached.timestamp < CACHE_DURATION) {
|
||||||
return cached.promise
|
return cached.promise
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache boyutu limitini aşarsa en eskiyi temizle
|
// Cache boyutu limitini aşarsa en eskiyi temizle
|
||||||
if (__lookupCache.size >= MAX_CACHE_SIZE) {
|
if (__lookupCache.size >= MAX_CACHE_SIZE) {
|
||||||
const oldestKey = Array.from(__lookupCache.entries())
|
const oldestKey = Array.from(__lookupCache.entries()).sort(
|
||||||
.sort((a, b) => a[1].timestamp - b[1].timestamp)[0][0]
|
(a, b) => a[1].timestamp - b[1].timestamp,
|
||||||
|
)[0][0]
|
||||||
__lookupCache.delete(oldestKey)
|
__lookupCache.delete(oldestKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,13 +155,15 @@ const useListFormColumns = ({
|
||||||
const { translate } = useLocalization()
|
const { translate } = useLocalization()
|
||||||
const { checkPermission } = usePermission()
|
const { checkPermission } = usePermission()
|
||||||
const isPwaMode = usePWA()
|
const isPwaMode = usePWA()
|
||||||
|
const location = useLocation()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// listFormCode değişince lookup cache temizlensin (farklı form farklı lookuplar)
|
// listFormCode değişince lookup cache temizlensin (farklı form farklı lookuplar)
|
||||||
__lookupCache.clear()
|
__lookupCache.clear()
|
||||||
}, [listFormCode])
|
}, [listFormCode])
|
||||||
|
|
||||||
const lookupDataSource = useCallback((options: any, colData: any, listFormCode: string) => {
|
const lookupDataSource = useCallback(
|
||||||
|
(options: any, colData: any, listFormCode: string) => {
|
||||||
const { lookupDto } = colData
|
const { lookupDto } = colData
|
||||||
const filters = []
|
const filters = []
|
||||||
if (lookupDto.cascadeParentFields) {
|
if (lookupDto.cascadeParentFields) {
|
||||||
|
|
@ -201,7 +205,9 @@ const useListFormColumns = ({
|
||||||
store: [],
|
store: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [listFormCode])
|
},
|
||||||
|
[listFormCode],
|
||||||
|
)
|
||||||
|
|
||||||
const createLookupStaticDataSource = (
|
const createLookupStaticDataSource = (
|
||||||
load: () => any,
|
load: () => any,
|
||||||
|
|
@ -247,7 +253,7 @@ const useListFormColumns = ({
|
||||||
name: a.Name,
|
name: a.Name,
|
||||||
group: a.Group,
|
group: a.Group,
|
||||||
|
|
||||||
...a
|
...a,
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
|
@ -312,13 +318,17 @@ const useListFormColumns = ({
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasUpdate =
|
const hasUpdate =
|
||||||
gridDto.gridOptions.editingOptionDto.allowUpdating &&
|
gridDto.gridOptions.editingOptionDto.allowEditing &&
|
||||||
checkPermission(gridDto.gridOptions.permissionDto.u)
|
checkPermission(gridDto.gridOptions.permissionDto.u)
|
||||||
|
|
||||||
const hasDelete =
|
const hasDelete =
|
||||||
gridDto.gridOptions.editingOptionDto.allowDeleting &&
|
gridDto.gridOptions.editingOptionDto.allowDeleting &&
|
||||||
checkPermission(gridDto.gridOptions.permissionDto.d)
|
checkPermission(gridDto.gridOptions.permissionDto.d)
|
||||||
|
|
||||||
|
const hasDetail =
|
||||||
|
gridDto.gridOptions.editingOptionDto.allowDetail &&
|
||||||
|
checkPermission(gridDto.gridOptions.permissionDto.u)
|
||||||
|
|
||||||
const hasCommandButtons = gridDto.gridOptions.commandColumnDto.length > 0
|
const hasCommandButtons = gridDto.gridOptions.commandColumnDto.length > 0
|
||||||
|
|
||||||
// Eğer hiçbir buton eklenecek durumda değilse: çık
|
// Eğer hiçbir buton eklenecek durumda değilse: çık
|
||||||
|
|
@ -328,17 +338,39 @@ const useListFormColumns = ({
|
||||||
|
|
||||||
const buttons: any[] = []
|
const buttons: any[] = []
|
||||||
|
|
||||||
|
if (hasDetail) {
|
||||||
|
const item = {
|
||||||
|
name: 'detail',
|
||||||
|
text: translate('::App.Platform.Detail'),
|
||||||
|
onClick: (e: any) => {
|
||||||
|
if (typeof e.event?.preventDefault === 'function') {
|
||||||
|
e.event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gridDto.gridOptions.keyFieldName) return
|
||||||
|
|
||||||
|
const url =
|
||||||
|
location.pathname?.replace('/list/', '/form/') +
|
||||||
|
`/${e.row.data[gridDto.gridOptions.keyFieldName]}`
|
||||||
|
|
||||||
|
window.open(url, isPwaMode ? '_self' : '_blank')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons.push(item)
|
||||||
|
}
|
||||||
|
|
||||||
if (hasUpdate) {
|
if (hasUpdate) {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
name: 'edit',
|
name: 'edit',
|
||||||
text: translate('::App.Platform.Edit')
|
text: translate('::App.Platform.Edit'),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasDelete) {
|
if (hasDelete) {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
name: 'delete',
|
name: 'delete',
|
||||||
text: translate('::App.Platform.Delete')
|
text: translate('::App.Platform.Delete'),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,7 +450,8 @@ const useListFormColumns = ({
|
||||||
return column as GridColumnData
|
return column as GridColumnData
|
||||||
}, [gridDto, checkPermission, translate, listFormCode, isPwaMode, dialog, gridRef])
|
}, [gridDto, checkPermission, translate, listFormCode, isPwaMode, dialog, gridRef])
|
||||||
|
|
||||||
const getColumns = useCallback((columnFormats: ColumnFormatDto[]) => {
|
const getColumns = useCallback(
|
||||||
|
(columnFormats: ColumnFormatDto[]) => {
|
||||||
const columns: GridColumnData[] = []
|
const columns: GridColumnData[] = []
|
||||||
|
|
||||||
if (!gridDto || !columnFormats) {
|
if (!gridDto || !columnFormats) {
|
||||||
|
|
@ -567,7 +600,9 @@ const useListFormColumns = ({
|
||||||
})
|
})
|
||||||
|
|
||||||
return columns
|
return columns
|
||||||
}, [gridDto, lookupDataSource, translate, checkPermission, dialog, isPwaMode, listFormCode])
|
},
|
||||||
|
[gridDto, lookupDataSource, translate, checkPermission, dialog, isPwaMode, listFormCode],
|
||||||
|
)
|
||||||
|
|
||||||
const getBandedColumns = useCallback(() => {
|
const getBandedColumns = useCallback(() => {
|
||||||
if (!gridDto) {
|
if (!gridDto) {
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ const useToolbar = ({
|
||||||
|
|
||||||
// batch editing icin kaydet ve geri al butonu
|
// batch editing icin kaydet ve geri al butonu
|
||||||
if (
|
if (
|
||||||
grdOpt.editingOptionDto?.allowUpdating &&
|
grdOpt.editingOptionDto?.allowEditing &&
|
||||||
grdOpt.editingOptionDto?.mode == 'batch' &&
|
grdOpt.editingOptionDto?.mode == 'batch' &&
|
||||||
checkPermission(grdOpt.permissionDto?.u)
|
checkPermission(grdOpt.permissionDto?.u)
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue