EditingFormItemDto kaldırıldı. Yerine tüm sütunlar ColumnFormatDto eklendi
This commit is contained in:
parent
95b0b0ce89
commit
b87d7a94c8
40 changed files with 2885 additions and 2673 deletions
|
|
@ -10,6 +10,11 @@ namespace Sozsoft.Platform.ListForms;
|
||||||
|
|
||||||
public class ColumnFormatDto : AuditedEntityDto<Guid>
|
public class ColumnFormatDto : AuditedEntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
private static readonly JsonSerializerOptions EditorOptionsSerializerOptions = new()
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
public ColumnFormatDto() { }
|
public ColumnFormatDto() { }
|
||||||
|
|
||||||
public string FieldName { get; set; }
|
public string FieldName { get; set; }
|
||||||
|
|
@ -239,7 +244,42 @@ public class ColumnFormatDto : AuditedEntityDto<Guid>
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Alignment { get; set; }
|
public string Alignment { get; set; }
|
||||||
public string Format { get; set; }
|
public string Format { get; set; }
|
||||||
public string EditorOptions { get; set; }
|
|
||||||
|
public int? EditOrderNo { get; set; }
|
||||||
|
public int? EditGroupOrderNo { get; set; }
|
||||||
|
public string EditorType2 { get; set; }
|
||||||
|
public int? ColSpan { get; set; }
|
||||||
|
|
||||||
|
public string EditorOptions { get; set; }
|
||||||
|
public GridBoxOptionsDto GridBoxOptions =>
|
||||||
|
DeserializeEditorOptions<GridBoxOptionsDto>(PlatformConsts.EditorTypes.dxGridBox);
|
||||||
|
public TagBoxOptionsDto TagBoxOptions =>
|
||||||
|
DeserializeEditorOptions<TagBoxOptionsDto>(PlatformConsts.EditorTypes.dxTagBox);
|
||||||
|
public ImageUploadOptionsDto ImageUploadOptions =>
|
||||||
|
DeserializeEditorOptions<ImageUploadOptionsDto>(
|
||||||
|
PlatformConsts.EditorTypes.dxImageUpload,
|
||||||
|
PlatformConsts.EditorTypes.dxImageViewer);
|
||||||
|
public string EditorScript { get; set; }
|
||||||
|
|
||||||
|
private T DeserializeEditorOptions<T>(params string[] editorTypes) where T : class
|
||||||
|
{
|
||||||
|
if (!Array.Exists(
|
||||||
|
editorTypes,
|
||||||
|
editorType => string.Equals(EditorType2, editorType, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
|
string.IsNullOrWhiteSpace(EditorOptions))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return JsonSerializer.Deserialize<T>(EditorOptions, EditorOptionsSerializerOptions);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,35 +16,5 @@ public class EditingFormDto
|
||||||
public string Caption { get; set; }
|
public string Caption { get; set; }
|
||||||
public int ColCount { get; set; } = 2;
|
public int ColCount { get; set; } = 2;
|
||||||
public int ColSpan { get; set; } = 2;
|
public int ColSpan { get; set; } = 2;
|
||||||
/// <summary> Type: Array<Simple Form Item | Group Form Item | Tabbed Form Item | Empty Form Item | Button Form Item>
|
|
||||||
/// Bu kisma suan sadece string olarak doldurulacak
|
|
||||||
/// items: ['FirstName', 'LastName',
|
|
||||||
/// { dataField: 'Notes', editorType: 'dxTextArea', colSpan: 2, editorOptions: { height: 100, }, }
|
|
||||||
/// ],
|
|
||||||
/// </summary>
|
|
||||||
//[TextArea]
|
|
||||||
//public string[] Items { get; set; }
|
|
||||||
public EditingFormItemDto[] Items { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EditingFormItemDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// DataField Accepted Values: 'dxAutocomplete' | 'dxCalendar' | 'dxCheckBox' | 'dxColorBox' | 'dxDateBox' | 'dxDateRangeBox' | 'dxDropDownBox' | 'dxHtmlEditor' | 'dxLookup' | 'dxNumberBox' | 'dxRadioGroup' | 'dxRangeSlider' | 'dxSelectBox' | 'dxSlider' | 'dxSwitch' | 'dxTagBox' | 'dxTextArea' | 'dxTextBox' | 'dxImageViewer' | 'dxImageUpload';
|
|
||||||
/// </summary>
|
|
||||||
[JsonPropertyName("order")]
|
|
||||||
public int Order { get; set; }
|
|
||||||
[JsonPropertyName("dataField")]
|
|
||||||
public string DataField { get; set; }
|
|
||||||
[JsonPropertyName("editorType2")]
|
|
||||||
public string EditorType2 { get; set; }
|
|
||||||
[JsonPropertyName("colSpan")]
|
|
||||||
public int ColSpan { get; set; }
|
|
||||||
[JsonPropertyName("editorOptions")]
|
|
||||||
public string EditorOptions { get; set; }
|
|
||||||
public GridBoxOptionsDto GridBoxOptions { get; set; }
|
|
||||||
public TagBoxOptionsDto TagBoxOptions { get; set; }
|
|
||||||
[JsonPropertyName("editorScript")]
|
|
||||||
public string EditorScript { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace Sozsoft.Platform.ListForms;
|
||||||
|
|
||||||
|
public class ImageUploadOptionsDto
|
||||||
|
{
|
||||||
|
public string UploadUrl { get; set; }
|
||||||
|
public string Accept { get; set; }
|
||||||
|
public bool? Multiple { get; set; }
|
||||||
|
public long? MaxFileSize { get; set; }
|
||||||
|
public int? Width { get; set; }
|
||||||
|
public int? Height { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@ namespace Sozsoft.Platform.ListForms;
|
||||||
|
|
||||||
public class WizardColumnItemInputDto
|
public class WizardColumnItemInputDto
|
||||||
{
|
{
|
||||||
public string DataField { get; set; }
|
public string FieldName { get; set; }
|
||||||
public string CaptionName { get; set; }
|
public string CaptionName { get; set; }
|
||||||
public string EditorType { get; set; }
|
public string EditorType { get; set; }
|
||||||
public string EditorOptions { get; set; }
|
public string EditorOptions { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -47,26 +47,33 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
|
|
||||||
protected override void MapToEntity(ColumnFormatEditDto updateInput, ListFormField entity)
|
protected override void MapToEntity(ColumnFormatEditDto updateInput, ListFormField entity)
|
||||||
{
|
{
|
||||||
|
entity.CultureName = updateInput.CultureName;
|
||||||
entity.RoleId = updateInput.RoleId;
|
entity.RoleId = updateInput.RoleId;
|
||||||
entity.ListFormCode = updateInput.ListFormCode;
|
entity.ListFormCode = updateInput.ListFormCode;
|
||||||
entity.FieldName = updateInput.FieldName;
|
entity.FieldName = updateInput.FieldName;
|
||||||
entity.CultureName = updateInput.CultureName;
|
|
||||||
entity.CaptionName = updateInput.CaptionName;
|
entity.CaptionName = updateInput.CaptionName;
|
||||||
entity.PlaceHolder = updateInput.PlaceHolder;
|
entity.PlaceHolder = updateInput.PlaceHolder;
|
||||||
entity.BandName = updateInput.BandName;
|
entity.BandName = updateInput.BandName;
|
||||||
entity.IsActive = updateInput.IsActive;
|
entity.IsActive = updateInput.IsActive;
|
||||||
entity.Visible = updateInput.Visible;
|
entity.Visible = updateInput.Visible;
|
||||||
entity.AllowSearch = updateInput.AllowSearch;
|
entity.AllowSearch = updateInput.AllowSearch;
|
||||||
entity.AllowEditing = updateInput.AllowEditing;
|
|
||||||
entity.AllowAdding = updateInput.AllowAdding;
|
|
||||||
entity.ListOrderNo = updateInput.ListOrderNo;
|
|
||||||
entity.SourceDbType = updateInput.SourceDbType;
|
entity.SourceDbType = updateInput.SourceDbType;
|
||||||
|
entity.Alignment = updateInput.Alignment;
|
||||||
|
entity.Format = updateInput.Format;
|
||||||
|
entity.EditorOptions = updateInput.EditorOptions;
|
||||||
|
entity.EditorScript = updateInput.EditorScript;
|
||||||
|
entity.ListOrderNo = updateInput.ListOrderNo;
|
||||||
entity.Width = updateInput.Width;
|
entity.Width = updateInput.Width;
|
||||||
entity.SortDirection = updateInput.SortDirection;
|
entity.SortDirection = updateInput.SortDirection;
|
||||||
entity.SortIndex = updateInput.SortIndex;
|
entity.SortIndex = updateInput.SortIndex;
|
||||||
entity.Format = updateInput.Format;
|
entity.EditOrderNo = updateInput.EditOrderNo;
|
||||||
entity.Alignment = updateInput.Alignment;
|
entity.EditGroupOrderNo = updateInput.EditGroupOrderNo;
|
||||||
entity.EditorOptions = updateInput.EditorOptions;
|
entity.ColSpan = updateInput.ColSpan;
|
||||||
|
entity.EditorType2 = updateInput.EditorType2;
|
||||||
|
entity.AllowEditing = updateInput.AllowEditing;
|
||||||
|
entity.AllowAdding = updateInput.AllowAdding;
|
||||||
|
entity.PermissionJson = JsonSerializer.Serialize(updateInput.PermissionDto);
|
||||||
|
entity.LookupJson = JsonSerializer.Serialize(updateInput.LookupDto);
|
||||||
entity.ColumnCustomizationJson = JsonSerializer.Serialize(updateInput.ColumnCustomizationDto);
|
entity.ColumnCustomizationJson = JsonSerializer.Serialize(updateInput.ColumnCustomizationDto);
|
||||||
entity.ColumnFilterJson = JsonSerializer.Serialize(updateInput.ColumnFilterDto);
|
entity.ColumnFilterJson = JsonSerializer.Serialize(updateInput.ColumnFilterDto);
|
||||||
entity.ColumnHeaderJson = JsonSerializer.Serialize(updateInput.ColumnHeaderDto);
|
entity.ColumnHeaderJson = JsonSerializer.Serialize(updateInput.ColumnHeaderDto);
|
||||||
|
|
@ -74,12 +81,10 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
entity.GroupSummaryJson = updateInput.ColumnGroupSummaryDto.SummaryType.IsNullOrEmpty() ? "" : JsonSerializer.Serialize(updateInput.ColumnGroupSummaryDto);
|
entity.GroupSummaryJson = updateInput.ColumnGroupSummaryDto.SummaryType.IsNullOrEmpty() ? "" : JsonSerializer.Serialize(updateInput.ColumnGroupSummaryDto);
|
||||||
entity.TotalSummaryJson = updateInput.ColumnTotalSummaryDto.SummaryType.IsNullOrEmpty() ? "" : JsonSerializer.Serialize(updateInput.ColumnTotalSummaryDto);
|
entity.TotalSummaryJson = updateInput.ColumnTotalSummaryDto.SummaryType.IsNullOrEmpty() ? "" : JsonSerializer.Serialize(updateInput.ColumnTotalSummaryDto);
|
||||||
entity.JoinTableJson = JsonSerializer.Serialize(updateInput.ColumnJoinTableDto);
|
entity.JoinTableJson = JsonSerializer.Serialize(updateInput.ColumnJoinTableDto);
|
||||||
entity.LookupJson = JsonSerializer.Serialize(updateInput.LookupDto);
|
|
||||||
entity.ColumnCssClass = updateInput.ColumnCssClass;
|
entity.ColumnCssClass = updateInput.ColumnCssClass;
|
||||||
entity.ColumnCssValue = updateInput.ColumnCssValue;
|
entity.ColumnCssValue = updateInput.ColumnCssValue;
|
||||||
entity.ValidationRuleJson = JsonSerializer.Serialize(updateInput.ValidationRuleDto);
|
entity.ValidationRuleJson = JsonSerializer.Serialize(updateInput.ValidationRuleDto);
|
||||||
entity.ColumnStylingJson = JsonSerializer.Serialize(updateInput.ColumnStylingDto);
|
entity.ColumnStylingJson = JsonSerializer.Serialize(updateInput.ColumnStylingDto);
|
||||||
entity.PermissionJson = JsonSerializer.Serialize(updateInput.PermissionDto);
|
|
||||||
entity.PivotSettingsJson = JsonSerializer.Serialize(updateInput.PivotSettingsDto);
|
entity.PivotSettingsJson = JsonSerializer.Serialize(updateInput.PivotSettingsDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,6 +141,9 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
item.Alignment = input.Alignment;
|
item.Alignment = input.Alignment;
|
||||||
item.Format = input.Format;
|
item.Format = input.Format;
|
||||||
item.EditorOptions = input.EditorOptions;
|
item.EditorOptions = input.EditorOptions;
|
||||||
|
item.IsActive = input.IsActive;
|
||||||
|
item.Visible = input.Visible;
|
||||||
|
item.AllowSearch = input.AllowSearch;
|
||||||
}
|
}
|
||||||
else if (input.EditType == ListFormFieldEditTabs.PermissionsForm)
|
else if (input.EditType == ListFormFieldEditTabs.PermissionsForm)
|
||||||
{
|
{
|
||||||
|
|
@ -152,6 +160,11 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
item.AllowSearch = input.AllowSearch;
|
item.AllowSearch = input.AllowSearch;
|
||||||
item.AllowEditing = input.AllowEditing;
|
item.AllowEditing = input.AllowEditing;
|
||||||
item.AllowAdding = input.AllowAdding;
|
item.AllowAdding = input.AllowAdding;
|
||||||
|
item.EditGroupOrderNo = input.EditGroupOrderNo;
|
||||||
|
item.EditOrderNo = input.EditOrderNo;
|
||||||
|
item.ColSpan = input.ColSpan;
|
||||||
|
item.EditorType2 = input.EditorType2;
|
||||||
|
item.EditorScript = input.EditorScript;
|
||||||
}
|
}
|
||||||
else if (input.EditType == ListFormFieldEditTabs.CustomizationForm)
|
else if (input.EditType == ListFormFieldEditTabs.CustomizationForm)
|
||||||
{
|
{
|
||||||
|
|
@ -257,6 +270,9 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
field.CaptionName = sourceField.CaptionName;
|
field.CaptionName = sourceField.CaptionName;
|
||||||
field.PlaceHolder = sourceField.PlaceHolder;
|
field.PlaceHolder = sourceField.PlaceHolder;
|
||||||
field.SourceDbType = sourceField.SourceDbType;
|
field.SourceDbType = sourceField.SourceDbType;
|
||||||
|
field.Alignment = sourceField.Alignment;
|
||||||
|
field.Format = sourceField.Format;
|
||||||
|
field.EditorOptions = sourceField.EditorOptions;
|
||||||
}
|
}
|
||||||
if (input.CopiedFields.All || input.CopiedFields.Options)
|
if (input.CopiedFields.All || input.CopiedFields.Options)
|
||||||
{
|
{
|
||||||
|
|
@ -269,35 +285,40 @@ public class ListFormFieldsAppService : CrudAppService<
|
||||||
field.AllowSearch = sourceField.AllowSearch;
|
field.AllowSearch = sourceField.AllowSearch;
|
||||||
field.AllowEditing = sourceField.AllowEditing;
|
field.AllowEditing = sourceField.AllowEditing;
|
||||||
field.AllowAdding = sourceField.AllowAdding;
|
field.AllowAdding = sourceField.AllowAdding;
|
||||||
|
field.EditGroupOrderNo = sourceField.EditGroupOrderNo;
|
||||||
|
field.EditOrderNo = sourceField.EditOrderNo;
|
||||||
|
field.ColSpan = sourceField.ColSpan;
|
||||||
|
field.EditorType2 = sourceField.EditorType2;
|
||||||
|
field.EditorScript = sourceField.EditorScript;
|
||||||
}
|
}
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Permission)
|
if (input.CopiedFields.All || input.CopiedFields.Permission)
|
||||||
{
|
{
|
||||||
field.PermissionJson = sourceField.PermissionJson;
|
field.PermissionJson = sourceField.PermissionJson;
|
||||||
}
|
}
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Customization)
|
if (input.CopiedFields.All || input.CopiedFields.Customization)
|
||||||
field.ColumnCustomizationJson = sourceField.ColumnCustomizationJson;
|
field.ColumnCustomizationJson = sourceField.ColumnCustomizationJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Filtering)
|
if (input.CopiedFields.All || input.CopiedFields.Filtering)
|
||||||
field.ColumnFilterJson = sourceField.ColumnFilterJson;
|
field.ColumnFilterJson = sourceField.ColumnFilterJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Headering)
|
if (input.CopiedFields.All || input.CopiedFields.Headering)
|
||||||
field.ColumnHeaderJson = sourceField.ColumnHeaderJson;
|
field.ColumnHeaderJson = sourceField.ColumnHeaderJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Grouping)
|
if (input.CopiedFields.All || input.CopiedFields.Grouping)
|
||||||
field.GroupingJson = sourceField.GroupingJson;
|
field.GroupingJson = sourceField.GroupingJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.GroupSummary)
|
if (input.CopiedFields.All || input.CopiedFields.GroupSummary)
|
||||||
field.GroupSummaryJson = sourceField.GroupSummaryJson;
|
field.GroupSummaryJson = sourceField.GroupSummaryJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.TotalSummary)
|
if (input.CopiedFields.All || input.CopiedFields.TotalSummary)
|
||||||
field.TotalSummaryJson = sourceField.TotalSummaryJson;
|
field.TotalSummaryJson = sourceField.TotalSummaryJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.JoinOptions)
|
if (input.CopiedFields.All || input.CopiedFields.JoinOptions)
|
||||||
field.JoinTableJson = sourceField.JoinTableJson;
|
field.JoinTableJson = sourceField.JoinTableJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.CssOptions)
|
if (input.CopiedFields.All || input.CopiedFields.CssOptions)
|
||||||
{
|
{
|
||||||
field.ColumnCssClass = sourceField.ColumnCssClass;
|
field.ColumnCssClass = sourceField.ColumnCssClass;
|
||||||
field.ColumnCssValue = sourceField.ColumnCssValue;
|
field.ColumnCssValue = sourceField.ColumnCssValue;
|
||||||
}
|
}
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.ValidationRules)
|
if (input.CopiedFields.All || input.CopiedFields.ValidationRules)
|
||||||
field.ValidationRuleJson = sourceField.ValidationRuleJson;
|
field.ValidationRuleJson = sourceField.ValidationRuleJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.Formatting)
|
if (input.CopiedFields.All || input.CopiedFields.Formatting)
|
||||||
field.ColumnStylingJson = sourceField.ColumnStylingJson;
|
field.ColumnStylingJson = sourceField.ColumnStylingJson;
|
||||||
else if (input.CopiedFields.All || input.CopiedFields.PivotSetting)
|
if (input.CopiedFields.All || input.CopiedFields.PivotSetting)
|
||||||
field.PivotSettingsJson = sourceField.PivotSettingsJson;
|
field.PivotSettingsJson = sourceField.PivotSettingsJson;
|
||||||
|
|
||||||
await Repository.InsertAsync(field);
|
await Repository.InsertAsync(field);
|
||||||
|
|
|
||||||
|
|
@ -230,21 +230,9 @@ public class ListFormWizardAppService(
|
||||||
Caption = g.Caption,
|
Caption = g.Caption,
|
||||||
ColCount = g.ColCount,
|
ColCount = g.ColCount,
|
||||||
ColSpan = g.ColCount,
|
ColSpan = g.ColCount,
|
||||||
ItemType = "group",
|
ItemType = "group"
|
||||||
Items = g.Items
|
|
||||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
|
||||||
.Select((it, ii) => new EditingFormItemDto
|
|
||||||
{
|
|
||||||
Order = ii + 1,
|
|
||||||
DataField = it.DataField,
|
|
||||||
EditorType2 = it.EditorType,
|
|
||||||
ColSpan = it.ColSpan,
|
|
||||||
EditorOptions = string.IsNullOrWhiteSpace(it.EditorOptions) ? null : it.EditorOptions,
|
|
||||||
EditorScript = string.IsNullOrWhiteSpace(it.EditorScript) ? null : it.EditorScript,
|
|
||||||
})
|
|
||||||
.ToArray()
|
|
||||||
})
|
})
|
||||||
.Where(g => g.Items.Length > 0)
|
.Where((_, index) => input.Groups[index].Items.Any(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//ListForm - varsa sil, yeniden ekle
|
//ListForm - varsa sil, yeniden ekle
|
||||||
|
|
@ -371,21 +359,34 @@ public class ListFormWizardAppService(
|
||||||
|
|
||||||
// ListFormField - each item in each group becomes a visible field record
|
// ListFormField - each item in each group becomes a visible field record
|
||||||
var fieldOrder = 0;
|
var fieldOrder = 0;
|
||||||
|
var editGroupOrder = 0;
|
||||||
foreach (var group in input.Groups)
|
foreach (var group in input.Groups)
|
||||||
{
|
{
|
||||||
|
editGroupOrder++;
|
||||||
|
var editOrder = 0;
|
||||||
foreach (var item in group.Items)
|
foreach (var item in group.Items)
|
||||||
{
|
{
|
||||||
fieldOrder++;
|
fieldOrder++;
|
||||||
|
if (item.IncludeInEditingForm && item.FieldName != input.KeyFieldName)
|
||||||
|
{
|
||||||
|
editOrder++;
|
||||||
|
}
|
||||||
await repoListFormField.InsertAsync(new ListFormField
|
await repoListFormField.InsertAsync(new ListFormField
|
||||||
{
|
{
|
||||||
ListFormCode = input.ListFormCode,
|
ListFormCode = input.ListFormCode,
|
||||||
FieldName = item.DataField,
|
FieldName = item.FieldName,
|
||||||
CaptionName = item.CaptionName,
|
CaptionName = item.CaptionName,
|
||||||
Visible = item.DataField != input.KeyFieldName,
|
Visible = item.FieldName != input.KeyFieldName,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
AllowSearch = true,
|
AllowSearch = true,
|
||||||
Width = 0,
|
Width = 0,
|
||||||
ListOrderNo = fieldOrder,
|
ListOrderNo = fieldOrder,
|
||||||
|
EditGroupOrderNo = item.IncludeInEditingForm ? editGroupOrder : null,
|
||||||
|
EditOrderNo = item.IncludeInEditingForm && item.FieldName != input.KeyFieldName ? editOrder : null,
|
||||||
|
EditorType2 = item.IncludeInEditingForm ? item.EditorType : null,
|
||||||
|
ColSpan = item.IncludeInEditingForm ? item.ColSpan : null,
|
||||||
|
EditorOptions = string.IsNullOrWhiteSpace(item.EditorOptions) ? null : item.EditorOptions,
|
||||||
|
EditorScript = string.IsNullOrWhiteSpace(item.EditorScript) ? null : item.EditorScript,
|
||||||
SourceDbType = item.DbSourceType,
|
SourceDbType = item.DbSourceType,
|
||||||
CultureName = PlatformConsts.DefaultLanguage,
|
CultureName = PlatformConsts.DefaultLanguage,
|
||||||
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
||||||
|
|
|
||||||
|
|
@ -4686,6 +4686,12 @@
|
||||||
"en": "Scheduler Layout",
|
"en": "Scheduler Layout",
|
||||||
"tr": "Zamanlayıcı Düzeni"
|
"tr": "Zamanlayıcı Düzeni"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormEdit.DetailsLayoutDto.TodoLayout",
|
||||||
|
"en": "Todo Layout",
|
||||||
|
"tr": "İşler Düzeni"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.DetailsLayoutDto.GanttLayout",
|
"key": "ListForms.ListFormEdit.DetailsLayoutDto.GanttLayout",
|
||||||
|
|
@ -5186,15 +5192,15 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.EditingFormFormFields",
|
"key": "ListForms.ListFormEdit.EditingFormFormGroups",
|
||||||
"en": "Editing Form Fields",
|
"en": "Editing Form Groups",
|
||||||
"tr": "Düzenleme Form Alanları"
|
"tr": "Düzenleme Form Grupları"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormEdit.EditingFormFormFieldsDescription",
|
"key": "ListForms.ListFormEdit.EditingFormFormGroupsDescription",
|
||||||
"en": "Edit formunda çıkacak field'lar",
|
"en": "Groups that will appear in Edit form",
|
||||||
"tr": "Form Sütunları"
|
"tr": "Düzenleme formunda çıkacak gruplar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
|
|
@ -5916,6 +5922,30 @@
|
||||||
"en": "Field Name",
|
"en": "Field Name",
|
||||||
"tr": "Alan Adı"
|
"tr": "Alan Adı"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormFieldEdit.EditorType",
|
||||||
|
"en": "Editor Type",
|
||||||
|
"tr": "Editör Tipi"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormFieldEdit.EditFormGroup",
|
||||||
|
"en": "Edit Form Group",
|
||||||
|
"tr": "Düzenleme Form Grubu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormFieldEdit.EditFormOrderNo",
|
||||||
|
"en": "Edit Order No",
|
||||||
|
"tr": "Düzenleme Sıra No"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"resourceName": "Platform",
|
||||||
|
"key": "ListForms.ListFormFieldEdit.EditFormColSpan",
|
||||||
|
"en": "Edit Col Span",
|
||||||
|
"tr": "Düzenleme Col Span"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"resourceName": "Platform",
|
"resourceName": "Platform",
|
||||||
"key": "ListForms.ListFormFieldEdit.PlaceHolder",
|
"key": "ListForms.ListFormFieldEdit.PlaceHolder",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,21 +0,0 @@
|
||||||
IF OBJECT_ID(N'[dbo].[Adm_D_Todos]', 'U') IS NULL
|
|
||||||
BEGIN
|
|
||||||
CREATE TABLE [dbo].[Adm_D_Todos]
|
|
||||||
(
|
|
||||||
[Id] uniqueidentifier NOT NULL DEFAULT NEWID(),
|
|
||||||
[Title] nvarchar(300) NOT NULL,
|
|
||||||
[Status] nvarchar(50) NOT NULL DEFAULT N'Inbox',
|
|
||||||
[Description] nvarchar(MAX) NULL,
|
|
||||||
[DueDate] datetime2 NULL,
|
|
||||||
[Tags] nvarchar(500) NULL,
|
|
||||||
[Assignees] nvarchar(500) NULL,
|
|
||||||
[Priority] nvarchar(50) NULL,
|
|
||||||
[Completed] bit NOT NULL DEFAULT 0,
|
|
||||||
[SortOrder] int NOT NULL DEFAULT 0,
|
|
||||||
CONSTRAINT [PK_Table] PRIMARY KEY NONCLUSTERED
|
|
||||||
(
|
|
||||||
[Id] ASC
|
|
||||||
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
|
|
||||||
) ON [PRIMARY]
|
|
||||||
END
|
|
||||||
GO
|
|
||||||
|
|
@ -1,278 +0,0 @@
|
||||||
{
|
|
||||||
"Wizard": {
|
|
||||||
"WizardName": "Todos",
|
|
||||||
"ListFormCode": "App.Wizard.Todos",
|
|
||||||
"MenuCode": "App.Wizard.Todos",
|
|
||||||
"IsTenant": false,
|
|
||||||
"IsBranch": false,
|
|
||||||
"IsOrganizationUnit": false,
|
|
||||||
"AllowAdding": true,
|
|
||||||
"AllowUpdating": true,
|
|
||||||
"AllowDeleting": true,
|
|
||||||
"AllowDetail": false,
|
|
||||||
"ConfirmDelete": true,
|
|
||||||
"DefaultLayout": "grid",
|
|
||||||
"Grid": true,
|
|
||||||
"Card": true,
|
|
||||||
"Pivot": true,
|
|
||||||
"Tree": true,
|
|
||||||
"Chart": true,
|
|
||||||
"Gantt": true,
|
|
||||||
"Scheduler": true,
|
|
||||||
"Todo": true,
|
|
||||||
"LanguageTextMenuEn": "Todos",
|
|
||||||
"LanguageTextMenuTr": "Todos",
|
|
||||||
"LanguageTextTitleEn": "Todos",
|
|
||||||
"LanguageTextTitleTr": "Todos",
|
|
||||||
"LanguageTextDescEn": "Todos",
|
|
||||||
"LanguageTextDescTr": "Todos",
|
|
||||||
"LanguageTextMenuParentEn": "",
|
|
||||||
"LanguageTextMenuParentTr": "",
|
|
||||||
"PermissionGroupName": "App.Administration",
|
|
||||||
"MenuParentCode": "App.Administration",
|
|
||||||
"MenuParentIcon": "FcOrganization",
|
|
||||||
"MenuIcon": "FcAndroidOs",
|
|
||||||
"DataSourceCode": "Default",
|
|
||||||
"DataSourceConnectionString": "",
|
|
||||||
"SelectCommandType": 1,
|
|
||||||
"SelectCommand": "Adm_D_Todos",
|
|
||||||
"KeyFieldName": "Id",
|
|
||||||
"KeyFieldDbSourceType": 9,
|
|
||||||
"TreeKeyExpr": "",
|
|
||||||
"TreeParentIdExpr": "",
|
|
||||||
"TreeAutoExpandAll": false,
|
|
||||||
"GanttKeyExpr": "",
|
|
||||||
"GanttParentIdExpr": "",
|
|
||||||
"GanttAutoExpandAll": false,
|
|
||||||
"GanttTitleExpr": "",
|
|
||||||
"GanttStartExpr": "",
|
|
||||||
"GanttEndExpr": "",
|
|
||||||
"GanttProgressExpr": "",
|
|
||||||
"SchedulerTextExpr": "",
|
|
||||||
"SchedulerStartDateExpr": "",
|
|
||||||
"SchedulerEndDateExpr": "",
|
|
||||||
"TodoTitleExpr": "Title",
|
|
||||||
"TodoStatusExpr": "Status",
|
|
||||||
"TodoDescriptionExpr": "Description",
|
|
||||||
"TodoDueDateExpr": "DueDate",
|
|
||||||
"TodoTagExpr": "Tags",
|
|
||||||
"TodoAssigneeExpr": "Assignees",
|
|
||||||
"TodoPriorityExpr": "Priority",
|
|
||||||
"TodoCompletedExpr": "Completed",
|
|
||||||
"TodoOrderExpr": "SortOrder",
|
|
||||||
"TodoStatusOrder": "Inbox, Today, This Week, This Month, Later, Done",
|
|
||||||
"TodoAllowDragging": true,
|
|
||||||
"ApprovalUserFieldName": "",
|
|
||||||
"ApprovalDateFieldName": "",
|
|
||||||
"ApprovalStatusFieldName": "",
|
|
||||||
"ApprovalDescriptionFieldName": "",
|
|
||||||
"ApprovalIsFilterUserName": false,
|
|
||||||
"Criteria": [],
|
|
||||||
"Groups": [
|
|
||||||
{
|
|
||||||
"Caption": "",
|
|
||||||
"ColCount": 1,
|
|
||||||
"Items": [
|
|
||||||
{
|
|
||||||
"DataField": "Id",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Id",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": true,
|
|
||||||
"IncludeInEditingForm": true,
|
|
||||||
"DbSourceType": 9,
|
|
||||||
"TurkishCaption": "Id",
|
|
||||||
"EnglishCaption": "Id",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Title",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Title",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": true,
|
|
||||||
"IncludeInEditingForm": true,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Title",
|
|
||||||
"EnglishCaption": "Title",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Status",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Status",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": true,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Status",
|
|
||||||
"EnglishCaption": "Status",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Description",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Description",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": false,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Description",
|
|
||||||
"EnglishCaption": "Description",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "DueDate",
|
|
||||||
"CaptionName": "App.Listform.ListformField.DueDate",
|
|
||||||
"EditorType": "dxDateBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": false,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 6,
|
|
||||||
"TurkishCaption": "Due Date",
|
|
||||||
"EnglishCaption": "Due Date",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Tags",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Tags",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": false,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Tags",
|
|
||||||
"EnglishCaption": "Tags",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Assignees",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Assignees",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": false,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Assignees",
|
|
||||||
"EnglishCaption": "Assignees",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Priority",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Priority",
|
|
||||||
"EditorType": "dxTextBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": false,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 16,
|
|
||||||
"TurkishCaption": "Priority",
|
|
||||||
"EnglishCaption": "Priority",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "Completed",
|
|
||||||
"CaptionName": "App.Listform.ListformField.Completed",
|
|
||||||
"EditorType": "dxCheckBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": true,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 3,
|
|
||||||
"TurkishCaption": "Completed",
|
|
||||||
"EnglishCaption": "Completed",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"DataField": "SortOrder",
|
|
||||||
"CaptionName": "App.Listform.ListformField.SortOrder",
|
|
||||||
"EditorType": "dxNumberBox",
|
|
||||||
"EditorOptions": "",
|
|
||||||
"EditorScript": "",
|
|
||||||
"ColSpan": 1,
|
|
||||||
"IsRequired": true,
|
|
||||||
"IncludeInEditingForm": false,
|
|
||||||
"DbSourceType": 11,
|
|
||||||
"TurkishCaption": "Sort Order",
|
|
||||||
"EnglishCaption": "Sort Order",
|
|
||||||
"LookupDataSourceType": 1,
|
|
||||||
"ValueExpr": "Key",
|
|
||||||
"DisplayExpr": "Name",
|
|
||||||
"LookupQuery": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"SubForms": [],
|
|
||||||
"Widgets": []
|
|
||||||
},
|
|
||||||
"IsDeletedField": false,
|
|
||||||
"IsCreatedField": false,
|
|
||||||
"InsertedRecords": {
|
|
||||||
"LanguageKeys": [
|
|
||||||
"App.Wizard.Todos",
|
|
||||||
"App.Wizard.Todos.Title",
|
|
||||||
"App.Wizard.Todos.Desc",
|
|
||||||
"App.Listform.ListformField.Assignees",
|
|
||||||
"App.Listform.ListformField.Completed",
|
|
||||||
"App.Listform.ListformField.SortOrder"
|
|
||||||
],
|
|
||||||
"PermissionGroupNames": [],
|
|
||||||
"PermissionNames": [
|
|
||||||
"App.Wizard.Todos",
|
|
||||||
"App.Wizard.Todos.Create",
|
|
||||||
"App.Wizard.Todos.Update",
|
|
||||||
"App.Wizard.Todos.Delete",
|
|
||||||
"App.Wizard.Todos.Export",
|
|
||||||
"App.Wizard.Todos.Import",
|
|
||||||
"App.Wizard.Todos.Note"
|
|
||||||
],
|
|
||||||
"MenuCodes": [
|
|
||||||
"App.Wizard.Todos"
|
|
||||||
],
|
|
||||||
"DataSourceCodes": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -302,21 +302,9 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
Caption = g.Caption,
|
Caption = g.Caption,
|
||||||
ColCount = g.ColCount,
|
ColCount = g.ColCount,
|
||||||
ColSpan = g.ColCount,
|
ColSpan = g.ColCount,
|
||||||
ItemType = "group",
|
ItemType = "group"
|
||||||
Items = g.Items
|
|
||||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
|
||||||
.Select((it, ii) => new EditingFormItemDto
|
|
||||||
{
|
|
||||||
Order = ii + 1,
|
|
||||||
DataField = it.DataField,
|
|
||||||
EditorType2 = it.EditorType,
|
|
||||||
ColSpan = it.ColSpan,
|
|
||||||
EditorOptions = string.IsNullOrWhiteSpace(it.EditorOptions) ? null : it.EditorOptions,
|
|
||||||
EditorScript = string.IsNullOrWhiteSpace(it.EditorScript) ? null : it.EditorScript,
|
|
||||||
})
|
|
||||||
.ToArray()
|
|
||||||
})
|
})
|
||||||
.Where(g => g.Items.Length > 0)
|
.Where((_, index) => input.Groups[index].Items.Any(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// ListForm - varsa sil, yeniden ekle
|
// ListForm - varsa sil, yeniden ekle
|
||||||
|
|
@ -341,8 +329,8 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
// EditingForm'da required olan alanları tespit et, ValidationRuleJson eklemek için
|
// EditingForm'da required olan alanları tespit et, ValidationRuleJson eklemek için
|
||||||
var editingFormFieldNames = input.Groups
|
var editingFormFieldNames = input.Groups
|
||||||
.SelectMany(g => g.Items)
|
.SelectMany(g => g.Items)
|
||||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
.Where(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName)
|
||||||
.Select(i => new { FieldName = i.DataField, Isrequired = i.IsRequired })
|
.Select(i => new { FieldName = i.FieldName, Isrequired = i.IsRequired })
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// Heigth ve Width hesaplama
|
// Heigth ve Width hesaplama
|
||||||
|
|
@ -350,7 +338,7 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
.Select(g =>
|
.Select(g =>
|
||||||
{
|
{
|
||||||
var items = g.Items
|
var items = g.Items
|
||||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
.Where(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var columnCount = g.ColCount;
|
var columnCount = g.ColCount;
|
||||||
|
|
@ -454,21 +442,34 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
|
|
||||||
// ListFormFields
|
// ListFormFields
|
||||||
var fieldOrder = 0;
|
var fieldOrder = 0;
|
||||||
|
var editGroupOrder = 0;
|
||||||
foreach (var group in input.Groups)
|
foreach (var group in input.Groups)
|
||||||
{
|
{
|
||||||
|
editGroupOrder++;
|
||||||
|
var editOrder = 0;
|
||||||
foreach (var item in group.Items)
|
foreach (var item in group.Items)
|
||||||
{
|
{
|
||||||
fieldOrder++;
|
fieldOrder++;
|
||||||
|
if (item.IncludeInEditingForm && item.FieldName != input.KeyFieldName)
|
||||||
|
{
|
||||||
|
editOrder++;
|
||||||
|
}
|
||||||
await _repoListFormField.InsertAsync(new ListFormField
|
await _repoListFormField.InsertAsync(new ListFormField
|
||||||
{
|
{
|
||||||
ListFormCode = input.ListFormCode,
|
ListFormCode = input.ListFormCode,
|
||||||
FieldName = item.DataField,
|
FieldName = item.FieldName,
|
||||||
CaptionName = item.CaptionName,
|
CaptionName = item.CaptionName,
|
||||||
Visible = item.DataField != input.KeyFieldName,
|
Visible = item.FieldName != input.KeyFieldName,
|
||||||
IsActive = true,
|
IsActive = true,
|
||||||
Width = 0, //Fit columns için hepsine sıfır veriyorum.
|
Width = 0, //Fit columns için hepsine sıfır veriyorum.
|
||||||
AllowSearch = true,
|
AllowSearch = true,
|
||||||
ListOrderNo = fieldOrder,
|
ListOrderNo = fieldOrder,
|
||||||
|
EditGroupOrderNo = item.IncludeInEditingForm ? editGroupOrder : null,
|
||||||
|
EditOrderNo = item.IncludeInEditingForm && item.FieldName != input.KeyFieldName ? editOrder : null,
|
||||||
|
EditorType2 = item.IncludeInEditingForm ? item.EditorType : null,
|
||||||
|
ColSpan = item.IncludeInEditingForm ? item.ColSpan : null,
|
||||||
|
EditorOptions = string.IsNullOrWhiteSpace(item.EditorOptions) ? null : item.EditorOptions,
|
||||||
|
EditorScript = string.IsNullOrWhiteSpace(item.EditorScript) ? null : item.EditorScript,
|
||||||
SourceDbType = item.DbSourceType,
|
SourceDbType = item.DbSourceType,
|
||||||
CultureName = PlatformConsts.DefaultLanguage,
|
CultureName = PlatformConsts.DefaultLanguage,
|
||||||
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
||||||
|
|
@ -478,7 +479,7 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
||||||
LookupJson = !string.IsNullOrWhiteSpace(item.LookupQuery)
|
LookupJson = !string.IsNullOrWhiteSpace(item.LookupQuery)
|
||||||
? WizardConsts.DefaultLookupJson(item.LookupDataSourceType, item.DisplayExpr, item.ValueExpr, item.LookupQuery)
|
? WizardConsts.DefaultLookupJson(item.LookupDataSourceType, item.DisplayExpr, item.ValueExpr, item.LookupQuery)
|
||||||
: null,
|
: null,
|
||||||
ValidationRuleJson = editingFormFieldNames.Any(f => f.FieldName == item.DataField && f.Isrequired)
|
ValidationRuleJson = editingFormFieldNames.Any(f => f.FieldName == item.FieldName && f.Isrequired)
|
||||||
? WizardConsts.DefaultValidationRuleRequiredJson
|
? WizardConsts.DefaultValidationRuleRequiredJson
|
||||||
: null
|
: null
|
||||||
}, autoSave: true);
|
}, autoSave: true);
|
||||||
|
|
|
||||||
|
|
@ -758,6 +758,7 @@ public static class PlatformConsts
|
||||||
public const string dxDateBox = "dxDateBox";
|
public const string dxDateBox = "dxDateBox";
|
||||||
public const string dxDateRangeBox = "dxDateRangeBox";
|
public const string dxDateRangeBox = "dxDateRangeBox";
|
||||||
public const string dxDropDownBox = "dxDropDownBox";
|
public const string dxDropDownBox = "dxDropDownBox";
|
||||||
|
public const string dxGridBox = "dxGridBox";
|
||||||
public const string dxHtmlEditor = "dxHtmlEditor";
|
public const string dxHtmlEditor = "dxHtmlEditor";
|
||||||
public const string dxLookup = "dxHtmlEdidxLookuptor";
|
public const string dxLookup = "dxHtmlEdidxLookuptor";
|
||||||
public const string dxNumberBox = "dxNumberBox";
|
public const string dxNumberBox = "dxNumberBox";
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,13 @@ public class ListFormField : Entity<Guid>
|
||||||
|
|
||||||
public string Alignment { get; set; } = "left"; // Sütunun Sağa, sola veya ortalama gösterimi
|
public string Alignment { get; set; } = "left"; // Sütunun Sağa, sola veya ortalama gösterimi
|
||||||
public string Format { get; set; } // Cell bazında sütunun formatlanması
|
public string Format { get; set; } // Cell bazında sütunun formatlanması
|
||||||
public string EditorOptions { get; set; } //Sütunun ekstra özellikleri yönetilmesi
|
|
||||||
|
public int? EditOrderNo { get; set; }
|
||||||
|
public int? EditGroupOrderNo { get; set; }
|
||||||
|
public string EditorType2 { get; set; }
|
||||||
|
public int? ColSpan { get; set; }
|
||||||
|
public string EditorScript { get; set; } //Sütunun ekstra javascript ile yönetilmesi
|
||||||
|
public string EditorOptions { get; set; } //Sütunun ekstra özellikleri yönetilmesi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using Volo.Abp.Domain.Values;
|
|
||||||
|
|
||||||
namespace Sozsoft.Platform.Queries;
|
|
||||||
|
|
||||||
// public class EditingForm : ValueObject
|
|
||||||
// {
|
|
||||||
// public int Order { get; set; }
|
|
||||||
// public string ItemType { get; set; }
|
|
||||||
// public string Caption { get; set; }
|
|
||||||
// public int ColCount { get; set; }
|
|
||||||
// public int ColSpan { get; set; }
|
|
||||||
// /// <summary> Type: Array<Simple Form Item | Group Form Item | Tabbed Form Item | Empty Form Item | Button Form Item>
|
|
||||||
// /// Bu kisma suan sadece string olarak doldurulacak
|
|
||||||
// /// items: ['FirstName', 'LastName',
|
|
||||||
// /// { dataField: 'Notes', editorType: 'dxTextArea', colSpan: 2, editorOptions: { height: 100, }, }
|
|
||||||
// /// ],
|
|
||||||
// /// </summary>
|
|
||||||
// //[TextArea]
|
|
||||||
// //public string[] Items { get; set; }
|
|
||||||
// public EditingFormItem[] Items { get; set; }
|
|
||||||
|
|
||||||
// protected override IEnumerable<object> GetAtomicValues()
|
|
||||||
// {
|
|
||||||
// yield return ItemType;
|
|
||||||
// yield return Caption;
|
|
||||||
// yield return ColCount;
|
|
||||||
// yield return ColSpan;
|
|
||||||
// yield return Items;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public class EditingFormItem : ValueObject
|
|
||||||
// {
|
|
||||||
// [JsonPropertyName("order")]
|
|
||||||
// public int Order { get; set; }
|
|
||||||
// [JsonPropertyName("dataField")]
|
|
||||||
// public string DataField { get; set; }
|
|
||||||
// [JsonPropertyName("editorType2")]
|
|
||||||
// public string EditorType2 { get; set; }
|
|
||||||
// [JsonPropertyName("colSpan")]
|
|
||||||
// public int ColSpan { get; set; }
|
|
||||||
// [JsonPropertyName("editorOptions")]
|
|
||||||
// public string EditorOptions { get; set; }
|
|
||||||
// [JsonPropertyName("isRequired")]
|
|
||||||
// public bool IsRequired { get; set; }
|
|
||||||
|
|
||||||
// protected override IEnumerable<object> GetAtomicValues()
|
|
||||||
// {
|
|
||||||
// yield return DataField;
|
|
||||||
// yield return EditorType2;
|
|
||||||
// yield return ColSpan;
|
|
||||||
// yield return EditorOptions;
|
|
||||||
// yield return IsRequired;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
@ -455,6 +455,8 @@ public class PlatformDbContext :
|
||||||
b.Property(a => a.Alignment).HasMaxLength(20).HasDefaultValue("left");
|
b.Property(a => a.Alignment).HasMaxLength(20).HasDefaultValue("left");
|
||||||
b.Property(a => a.Format).HasMaxLength(128);
|
b.Property(a => a.Format).HasMaxLength(128);
|
||||||
b.Property(a => a.EditorOptions).HasColumnType("text");
|
b.Property(a => a.EditorOptions).HasColumnType("text");
|
||||||
|
b.Property(a => a.EditorType2).HasMaxLength(64);
|
||||||
|
b.Property(a => a.EditorScript).HasColumnType("text");
|
||||||
|
|
||||||
b.HasIndex(x => new { x.ListFormCode, x.UserId, x.RoleId, x.CultureName, x.FieldName }).IsUnique().HasFilter(null);
|
b.HasIndex(x => new { x.ListFormCode, x.UserId, x.RoleId, x.CultureName, x.FieldName }).IsUnique().HasFilter(null);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
||||||
namespace Sozsoft.Platform.Migrations
|
namespace Sozsoft.Platform.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(PlatformDbContext))]
|
[DbContext(typeof(PlatformDbContext))]
|
||||||
[Migration("20260716120523_Initial")]
|
[Migration("20260717065637_Initial")]
|
||||||
partial class Initial
|
partial class Initial
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
@ -3415,6 +3415,9 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
.HasColumnType("nvarchar(256)");
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<int?>("ColSpan")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("ColumnCssClass")
|
b.Property<string>("ColumnCssClass")
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
.HasColumnType("nvarchar(128)");
|
.HasColumnType("nvarchar(128)");
|
||||||
|
|
@ -3440,9 +3443,22 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasMaxLength(10)
|
.HasMaxLength(10)
|
||||||
.HasColumnType("nvarchar(10)");
|
.HasColumnType("nvarchar(10)");
|
||||||
|
|
||||||
|
b.Property<int?>("EditGroupOrderNo")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("EditOrderNo")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("EditorOptions")
|
b.Property<string>("EditorOptions")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("EditorScript")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("EditorType2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
b.Property<string>("FieldName")
|
b.Property<string>("FieldName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
|
|
@ -2791,6 +2791,11 @@ namespace Sozsoft.Platform.Migrations
|
||||||
PivotSettingsJson = table.Column<string>(type: "text", nullable: true),
|
PivotSettingsJson = table.Column<string>(type: "text", nullable: true),
|
||||||
Alignment = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, defaultValue: "left"),
|
Alignment = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, defaultValue: "left"),
|
||||||
Format = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
Format = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
|
||||||
|
EditOrderNo = table.Column<int>(type: "int", nullable: true),
|
||||||
|
EditGroupOrderNo = table.Column<int>(type: "int", nullable: true),
|
||||||
|
EditorType2 = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: true),
|
||||||
|
ColSpan = table.Column<int>(type: "int", nullable: true),
|
||||||
|
EditorScript = table.Column<string>(type: "text", nullable: true),
|
||||||
EditorOptions = table.Column<string>(type: "text", nullable: true)
|
EditorOptions = table.Column<string>(type: "text", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
|
|
@ -3412,6 +3412,9 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasMaxLength(256)
|
.HasMaxLength(256)
|
||||||
.HasColumnType("nvarchar(256)");
|
.HasColumnType("nvarchar(256)");
|
||||||
|
|
||||||
|
b.Property<int?>("ColSpan")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("ColumnCssClass")
|
b.Property<string>("ColumnCssClass")
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
.HasColumnType("nvarchar(128)");
|
.HasColumnType("nvarchar(128)");
|
||||||
|
|
@ -3437,9 +3440,22 @@ namespace Sozsoft.Platform.Migrations
|
||||||
.HasMaxLength(10)
|
.HasMaxLength(10)
|
||||||
.HasColumnType("nvarchar(10)");
|
.HasColumnType("nvarchar(10)");
|
||||||
|
|
||||||
|
b.Property<int?>("EditGroupOrderNo")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("EditOrderNo")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<string>("EditorOptions")
|
b.Property<string>("EditorOptions")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("EditorScript")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("EditorType2")
|
||||||
|
.HasMaxLength(64)
|
||||||
|
.HasColumnType("nvarchar(64)");
|
||||||
|
|
||||||
b.Property<string>("FieldName")
|
b.Property<string>("FieldName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(128)
|
.HasMaxLength(128)
|
||||||
|
|
|
||||||
|
|
@ -542,14 +542,16 @@ public class DynamicFormReport : XtraReport
|
||||||
.Where(x => x.IsActive != false)
|
.Where(x => x.IsActive != false)
|
||||||
.ToDictionary(x => x.FieldName, StringComparer.OrdinalIgnoreCase);
|
.ToDictionary(x => x.FieldName, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var formItems = GetEditingFormItems(listForm)
|
var editFields = fields
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(x.DataField))
|
.Where(x => x.EditOrderNo.HasValue)
|
||||||
|
.OrderBy(x => x.EditGroupOrderNo ?? 1)
|
||||||
|
.ThenBy(x => x.EditOrderNo)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var orderedFields = formItems.Count > 0
|
var orderedFields = editFields.Count > 0
|
||||||
? formItems
|
? editFields
|
||||||
.Where(x => fieldsByName.ContainsKey(x.DataField))
|
.Where(x => fieldsByName.ContainsKey(x.FieldName))
|
||||||
.Select(x => new FieldWithEditor(fieldsByName[x.DataField], x.EditorType2, x.ColSpan))
|
.Select(x => new FieldWithEditor(x, x.EditorType2, x.ColSpan ?? 1))
|
||||||
.ToList()
|
.ToList()
|
||||||
: fields
|
: fields
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||||
|
|
@ -582,10 +584,9 @@ public class DynamicFormReport : XtraReport
|
||||||
var usedFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
var usedFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
foreach (var group in groups)
|
foreach (var group in groups)
|
||||||
{
|
{
|
||||||
var groupFields = (group.Items ?? [])
|
var groupFields = fields
|
||||||
.OrderBy(x => x.Order)
|
.Where(x => (x.Field.EditGroupOrderNo ?? 1) == group.Order)
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(x.DataField) && fieldsByName.ContainsKey(x.DataField))
|
.OrderBy(x => x.Field.EditOrderNo ?? int.MaxValue)
|
||||||
.Select(x => fieldsByName[x.DataField])
|
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var field in groupFields)
|
foreach (var field in groupFields)
|
||||||
|
|
@ -625,13 +626,6 @@ public class DynamicFormReport : XtraReport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IEnumerable<EditingFormItemDto> GetEditingFormItems(ListForm listForm)
|
|
||||||
{
|
|
||||||
return GetEditingFormGroups(listForm)
|
|
||||||
.OrderBy(x => x.Order)
|
|
||||||
.SelectMany(x => (x.Items ?? []).OrderBy(i => i.Order));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IEnumerable<(SubFormDto Form, string Filter)> GetListSubForms(
|
private static IEnumerable<(SubFormDto Form, string Filter)> GetListSubForms(
|
||||||
ListForm listForm,
|
ListForm listForm,
|
||||||
IDictionary<string, object> row)
|
IDictionary<string, object> row)
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public class DynamicGridReport : XtraReport
|
||||||
|
|
||||||
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
||||||
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
||||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(listForm);
|
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(fields);
|
||||||
|
|
||||||
var availableFields = fields
|
var availableFields = fields
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||||
|
|
|
||||||
|
|
@ -73,28 +73,16 @@ internal static class DynamicReportImageHelper
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, string> CreateEditorTypeMap(ListForm listForm)
|
public static Dictionary<string, string> CreateEditorTypeMap(IEnumerable<ListFormField> fields)
|
||||||
{
|
{
|
||||||
var map = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
var map = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
if (string.IsNullOrWhiteSpace(listForm?.EditingFormJson))
|
foreach (var field in fields ?? [])
|
||||||
{
|
{
|
||||||
return map;
|
if (!string.IsNullOrWhiteSpace(field.FieldName) && !string.IsNullOrWhiteSpace(field.EditorType2))
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var groups = JsonSerializer.Deserialize<List<EditingFormDto>>(listForm.EditingFormJson) ?? [];
|
|
||||||
foreach (var item in groups.SelectMany(x => x.Items ?? []))
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(item.DataField))
|
map[field.FieldName] = field.EditorType2;
|
||||||
{
|
|
||||||
map[item.DataField] = item.EditorType2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (JsonException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
@ -452,25 +440,16 @@ internal static class DynamicReportImageHelper
|
||||||
return editorType is PlatformConsts.EditorTypes.dxImageUpload or PlatformConsts.EditorTypes.dxImageViewer;
|
return editorType is PlatformConsts.EditorTypes.dxImageUpload or PlatformConsts.EditorTypes.dxImageViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HasImageEditor(ListForm listForm, string fieldName)
|
public static bool HasImageEditor(IEnumerable<ListFormField> fields, string fieldName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(listForm?.EditingFormJson) || string.IsNullOrWhiteSpace(fieldName))
|
if (string.IsNullOrWhiteSpace(fieldName))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
return (fields ?? []).Any(x =>
|
||||||
{
|
string.Equals(x.FieldName, fieldName, StringComparison.OrdinalIgnoreCase) &&
|
||||||
var groups = JsonSerializer.Deserialize<List<EditingFormDto>>(listForm.EditingFormJson) ?? [];
|
IsImageEditor(x.EditorType2));
|
||||||
return groups
|
|
||||||
.SelectMany(x => x.Items ?? [])
|
|
||||||
.Any(x => string.Equals(x.DataField, fieldName, StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
IsImageEditor(x.EditorType2));
|
|
||||||
}
|
|
||||||
catch (JsonException)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float GetGridImageHeight() => DefaultGridImageHeight;
|
public static float GetGridImageHeight() => DefaultGridImageHeight;
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ public class DynamicTreeReport : XtraReport
|
||||||
|
|
||||||
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
||||||
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
||||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(listForm);
|
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(fields);
|
||||||
|
|
||||||
var availableFields = fields
|
var availableFields = fields
|
||||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import type {
|
||||||
StartEditAction,
|
StartEditAction,
|
||||||
StateStoreType,
|
StateStoreType,
|
||||||
} from 'devextreme/ui/data_grid_types'
|
} from 'devextreme/ui/data_grid_types'
|
||||||
import type { FormItemComponent } from 'devextreme/ui/form'
|
|
||||||
import { AuditedEntityDto } from '../abp'
|
import { AuditedEntityDto } from '../abp'
|
||||||
import { EditorType2, RowMode } from '../../views/form/types'
|
import { EditorType2, RowMode } from '../../views/form/types'
|
||||||
import {
|
import {
|
||||||
|
|
@ -195,7 +194,7 @@ export interface ColumnFilterDto {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ColumnFormatDto extends AuditedEntityDto<string> {
|
export interface ColumnFormatDto extends AuditedEntityDto<string> {
|
||||||
fieldName?: string
|
fieldName: string
|
||||||
captionName?: string
|
captionName?: string
|
||||||
placeHolder?: string
|
placeHolder?: string
|
||||||
readOnly: boolean
|
readOnly: boolean
|
||||||
|
|
@ -245,6 +244,14 @@ export interface ColumnFormatDto extends AuditedEntityDto<string> {
|
||||||
alignment?: HorizontalAlignment
|
alignment?: HorizontalAlignment
|
||||||
format?: string
|
format?: string
|
||||||
editorOptions?: string
|
editorOptions?: string
|
||||||
|
editOrderNo?: number
|
||||||
|
editGroupOrderNo?: number
|
||||||
|
editorType2: EditorType2
|
||||||
|
colSpan?: number
|
||||||
|
gridBoxOptions?: GridBoxOptionsDto
|
||||||
|
tagBoxOptions?: TagBoxOptionsDto
|
||||||
|
imageUploadOptions?: ImageUploadOptionsDto
|
||||||
|
editorScript?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AuthorizationTypeEnum {
|
export enum AuthorizationTypeEnum {
|
||||||
|
|
@ -492,20 +499,6 @@ export interface EditingFormDto {
|
||||||
caption?: string
|
caption?: string
|
||||||
colCount: number
|
colCount: number
|
||||||
colSpan: number
|
colSpan: number
|
||||||
items?: EditingFormItemDto[]
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EditingFormItemDto {
|
|
||||||
order: number
|
|
||||||
dataField: string
|
|
||||||
editorType: FormItemComponent
|
|
||||||
editorType2: EditorType2
|
|
||||||
colSpan?: number
|
|
||||||
editorOptions?: string
|
|
||||||
gridBoxOptions?: GridBoxOptionsDto
|
|
||||||
tagBoxOptions?: TagBoxOptionsDto
|
|
||||||
imageUploadOptions?: ImageUploadOptionsDto
|
|
||||||
editorScript?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GridEditingPopupDto {
|
export interface GridEditingPopupDto {
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,9 @@ const FormEdit = () => {
|
||||||
{translate('::ListForms.ListFormEdit.ExtraFilters')}
|
{translate('::ListForms.ListFormEdit.ExtraFilters')}
|
||||||
</TabNav>
|
</TabNav>
|
||||||
)}
|
)}
|
||||||
|
{visibleTabs.includes('editForm') && (
|
||||||
|
<TabNav value="editForm">{translate('::ListForms.ListFormEdit.EditingForm')}</TabNav>
|
||||||
|
)}
|
||||||
{visibleTabs.includes('fields') && (
|
{visibleTabs.includes('fields') && (
|
||||||
<TabNav value="fields">{translate('::ListForms.ListFormEdit.TabFields')}</TabNav>
|
<TabNav value="fields">{translate('::ListForms.ListFormEdit.TabFields')}</TabNav>
|
||||||
)}
|
)}
|
||||||
|
|
@ -308,9 +311,6 @@ const FormEdit = () => {
|
||||||
{translate('::ListForms.ListFormEdit.TabCustomization')}
|
{translate('::ListForms.ListFormEdit.TabCustomization')}
|
||||||
</TabNav>
|
</TabNav>
|
||||||
)}
|
)}
|
||||||
{visibleTabs.includes('editForm') && (
|
|
||||||
<TabNav value="editForm">{translate('::ListForms.ListFormEdit.EditingForm')}</TabNav>
|
|
||||||
)}
|
|
||||||
{visibleTabs.includes('pivots') && (
|
{visibleTabs.includes('pivots') && (
|
||||||
<TabNav value="pivots">{translate('::ListForms.ListFormEdit.TabPivot')}</TabNav>
|
<TabNav value="pivots">{translate('::ListForms.ListFormEdit.TabPivot')}</TabNav>
|
||||||
)}
|
)}
|
||||||
|
|
@ -464,6 +464,7 @@ const FormEdit = () => {
|
||||||
<TabContent value="fields" className="px-2">
|
<TabContent value="fields" className="px-2">
|
||||||
<FormFields
|
<FormFields
|
||||||
listFormCode={listFormCode}
|
listFormCode={listFormCode}
|
||||||
|
editingFormGroups={listFormValues.editingFormDto ?? []}
|
||||||
langOptions={langOptions}
|
langOptions={langOptions}
|
||||||
roleList={roleList}
|
roleList={roleList}
|
||||||
userList={userList}
|
userList={userList}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ const schema = Yup.object().shape({
|
||||||
chart: Yup.boolean(),
|
chart: Yup.boolean(),
|
||||||
tree: Yup.boolean(),
|
tree: Yup.boolean(),
|
||||||
gantt: Yup.boolean(),
|
gantt: Yup.boolean(),
|
||||||
|
scheduler: Yup.boolean(),
|
||||||
|
todo: Yup.boolean(),
|
||||||
defaultLayout: Yup.string(),
|
defaultLayout: Yup.string(),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
@ -411,7 +413,11 @@ function FormTabDetails(
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="Todo Layout">
|
<FormItem
|
||||||
|
label={translate('::ListForms.ListFormEdit.DetailsLayoutDto.TodoLayout')}
|
||||||
|
invalid={errors.layoutDto?.todo && touched.layoutDto?.todo}
|
||||||
|
errorMessage={errors.layoutDto?.todo}
|
||||||
|
>
|
||||||
<Field
|
<Field
|
||||||
className="w-20"
|
className="w-20"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ function FormTabEditForm(props: { listFormCode: string }) {
|
||||||
<Th>{translate('::ListForms.ListFormEdit.DetailsTitle')}</Th>
|
<Th>{translate('::ListForms.ListFormEdit.DetailsTitle')}</Th>
|
||||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnCount')}</Th>
|
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnCount')}</Th>
|
||||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnSpan')}</Th>
|
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnSpan')}</Th>
|
||||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormItems')}</Th>
|
|
||||||
</Tr>
|
</Tr>
|
||||||
</THead>
|
</THead>
|
||||||
<TBody>
|
<TBody>
|
||||||
|
|
@ -109,13 +108,6 @@ function FormTabEditForm(props: { listFormCode: string }) {
|
||||||
<Td>{row.caption}</Td>
|
<Td>{row.caption}</Td>
|
||||||
<Td>{row.colCount}</Td>
|
<Td>{row.colCount}</Td>
|
||||||
<Td>{row.colSpan}</Td>
|
<Td>{row.colSpan}</Td>
|
||||||
<Td>
|
|
||||||
<ul className="list-disc">
|
|
||||||
{row.items?.map((i, idx) => (
|
|
||||||
<li key={`items-${i.dataField}-${idx}`}>{i.dataField}</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</Td>
|
|
||||||
</Tr>
|
</Tr>
|
||||||
))}
|
))}
|
||||||
</TBody>
|
</TBody>
|
||||||
|
|
|
||||||
|
|
@ -20,14 +20,17 @@ import FormFieldTabTotalSummary from './FormFieldTabTotalSummary'
|
||||||
import FormFieldTabValidationRules from './FormFieldTabValidationRules'
|
import FormFieldTabValidationRules from './FormFieldTabValidationRules'
|
||||||
import { FormFieldEditProps } from './FormFields'
|
import { FormFieldEditProps } from './FormFields'
|
||||||
import FormFieldTabPivotSetting from './FormFieldTabPivotSetting'
|
import FormFieldTabPivotSetting from './FormFieldTabPivotSetting'
|
||||||
|
import type { EditingFormDto } from '@/proxy/form/models'
|
||||||
|
|
||||||
function FormFieldEdit({
|
function FormFieldEdit({
|
||||||
item,
|
item,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
fields,
|
fields,
|
||||||
|
editingFormGroups,
|
||||||
}: {
|
}: {
|
||||||
item: ColumnFormatEditDto | null
|
item: ColumnFormatEditDto | null
|
||||||
fields: ColumnFormatEditDto[]
|
fields: ColumnFormatEditDto[]
|
||||||
|
editingFormGroups: EditingFormDto[]
|
||||||
} & FormFieldEditProps) {
|
} & FormFieldEditProps) {
|
||||||
const { translate } = useLocalization()
|
const { translate } = useLocalization()
|
||||||
|
|
||||||
|
|
@ -72,13 +75,18 @@ function FormFieldEdit({
|
||||||
<TabNav value="pivotSetting">
|
<TabNav value="pivotSetting">
|
||||||
{translate('::ListForms.ListFormFieldEdit.TabPivotSettings')}
|
{translate('::ListForms.ListFormFieldEdit.TabPivotSettings')}
|
||||||
</TabNav>
|
</TabNav>
|
||||||
</TabList>
|
</TabList>
|
||||||
<div className="pt-4">
|
<div className="pt-4">
|
||||||
<TabContent value="details">
|
<TabContent value="details">
|
||||||
<FormFieldTabDetails initialValues={item} onSubmit={onSubmit} />
|
<FormFieldTabDetails initialValues={item} onSubmit={onSubmit} />
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="options">
|
<TabContent value="options">
|
||||||
<FormFieldTabOptions initialValues={item} onSubmit={onSubmit} />
|
<FormFieldTabOptions
|
||||||
|
initialValues={item}
|
||||||
|
editingFormGroups={editingFormGroups}
|
||||||
|
fields={fields}
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
/>
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="permissions">
|
<TabContent value="permissions">
|
||||||
<FormFieldTabPermissions initialValues={item} onSubmit={onSubmit} />
|
<FormFieldTabPermissions initialValues={item} onSubmit={onSubmit} />
|
||||||
|
|
@ -96,18 +104,10 @@ function FormFieldEdit({
|
||||||
<FormFieldTabGrouping initialValues={item} onSubmit={onSubmit} />
|
<FormFieldTabGrouping initialValues={item} onSubmit={onSubmit} />
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="groupSummary">
|
<TabContent value="groupSummary">
|
||||||
<FormFieldTabGroupSummary
|
<FormFieldTabGroupSummary initialValues={item} fields={fields} onSubmit={onSubmit} />
|
||||||
initialValues={item}
|
|
||||||
fields={fields}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
/>
|
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="totalSummary">
|
<TabContent value="totalSummary">
|
||||||
<FormFieldTabTotalSummary
|
<FormFieldTabTotalSummary initialValues={item} fields={fields} onSubmit={onSubmit} />
|
||||||
initialValues={item}
|
|
||||||
fields={fields}
|
|
||||||
onSubmit={onSubmit}
|
|
||||||
/>
|
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="joinOptions">
|
<TabContent value="joinOptions">
|
||||||
<FormFieldTabJoinOptions initialValues={item} onSubmit={onSubmit} />
|
<FormFieldTabJoinOptions initialValues={item} onSubmit={onSubmit} />
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Button, Card, FormItem, Input, Select } from '@/components/ui'
|
import { Button, Card, Checkbox, FormItem, Input, Select } from '@/components/ui'
|
||||||
import { ColumnFormatEditDto, ListFormFieldEditTabs } from '@/proxy/admin/list-form-field/models'
|
import { ColumnFormatEditDto, ListFormFieldEditTabs } from '@/proxy/admin/list-form-field/models'
|
||||||
import { SelectBoxOption } from '@/types/shared'
|
import { SelectBoxOption } from '@/types/shared'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { FaSlidersH } from 'react-icons/fa'
|
import { FaSlidersH } from 'react-icons/fa'
|
||||||
import { number, object, string } from 'yup'
|
import { bool, number, object, string } from 'yup'
|
||||||
import { dbSourceTypeOptions, listFormAlignmentOptions } from '../options'
|
import { dbSourceTypeOptions, listFormAlignmentOptions } from '../options'
|
||||||
import EditorOptionsBuilderDialog from '../json-row-operations/EditorOptionsBuilderDialog'
|
import EditorOptionsBuilderDialog from '../json-row-operations/EditorOptionsBuilderDialog'
|
||||||
import { FormFieldEditProps } from './FormFields'
|
import { FormFieldEditProps } from './FormFields'
|
||||||
|
|
@ -16,10 +16,13 @@ const schema = object().shape({
|
||||||
captionName: string(),
|
captionName: string(),
|
||||||
placeHolder: string(),
|
placeHolder: string(),
|
||||||
bandName: string(),
|
bandName: string(),
|
||||||
|
isActive: bool().required(),
|
||||||
|
visible: bool().required(),
|
||||||
|
allowSearch: bool().required(),
|
||||||
sourceDbType: number().required(),
|
sourceDbType: number().required(),
|
||||||
alignment: string(),
|
alignment: string(),
|
||||||
format: string(),
|
format: string(),
|
||||||
editorOptions: string().max(1000),
|
editorOptions: string(),
|
||||||
})
|
})
|
||||||
|
|
||||||
function FormFieldTabDetails({
|
function FormFieldTabDetails({
|
||||||
|
|
@ -72,6 +75,32 @@ function FormFieldTabDetails({
|
||||||
>
|
>
|
||||||
<Field type="text" name="bandName" component={Input} />
|
<Field type="text" name="bandName" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
<div className="flex w-full gap-4">
|
||||||
|
<FormItem
|
||||||
|
className="flex-1"
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.HeaderingAllowSearch')}
|
||||||
|
>
|
||||||
|
<Field name="allowSearch" component={Checkbox} />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
className="flex-1"
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.OptionsIsActive')}
|
||||||
|
invalid={errors.isActive && touched.isActive}
|
||||||
|
errorMessage={errors.isActive}
|
||||||
|
>
|
||||||
|
<Field name="isActive" component={Checkbox} />
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
className="flex-1"
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.OptionsVisible')}
|
||||||
|
invalid={errors.visible && touched.visible}
|
||||||
|
errorMessage={errors.visible}
|
||||||
|
>
|
||||||
|
<Field name="visible" component={Checkbox} />
|
||||||
|
</FormItem>
|
||||||
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
<FormItem label={translate('::ListForms.ListFormEdit.CustomValueType')}>
|
<FormItem label={translate('::ListForms.ListFormEdit.CustomValueType')}>
|
||||||
|
|
@ -132,7 +161,7 @@ function FormFieldTabDetails({
|
||||||
type="text"
|
type="text"
|
||||||
name="editorOptions"
|
name="editorOptions"
|
||||||
component={Input}
|
component={Input}
|
||||||
rows={4}
|
rows={3}
|
||||||
textArea={true}
|
textArea={true}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
|
|
@ -154,7 +183,14 @@ function FormFieldTabDetails({
|
||||||
onClose={() => setIsEditorOptionsDialogOpen(false)}
|
onClose={() => setIsEditorOptionsDialogOpen(false)}
|
||||||
onApply={(val) => setFieldValue('editorOptions', val)}
|
onApply={(val) => setFieldValue('editorOptions', val)}
|
||||||
/>
|
/>
|
||||||
<Button block size="sm" className="mt-1" variant="solid" loading={isSubmitting} type="submit">
|
<Button
|
||||||
|
block
|
||||||
|
size="sm"
|
||||||
|
className="mt-1"
|
||||||
|
variant="solid"
|
||||||
|
loading={isSubmitting}
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
{isSubmitting ? translate('::Saving') : translate('::Save')}
|
{isSubmitting ? translate('::Saving') : translate('::Save')}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -4,29 +4,50 @@ import { SelectBoxOption } from '@/types/shared'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||||
import { bool, number, object, string } from 'yup'
|
import { bool, number, object, string } from 'yup'
|
||||||
import { sortDirectionOptions } from '../options'
|
import { columnEditorTypeListOptions, sortDirectionOptions } from '../options'
|
||||||
import { FormFieldEditProps } from './FormFields'
|
import { FormFieldEditProps } from './FormFields'
|
||||||
import { SortDirectionEnum } from '@/proxy/form/models'
|
import { EditingFormDto, SortDirectionEnum } from '@/proxy/form/models'
|
||||||
|
import { FaCode } from 'react-icons/fa'
|
||||||
|
import { useState } from 'react'
|
||||||
|
import EditorScriptBuilderDialog from '../json-row-operations/EditorScriptBuilderDialog'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = object().shape({
|
||||||
listOrderNo: number(),
|
listOrderNo: number(),
|
||||||
width: number(),
|
width: number(),
|
||||||
sortDirection: string().oneOf(Object.values(SortDirectionEnum) as string[]),
|
sortDirection: string().oneOf(Object.values(SortDirectionEnum) as string[]),
|
||||||
sortIndex: number(),
|
sortIndex: number(),
|
||||||
isActive: bool().required(),
|
editGroupOrderNo: number().nullable(),
|
||||||
visible: bool().required(),
|
editOrderNo: number().nullable(),
|
||||||
allowSearch: bool().required(),
|
colSpan: number().nullable(),
|
||||||
allowEditing: bool().required(),
|
allowEditing: bool().required(),
|
||||||
allowAdding: bool().required(),
|
allowAdding: bool().required(),
|
||||||
|
editorScript: string(),
|
||||||
})
|
})
|
||||||
|
|
||||||
function FormFieldTabOptions({
|
function FormFieldTabOptions({
|
||||||
initialValues,
|
initialValues,
|
||||||
|
editingFormGroups,
|
||||||
|
fields,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}: {
|
}: {
|
||||||
initialValues: ColumnFormatEditDto
|
initialValues: ColumnFormatEditDto
|
||||||
|
editingFormGroups: EditingFormDto[]
|
||||||
|
fields: ColumnFormatEditDto[]
|
||||||
} & FormFieldEditProps) {
|
} & FormFieldEditProps) {
|
||||||
const { translate } = useLocalization()
|
const { translate } = useLocalization()
|
||||||
|
const [isEditorScriptDialogOpen, setIsEditorScriptDialogOpen] = useState(false)
|
||||||
|
const editingFormGroupOptions: SelectBoxOption[] = [...editingFormGroups]
|
||||||
|
.sort((left, right) => left.order - right.order)
|
||||||
|
.map((group) => ({
|
||||||
|
value: String(group.order),
|
||||||
|
label: `${group.order} - ${group.caption || translate('::ListForms.ListFormFieldEdit.EditFormGroup')}`,
|
||||||
|
}))
|
||||||
|
const editorScriptFields: SelectBoxOption[] = fields
|
||||||
|
.filter((field) => field.fieldName)
|
||||||
|
.map((field) => ({
|
||||||
|
value: field.fieldName,
|
||||||
|
label: field.captionName || field.fieldName,
|
||||||
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Formik
|
<Formik
|
||||||
|
|
@ -37,7 +58,7 @@ function FormFieldTabOptions({
|
||||||
await onSubmit(ListFormFieldEditTabs.OptionsForm, values, formikHelpers)
|
await onSubmit(ListFormFieldEditTabs.OptionsForm, values, formikHelpers)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{({ touched, errors, isSubmitting, values }) => (
|
{({ touched, errors, isSubmitting, values, setFieldValue }) => (
|
||||||
<Form>
|
<Form>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||||
<Card>
|
<Card>
|
||||||
|
|
@ -82,25 +103,7 @@ function FormFieldTabOptions({
|
||||||
>
|
>
|
||||||
<Field type="number" name="sortIndex" component={Input} />
|
<Field type="number" name="sortIndex" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Card>
|
|
||||||
<Card>
|
|
||||||
<FormItem
|
|
||||||
label={translate('::ListForms.ListFormFieldEdit.OptionsIsActive')}
|
|
||||||
invalid={errors.isActive && touched.isActive}
|
|
||||||
errorMessage={errors.isActive}
|
|
||||||
>
|
|
||||||
<Field name="isActive" component={Checkbox} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem
|
|
||||||
label={translate('::ListForms.ListFormFieldEdit.OptionsVisible')}
|
|
||||||
invalid={errors.visible && touched.visible}
|
|
||||||
errorMessage={errors.visible}
|
|
||||||
>
|
|
||||||
<Field name="visible" component={Checkbox} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={translate('::ListForms.ListFormFieldEdit.HeaderingAllowSearch')}>
|
|
||||||
<Field name="allowSearch" component={Checkbox} />
|
|
||||||
</FormItem>
|
|
||||||
<FormItem label={translate('::ListForms.ListFormEdit.AllowEditing')}>
|
<FormItem label={translate('::ListForms.ListFormEdit.AllowEditing')}>
|
||||||
<Field name="allowEditing" component={Checkbox} />
|
<Field name="allowEditing" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
@ -108,9 +111,100 @@ function FormFieldTabOptions({
|
||||||
<Field name="allowAdding" component={Checkbox} />
|
<Field name="allowAdding" component={Checkbox} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Card>
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<FormItem
|
||||||
|
invalid={errors.editorType2 && touched.editorType2}
|
||||||
|
errorMessage={errors.editorType2}
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.EditorType')}
|
||||||
|
>
|
||||||
|
<Field name="editorType2">
|
||||||
|
{({ field, form }: FieldProps<SelectBoxOption>) => (
|
||||||
|
<Select
|
||||||
|
isClearable
|
||||||
|
options={columnEditorTypeListOptions}
|
||||||
|
value={columnEditorTypeListOptions.find(
|
||||||
|
(option) => option.value === field.value,
|
||||||
|
)}
|
||||||
|
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Field>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
invalid={errors.editGroupOrderNo && touched.editGroupOrderNo}
|
||||||
|
errorMessage={errors.editGroupOrderNo}
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.EditFormGroup')}
|
||||||
|
>
|
||||||
|
<Field name="editGroupOrderNo">
|
||||||
|
{({ field, form }: FieldProps<SelectBoxOption>) => (
|
||||||
|
<Select
|
||||||
|
isClearable
|
||||||
|
options={editingFormGroupOptions}
|
||||||
|
value={editingFormGroupOptions.find(
|
||||||
|
(option) => Number(option.value) === Number(field.value),
|
||||||
|
)}
|
||||||
|
onChange={(option) =>
|
||||||
|
form.setFieldValue(
|
||||||
|
field.name,
|
||||||
|
option?.value == null ? null : Number(option.value),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Field>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
invalid={errors.editOrderNo && touched.editOrderNo}
|
||||||
|
errorMessage={errors.editOrderNo}
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.EditFormOrderNo')}
|
||||||
|
>
|
||||||
|
<Field type="number" name="editOrderNo" component={Input} />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem
|
||||||
|
invalid={errors.colSpan && touched.colSpan}
|
||||||
|
errorMessage={errors.colSpan}
|
||||||
|
label={translate('::ListForms.ListFormFieldEdit.EditFormColSpan')}
|
||||||
|
>
|
||||||
|
<Field type="number" name="colSpan" component={Input} />
|
||||||
|
</FormItem>
|
||||||
|
<FormItem label={translate('::ListForms.Wizard.Step3.EditorScript')}>
|
||||||
|
<div className="flex gap-2 items-start">
|
||||||
|
<Field
|
||||||
|
type="text"
|
||||||
|
name="editorScript"
|
||||||
|
component={Input}
|
||||||
|
rows={3}
|
||||||
|
textArea={true}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
shape="circle"
|
||||||
|
variant="plain"
|
||||||
|
type="button"
|
||||||
|
size="sm"
|
||||||
|
title="Build editor script"
|
||||||
|
icon={<FaCode />}
|
||||||
|
onClick={() => setIsEditorScriptDialogOpen(true)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormItem>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
<EditorScriptBuilderDialog
|
||||||
<Button block size="sm" className="mt-1" variant="solid" loading={isSubmitting} type="submit">
|
isOpen={isEditorScriptDialogOpen}
|
||||||
|
value={values.editorScript}
|
||||||
|
currentField={values.fieldName}
|
||||||
|
fields={editorScriptFields}
|
||||||
|
onClose={() => setIsEditorScriptDialogOpen(false)}
|
||||||
|
onApply={(val) => setFieldValue('editorScript', val)}
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
block
|
||||||
|
size="sm"
|
||||||
|
className="mt-1"
|
||||||
|
variant="solid"
|
||||||
|
loading={isSubmitting}
|
||||||
|
type="submit"
|
||||||
|
>
|
||||||
{isSubmitting ? translate('::Saving') : translate('::Save')}
|
{isSubmitting ? translate('::Saving') : translate('::Save')}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import { dbSourceTypeOptions, sqlDataTypeToDbType } from '../options'
|
||||||
import { IdentityRoleDto, IdentityUserDto } from '@/proxy/admin/models'
|
import { IdentityRoleDto, IdentityUserDto } from '@/proxy/admin/models'
|
||||||
import { sqlObjectManagerService } from '@/services/sql-query-manager.service'
|
import { sqlObjectManagerService } from '@/services/sql-query-manager.service'
|
||||||
import type { DatabaseColumnDto } from '@/proxy/sql-query-manager/models'
|
import type { DatabaseColumnDto } from '@/proxy/sql-query-manager/models'
|
||||||
|
import type { EditingFormDto } from '@/proxy/form/models'
|
||||||
|
|
||||||
export interface FormFieldEditProps {
|
export interface FormFieldEditProps {
|
||||||
onSubmit: (
|
onSubmit: (
|
||||||
|
|
@ -71,12 +72,14 @@ const copyFieldSchema = object().shape({
|
||||||
|
|
||||||
function FormFields({
|
function FormFields({
|
||||||
listFormCode,
|
listFormCode,
|
||||||
|
editingFormGroups,
|
||||||
langOptions,
|
langOptions,
|
||||||
roleList,
|
roleList,
|
||||||
userList,
|
userList,
|
||||||
columns,
|
columns,
|
||||||
}: {
|
}: {
|
||||||
listFormCode: string
|
listFormCode: string
|
||||||
|
editingFormGroups: EditingFormDto[]
|
||||||
langOptions: SelectBoxOption[]
|
langOptions: SelectBoxOption[]
|
||||||
roleList: SelectBoxOption[]
|
roleList: SelectBoxOption[]
|
||||||
userList: SelectBoxOption[]
|
userList: SelectBoxOption[]
|
||||||
|
|
@ -219,42 +222,45 @@ function FormFields({
|
||||||
await getFields()
|
await getFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
const getFields = useCallback(async (cultureName?: string, roleId?: string, userId?: string) => {
|
const getFields = useCallback(
|
||||||
if (!listFormCode) {
|
async (cultureName?: string, roleId?: string, userId?: string) => {
|
||||||
return
|
if (!listFormCode) {
|
||||||
}
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await getListFormFields({
|
const resp = await getListFormFields({
|
||||||
listFormCode,
|
listFormCode,
|
||||||
cultureName,
|
cultureName,
|
||||||
roleId,
|
roleId,
|
||||||
userId,
|
userId,
|
||||||
sorting: 'ListOrderNo',
|
sorting: 'ListOrderNo',
|
||||||
maxResultCount: 1000,
|
maxResultCount: 1000,
|
||||||
})
|
})
|
||||||
setNull(resp?.data?.items)
|
setNull(resp?.data?.items)
|
||||||
setFields(resp?.data?.items)
|
setFields(resp?.data?.items)
|
||||||
if (resp.data?.items) {
|
if (resp.data?.items) {
|
||||||
setFieldList(
|
setFieldList(
|
||||||
resp?.data?.items.map((f: ColumnFormatEditDto) => ({
|
resp?.data?.items.map((f: ColumnFormatEditDto) => ({
|
||||||
value: f.fieldName,
|
value: f.fieldName,
|
||||||
label: f.fieldName,
|
label: f.fieldName,
|
||||||
})),
|
})),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
toast.push(
|
||||||
|
<Notification type="danger" duration={2000}>
|
||||||
|
Alanlar getirilemedi
|
||||||
|
{error.toString()}
|
||||||
|
</Notification>,
|
||||||
|
{
|
||||||
|
placement: 'bottom-end',
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
},
|
||||||
toast.push(
|
[listFormCode],
|
||||||
<Notification type="danger" duration={2000}>
|
)
|
||||||
Alanlar getirilemedi
|
|
||||||
{error.toString()}
|
|
||||||
</Notification>,
|
|
||||||
{
|
|
||||||
placement: 'bottom-end',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}, [listFormCode])
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getFields()
|
getFields()
|
||||||
|
|
@ -405,7 +411,7 @@ function FormFields({
|
||||||
<Table compact>
|
<Table compact>
|
||||||
<THead>
|
<THead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th className='w-3/12'>
|
<Th className="w-3/12">
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
shape="circle"
|
shape="circle"
|
||||||
|
|
@ -478,12 +484,19 @@ function FormFields({
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<span>{field.listOrderNo}</span>
|
<span style={{ visibility: !field?.visible ? 'visible' : 'hidden' }}>
|
||||||
<span>{!field?.visible && <FaEyeSlash />}</span>
|
<FaEyeSlash />
|
||||||
<span>{!field?.isActive && <FaTimes />}</span>
|
</span>
|
||||||
|
<span style={{ visibility: !field?.isActive ? 'visible' : 'hidden' }}>
|
||||||
|
<FaTimes />
|
||||||
|
</span>
|
||||||
|
<span className="ml-5">
|
||||||
|
{field.listOrderNo}
|
||||||
|
{field.editOrderNo ? ` (${field.editOrderNo})` : ''}
|
||||||
|
</span>
|
||||||
</Td>
|
</Td>
|
||||||
<Td className='!p-0'>{field.fieldName}</Td>
|
<Td className="!p-0">{field.fieldName}</Td>
|
||||||
<Td className='align-middle text-center !p-0'>
|
<Td className="align-middle text-center !p-0">
|
||||||
<Avatar
|
<Avatar
|
||||||
size={18}
|
size={18}
|
||||||
shape="circle"
|
shape="circle"
|
||||||
|
|
@ -505,7 +518,12 @@ function FormFields({
|
||||||
</Table>
|
</Table>
|
||||||
</div>
|
</div>
|
||||||
<div className="2xl:col-span-3 lg:col-span-3 xl:col-span-2">
|
<div className="2xl:col-span-3 lg:col-span-3 xl:col-span-2">
|
||||||
<FormFieldEdit item={row} fields={fields} onSubmit={onSubmit} />
|
<FormFieldEdit
|
||||||
|
item={row}
|
||||||
|
fields={fields}
|
||||||
|
editingFormGroups={editingFormGroups}
|
||||||
|
onSubmit={onSubmit}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</AdaptableCard>
|
</AdaptableCard>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -9,9 +9,9 @@ import type { GroupItem } from 'devextreme/ui/form'
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
import { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
||||||
import { GridColumnData } from '../list/GridColumnData'
|
import { GridColumnData } from '../list/GridColumnData'
|
||||||
import { addCss, addJs } from '../list/Utils'
|
import { addCss, addJs, getEditingFormGroups } from '../list/Utils'
|
||||||
import { PermissionResults, RowMode, SimpleItemWithColData } from './types'
|
import { PermissionResults, RowMode, SimpleItemWithColData } from './types'
|
||||||
import { EditingFormItemDto, GridDto, PlatformEditorTypes } from '@/proxy/form/models'
|
import { ColumnFormatDto, GridDto, PlatformEditorTypes } from '@/proxy/form/models'
|
||||||
import { getAccessDeniedPath } from '@/utils/routing'
|
import { getAccessDeniedPath } from '@/utils/routing'
|
||||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||||
import { useLookupDataSource } from './useLookupDataSource'
|
import { useLookupDataSource } from './useLookupDataSource'
|
||||||
|
|
@ -218,10 +218,7 @@ const useGridData = (props: {
|
||||||
)
|
)
|
||||||
setDataSource(dataSource)
|
setDataSource(dataSource)
|
||||||
|
|
||||||
const items = gridDto?.gridOptions.editingFormDto
|
const items = getEditingFormGroups(gridDto)
|
||||||
?.sort((a: any, b: any) => {
|
|
||||||
return a.order >= b.order ? 1 : -1
|
|
||||||
})
|
|
||||||
.map((e: any) => {
|
.map((e: any) => {
|
||||||
return {
|
return {
|
||||||
itemType: e.itemType,
|
itemType: e.itemType,
|
||||||
|
|
@ -230,12 +227,12 @@ const useGridData = (props: {
|
||||||
caption: e.caption,
|
caption: e.caption,
|
||||||
items: e.items
|
items: e.items
|
||||||
?.sort((a: any, b: any) => {
|
?.sort((a: any, b: any) => {
|
||||||
return a.order >= b.order ? 1 : -1
|
return (a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1
|
||||||
})
|
})
|
||||||
.map((i: EditingFormItemDto) => {
|
.map((i: ColumnFormatDto) => {
|
||||||
let editorOptions: Record<string, any> = {}
|
let editorOptions: Record<string, any> = {}
|
||||||
let parsedEditorOptions: Record<string, any> = {}
|
let parsedEditorOptions: Record<string, any> = {}
|
||||||
const colData = gridDto.columnFormats.find((x) => x.fieldName === i.dataField)
|
const colData = i
|
||||||
|
|
||||||
parsedEditorOptions = i.editorOptions ? JSON.parse(i.editorOptions) : {}
|
parsedEditorOptions = i.editorOptions ? JSON.parse(i.editorOptions) : {}
|
||||||
const lookupEditorOptions = colData?.lookupDto?.dataSourceType
|
const lookupEditorOptions = colData?.lookupDto?.dataSourceType
|
||||||
|
|
@ -250,26 +247,14 @@ const useGridData = (props: {
|
||||||
...parsedEditorOptions,
|
...parsedEditorOptions,
|
||||||
}
|
}
|
||||||
const item: SimpleItemWithColData = {
|
const item: SimpleItemWithColData = {
|
||||||
canRead:
|
canRead: i.canRead ?? false,
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canRead ??
|
canUpdate: i.canUpdate ?? false,
|
||||||
false,
|
canCreate: i.canCreate ?? false,
|
||||||
canUpdate:
|
canExport: i.canExport ?? false,
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canUpdate ??
|
allowEditing: i.allowEditing ?? true,
|
||||||
false,
|
allowAdding: i.allowAdding ?? true,
|
||||||
canCreate:
|
dataField: i.fieldName,
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canCreate ??
|
name: i.fieldName,
|
||||||
false,
|
|
||||||
canExport:
|
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canExport ??
|
|
||||||
false,
|
|
||||||
allowEditing:
|
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)
|
|
||||||
?.allowEditing ?? true,
|
|
||||||
allowAdding:
|
|
||||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)
|
|
||||||
?.allowAdding ?? true,
|
|
||||||
dataField: i.dataField,
|
|
||||||
name: i.dataField,
|
|
||||||
editorType2: i.editorType2,
|
editorType2: i.editorType2,
|
||||||
editorType:
|
editorType:
|
||||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||||
|
|
@ -286,8 +271,8 @@ const useGridData = (props: {
|
||||||
imageUploadOptions: i.imageUploadOptions,
|
imageUploadOptions: i.imageUploadOptions,
|
||||||
editorScript: i.editorScript,
|
editorScript: i.editorScript,
|
||||||
}
|
}
|
||||||
if (i.dataField.indexOf(':') >= 0) {
|
if (i.fieldName?.indexOf(':') >= 0) {
|
||||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||||
}
|
}
|
||||||
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
||||||
item.editorOptions = {
|
item.editorOptions = {
|
||||||
|
|
@ -348,7 +333,7 @@ const useGridData = (props: {
|
||||||
|
|
||||||
const updateItems = (items: any[] = []): any[] =>
|
const updateItems = (items: any[] = []): any[] =>
|
||||||
items.map((item) => {
|
items.map((item) => {
|
||||||
const colData = gridDto.columnFormats.find((x) => x.fieldName === item.dataField)
|
const colData = item.colData
|
||||||
if (colData?.lookupDto?.dataSourceType && shouldRefreshLookup(item)) {
|
if (colData?.lookupDto?.dataSourceType && shouldRefreshLookup(item)) {
|
||||||
const currentDataSource = item.editorOptions?.dataSource
|
const currentDataSource = item.editorOptions?.dataSource
|
||||||
const keepCustomDataSource =
|
const keepCustomDataSource =
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { ImportDashboard } from '@/components/importManager/ImportDashboard'
|
||||||
import { Dialog, Notification, toast } from '@/components/ui'
|
import { Dialog, Notification, toast } from '@/components/ui'
|
||||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import {
|
import {
|
||||||
|
ColumnFormatDto,
|
||||||
DbTypeEnum,
|
DbTypeEnum,
|
||||||
EditingFormItemDto,
|
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
SubFormTabTypeEnum,
|
SubFormTabTypeEnum,
|
||||||
|
|
@ -41,7 +41,12 @@ import GridFilterDialogs from './GridFilterDialogs'
|
||||||
import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
|
import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
|
||||||
import { ImageUploadEditorComponent } from './editors/ImageUploadEditorComponent'
|
import { ImageUploadEditorComponent } from './editors/ImageUploadEditorComponent'
|
||||||
import { ImageViewerEditorComponent } from './editors/ImageViewerEditorComponent'
|
import { ImageViewerEditorComponent } from './editors/ImageViewerEditorComponent'
|
||||||
import { extractSearchParamsFields, GridExtraFilterState, safeJsonParse } from './Utils'
|
import {
|
||||||
|
extractSearchParamsFields,
|
||||||
|
getEditingFormGroups,
|
||||||
|
GridExtraFilterState,
|
||||||
|
safeJsonParse,
|
||||||
|
} from './Utils'
|
||||||
import { useFilters } from './useFilters'
|
import { useFilters } from './useFilters'
|
||||||
import { useListFormColumns } from './useListFormColumns'
|
import { useListFormColumns } from './useListFormColumns'
|
||||||
import { useListFormCustomDataSource } from './useListFormCustomDataSource'
|
import { useListFormCustomDataSource } from './useListFormCustomDataSource'
|
||||||
|
|
@ -788,12 +793,9 @@ const CardView = (props: CardViewProps) => {
|
||||||
}, [filterToolbarData, toolbarData])
|
}, [filterToolbarData, toolbarData])
|
||||||
|
|
||||||
const mapEditingFormItem = useCallback(
|
const mapEditingFormItem = useCallback(
|
||||||
(item: EditingFormItemDto) => {
|
(item: ColumnFormatDto) => {
|
||||||
const fieldName = item.dataField.split(':')[0]
|
const fieldName = item.fieldName!
|
||||||
const column = gridDto?.columnFormats.find(
|
const column = item
|
||||||
(candidate) => candidate.fieldName?.toLowerCase() === fieldName.toLowerCase(),
|
|
||||||
)
|
|
||||||
if (!column) return undefined
|
|
||||||
if (
|
if (
|
||||||
mode === 'new' &&
|
mode === 'new' &&
|
||||||
fieldName.toLowerCase() === gridDto?.gridOptions.keyFieldName?.toLowerCase()
|
fieldName.toLowerCase() === gridDto?.gridOptions.keyFieldName?.toLowerCase()
|
||||||
|
|
@ -813,7 +815,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
try {
|
try {
|
||||||
editorOptions = item.editorOptions ? JSON.parse(item.editorOptions) : {}
|
editorOptions = item.editorOptions ? JSON.parse(item.editorOptions) : {}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('EditorOptions parse error:', item.dataField, error)
|
console.error('EditorOptions parse error:', item.fieldName, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (column.sourceDbType === DbTypeEnum.Date) {
|
if (column.sourceDbType === DbTypeEnum.Date) {
|
||||||
|
|
@ -862,8 +864,8 @@ const CardView = (props: CardViewProps) => {
|
||||||
name: fieldName,
|
name: fieldName,
|
||||||
colSpan: item.colSpan,
|
colSpan: item.colSpan,
|
||||||
label: {
|
label: {
|
||||||
text: item.dataField.includes(':')
|
text: item.fieldName!.includes(':')
|
||||||
? item.dataField.split(':')[1]
|
? item.fieldName!.split(':')[1]
|
||||||
: translate('::' + (column.captionName || column.fieldName)),
|
: translate('::' + (column.captionName || column.fieldName)),
|
||||||
},
|
},
|
||||||
editorType:
|
editorType:
|
||||||
|
|
@ -888,7 +890,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
const editingFormItems = useMemo(() => {
|
const editingFormItems = useMemo(() => {
|
||||||
if (!gridDto || mode === 'view') return []
|
if (!gridDto || mode === 'view') return []
|
||||||
|
|
||||||
const groups = [...(gridDto.gridOptions.editingFormDto ?? [])].sort(
|
const groups = [...(getEditingFormGroups(gridDto) ?? [])].sort(
|
||||||
(left, right) => left.order - right.order,
|
(left, right) => left.order - right.order,
|
||||||
)
|
)
|
||||||
const tabbedGroups = groups.filter((group) => group.itemType === 'tabbed')
|
const tabbedGroups = groups.filter((group) => group.itemType === 'tabbed')
|
||||||
|
|
@ -896,7 +898,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
|
|
||||||
groups.forEach((group) => {
|
groups.forEach((group) => {
|
||||||
const items = [...(group.items ?? [])]
|
const items = [...(group.items ?? [])]
|
||||||
.sort((left, right) => left.order - right.order)
|
.sort((left, right) => (left.editOrderNo ?? 0) - (right.editOrderNo ?? 0))
|
||||||
.map(mapEditingFormItem)
|
.map(mapEditingFormItem)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
|
|
@ -918,7 +920,7 @@ const CardView = (props: CardViewProps) => {
|
||||||
title: tab.caption,
|
title: tab.caption,
|
||||||
colCount: useMobileEditPopup ? 1 : tab.colCount || 1,
|
colCount: useMobileEditPopup ? 1 : tab.colCount || 1,
|
||||||
items: [...(tab.items ?? [])]
|
items: [...(tab.items ?? [])]
|
||||||
.sort((left, right) => left.order - right.order)
|
.sort((left, right) => (left.editOrderNo ?? 0) - (right.editOrderNo ?? 0))
|
||||||
.map(mapEditingFormItem)
|
.map(mapEditingFormItem)
|
||||||
.filter(Boolean),
|
.filter(Boolean),
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ import '@/utils/registerDevExtremeEditors'
|
||||||
import { Dialog, Notification, toast } from '@/components/ui'
|
import { Dialog, Notification, toast } from '@/components/ui'
|
||||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import {
|
import {
|
||||||
|
ColumnFormatDto,
|
||||||
DbTypeEnum,
|
DbTypeEnum,
|
||||||
EditingFormItemDto,
|
|
||||||
FieldCustomValueTypeEnum,
|
FieldCustomValueTypeEnum,
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
|
|
@ -53,6 +53,8 @@ import {
|
||||||
autoNumber,
|
autoNumber,
|
||||||
controlStyleCondition,
|
controlStyleCondition,
|
||||||
extractSearchParamsFields,
|
extractSearchParamsFields,
|
||||||
|
getEditingFormFields,
|
||||||
|
getEditingFormGroups,
|
||||||
GridExtraFilterState,
|
GridExtraFilterState,
|
||||||
safeJsonParse,
|
safeJsonParse,
|
||||||
setFormEditingExtraItemValues,
|
setFormEditingExtraItemValues,
|
||||||
|
|
@ -218,13 +220,6 @@ const getActiveEditingForm = (component: any) => {
|
||||||
return editForm?.getEditor || editForm?.itemOption ? editForm : undefined
|
return editForm?.getEditor || editForm?.itemOption ? editForm : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const flattenEditingFormItems = (items: any[] = []): EditingFormItemDto[] =>
|
|
||||||
items.flatMap((item) => [
|
|
||||||
...(item?.dataField ? [item] : []),
|
|
||||||
...flattenEditingFormItems(item?.items || []),
|
|
||||||
...(item?.tabs || []).flatMap((tab: any) => flattenEditingFormItems(tab?.items || [])),
|
|
||||||
])
|
|
||||||
|
|
||||||
const getValueByField = (data: Record<string, any> = {}, field?: string) => {
|
const getValueByField = (data: Record<string, any> = {}, field?: string) => {
|
||||||
if (!field) return undefined
|
if (!field) return undefined
|
||||||
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
||||||
|
|
@ -725,11 +720,10 @@ const Grid = (props: GridProps) => {
|
||||||
const onEditorPreparing = useCallback(
|
const onEditorPreparing = useCallback(
|
||||||
(editor: DataGridTypes.EditorPreparingEvent<any, any>) => {
|
(editor: DataGridTypes.EditorPreparingEvent<any, any>) => {
|
||||||
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
||||||
const formItem = gridDto.gridOptions.editingFormDto
|
const columnFormat = gridDto.columnFormats.find(
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
(column) => column.fieldName === editor.dataField,
|
||||||
.find((i) => i.dataField === editor.dataField)
|
)
|
||||||
const fieldName = editor.dataField.split(':')[0]
|
const formItem = columnFormat?.editOrderNo != null ? columnFormat : undefined
|
||||||
const columnFormat = gridDto.columnFormats.find((column) => column.fieldName === fieldName)
|
|
||||||
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
||||||
|
|
||||||
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
||||||
|
|
@ -786,9 +780,9 @@ const Grid = (props: GridProps) => {
|
||||||
(pf: string) => !rowData[pf],
|
(pf: string) => !rowData[pf],
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
const childFormItem = gridDto.gridOptions.editingFormDto
|
const childFormItem = gridDto.columnFormats.find(
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
(column) => column.fieldName === childFieldName,
|
||||||
.find((i) => i.dataField === childFieldName)
|
)
|
||||||
const childEditorOptions = childFormItem?.editorOptions
|
const childEditorOptions = childFormItem?.editorOptions
|
||||||
? JSON.parse(childFormItem.editorOptions)
|
? JSON.parse(childFormItem.editorOptions)
|
||||||
: {}
|
: {}
|
||||||
|
|
@ -858,7 +852,7 @@ const Grid = (props: GridProps) => {
|
||||||
setFormData,
|
setFormData,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Script exec error', formItem.dataField, err)
|
console.error('Script exec error', formItem.fieldName, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1136,7 +1130,7 @@ const Grid = (props: GridProps) => {
|
||||||
|
|
||||||
// Form items mapper'ı memoize et - popup açılışını hızlandırır
|
// Form items mapper'ı memoize et - popup açılışını hızlandırır
|
||||||
const mapFormItem = useCallback(
|
const mapFormItem = useCallback(
|
||||||
(i: EditingFormItemDto) => {
|
(i: ColumnFormatDto) => {
|
||||||
let editorOptions: EditorOptionsWithButtons = {}
|
let editorOptions: EditorOptionsWithButtons = {}
|
||||||
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
||||||
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
||||||
|
|
@ -1148,10 +1142,10 @@ const Grid = (props: GridProps) => {
|
||||||
const parsed = JSON.parse(rawFilter)
|
const parsed = JSON.parse(rawFilter)
|
||||||
const filters = extractSearchParamsFields(parsed)
|
const filters = extractSearchParamsFields(parsed)
|
||||||
|
|
||||||
const hasFilter = filters.some(([field]) => field === i.dataField)
|
const hasFilter = filters.some(([field]) => field === i.fieldName)
|
||||||
|
|
||||||
if (hasFilter) {
|
if (hasFilter) {
|
||||||
const existsInExtra = extraFilters.some((f) => f.fieldName === i.dataField && !!f.value)
|
const existsInExtra = extraFilters.some((f) => f.fieldName === i.fieldName && !!f.value)
|
||||||
|
|
||||||
if (!existsInExtra) {
|
if (!existsInExtra) {
|
||||||
forcedEditorOptions.readOnly = true
|
forcedEditorOptions.readOnly = true
|
||||||
|
|
@ -1159,11 +1153,11 @@ const Grid = (props: GridProps) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('EditorOptions parse error:', i.dataField, err)
|
console.error('EditorOptions parse error:', i.fieldName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldName = i.dataField.split(':')[0]
|
const fieldName = i.fieldName!
|
||||||
const listFormField = gridDto?.columnFormats.find((x: any) => x.fieldName === fieldName)
|
const listFormField = i
|
||||||
|
|
||||||
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
||||||
|
|
||||||
|
|
@ -1221,8 +1215,8 @@ const Grid = (props: GridProps) => {
|
||||||
canExport: listFormField?.canExport ?? false,
|
canExport: listFormField?.canExport ?? false,
|
||||||
allowEditing: listFormField?.allowEditing ?? true,
|
allowEditing: listFormField?.allowEditing ?? true,
|
||||||
allowAdding: listFormField?.allowAdding ?? true,
|
allowAdding: listFormField?.allowAdding ?? true,
|
||||||
dataField: i.dataField,
|
dataField: i.fieldName,
|
||||||
name: i.dataField,
|
name: i.fieldName,
|
||||||
editorType2: i.editorType2,
|
editorType2: i.editorType2,
|
||||||
editorType:
|
editorType:
|
||||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||||
|
|
@ -1240,12 +1234,12 @@ const Grid = (props: GridProps) => {
|
||||||
item.template = 'cellEditImageViewer'
|
item.template = 'cellEditImageViewer'
|
||||||
item.editorOptions = {
|
item.editorOptions = {
|
||||||
...item.editorOptions,
|
...item.editorOptions,
|
||||||
value: getValueByField(editingFormDataRef.current, i.dataField),
|
value: getValueByField(editingFormDataRef.current, i.fieldName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.dataField.indexOf(':') >= 0) {
|
if (i.fieldName?.indexOf(':') >= 0) {
|
||||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
||||||
|
|
@ -1614,9 +1608,7 @@ const Grid = (props: GridProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const runReadOnlyScripts = () => {
|
const runReadOnlyScripts = () => {
|
||||||
const formItems = gridDto.gridOptions.editingFormDto.flatMap((group) =>
|
const formItems = getEditingFormFields(gridDto)
|
||||||
flattenEditingFormItems([group]),
|
|
||||||
)
|
|
||||||
const scriptItems = formItems.filter((formItem) =>
|
const scriptItems = formItems.filter((formItem) =>
|
||||||
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
||||||
)
|
)
|
||||||
|
|
@ -1627,9 +1619,9 @@ const Grid = (props: GridProps) => {
|
||||||
|
|
||||||
const editorValues = formItems.reduce<Record<string, any>>(
|
const editorValues = formItems.reduce<Record<string, any>>(
|
||||||
(values, formItem) => {
|
(values, formItem) => {
|
||||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||||
if (editorInstance?.option) {
|
if (editorInstance?.option) {
|
||||||
values[formItem.dataField] = editorInstance.option('value')
|
values[formItem.fieldName!] = editorInstance.option('value')
|
||||||
}
|
}
|
||||||
return values
|
return values
|
||||||
},
|
},
|
||||||
|
|
@ -1644,17 +1636,17 @@ const Grid = (props: GridProps) => {
|
||||||
|
|
||||||
scriptItems.forEach((formItem) => {
|
scriptItems.forEach((formItem) => {
|
||||||
try {
|
try {
|
||||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||||
const editorValue =
|
const editorValue =
|
||||||
editorInstance?.option?.('value') ??
|
editorInstance?.option?.('value') ??
|
||||||
getValueByField(formData, formItem.dataField)
|
getValueByField(formData, formItem.fieldName)
|
||||||
const editor = {
|
const editor = {
|
||||||
dataField: formItem.dataField,
|
dataField: formItem.fieldName,
|
||||||
component: grid,
|
component: grid,
|
||||||
}
|
}
|
||||||
const e = {
|
const e = {
|
||||||
component: form,
|
component: form,
|
||||||
dataField: formItem.dataField,
|
dataField: formItem.fieldName,
|
||||||
scriptEvent: 'contentReady',
|
scriptEvent: 'contentReady',
|
||||||
value: editorValue,
|
value: editorValue,
|
||||||
}
|
}
|
||||||
|
|
@ -1669,7 +1661,7 @@ const Grid = (props: GridProps) => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
'Script exec error on contentReady',
|
'Script exec error on contentReady',
|
||||||
formItem.dataField,
|
formItem.fieldName!,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1685,11 +1677,10 @@ const Grid = (props: GridProps) => {
|
||||||
...(e.component?.option?.('formData') || {}),
|
...(e.component?.option?.('formData') || {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
const formItem = gridDto.gridOptions.editingFormDto
|
const formItem = getEditingFormFields(gridDto)
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
|
||||||
.find(
|
.find(
|
||||||
(i) =>
|
(i) =>
|
||||||
String(i.dataField || '').toLowerCase() ===
|
String(i.fieldName || '').toLowerCase() ===
|
||||||
String(e.dataField || '').toLowerCase(),
|
String(e.dataField || '').toLowerCase(),
|
||||||
)
|
)
|
||||||
if (formItem?.editorScript) {
|
if (formItem?.editorScript) {
|
||||||
|
|
@ -1732,9 +1723,9 @@ const Grid = (props: GridProps) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
items:
|
items:
|
||||||
gridDto.gridOptions.editingFormDto?.length > 0
|
getEditingFormGroups(gridDto)?.length > 0
|
||||||
? (() => {
|
? (() => {
|
||||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||||
|
|
||||||
|
|
@ -1756,7 +1747,9 @@ const Grid = (props: GridProps) => {
|
||||||
colSpan: effectiveColSpan,
|
colSpan: effectiveColSpan,
|
||||||
caption: e.caption, // Group'larda caption olmalı
|
caption: e.caption, // Group'larda caption olmalı
|
||||||
items: e.items
|
items: e.items
|
||||||
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
?.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
.map(mapFormItem)
|
.map(mapFormItem)
|
||||||
.filter((a: any) => {
|
.filter((a: any) => {
|
||||||
if (mode === 'view') {
|
if (mode === 'view') {
|
||||||
|
|
@ -1785,7 +1778,9 @@ const Grid = (props: GridProps) => {
|
||||||
title: tabbedItem.caption, // Her tab'ın title'ı
|
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||||
colCount: effectiveColCount,
|
colCount: effectiveColCount,
|
||||||
items: tabbedItem.items
|
items: tabbedItem.items
|
||||||
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
?.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
.map(mapFormItem)
|
.map(mapFormItem)
|
||||||
.filter((a: any) => {
|
.filter((a: any) => {
|
||||||
if (mode === 'view') {
|
if (mode === 'view') {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface IGridColumnData extends DataGridTypes.Column {
|
||||||
colData?: ColumnFormatDto
|
colData?: ColumnFormatDto
|
||||||
extras?: {
|
extras?: {
|
||||||
multiValue: boolean
|
multiValue: boolean
|
||||||
editorOptions?: string
|
editorOptions?: Record<string, any>
|
||||||
tagBoxOptions?: TagBoxOptionsDto
|
tagBoxOptions?: TagBoxOptionsDto
|
||||||
gridBoxOptions?: GridBoxOptionsDto
|
gridBoxOptions?: GridBoxOptionsDto
|
||||||
imageUploadOptions?: ImageUploadOptionsDto
|
imageUploadOptions?: ImageUploadOptionsDto
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ import Container from '@/components/shared/Container'
|
||||||
import '@/utils/registerDevExtremeEditors'
|
import '@/utils/registerDevExtremeEditors'
|
||||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import {
|
import {
|
||||||
|
ColumnFormatDto,
|
||||||
DbTypeEnum,
|
DbTypeEnum,
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
UiLookupDataSourceTypeEnum,
|
UiLookupDataSourceTypeEnum,
|
||||||
EditingFormItemDto,
|
|
||||||
} from '@/proxy/form/models'
|
} from '@/proxy/form/models'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import Scheduler, {
|
import Scheduler, {
|
||||||
|
|
@ -21,7 +21,12 @@ import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { getList } from '@/services/form.service'
|
import { getList } from '@/services/form.service'
|
||||||
import { useListFormCustomDataSource } from './useListFormCustomDataSource'
|
import { useListFormCustomDataSource } from './useListFormCustomDataSource'
|
||||||
import { addCss, addJs, autoNumber } from './Utils'
|
import {
|
||||||
|
addCss,
|
||||||
|
addJs,
|
||||||
|
autoNumber,
|
||||||
|
getEditingFormGroups,
|
||||||
|
} from './Utils'
|
||||||
import { layoutTypes } from '../admin/listForm/edit/types'
|
import { layoutTypes } from '../admin/listForm/edit/types'
|
||||||
import WidgetGroup from '@/components/ui/Widget/WidgetGroup'
|
import WidgetGroup from '@/components/ui/Widget/WidgetGroup'
|
||||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||||
|
|
@ -289,11 +294,11 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
// EditingFormDto'dan form items oluştur
|
// Grup düzenini EditingFormDto'dan, alanları ColumnFormatDto'dan oluştur.
|
||||||
const result: any[] = []
|
const result: any[] = []
|
||||||
|
|
||||||
if (gridDto.gridOptions.editingFormDto?.length > 0) {
|
if (getEditingFormGroups(gridDto)?.length > 0) {
|
||||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||||
|
|
||||||
|
|
@ -301,7 +306,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
const tabbedItems = sortedFormDto.filter((e: any) => e.itemType === 'tabbed')
|
const tabbedItems = sortedFormDto.filter((e: any) => e.itemType === 'tabbed')
|
||||||
|
|
||||||
// Ortak item mapper fonksiyonu - hem group hem tab için kullanılır
|
// Ortak item mapper fonksiyonu - hem group hem tab için kullanılır
|
||||||
const mapFormItem = (i: EditingFormItemDto) => {
|
const mapFormItem = (i: ColumnFormatDto) => {
|
||||||
let editorOptions: any = {}
|
let editorOptions: any = {}
|
||||||
try {
|
try {
|
||||||
if (i.editorOptions) {
|
if (i.editorOptions) {
|
||||||
|
|
@ -311,8 +316,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldName = i.dataField.split(':')[0]
|
const fieldName = i.fieldName!
|
||||||
const listFormField = gridDto.columnFormats.find((x: any) => x.fieldName === fieldName)
|
const listFormField = i
|
||||||
|
|
||||||
if (listFormField?.sourceDbType === DbTypeEnum.Date) {
|
if (listFormField?.sourceDbType === DbTypeEnum.Date) {
|
||||||
editorOptions = {
|
editorOptions = {
|
||||||
|
|
@ -351,7 +356,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// EditorType belirleme
|
// EditorType belirleme
|
||||||
let editorType: any = i.editorType2 || i.editorType
|
let editorType: any = i.editorType2
|
||||||
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||||
editorType = 'dxDropDownBox'
|
editorType = 'dxDropDownBox'
|
||||||
} else if (i.editorType2) {
|
} else if (i.editorType2) {
|
||||||
|
|
@ -409,8 +414,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
canExport: listFormField?.canExport ?? false,
|
canExport: listFormField?.canExport ?? false,
|
||||||
allowEditing: listFormField?.allowEditing ?? true,
|
allowEditing: listFormField?.allowEditing ?? true,
|
||||||
allowAdding: listFormField?.allowAdding ?? true,
|
allowAdding: listFormField?.allowAdding ?? true,
|
||||||
dataField: i.dataField,
|
dataField: i.fieldName,
|
||||||
name: i.dataField,
|
name: i.fieldName,
|
||||||
editorType2: i.editorType2,
|
editorType2: i.editorType2,
|
||||||
editorType:
|
editorType:
|
||||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||||
|
|
@ -424,8 +429,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
editorScript: i.editorScript,
|
editorScript: i.editorScript,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.dataField.indexOf(':') >= 0) {
|
if (i.fieldName?.indexOf(':') >= 0) {
|
||||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -445,7 +450,9 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
// Items'ları da order'a göre sırala
|
// Items'ları da order'a göre sırala
|
||||||
const sortedItems = (e.items || [])
|
const sortedItems = (e.items || [])
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
|
|
||||||
const groupItems = sortedItems.map(mapFormItem)
|
const groupItems = sortedItems.map(mapFormItem)
|
||||||
|
|
||||||
|
|
@ -467,7 +474,9 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
title: tabbedItem.caption, // Her tab'ın title'ı
|
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||||
colCount: effectiveColCount,
|
colCount: effectiveColCount,
|
||||||
items: tabbedItem.items
|
items: tabbedItem.items
|
||||||
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
?.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
.map(mapFormItem)
|
.map(mapFormItem)
|
||||||
.filter((a: any) => {
|
.filter((a: any) => {
|
||||||
if (currentMode === 'new') {
|
if (currentMode === 'new') {
|
||||||
|
|
@ -490,11 +499,11 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
// Form'u tamamen yeniden baştan yapılandır
|
// Form'u tamamen yeniden baştan yapılandır
|
||||||
e.form.option(
|
e.form.option(
|
||||||
'colCount',
|
'colCount',
|
||||||
hasTabbedItems ? 1 : gridDto.gridOptions.editingFormDto?.[0]?.colCount || 2,
|
hasTabbedItems ? 1 : getEditingFormGroups(gridDto)?.[0]?.colCount || 2,
|
||||||
)
|
)
|
||||||
e.form.option(
|
e.form.option(
|
||||||
'colCount',
|
'colCount',
|
||||||
hasTabbedItems ? 1 : gridDto.gridOptions.editingFormDto?.[0]?.colCount || 2,
|
hasTabbedItems ? 1 : getEditingFormGroups(gridDto)?.[0]?.colCount || 2,
|
||||||
)
|
)
|
||||||
e.form.option('showValidationSummary', false)
|
e.form.option('showValidationSummary', false)
|
||||||
e.form.option('items', result)
|
e.form.option('items', result)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import { Dialog, Notification, toast } from '@/components/ui'
|
||||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import { executeEditorScript } from '@/utils/editorScriptRuntime'
|
import { executeEditorScript } from '@/utils/editorScriptRuntime'
|
||||||
import {
|
import {
|
||||||
|
ColumnFormatDto,
|
||||||
DbTypeEnum,
|
DbTypeEnum,
|
||||||
EditingFormItemDto,
|
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
SubFormTabTypeEnum,
|
SubFormTabTypeEnum,
|
||||||
|
|
@ -44,6 +44,8 @@ import {
|
||||||
addJs,
|
addJs,
|
||||||
autoNumber,
|
autoNumber,
|
||||||
controlStyleCondition,
|
controlStyleCondition,
|
||||||
|
getEditingFormFields,
|
||||||
|
getEditingFormGroups,
|
||||||
GridExtraFilterState,
|
GridExtraFilterState,
|
||||||
safeJsonParse,
|
safeJsonParse,
|
||||||
setFormEditingExtraItemValues,
|
setFormEditingExtraItemValues,
|
||||||
|
|
@ -206,13 +208,6 @@ const getActiveEditingForm = (component: any) => {
|
||||||
return editForm?.getEditor || editForm?.itemOption ? editForm : undefined
|
return editForm?.getEditor || editForm?.itemOption ? editForm : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const flattenEditingFormItems = (items: any[] = []): EditingFormItemDto[] =>
|
|
||||||
items.flatMap((item) => [
|
|
||||||
...(item?.dataField ? [item] : []),
|
|
||||||
...flattenEditingFormItems(item?.items || []),
|
|
||||||
...(item?.tabs || []).flatMap((tab: any) => flattenEditingFormItems(tab?.items || [])),
|
|
||||||
])
|
|
||||||
|
|
||||||
const getValueByField = (data: Record<string, any> = {}, field?: string) => {
|
const getValueByField = (data: Record<string, any> = {}, field?: string) => {
|
||||||
if (!field) return undefined
|
if (!field) return undefined
|
||||||
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
||||||
|
|
@ -664,11 +659,10 @@ const Tree = (props: TreeProps) => {
|
||||||
|
|
||||||
function onEditorPreparing(editor: TreeListTypes.EditorPreparingEvent) {
|
function onEditorPreparing(editor: TreeListTypes.EditorPreparingEvent) {
|
||||||
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
||||||
const formItem = gridDto.gridOptions.editingFormDto
|
const columnFormat = gridDto.columnFormats.find(
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
(column) => column.fieldName === editor.dataField,
|
||||||
.find((i) => i.dataField === editor.dataField)
|
)
|
||||||
const fieldName = editor.dataField.split(':')[0]
|
const formItem = columnFormat?.editOrderNo != null ? columnFormat : undefined
|
||||||
const columnFormat = gridDto.columnFormats.find((column) => column.fieldName === fieldName)
|
|
||||||
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
||||||
|
|
||||||
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
||||||
|
|
@ -689,7 +683,7 @@ const Tree = (props: TreeProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cascade disabled mantığı
|
// Cascade disabled mantığı
|
||||||
const colFormat = gridDto.columnFormats.find((c) => c.fieldName === editor.dataField)
|
const colFormat = columnFormat
|
||||||
if (colFormat?.lookupDto?.cascadeParentFields) {
|
if (colFormat?.lookupDto?.cascadeParentFields) {
|
||||||
const parentFields = colFormat.lookupDto.cascadeParentFields
|
const parentFields = colFormat.lookupDto.cascadeParentFields
|
||||||
.split(',')
|
.split(',')
|
||||||
|
|
@ -733,11 +727,8 @@ const Tree = (props: TreeProps) => {
|
||||||
try {
|
try {
|
||||||
const editorInstance = formInstance.getEditor(col.fieldName!)
|
const editorInstance = formInstance.getEditor(col.fieldName!)
|
||||||
if (editorInstance) {
|
if (editorInstance) {
|
||||||
const formItem = gridDto.gridOptions.editingFormDto
|
const editorOptions = col.editorOptions
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
? JSON.parse(col.editorOptions)
|
||||||
.find((i) => i.dataField === col.fieldName)
|
|
||||||
const editorOptions = formItem?.editorOptions
|
|
||||||
? JSON.parse(formItem.editorOptions)
|
|
||||||
: {}
|
: {}
|
||||||
|
|
||||||
editorInstance.option(
|
editorInstance.option(
|
||||||
|
|
@ -804,7 +795,7 @@ const Tree = (props: TreeProps) => {
|
||||||
setFormData,
|
setFormData,
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Script exec error', formItem.dataField, err)
|
console.error('Script exec error', formItem.fieldName, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1269,9 +1260,7 @@ const Tree = (props: TreeProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const runReadOnlyScripts = () => {
|
const runReadOnlyScripts = () => {
|
||||||
const formItems = gridDto.gridOptions.editingFormDto.flatMap((group) =>
|
const formItems = getEditingFormFields(gridDto)
|
||||||
flattenEditingFormItems([group]),
|
|
||||||
)
|
|
||||||
const scriptItems = formItems.filter((formItem) =>
|
const scriptItems = formItems.filter((formItem) =>
|
||||||
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
||||||
)
|
)
|
||||||
|
|
@ -1282,9 +1271,9 @@ const Tree = (props: TreeProps) => {
|
||||||
|
|
||||||
const editorValues = formItems.reduce<Record<string, any>>(
|
const editorValues = formItems.reduce<Record<string, any>>(
|
||||||
(values, formItem) => {
|
(values, formItem) => {
|
||||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||||
if (editorInstance?.option) {
|
if (editorInstance?.option) {
|
||||||
values[formItem.dataField] = editorInstance.option('value')
|
values[formItem.fieldName!] = editorInstance.option('value')
|
||||||
}
|
}
|
||||||
return values
|
return values
|
||||||
},
|
},
|
||||||
|
|
@ -1299,17 +1288,17 @@ const Tree = (props: TreeProps) => {
|
||||||
|
|
||||||
scriptItems.forEach((formItem) => {
|
scriptItems.forEach((formItem) => {
|
||||||
try {
|
try {
|
||||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||||
const editorValue =
|
const editorValue =
|
||||||
editorInstance?.option?.('value') ??
|
editorInstance?.option?.('value') ??
|
||||||
getValueByField(formData, formItem.dataField)
|
getValueByField(formData, formItem.fieldName)
|
||||||
const editor = {
|
const editor = {
|
||||||
dataField: formItem.dataField,
|
dataField: formItem.fieldName,
|
||||||
component: grid,
|
component: grid,
|
||||||
}
|
}
|
||||||
const e = {
|
const e = {
|
||||||
component: form,
|
component: form,
|
||||||
dataField: formItem.dataField,
|
dataField: formItem.fieldName,
|
||||||
scriptEvent: 'contentReady',
|
scriptEvent: 'contentReady',
|
||||||
value: editorValue,
|
value: editorValue,
|
||||||
}
|
}
|
||||||
|
|
@ -1324,7 +1313,7 @@ const Tree = (props: TreeProps) => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
'Script exec error on contentReady',
|
'Script exec error on contentReady',
|
||||||
formItem.dataField,
|
formItem.fieldName!,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1340,11 +1329,10 @@ const Tree = (props: TreeProps) => {
|
||||||
...(e.component?.option?.('formData') || {}),
|
...(e.component?.option?.('formData') || {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
const formItem = gridDto.gridOptions.editingFormDto
|
const formItem = getEditingFormFields(gridDto)
|
||||||
.flatMap((group) => flattenEditingFormItems([group]))
|
|
||||||
.find(
|
.find(
|
||||||
(i) =>
|
(i) =>
|
||||||
String(i.dataField || '').toLowerCase() ===
|
String(i.fieldName || '').toLowerCase() ===
|
||||||
String(e.dataField || '').toLowerCase(),
|
String(e.dataField || '').toLowerCase(),
|
||||||
)
|
)
|
||||||
if (formItem?.editorScript) {
|
if (formItem?.editorScript) {
|
||||||
|
|
@ -1387,9 +1375,9 @@ const Tree = (props: TreeProps) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
items:
|
items:
|
||||||
gridDto.gridOptions.editingFormDto?.length > 0
|
getEditingFormGroups(gridDto)?.length > 0
|
||||||
? (() => {
|
? (() => {
|
||||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||||
.slice()
|
.slice()
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||||
|
|
||||||
|
|
@ -1400,7 +1388,7 @@ const Tree = (props: TreeProps) => {
|
||||||
const result: any[] = []
|
const result: any[] = []
|
||||||
|
|
||||||
// Helper function: item mapper
|
// Helper function: item mapper
|
||||||
const mapFormItem = (i: EditingFormItemDto) => {
|
const mapFormItem = (i: ColumnFormatDto) => {
|
||||||
let editorOptions: EditorOptionsWithButtons = {}
|
let editorOptions: EditorOptionsWithButtons = {}
|
||||||
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
||||||
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
||||||
|
|
@ -1415,12 +1403,12 @@ const Tree = (props: TreeProps) => {
|
||||||
const filters = extractSearchParamsFields(parsed)
|
const filters = extractSearchParamsFields(parsed)
|
||||||
|
|
||||||
const hasFilter = filters.some(
|
const hasFilter = filters.some(
|
||||||
([field, op, val]) => field === i.dataField,
|
([field, op, val]) => field === i.fieldName,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (hasFilter) {
|
if (hasFilter) {
|
||||||
const existsInExtra = extraFilters.some(
|
const existsInExtra = extraFilters.some(
|
||||||
(f) => f.fieldName === i.dataField && !!f.value,
|
(f) => f.fieldName === i.fieldName && !!f.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!existsInExtra) {
|
if (!existsInExtra) {
|
||||||
|
|
@ -1429,13 +1417,11 @@ const Tree = (props: TreeProps) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err){
|
} catch (err){
|
||||||
console.error('EditorOptions parse error:', i.dataField, err)
|
console.error('EditorOptions parse error:', i.fieldName, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldName = i.dataField.split(':')[0]
|
const fieldName = i.fieldName!
|
||||||
const listFormField = gridDto.columnFormats.find(
|
const listFormField = i
|
||||||
(x: any) => x.fieldName === fieldName,
|
|
||||||
)
|
|
||||||
|
|
||||||
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
||||||
|
|
||||||
|
|
@ -1484,8 +1470,8 @@ const Tree = (props: TreeProps) => {
|
||||||
canExport: listFormField?.canExport ?? false,
|
canExport: listFormField?.canExport ?? false,
|
||||||
allowEditing: listFormField?.allowEditing ?? true,
|
allowEditing: listFormField?.allowEditing ?? true,
|
||||||
allowAdding: listFormField?.allowAdding ?? true,
|
allowAdding: listFormField?.allowAdding ?? true,
|
||||||
dataField: i.dataField,
|
dataField: i.fieldName,
|
||||||
name: i.dataField,
|
name: i.fieldName,
|
||||||
editorType2: i.editorType2,
|
editorType2: i.editorType2,
|
||||||
editorType:
|
editorType:
|
||||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||||
|
|
@ -1503,12 +1489,12 @@ const Tree = (props: TreeProps) => {
|
||||||
item.template = 'cellEditImageViewer'
|
item.template = 'cellEditImageViewer'
|
||||||
item.editorOptions = {
|
item.editorOptions = {
|
||||||
...item.editorOptions,
|
...item.editorOptions,
|
||||||
value: getValueByField(editingFormDataRef.current, i.dataField),
|
value: getValueByField(editingFormDataRef.current, i.fieldName),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.dataField.indexOf(':') >= 0) {
|
if (i.fieldName?.indexOf(':') >= 0) {
|
||||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -1532,7 +1518,9 @@ const Tree = (props: TreeProps) => {
|
||||||
colSpan: e.colSpan,
|
colSpan: e.colSpan,
|
||||||
caption: e.caption, // Group'larda caption olmalı
|
caption: e.caption, // Group'larda caption olmalı
|
||||||
items: e.items
|
items: e.items
|
||||||
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
?.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
.map(mapFormItem)
|
.map(mapFormItem)
|
||||||
.filter((a: any) => {
|
.filter((a: any) => {
|
||||||
if (mode === 'view') {
|
if (mode === 'view') {
|
||||||
|
|
@ -1561,7 +1549,9 @@ const Tree = (props: TreeProps) => {
|
||||||
title: tabbedItem.caption, // Her tab'ın title'ı
|
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||||
colCount: effectiveColCount,
|
colCount: effectiveColCount,
|
||||||
items: tabbedItem.items
|
items: tabbedItem.items
|
||||||
?.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
?.sort((a: any, b: any) =>
|
||||||
|
(a.editOrderNo ?? 0) >= (b.editOrderNo ?? 0) ? 1 : -1,
|
||||||
|
)
|
||||||
.map(mapFormItem)
|
.map(mapFormItem)
|
||||||
.filter((a: any) => {
|
.filter((a: any) => {
|
||||||
if (mode === 'view') {
|
if (mode === 'view') {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,24 @@ import type { DataType } from 'devextreme/common'
|
||||||
import type { PivotGridDataType } from 'devextreme/ui/pivot_grid/data_source'
|
import type { PivotGridDataType } from 'devextreme/ui/pivot_grid/data_source'
|
||||||
import { MULTIVALUE_DELIMITER } from '../../constants/app.constant'
|
import { MULTIVALUE_DELIMITER } from '../../constants/app.constant'
|
||||||
import { ChartSeriesDto } from '@/proxy/admin/charts/models'
|
import { ChartSeriesDto } from '@/proxy/admin/charts/models'
|
||||||
|
import type { GridDto } from '@/proxy/form/models'
|
||||||
|
|
||||||
|
/** EditingFormDto gruplarını ColumnFormatDto alanlarıyla DevExtreme için birleştirir. */
|
||||||
|
export const getEditingFormFields = (gridDto: GridDto) =>
|
||||||
|
gridDto.columnFormats
|
||||||
|
.filter((field) => field.editOrderNo != null && field.fieldName)
|
||||||
|
.sort((left, right) => left.editOrderNo! - right.editOrderNo!)
|
||||||
|
|
||||||
|
export const getEditingFormGroups = (gridDto: GridDto) => {
|
||||||
|
const fields = getEditingFormFields(gridDto)
|
||||||
|
|
||||||
|
return [...(gridDto.gridOptions.editingFormDto ?? [])]
|
||||||
|
.sort((left, right) => left.order - right.order)
|
||||||
|
.map((group) => ({
|
||||||
|
...group,
|
||||||
|
items: fields.filter((field) => (field.editGroupOrderNo ?? 1) === group.order),
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
export interface GridExtraFilterState {
|
export interface GridExtraFilterState {
|
||||||
fieldName: string
|
fieldName: string
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,12 @@ import { dynamicFetch } from '@/services/form.service'
|
||||||
import { GridColumnData } from './GridColumnData'
|
import { GridColumnData } from './GridColumnData'
|
||||||
import {
|
import {
|
||||||
ColumnFormatDto,
|
ColumnFormatDto,
|
||||||
EditingFormItemDto,
|
|
||||||
GridDto,
|
GridDto,
|
||||||
PlatformEditorTypes,
|
PlatformEditorTypes,
|
||||||
UiCommandButtonPositionTypeEnum,
|
UiCommandButtonPositionTypeEnum,
|
||||||
UiLookupDataSourceTypeEnum,
|
UiLookupDataSourceTypeEnum,
|
||||||
} from '@/proxy/form/models'
|
} from '@/proxy/form/models'
|
||||||
import { addCss } from './Utils'
|
import { addCss, getEditingFormFields } from './Utils'
|
||||||
|
|
||||||
const NO_IMAGE = '/img/others/no-image.png'
|
const NO_IMAGE = '/img/others/no-image.png'
|
||||||
|
|
||||||
|
|
@ -926,12 +925,11 @@ const useListFormColumns = ({
|
||||||
// #region lookup ayarlari
|
// #region lookup ayarlari
|
||||||
if (colData.lookupDto?.dataSourceType) {
|
if (colData.lookupDto?.dataSourceType) {
|
||||||
// UiColumnEditorTemplateTypeEnum : None:0, Table:1, TagBox:2
|
// UiColumnEditorTemplateTypeEnum : None:0, Table:1, TagBox:2
|
||||||
const allItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
const formItem = colData.editOrderNo != null ? colData : undefined
|
||||||
const formItem = allItems.find((a) => a?.dataField === colData.fieldName)
|
|
||||||
if (formItem?.editorType2 === PlatformEditorTypes.dxTagBox) {
|
if (formItem?.editorType2 === PlatformEditorTypes.dxTagBox) {
|
||||||
column.extras = {
|
column.extras = {
|
||||||
multiValue: true,
|
multiValue: true,
|
||||||
editorOptions: formItem.editorOptions,
|
editorOptions,
|
||||||
tagBoxOptions: formItem.tagBoxOptions,
|
tagBoxOptions: formItem.tagBoxOptions,
|
||||||
}
|
}
|
||||||
column.editCellTemplate = 'cellEditTagBox'
|
column.editCellTemplate = 'cellEditTagBox'
|
||||||
|
|
@ -940,7 +938,7 @@ const useListFormColumns = ({
|
||||||
} else if (formItem?.editorType2 === PlatformEditorTypes.dxGridBox) {
|
} else if (formItem?.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||||
column.extras = {
|
column.extras = {
|
||||||
multiValue: false,
|
multiValue: false,
|
||||||
editorOptions: formItem.editorOptions,
|
editorOptions,
|
||||||
gridBoxOptions: formItem.gridBoxOptions,
|
gridBoxOptions: formItem.gridBoxOptions,
|
||||||
}
|
}
|
||||||
column.editCellTemplate = 'cellEditGridBox'
|
column.editCellTemplate = 'cellEditGridBox'
|
||||||
|
|
@ -976,8 +974,7 @@ const useListFormColumns = ({
|
||||||
|
|
||||||
// #region image upload editor
|
// #region image upload editor
|
||||||
if (!colData.lookupDto?.dataSourceType) {
|
if (!colData.lookupDto?.dataSourceType) {
|
||||||
const allFormItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
const imageFormItem = colData.editOrderNo != null ? colData : undefined
|
||||||
const imageFormItem = allFormItems.find((a) => a?.dataField === colData.fieldName)
|
|
||||||
const isImageUploadEditor =
|
const isImageUploadEditor =
|
||||||
imageFormItem?.editorType2 === PlatformEditorTypes.dxImageUpload
|
imageFormItem?.editorType2 === PlatformEditorTypes.dxImageUpload
|
||||||
const isImageViewerEditor =
|
const isImageViewerEditor =
|
||||||
|
|
@ -1006,7 +1003,7 @@ const useListFormColumns = ({
|
||||||
}
|
}
|
||||||
column.extras = {
|
column.extras = {
|
||||||
multiValue: imageUploadOptions?.multiple ?? false,
|
multiValue: imageUploadOptions?.multiple ?? false,
|
||||||
editorOptions: imageFormItem?.editorOptions ?? colData.editorOptions,
|
editorOptions,
|
||||||
imageUploadOptions: imageUploadOptions,
|
imageUploadOptions: imageUploadOptions,
|
||||||
}
|
}
|
||||||
if (isImageUploadEditor) {
|
if (isImageUploadEditor) {
|
||||||
|
|
@ -1091,25 +1088,19 @@ const useListFormColumns = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FormEditingExtraItem
|
// Formda kullanılan fakat listede görünmeyen ColumnFormatDto alanlarını
|
||||||
// Devexpress Gridde kaydete basılınca
|
// DevExtreme'in düzenleme modeline gizli kolon olarak ekliyoruz.
|
||||||
// formda gözükecek olan EditingFormDto.Items elemanları gelmiyor
|
|
||||||
// Sadece grid'de tanımlanmış columnları getiriyor.
|
|
||||||
// Bu elemanları da getirmesi için aşağıdaki şekilde,
|
|
||||||
// columns'da olmayan alanları da gizli olarak ekliyoruz
|
|
||||||
if (columns?.length) {
|
if (columns?.length) {
|
||||||
gridDto.gridOptions.editingFormDto.forEach((group) => {
|
getEditingFormFields(gridDto).forEach((item: ColumnFormatDto) => {
|
||||||
group.items?.forEach((item: EditingFormItemDto) => {
|
if (!columns.some((a) => a.dataField === item.fieldName)) {
|
||||||
if (!columns.some((a) => a.dataField === item.dataField)) {
|
columns.push({
|
||||||
columns.push({
|
dataField: item.fieldName,
|
||||||
dataField: item.dataField,
|
visible: false,
|
||||||
visible: false,
|
showInColumnChooser: false,
|
||||||
showInColumnChooser: false,
|
allowSearch: false,
|
||||||
allowSearch: false
|
})
|
||||||
})
|
insertedColumns.push(item.fieldName)
|
||||||
insertedColumns.push(item.dataField)
|
}
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue