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,
|
||||||
|
|
@ -113,19 +114,20 @@ const MAX_CACHE_SIZE = 100 // Maksimum cache entry sayısı
|
||||||
const cachedLoader = (key: string, loader: () => Promise<any[]>) => {
|
const cachedLoader = (key: string, loader: () => Promise<any[]>) => {
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
const p = Promise.resolve()
|
const p = Promise.resolve()
|
||||||
.then(() => loader())
|
.then(() => loader())
|
||||||
.then((res) => res ?? [])
|
.then((res) => res ?? [])
|
||||||
|
|
@ -133,7 +135,7 @@ const cachedLoader = (key: string, loader: () => Promise<any[]>) => {
|
||||||
__lookupCache.delete(key) // hata olursa tekrar denenebilsin
|
__lookupCache.delete(key) // hata olursa tekrar denenebilsin
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
|
|
||||||
__lookupCache.set(key, { promise: p, timestamp: now })
|
__lookupCache.set(key, { promise: p, timestamp: now })
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
@ -153,55 +155,59 @@ 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(
|
||||||
const { lookupDto } = colData
|
(options: any, colData: any, listFormCode: string) => {
|
||||||
const filters = []
|
const { lookupDto } = colData
|
||||||
if (lookupDto.cascadeParentFields) {
|
const filters = []
|
||||||
if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.StaticData) {
|
if (lookupDto.cascadeParentFields) {
|
||||||
filters.push([
|
if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.StaticData) {
|
||||||
lookupDto?.cascadeRelationField,
|
filters.push([
|
||||||
lookupDto?.cascadeFilterOperator,
|
lookupDto?.cascadeRelationField,
|
||||||
options?.data[lookupDto?.cascadeParentField],
|
lookupDto?.cascadeFilterOperator,
|
||||||
])
|
options?.data[lookupDto?.cascadeParentField],
|
||||||
//TODO: Statik data test edilecek
|
])
|
||||||
} else {
|
//TODO: Statik data test edilecek
|
||||||
const data = options?.data ?? options
|
} else {
|
||||||
for (const cascadeParentField of lookupDto.cascadeParentFields.split(',')) {
|
const data = options?.data ?? options
|
||||||
filters.push(data[cascadeParentField])
|
for (const cascadeParentField of lookupDto.cascadeParentFields.split(',')) {
|
||||||
|
filters.push(data[cascadeParentField])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//UiLookupDataSourceTypeEnum :
|
||||||
//UiLookupDataSourceTypeEnum :
|
// Data = 1 (Statik Data),
|
||||||
// Data = 1 (Statik Data),
|
// Query = 2 (API'den geliyor fakat API query çalıştırıyor)
|
||||||
// Query = 2 (API'den geliyor fakat API query çalıştırıyor)
|
// WebService = 3 (API servisten geliyor)
|
||||||
// WebService = 3 (API servisten geliyor)
|
if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.StaticData) {
|
||||||
if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.StaticData) {
|
return createLookupStaticDataSource(
|
||||||
return createLookupStaticDataSource(
|
() => JSON.parse(lookupDto?.lookupQuery),
|
||||||
() => JSON.parse(lookupDto?.lookupQuery),
|
filters.length ? filters : null,
|
||||||
filters.length ? filters : null,
|
`static:${listFormCode}:${colData.fieldName}`, // cache key
|
||||||
`static:${listFormCode}:${colData.fieldName}`, // cache key
|
)
|
||||||
)
|
} else if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.Query) {
|
||||||
} else if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.Query) {
|
return createLookupQueryDataSource(listFormCode, colData.fieldName, filters)
|
||||||
return createLookupQueryDataSource(listFormCode, colData.fieldName, filters)
|
} else if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.WebService) {
|
||||||
} else if (lookupDto.dataSourceType == UiLookupDataSourceTypeEnum.WebService) {
|
return createLookupApiDataSource(
|
||||||
return createLookupApiDataSource(
|
listFormCode,
|
||||||
listFormCode,
|
lookupDto?.lookupQuery,
|
||||||
lookupDto?.lookupQuery,
|
filters,
|
||||||
filters,
|
colData.lookupDto?.valueExpr?.toLowerCase(),
|
||||||
colData.lookupDto?.valueExpr?.toLowerCase(),
|
)
|
||||||
)
|
} else {
|
||||||
} else {
|
return {
|
||||||
return {
|
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,156 +450,159 @@ 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(
|
||||||
const columns: GridColumnData[] = []
|
(columnFormats: ColumnFormatDto[]) => {
|
||||||
|
const columns: GridColumnData[] = []
|
||||||
|
|
||||||
if (!gridDto || !columnFormats) {
|
if (!gridDto || !columnFormats) {
|
||||||
return columns
|
return columns
|
||||||
}
|
|
||||||
columnFormats.forEach((colData) => {
|
|
||||||
if (!colData.canRead || !colData.isActive) {
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
const column: GridColumnData = {}
|
columnFormats.forEach((colData) => {
|
||||||
column.colData = colData // Onemli: Baska event-callback lerde kullanmak icin eklendi, colData.lookupDto?.editorTemplateType
|
if (!colData.canRead || !colData.isActive) {
|
||||||
//column.showEditorAlways = true
|
return
|
||||||
column.dataField = colData.fieldName
|
|
||||||
if (colData.dataType) column.dataType = colData.dataType as DataType
|
|
||||||
if (colData.captionName) column.caption = translate('::' + colData.captionName)
|
|
||||||
if (colData.width > 0) column.width = colData.width
|
|
||||||
column.visible = colData.visible
|
|
||||||
|
|
||||||
column.alignment = colData.alignment
|
|
||||||
column.format = colData.format
|
|
||||||
|
|
||||||
let editorOptions: any = {}
|
|
||||||
if (colData.editorOptions) {
|
|
||||||
try {
|
|
||||||
editorOptions =
|
|
||||||
typeof colData.editorOptions === 'string'
|
|
||||||
? JSON.parse(colData.editorOptions)
|
|
||||||
: colData.editorOptions
|
|
||||||
} catch {
|
|
||||||
editorOptions = {}
|
|
||||||
}
|
}
|
||||||
}
|
const column: GridColumnData = {}
|
||||||
|
column.colData = colData // Onemli: Baska event-callback lerde kullanmak icin eklendi, colData.lookupDto?.editorTemplateType
|
||||||
|
//column.showEditorAlways = true
|
||||||
|
column.dataField = colData.fieldName
|
||||||
|
if (colData.dataType) column.dataType = colData.dataType as DataType
|
||||||
|
if (colData.captionName) column.caption = translate('::' + colData.captionName)
|
||||||
|
if (colData.width > 0) column.width = colData.width
|
||||||
|
column.visible = colData.visible
|
||||||
|
|
||||||
column.editorOptions = { ...editorOptions }
|
column.alignment = colData.alignment
|
||||||
|
column.format = colData.format
|
||||||
|
|
||||||
// Format bilgisini öncelik sırasına göre ata
|
let editorOptions: any = {}
|
||||||
if (column.editorOptions.displayFormat) {
|
if (colData.editorOptions) {
|
||||||
column.format = column.editorOptions.displayFormat
|
try {
|
||||||
} else if (column.editorOptions.format) {
|
editorOptions =
|
||||||
column.format = column.editorOptions.format
|
typeof colData.editorOptions === 'string'
|
||||||
}
|
? JSON.parse(colData.editorOptions)
|
||||||
|
: colData.editorOptions
|
||||||
// columnCustomizationDto
|
} catch {
|
||||||
column.fixed = colData.columnCustomizationDto?.fixed
|
editorOptions = {}
|
||||||
column.fixedPosition = colData.columnCustomizationDto?.fixedPosition as HorizontalEdge
|
}
|
||||||
column.allowReordering = colData.columnCustomizationDto?.allowReordering
|
|
||||||
|
|
||||||
// sort
|
|
||||||
if (colData.sortIndex >= 0) {
|
|
||||||
column.sortIndex = colData.sortIndex
|
|
||||||
column.sortOrder = colData.sortDirection as SortOrder
|
|
||||||
}
|
|
||||||
|
|
||||||
// filterRow
|
|
||||||
column.allowFiltering = colData.columnFilterDto?.allowFiltering
|
|
||||||
column.selectedFilterOperation = colData.columnFilterDto
|
|
||||||
?.selectedFilterOperation as SelectedFilterOperation
|
|
||||||
column.filterValue = colData.columnFilterDto?.filterValue
|
|
||||||
|
|
||||||
// headerFilter
|
|
||||||
column.allowHeaderFiltering = colData.columnHeaderDto?.allowHeaderFiltering
|
|
||||||
if (column.allowHeaderFiltering == true) {
|
|
||||||
column.headerFilter = {}
|
|
||||||
column.headerFilter.allowSearch = colData.columnHeaderDto?.allowSearch
|
|
||||||
column.headerFilter.dataSource = colData.columnHeaderDto?.dataSource
|
|
||||||
}
|
|
||||||
|
|
||||||
// search
|
|
||||||
column.allowSearch = colData.allowSearch
|
|
||||||
|
|
||||||
//export
|
|
||||||
column.allowExporting = colData.canExport
|
|
||||||
|
|
||||||
// grouping
|
|
||||||
column.allowGrouping = colData.columnGroupingDto?.allowGrouping
|
|
||||||
column.autoExpandGroup = colData.columnGroupingDto?.autoExpandGroup
|
|
||||||
if (colData.columnGroupingDto.groupIndex)
|
|
||||||
column.groupIndex = colData.columnGroupingDto?.groupIndex
|
|
||||||
|
|
||||||
// constsa dinamik olarak css verilerini ekle
|
|
||||||
if (colData.columnCssClass) {
|
|
||||||
column.cssClass = colData.columnCssClass
|
|
||||||
if (colData.columnCssValue) {
|
|
||||||
addCss(colData.columnCssValue)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
column.allowEditing = colData.columnEditingDto?.allowEditing
|
column.editorOptions = { ...editorOptions }
|
||||||
|
|
||||||
// #region lookup ayarlari
|
// Format bilgisini öncelik sırasına göre ata
|
||||||
if (colData.lookupDto?.dataSourceType) {
|
if (column.editorOptions.displayFormat) {
|
||||||
// UiColumnEditorTemplateTypeEnum : None:0, Table:1, TagBox:2
|
column.format = column.editorOptions.displayFormat
|
||||||
const allItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
} else if (column.editorOptions.format) {
|
||||||
const formItem = allItems.find((a) => a?.dataField === colData.fieldName)
|
column.format = column.editorOptions.format
|
||||||
if (formItem?.editorType2 === PlatformEditorTypes.dxTagBox) {
|
}
|
||||||
column.extras = {
|
|
||||||
multiValue: true,
|
// columnCustomizationDto
|
||||||
editorOptions: formItem.editorOptions,
|
column.fixed = colData.columnCustomizationDto?.fixed
|
||||||
tagBoxOptions: formItem.tagBoxOptions,
|
column.fixedPosition = colData.columnCustomizationDto?.fixedPosition as HorizontalEdge
|
||||||
|
column.allowReordering = colData.columnCustomizationDto?.allowReordering
|
||||||
|
|
||||||
|
// sort
|
||||||
|
if (colData.sortIndex >= 0) {
|
||||||
|
column.sortIndex = colData.sortIndex
|
||||||
|
column.sortOrder = colData.sortDirection as SortOrder
|
||||||
|
}
|
||||||
|
|
||||||
|
// filterRow
|
||||||
|
column.allowFiltering = colData.columnFilterDto?.allowFiltering
|
||||||
|
column.selectedFilterOperation = colData.columnFilterDto
|
||||||
|
?.selectedFilterOperation as SelectedFilterOperation
|
||||||
|
column.filterValue = colData.columnFilterDto?.filterValue
|
||||||
|
|
||||||
|
// headerFilter
|
||||||
|
column.allowHeaderFiltering = colData.columnHeaderDto?.allowHeaderFiltering
|
||||||
|
if (column.allowHeaderFiltering == true) {
|
||||||
|
column.headerFilter = {}
|
||||||
|
column.headerFilter.allowSearch = colData.columnHeaderDto?.allowSearch
|
||||||
|
column.headerFilter.dataSource = colData.columnHeaderDto?.dataSource
|
||||||
|
}
|
||||||
|
|
||||||
|
// search
|
||||||
|
column.allowSearch = colData.allowSearch
|
||||||
|
|
||||||
|
//export
|
||||||
|
column.allowExporting = colData.canExport
|
||||||
|
|
||||||
|
// grouping
|
||||||
|
column.allowGrouping = colData.columnGroupingDto?.allowGrouping
|
||||||
|
column.autoExpandGroup = colData.columnGroupingDto?.autoExpandGroup
|
||||||
|
if (colData.columnGroupingDto.groupIndex)
|
||||||
|
column.groupIndex = colData.columnGroupingDto?.groupIndex
|
||||||
|
|
||||||
|
// constsa dinamik olarak css verilerini ekle
|
||||||
|
if (colData.columnCssClass) {
|
||||||
|
column.cssClass = colData.columnCssClass
|
||||||
|
if (colData.columnCssValue) {
|
||||||
|
addCss(colData.columnCssValue)
|
||||||
}
|
}
|
||||||
column.editCellTemplate = 'cellEditTagBox'
|
}
|
||||||
column.calculateFilterExpression = calculateFilterExpressionMultiValue
|
|
||||||
column.cellTemplate = cellTemplateMultiValue
|
column.allowEditing = colData.columnEditingDto?.allowEditing
|
||||||
} else if (formItem?.editorType2 === PlatformEditorTypes.dxGridBox) {
|
|
||||||
column.extras = {
|
// #region lookup ayarlari
|
||||||
multiValue: false,
|
if (colData.lookupDto?.dataSourceType) {
|
||||||
editorOptions: formItem.editorOptions,
|
// UiColumnEditorTemplateTypeEnum : None:0, Table:1, TagBox:2
|
||||||
gridBoxOptions: formItem.gridBoxOptions,
|
const allItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
||||||
}
|
const formItem = allItems.find((a) => a?.dataField === colData.fieldName)
|
||||||
column.editCellTemplate = 'cellEditGridBox'
|
if (formItem?.editorType2 === PlatformEditorTypes.dxTagBox) {
|
||||||
column.cellTemplate = cellTemplateMultiValue
|
column.extras = {
|
||||||
if (formItem.gridBoxOptions?.selectionMode === 'multiple') {
|
multiValue: true,
|
||||||
|
editorOptions: formItem.editorOptions,
|
||||||
|
tagBoxOptions: formItem.tagBoxOptions,
|
||||||
|
}
|
||||||
|
column.editCellTemplate = 'cellEditTagBox'
|
||||||
column.calculateFilterExpression = calculateFilterExpressionMultiValue
|
column.calculateFilterExpression = calculateFilterExpressionMultiValue
|
||||||
column.extras.multiValue = true
|
column.cellTemplate = cellTemplateMultiValue
|
||||||
|
} else if (formItem?.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||||
|
column.extras = {
|
||||||
|
multiValue: false,
|
||||||
|
editorOptions: formItem.editorOptions,
|
||||||
|
gridBoxOptions: formItem.gridBoxOptions,
|
||||||
|
}
|
||||||
|
column.editCellTemplate = 'cellEditGridBox'
|
||||||
|
column.cellTemplate = cellTemplateMultiValue
|
||||||
|
if (formItem.gridBoxOptions?.selectionMode === 'multiple') {
|
||||||
|
column.calculateFilterExpression = calculateFilterExpressionMultiValue
|
||||||
|
column.extras.multiValue = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
column.lookup = {
|
||||||
|
valueExpr: colData.lookupDto?.valueExpr?.toLowerCase(),
|
||||||
|
displayExpr: colData.lookupDto?.displayExpr?.toLowerCase(),
|
||||||
|
dataSource: (o) => lookupDataSource(o, colData, listFormCode),
|
||||||
|
}
|
||||||
|
//column.lookup.dataSource = lookupDataSource(null, colData)
|
||||||
|
|
||||||
|
//cascadeEmptyFields verisi dolu ise bu kolon/field bir parent field dir
|
||||||
|
if (colData.lookupDto.cascadeEmptyFields) {
|
||||||
|
// parent field guncellendigi zaman bu fonksiyon cagrilir
|
||||||
|
column.setCellValue = function (rowData: any, value: any) {
|
||||||
|
if (!colData.fieldName) return
|
||||||
|
//console.log({ rowData, value, colData })
|
||||||
|
rowData[colData.fieldName] = Array.isArray(value) ? value[0] : value
|
||||||
|
// cascadeEmptyFields alani aralarinda virgul olacak sekilde bosaltilmak istenen alanlari saklar
|
||||||
|
colData?.lookupDto?.cascadeEmptyFields?.split(',').forEach((emptyField: any) => {
|
||||||
|
rowData[emptyField] = null
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// #endregion
|
||||||
column.lookup = {
|
if (colData.validationRuleDto) {
|
||||||
valueExpr: colData.lookupDto?.valueExpr?.toLowerCase(),
|
// for server side validation : https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/DataValidation/jQuery/Light/
|
||||||
displayExpr: colData.lookupDto?.displayExpr?.toLowerCase(),
|
column.validationRules = colData.validationRuleDto as ValidationRule[]
|
||||||
dataSource: (o) => lookupDataSource(o, colData, listFormCode),
|
|
||||||
}
|
}
|
||||||
//column.lookup.dataSource = lookupDataSource(null, colData)
|
|
||||||
|
|
||||||
//cascadeEmptyFields verisi dolu ise bu kolon/field bir parent field dir
|
columns.push(column)
|
||||||
if (colData.lookupDto.cascadeEmptyFields) {
|
})
|
||||||
// parent field guncellendigi zaman bu fonksiyon cagrilir
|
|
||||||
column.setCellValue = function (rowData: any, value: any) {
|
|
||||||
if (!colData.fieldName) return
|
|
||||||
//console.log({ rowData, value, colData })
|
|
||||||
rowData[colData.fieldName] = Array.isArray(value) ? value[0] : value
|
|
||||||
// cascadeEmptyFields alani aralarinda virgul olacak sekilde bosaltilmak istenen alanlari saklar
|
|
||||||
colData?.lookupDto?.cascadeEmptyFields?.split(',').forEach((emptyField: any) => {
|
|
||||||
rowData[emptyField] = null
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
if (colData.validationRuleDto) {
|
|
||||||
// for server side validation : https://js.devexpress.com/Demos/WidgetsGallery/Demo/DataGrid/DataValidation/jQuery/Light/
|
|
||||||
column.validationRules = colData.validationRuleDto as ValidationRule[]
|
|
||||||
}
|
|
||||||
|
|
||||||
columns.push(column)
|
return columns
|
||||||
})
|
},
|
||||||
|
[gridDto, lookupDataSource, translate, checkPermission, dialog, isPwaMode, listFormCode],
|
||||||
return columns
|
)
|
||||||
}, [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