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>
|
||||
{
|
||||
private static readonly JsonSerializerOptions EditorOptionsSerializerOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
public ColumnFormatDto() { }
|
||||
|
||||
public string FieldName { get; set; }
|
||||
|
|
@ -239,7 +244,42 @@ public class ColumnFormatDto : AuditedEntityDto<Guid>
|
|||
}
|
||||
|
||||
public string Alignment { get; set; }
|
||||
public string Format { get; set; }
|
||||
public string EditorOptions { get; set; }
|
||||
public string Format { 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 int ColCount { 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 string DataField { get; set; }
|
||||
public string FieldName { get; set; }
|
||||
public string CaptionName { get; set; }
|
||||
public string EditorType { get; set; }
|
||||
public string EditorOptions { get; set; }
|
||||
|
|
|
|||
|
|
@ -47,26 +47,33 @@ public class ListFormFieldsAppService : CrudAppService<
|
|||
|
||||
protected override void MapToEntity(ColumnFormatEditDto updateInput, ListFormField entity)
|
||||
{
|
||||
entity.CultureName = updateInput.CultureName;
|
||||
entity.RoleId = updateInput.RoleId;
|
||||
entity.ListFormCode = updateInput.ListFormCode;
|
||||
entity.FieldName = updateInput.FieldName;
|
||||
entity.CultureName = updateInput.CultureName;
|
||||
entity.CaptionName = updateInput.CaptionName;
|
||||
entity.PlaceHolder = updateInput.PlaceHolder;
|
||||
entity.BandName = updateInput.BandName;
|
||||
entity.IsActive = updateInput.IsActive;
|
||||
entity.Visible = updateInput.Visible;
|
||||
entity.AllowSearch = updateInput.AllowSearch;
|
||||
entity.AllowEditing = updateInput.AllowEditing;
|
||||
entity.AllowAdding = updateInput.AllowAdding;
|
||||
entity.ListOrderNo = updateInput.ListOrderNo;
|
||||
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.SortDirection = updateInput.SortDirection;
|
||||
entity.SortIndex = updateInput.SortIndex;
|
||||
entity.Format = updateInput.Format;
|
||||
entity.Alignment = updateInput.Alignment;
|
||||
entity.EditorOptions = updateInput.EditorOptions;
|
||||
entity.EditOrderNo = updateInput.EditOrderNo;
|
||||
entity.EditGroupOrderNo = updateInput.EditGroupOrderNo;
|
||||
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.ColumnFilterJson = JsonSerializer.Serialize(updateInput.ColumnFilterDto);
|
||||
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.TotalSummaryJson = updateInput.ColumnTotalSummaryDto.SummaryType.IsNullOrEmpty() ? "" : JsonSerializer.Serialize(updateInput.ColumnTotalSummaryDto);
|
||||
entity.JoinTableJson = JsonSerializer.Serialize(updateInput.ColumnJoinTableDto);
|
||||
entity.LookupJson = JsonSerializer.Serialize(updateInput.LookupDto);
|
||||
entity.ColumnCssClass = updateInput.ColumnCssClass;
|
||||
entity.ColumnCssValue = updateInput.ColumnCssValue;
|
||||
entity.ValidationRuleJson = JsonSerializer.Serialize(updateInput.ValidationRuleDto);
|
||||
entity.ColumnStylingJson = JsonSerializer.Serialize(updateInput.ColumnStylingDto);
|
||||
entity.PermissionJson = JsonSerializer.Serialize(updateInput.PermissionDto);
|
||||
entity.PivotSettingsJson = JsonSerializer.Serialize(updateInput.PivotSettingsDto);
|
||||
}
|
||||
|
||||
|
|
@ -136,6 +141,9 @@ public class ListFormFieldsAppService : CrudAppService<
|
|||
item.Alignment = input.Alignment;
|
||||
item.Format = input.Format;
|
||||
item.EditorOptions = input.EditorOptions;
|
||||
item.IsActive = input.IsActive;
|
||||
item.Visible = input.Visible;
|
||||
item.AllowSearch = input.AllowSearch;
|
||||
}
|
||||
else if (input.EditType == ListFormFieldEditTabs.PermissionsForm)
|
||||
{
|
||||
|
|
@ -152,6 +160,11 @@ public class ListFormFieldsAppService : CrudAppService<
|
|||
item.AllowSearch = input.AllowSearch;
|
||||
item.AllowEditing = input.AllowEditing;
|
||||
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)
|
||||
{
|
||||
|
|
@ -257,6 +270,9 @@ public class ListFormFieldsAppService : CrudAppService<
|
|||
field.CaptionName = sourceField.CaptionName;
|
||||
field.PlaceHolder = sourceField.PlaceHolder;
|
||||
field.SourceDbType = sourceField.SourceDbType;
|
||||
field.Alignment = sourceField.Alignment;
|
||||
field.Format = sourceField.Format;
|
||||
field.EditorOptions = sourceField.EditorOptions;
|
||||
}
|
||||
if (input.CopiedFields.All || input.CopiedFields.Options)
|
||||
{
|
||||
|
|
@ -269,35 +285,40 @@ public class ListFormFieldsAppService : CrudAppService<
|
|||
field.AllowSearch = sourceField.AllowSearch;
|
||||
field.AllowEditing = sourceField.AllowEditing;
|
||||
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;
|
||||
}
|
||||
else if (input.CopiedFields.All || input.CopiedFields.Customization)
|
||||
if (input.CopiedFields.All || input.CopiedFields.Customization)
|
||||
field.ColumnCustomizationJson = sourceField.ColumnCustomizationJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.Filtering)
|
||||
if (input.CopiedFields.All || input.CopiedFields.Filtering)
|
||||
field.ColumnFilterJson = sourceField.ColumnFilterJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.Headering)
|
||||
if (input.CopiedFields.All || input.CopiedFields.Headering)
|
||||
field.ColumnHeaderJson = sourceField.ColumnHeaderJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.Grouping)
|
||||
if (input.CopiedFields.All || input.CopiedFields.Grouping)
|
||||
field.GroupingJson = sourceField.GroupingJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.GroupSummary)
|
||||
if (input.CopiedFields.All || input.CopiedFields.GroupSummary)
|
||||
field.GroupSummaryJson = sourceField.GroupSummaryJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.TotalSummary)
|
||||
if (input.CopiedFields.All || input.CopiedFields.TotalSummary)
|
||||
field.TotalSummaryJson = sourceField.TotalSummaryJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.JoinOptions)
|
||||
if (input.CopiedFields.All || input.CopiedFields.JoinOptions)
|
||||
field.JoinTableJson = sourceField.JoinTableJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.CssOptions)
|
||||
if (input.CopiedFields.All || input.CopiedFields.CssOptions)
|
||||
{
|
||||
field.ColumnCssClass = sourceField.ColumnCssClass;
|
||||
field.ColumnCssValue = sourceField.ColumnCssValue;
|
||||
}
|
||||
else if (input.CopiedFields.All || input.CopiedFields.ValidationRules)
|
||||
if (input.CopiedFields.All || input.CopiedFields.ValidationRules)
|
||||
field.ValidationRuleJson = sourceField.ValidationRuleJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.Formatting)
|
||||
if (input.CopiedFields.All || input.CopiedFields.Formatting)
|
||||
field.ColumnStylingJson = sourceField.ColumnStylingJson;
|
||||
else if (input.CopiedFields.All || input.CopiedFields.PivotSetting)
|
||||
if (input.CopiedFields.All || input.CopiedFields.PivotSetting)
|
||||
field.PivotSettingsJson = sourceField.PivotSettingsJson;
|
||||
|
||||
await Repository.InsertAsync(field);
|
||||
|
|
|
|||
|
|
@ -230,21 +230,9 @@ public class ListFormWizardAppService(
|
|||
Caption = g.Caption,
|
||||
ColCount = g.ColCount,
|
||||
ColSpan = g.ColCount,
|
||||
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()
|
||||
ItemType = "group"
|
||||
})
|
||||
.Where(g => g.Items.Length > 0)
|
||||
.Where((_, index) => input.Groups[index].Items.Any(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName))
|
||||
.ToList();
|
||||
|
||||
//ListForm - varsa sil, yeniden ekle
|
||||
|
|
@ -371,21 +359,34 @@ public class ListFormWizardAppService(
|
|||
|
||||
// ListFormField - each item in each group becomes a visible field record
|
||||
var fieldOrder = 0;
|
||||
var editGroupOrder = 0;
|
||||
foreach (var group in input.Groups)
|
||||
{
|
||||
editGroupOrder++;
|
||||
var editOrder = 0;
|
||||
foreach (var item in group.Items)
|
||||
{
|
||||
fieldOrder++;
|
||||
if (item.IncludeInEditingForm && item.FieldName != input.KeyFieldName)
|
||||
{
|
||||
editOrder++;
|
||||
}
|
||||
await repoListFormField.InsertAsync(new ListFormField
|
||||
{
|
||||
ListFormCode = input.ListFormCode,
|
||||
FieldName = item.DataField,
|
||||
FieldName = item.FieldName,
|
||||
CaptionName = item.CaptionName,
|
||||
Visible = item.DataField != input.KeyFieldName,
|
||||
Visible = item.FieldName != input.KeyFieldName,
|
||||
IsActive = true,
|
||||
AllowSearch = true,
|
||||
Width = 0,
|
||||
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,
|
||||
CultureName = PlatformConsts.DefaultLanguage,
|
||||
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
||||
|
|
|
|||
|
|
@ -4686,6 +4686,12 @@
|
|||
"en": "Scheduler Layout",
|
||||
"tr": "Zamanlayıcı Düzeni"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.DetailsLayoutDto.TodoLayout",
|
||||
"en": "Todo Layout",
|
||||
"tr": "İşler Düzeni"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.DetailsLayoutDto.GanttLayout",
|
||||
|
|
@ -5186,15 +5192,15 @@
|
|||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.EditingFormFormFields",
|
||||
"en": "Editing Form Fields",
|
||||
"tr": "Düzenleme Form Alanları"
|
||||
"key": "ListForms.ListFormEdit.EditingFormFormGroups",
|
||||
"en": "Editing Form Groups",
|
||||
"tr": "Düzenleme Form Grupları"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
"key": "ListForms.ListFormEdit.EditingFormFormFieldsDescription",
|
||||
"en": "Edit formunda çıkacak field'lar",
|
||||
"tr": "Form Sütunları"
|
||||
"key": "ListForms.ListFormEdit.EditingFormFormGroupsDescription",
|
||||
"en": "Groups that will appear in Edit form",
|
||||
"tr": "Düzenleme formunda çıkacak gruplar"
|
||||
},
|
||||
{
|
||||
"resourceName": "Platform",
|
||||
|
|
@ -5916,6 +5922,30 @@
|
|||
"en": "Field Name",
|
||||
"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",
|
||||
"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,
|
||||
ColCount = g.ColCount,
|
||||
ColSpan = g.ColCount,
|
||||
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()
|
||||
ItemType = "group"
|
||||
})
|
||||
.Where(g => g.Items.Length > 0)
|
||||
.Where((_, index) => input.Groups[index].Items.Any(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName))
|
||||
.ToList();
|
||||
|
||||
// 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
|
||||
var editingFormFieldNames = input.Groups
|
||||
.SelectMany(g => g.Items)
|
||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
||||
.Select(i => new { FieldName = i.DataField, Isrequired = i.IsRequired })
|
||||
.Where(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName)
|
||||
.Select(i => new { FieldName = i.FieldName, Isrequired = i.IsRequired })
|
||||
.ToList();
|
||||
|
||||
// Heigth ve Width hesaplama
|
||||
|
|
@ -350,7 +338,7 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
.Select(g =>
|
||||
{
|
||||
var items = g.Items
|
||||
.Where(i => i.IncludeInEditingForm && i.DataField != input.KeyFieldName)
|
||||
.Where(i => i.IncludeInEditingForm && i.FieldName != input.KeyFieldName)
|
||||
.ToList();
|
||||
|
||||
var columnCount = g.ColCount;
|
||||
|
|
@ -454,21 +442,34 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
|
||||
// ListFormFields
|
||||
var fieldOrder = 0;
|
||||
var editGroupOrder = 0;
|
||||
foreach (var group in input.Groups)
|
||||
{
|
||||
editGroupOrder++;
|
||||
var editOrder = 0;
|
||||
foreach (var item in group.Items)
|
||||
{
|
||||
fieldOrder++;
|
||||
if (item.IncludeInEditingForm && item.FieldName != input.KeyFieldName)
|
||||
{
|
||||
editOrder++;
|
||||
}
|
||||
await _repoListFormField.InsertAsync(new ListFormField
|
||||
{
|
||||
ListFormCode = input.ListFormCode,
|
||||
FieldName = item.DataField,
|
||||
FieldName = item.FieldName,
|
||||
CaptionName = item.CaptionName,
|
||||
Visible = item.DataField != input.KeyFieldName,
|
||||
Visible = item.FieldName != input.KeyFieldName,
|
||||
IsActive = true,
|
||||
Width = 0, //Fit columns için hepsine sıfır veriyorum.
|
||||
AllowSearch = true,
|
||||
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,
|
||||
CultureName = PlatformConsts.DefaultLanguage,
|
||||
PermissionJson = WizardConsts.DefaultFieldPermissionJson(code),
|
||||
|
|
@ -478,7 +479,7 @@ public class WizardDataSeeder : IDataSeedContributor, ITransientDependency
|
|||
LookupJson = !string.IsNullOrWhiteSpace(item.LookupQuery)
|
||||
? WizardConsts.DefaultLookupJson(item.LookupDataSourceType, item.DisplayExpr, item.ValueExpr, item.LookupQuery)
|
||||
: null,
|
||||
ValidationRuleJson = editingFormFieldNames.Any(f => f.FieldName == item.DataField && f.Isrequired)
|
||||
ValidationRuleJson = editingFormFieldNames.Any(f => f.FieldName == item.FieldName && f.Isrequired)
|
||||
? WizardConsts.DefaultValidationRuleRequiredJson
|
||||
: null
|
||||
}, autoSave: true);
|
||||
|
|
|
|||
|
|
@ -758,6 +758,7 @@ public static class PlatformConsts
|
|||
public const string dxDateBox = "dxDateBox";
|
||||
public const string dxDateRangeBox = "dxDateRangeBox";
|
||||
public const string dxDropDownBox = "dxDropDownBox";
|
||||
public const string dxGridBox = "dxGridBox";
|
||||
public const string dxHtmlEditor = "dxHtmlEditor";
|
||||
public const string dxLookup = "dxHtmlEdidxLookuptor";
|
||||
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 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.Format).HasMaxLength(128);
|
||||
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);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
|
|||
namespace Sozsoft.Platform.Migrations
|
||||
{
|
||||
[DbContext(typeof(PlatformDbContext))]
|
||||
[Migration("20260716120523_Initial")]
|
||||
[Migration("20260717065637_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
|
@ -3415,6 +3415,9 @@ namespace Sozsoft.Platform.Migrations
|
|||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<int?>("ColSpan")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ColumnCssClass")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
|
@ -3440,9 +3443,22 @@ namespace Sozsoft.Platform.Migrations
|
|||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<int?>("EditGroupOrderNo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("EditOrderNo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("EditorOptions")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EditorScript")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EditorType2")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("nvarchar(64)");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
|
|
@ -2791,6 +2791,11 @@ namespace Sozsoft.Platform.Migrations
|
|||
PivotSettingsJson = table.Column<string>(type: "text", nullable: true),
|
||||
Alignment = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, defaultValue: "left"),
|
||||
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)
|
||||
},
|
||||
constraints: table =>
|
||||
|
|
@ -3412,6 +3412,9 @@ namespace Sozsoft.Platform.Migrations
|
|||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)");
|
||||
|
||||
b.Property<int?>("ColSpan")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ColumnCssClass")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
|
@ -3437,9 +3440,22 @@ namespace Sozsoft.Platform.Migrations
|
|||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<int?>("EditGroupOrderNo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("EditOrderNo")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("EditorOptions")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EditorScript")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EditorType2")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("nvarchar(64)");
|
||||
|
||||
b.Property<string>("FieldName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
|
|
|
|||
|
|
@ -542,14 +542,16 @@ public class DynamicFormReport : XtraReport
|
|||
.Where(x => x.IsActive != false)
|
||||
.ToDictionary(x => x.FieldName, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var formItems = GetEditingFormItems(listForm)
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.DataField))
|
||||
var editFields = fields
|
||||
.Where(x => x.EditOrderNo.HasValue)
|
||||
.OrderBy(x => x.EditGroupOrderNo ?? 1)
|
||||
.ThenBy(x => x.EditOrderNo)
|
||||
.ToList();
|
||||
|
||||
var orderedFields = formItems.Count > 0
|
||||
? formItems
|
||||
.Where(x => fieldsByName.ContainsKey(x.DataField))
|
||||
.Select(x => new FieldWithEditor(fieldsByName[x.DataField], x.EditorType2, x.ColSpan))
|
||||
var orderedFields = editFields.Count > 0
|
||||
? editFields
|
||||
.Where(x => fieldsByName.ContainsKey(x.FieldName))
|
||||
.Select(x => new FieldWithEditor(x, x.EditorType2, x.ColSpan ?? 1))
|
||||
.ToList()
|
||||
: fields
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||
|
|
@ -582,10 +584,9 @@ public class DynamicFormReport : XtraReport
|
|||
var usedFields = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var groupFields = (group.Items ?? [])
|
||||
.OrderBy(x => x.Order)
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.DataField) && fieldsByName.ContainsKey(x.DataField))
|
||||
.Select(x => fieldsByName[x.DataField])
|
||||
var groupFields = fields
|
||||
.Where(x => (x.Field.EditGroupOrderNo ?? 1) == group.Order)
|
||||
.OrderBy(x => x.Field.EditOrderNo ?? int.MaxValue)
|
||||
.ToList();
|
||||
|
||||
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(
|
||||
ListForm listForm,
|
||||
IDictionary<string, object> row)
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class DynamicGridReport : XtraReport
|
|||
|
||||
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
||||
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(listForm);
|
||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(fields);
|
||||
|
||||
var availableFields = fields
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||
|
|
|
|||
|
|
@ -73,28 +73,16 @@ internal static class DynamicReportImageHelper
|
|||
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);
|
||||
if (string.IsNullOrWhiteSpace(listForm?.EditingFormJson))
|
||||
foreach (var field in fields ?? [])
|
||||
{
|
||||
return map;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var groups = JsonSerializer.Deserialize<List<EditingFormDto>>(listForm.EditingFormJson) ?? [];
|
||||
foreach (var item in groups.SelectMany(x => x.Items ?? []))
|
||||
if (!string.IsNullOrWhiteSpace(field.FieldName) && !string.IsNullOrWhiteSpace(field.EditorType2))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(item.DataField))
|
||||
{
|
||||
map[item.DataField] = item.EditorType2;
|
||||
}
|
||||
map[field.FieldName] = field.EditorType2;
|
||||
}
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
|
@ -452,25 +440,16 @@ internal static class DynamicReportImageHelper
|
|||
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;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var groups = JsonSerializer.Deserialize<List<EditingFormDto>>(listForm.EditingFormJson) ?? [];
|
||||
return groups
|
||||
.SelectMany(x => x.Items ?? [])
|
||||
.Any(x => string.Equals(x.DataField, fieldName, StringComparison.OrdinalIgnoreCase) &&
|
||||
IsImageEditor(x.EditorType2));
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (fields ?? []).Any(x =>
|
||||
string.Equals(x.FieldName, fieldName, StringComparison.OrdinalIgnoreCase) &&
|
||||
IsImageEditor(x.EditorType2));
|
||||
}
|
||||
|
||||
public static float GetGridImageHeight() => DefaultGridImageHeight;
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ public class DynamicTreeReport : XtraReport
|
|||
|
||||
await selectQueryManager.PrepareQueriesAsync(listForm, fields, dataSourceType, customizations, queryParams);
|
||||
var selectFieldsByName = DynamicReportImageHelper.CreateSelectFieldMap(selectQueryManager.SelectFields);
|
||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(listForm);
|
||||
var editorTypesByField = DynamicReportImageHelper.CreateEditorTypeMap(fields);
|
||||
|
||||
var availableFields = fields
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.FieldName) && x.FieldName != "undefined")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import type {
|
|||
StartEditAction,
|
||||
StateStoreType,
|
||||
} from 'devextreme/ui/data_grid_types'
|
||||
import type { FormItemComponent } from 'devextreme/ui/form'
|
||||
import { AuditedEntityDto } from '../abp'
|
||||
import { EditorType2, RowMode } from '../../views/form/types'
|
||||
import {
|
||||
|
|
@ -195,7 +194,7 @@ export interface ColumnFilterDto {
|
|||
}
|
||||
|
||||
export interface ColumnFormatDto extends AuditedEntityDto<string> {
|
||||
fieldName?: string
|
||||
fieldName: string
|
||||
captionName?: string
|
||||
placeHolder?: string
|
||||
readOnly: boolean
|
||||
|
|
@ -245,6 +244,14 @@ export interface ColumnFormatDto extends AuditedEntityDto<string> {
|
|||
alignment?: HorizontalAlignment
|
||||
format?: string
|
||||
editorOptions?: string
|
||||
editOrderNo?: number
|
||||
editGroupOrderNo?: number
|
||||
editorType2: EditorType2
|
||||
colSpan?: number
|
||||
gridBoxOptions?: GridBoxOptionsDto
|
||||
tagBoxOptions?: TagBoxOptionsDto
|
||||
imageUploadOptions?: ImageUploadOptionsDto
|
||||
editorScript?: string
|
||||
}
|
||||
|
||||
export enum AuthorizationTypeEnum {
|
||||
|
|
@ -492,20 +499,6 @@ export interface EditingFormDto {
|
|||
caption?: string
|
||||
colCount: 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 {
|
||||
|
|
|
|||
|
|
@ -300,6 +300,9 @@ const FormEdit = () => {
|
|||
{translate('::ListForms.ListFormEdit.ExtraFilters')}
|
||||
</TabNav>
|
||||
)}
|
||||
{visibleTabs.includes('editForm') && (
|
||||
<TabNav value="editForm">{translate('::ListForms.ListFormEdit.EditingForm')}</TabNav>
|
||||
)}
|
||||
{visibleTabs.includes('fields') && (
|
||||
<TabNav value="fields">{translate('::ListForms.ListFormEdit.TabFields')}</TabNav>
|
||||
)}
|
||||
|
|
@ -308,9 +311,6 @@ const FormEdit = () => {
|
|||
{translate('::ListForms.ListFormEdit.TabCustomization')}
|
||||
</TabNav>
|
||||
)}
|
||||
{visibleTabs.includes('editForm') && (
|
||||
<TabNav value="editForm">{translate('::ListForms.ListFormEdit.EditingForm')}</TabNav>
|
||||
)}
|
||||
{visibleTabs.includes('pivots') && (
|
||||
<TabNav value="pivots">{translate('::ListForms.ListFormEdit.TabPivot')}</TabNav>
|
||||
)}
|
||||
|
|
@ -464,6 +464,7 @@ const FormEdit = () => {
|
|||
<TabContent value="fields" className="px-2">
|
||||
<FormFields
|
||||
listFormCode={listFormCode}
|
||||
editingFormGroups={listFormValues.editingFormDto ?? []}
|
||||
langOptions={langOptions}
|
||||
roleList={roleList}
|
||||
userList={userList}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ const schema = Yup.object().shape({
|
|||
chart: Yup.boolean(),
|
||||
tree: Yup.boolean(),
|
||||
gantt: Yup.boolean(),
|
||||
scheduler: Yup.boolean(),
|
||||
todo: Yup.boolean(),
|
||||
defaultLayout: Yup.string(),
|
||||
}),
|
||||
})
|
||||
|
|
@ -411,7 +413,11 @@ function FormTabDetails(
|
|||
/>
|
||||
</FormItem>
|
||||
|
||||
<FormItem label="Todo Layout">
|
||||
<FormItem
|
||||
label={translate('::ListForms.ListFormEdit.DetailsLayoutDto.TodoLayout')}
|
||||
invalid={errors.layoutDto?.todo && touched.layoutDto?.todo}
|
||||
errorMessage={errors.layoutDto?.todo}
|
||||
>
|
||||
<Field
|
||||
className="w-20"
|
||||
autoComplete="off"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ function FormTabEditForm(props: { listFormCode: string }) {
|
|||
<Th>{translate('::ListForms.ListFormEdit.DetailsTitle')}</Th>
|
||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnCount')}</Th>
|
||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormColumnSpan')}</Th>
|
||||
<Th>{translate('::ListForms.ListFormEdit.EditingFormItems')}</Th>
|
||||
</Tr>
|
||||
</THead>
|
||||
<TBody>
|
||||
|
|
@ -109,13 +108,6 @@ function FormTabEditForm(props: { listFormCode: string }) {
|
|||
<Td>{row.caption}</Td>
|
||||
<Td>{row.colCount}</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>
|
||||
))}
|
||||
</TBody>
|
||||
|
|
|
|||
|
|
@ -20,14 +20,17 @@ import FormFieldTabTotalSummary from './FormFieldTabTotalSummary'
|
|||
import FormFieldTabValidationRules from './FormFieldTabValidationRules'
|
||||
import { FormFieldEditProps } from './FormFields'
|
||||
import FormFieldTabPivotSetting from './FormFieldTabPivotSetting'
|
||||
import type { EditingFormDto } from '@/proxy/form/models'
|
||||
|
||||
function FormFieldEdit({
|
||||
item,
|
||||
onSubmit,
|
||||
fields,
|
||||
editingFormGroups,
|
||||
}: {
|
||||
item: ColumnFormatEditDto | null
|
||||
fields: ColumnFormatEditDto[]
|
||||
editingFormGroups: EditingFormDto[]
|
||||
} & FormFieldEditProps) {
|
||||
const { translate } = useLocalization()
|
||||
|
||||
|
|
@ -72,13 +75,18 @@ function FormFieldEdit({
|
|||
<TabNav value="pivotSetting">
|
||||
{translate('::ListForms.ListFormFieldEdit.TabPivotSettings')}
|
||||
</TabNav>
|
||||
</TabList>
|
||||
</TabList>
|
||||
<div className="pt-4">
|
||||
<TabContent value="details">
|
||||
<FormFieldTabDetails initialValues={item} onSubmit={onSubmit} />
|
||||
</TabContent>
|
||||
<TabContent value="options">
|
||||
<FormFieldTabOptions initialValues={item} onSubmit={onSubmit} />
|
||||
<FormFieldTabOptions
|
||||
initialValues={item}
|
||||
editingFormGroups={editingFormGroups}
|
||||
fields={fields}
|
||||
onSubmit={onSubmit}
|
||||
/>
|
||||
</TabContent>
|
||||
<TabContent value="permissions">
|
||||
<FormFieldTabPermissions initialValues={item} onSubmit={onSubmit} />
|
||||
|
|
@ -96,18 +104,10 @@ function FormFieldEdit({
|
|||
<FormFieldTabGrouping initialValues={item} onSubmit={onSubmit} />
|
||||
</TabContent>
|
||||
<TabContent value="groupSummary">
|
||||
<FormFieldTabGroupSummary
|
||||
initialValues={item}
|
||||
fields={fields}
|
||||
onSubmit={onSubmit}
|
||||
/>
|
||||
<FormFieldTabGroupSummary initialValues={item} fields={fields} onSubmit={onSubmit} />
|
||||
</TabContent>
|
||||
<TabContent value="totalSummary">
|
||||
<FormFieldTabTotalSummary
|
||||
initialValues={item}
|
||||
fields={fields}
|
||||
onSubmit={onSubmit}
|
||||
/>
|
||||
<FormFieldTabTotalSummary initialValues={item} fields={fields} onSubmit={onSubmit} />
|
||||
</TabContent>
|
||||
<TabContent value="joinOptions">
|
||||
<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 { SelectBoxOption } from '@/types/shared'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||
import { useState } from 'react'
|
||||
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 EditorOptionsBuilderDialog from '../json-row-operations/EditorOptionsBuilderDialog'
|
||||
import { FormFieldEditProps } from './FormFields'
|
||||
|
|
@ -16,10 +16,13 @@ const schema = object().shape({
|
|||
captionName: string(),
|
||||
placeHolder: string(),
|
||||
bandName: string(),
|
||||
isActive: bool().required(),
|
||||
visible: bool().required(),
|
||||
allowSearch: bool().required(),
|
||||
sourceDbType: number().required(),
|
||||
alignment: string(),
|
||||
format: string(),
|
||||
editorOptions: string().max(1000),
|
||||
editorOptions: string(),
|
||||
})
|
||||
|
||||
function FormFieldTabDetails({
|
||||
|
|
@ -72,6 +75,32 @@ function FormFieldTabDetails({
|
|||
>
|
||||
<Field type="text" name="bandName" component={Input} />
|
||||
</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>
|
||||
<FormItem label={translate('::ListForms.ListFormEdit.CustomValueType')}>
|
||||
|
|
@ -132,7 +161,7 @@ function FormFieldTabDetails({
|
|||
type="text"
|
||||
name="editorOptions"
|
||||
component={Input}
|
||||
rows={4}
|
||||
rows={3}
|
||||
textArea={true}
|
||||
/>
|
||||
<Button
|
||||
|
|
@ -154,7 +183,14 @@ function FormFieldTabDetails({
|
|||
onClose={() => setIsEditorOptionsDialogOpen(false)}
|
||||
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')}
|
||||
</Button>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -4,29 +4,50 @@ import { SelectBoxOption } from '@/types/shared'
|
|||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||
import { bool, number, object, string } from 'yup'
|
||||
import { sortDirectionOptions } from '../options'
|
||||
import { columnEditorTypeListOptions, sortDirectionOptions } from '../options'
|
||||
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({
|
||||
listOrderNo: number(),
|
||||
width: number(),
|
||||
sortDirection: string().oneOf(Object.values(SortDirectionEnum) as string[]),
|
||||
sortIndex: number(),
|
||||
isActive: bool().required(),
|
||||
visible: bool().required(),
|
||||
allowSearch: bool().required(),
|
||||
editGroupOrderNo: number().nullable(),
|
||||
editOrderNo: number().nullable(),
|
||||
colSpan: number().nullable(),
|
||||
allowEditing: bool().required(),
|
||||
allowAdding: bool().required(),
|
||||
editorScript: string(),
|
||||
})
|
||||
|
||||
function FormFieldTabOptions({
|
||||
initialValues,
|
||||
editingFormGroups,
|
||||
fields,
|
||||
onSubmit,
|
||||
}: {
|
||||
initialValues: ColumnFormatEditDto
|
||||
editingFormGroups: EditingFormDto[]
|
||||
fields: ColumnFormatEditDto[]
|
||||
} & FormFieldEditProps) {
|
||||
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 (
|
||||
<Formik
|
||||
|
|
@ -37,7 +58,7 @@ function FormFieldTabOptions({
|
|||
await onSubmit(ListFormFieldEditTabs.OptionsForm, values, formikHelpers)
|
||||
}}
|
||||
>
|
||||
{({ touched, errors, isSubmitting, values }) => (
|
||||
{({ touched, errors, isSubmitting, values, setFieldValue }) => (
|
||||
<Form>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||
<Card>
|
||||
|
|
@ -82,25 +103,7 @@ function FormFieldTabOptions({
|
|||
>
|
||||
<Field type="number" name="sortIndex" component={Input} />
|
||||
</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')}>
|
||||
<Field name="allowEditing" component={Checkbox} />
|
||||
</FormItem>
|
||||
|
|
@ -108,9 +111,100 @@ function FormFieldTabOptions({
|
|||
<Field name="allowAdding" component={Checkbox} />
|
||||
</FormItem>
|
||||
</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>
|
||||
|
||||
<Button block size="sm" className="mt-1" variant="solid" loading={isSubmitting} type="submit">
|
||||
<EditorScriptBuilderDialog
|
||||
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')}
|
||||
</Button>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import { dbSourceTypeOptions, sqlDataTypeToDbType } from '../options'
|
|||
import { IdentityRoleDto, IdentityUserDto } from '@/proxy/admin/models'
|
||||
import { sqlObjectManagerService } from '@/services/sql-query-manager.service'
|
||||
import type { DatabaseColumnDto } from '@/proxy/sql-query-manager/models'
|
||||
import type { EditingFormDto } from '@/proxy/form/models'
|
||||
|
||||
export interface FormFieldEditProps {
|
||||
onSubmit: (
|
||||
|
|
@ -71,12 +72,14 @@ const copyFieldSchema = object().shape({
|
|||
|
||||
function FormFields({
|
||||
listFormCode,
|
||||
editingFormGroups,
|
||||
langOptions,
|
||||
roleList,
|
||||
userList,
|
||||
columns,
|
||||
}: {
|
||||
listFormCode: string
|
||||
editingFormGroups: EditingFormDto[]
|
||||
langOptions: SelectBoxOption[]
|
||||
roleList: SelectBoxOption[]
|
||||
userList: SelectBoxOption[]
|
||||
|
|
@ -219,42 +222,45 @@ function FormFields({
|
|||
await getFields()
|
||||
}
|
||||
|
||||
const getFields = useCallback(async (cultureName?: string, roleId?: string, userId?: string) => {
|
||||
if (!listFormCode) {
|
||||
return
|
||||
}
|
||||
const getFields = useCallback(
|
||||
async (cultureName?: string, roleId?: string, userId?: string) => {
|
||||
if (!listFormCode) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const resp = await getListFormFields({
|
||||
listFormCode,
|
||||
cultureName,
|
||||
roleId,
|
||||
userId,
|
||||
sorting: 'ListOrderNo',
|
||||
maxResultCount: 1000,
|
||||
})
|
||||
setNull(resp?.data?.items)
|
||||
setFields(resp?.data?.items)
|
||||
if (resp.data?.items) {
|
||||
setFieldList(
|
||||
resp?.data?.items.map((f: ColumnFormatEditDto) => ({
|
||||
value: f.fieldName,
|
||||
label: f.fieldName,
|
||||
})),
|
||||
try {
|
||||
const resp = await getListFormFields({
|
||||
listFormCode,
|
||||
cultureName,
|
||||
roleId,
|
||||
userId,
|
||||
sorting: 'ListOrderNo',
|
||||
maxResultCount: 1000,
|
||||
})
|
||||
setNull(resp?.data?.items)
|
||||
setFields(resp?.data?.items)
|
||||
if (resp.data?.items) {
|
||||
setFieldList(
|
||||
resp?.data?.items.map((f: ColumnFormatEditDto) => ({
|
||||
value: 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(
|
||||
<Notification type="danger" duration={2000}>
|
||||
Alanlar getirilemedi
|
||||
{error.toString()}
|
||||
</Notification>,
|
||||
{
|
||||
placement: 'bottom-end',
|
||||
},
|
||||
)
|
||||
}
|
||||
}, [listFormCode])
|
||||
},
|
||||
[listFormCode],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
getFields()
|
||||
|
|
@ -405,7 +411,7 @@ function FormFields({
|
|||
<Table compact>
|
||||
<THead>
|
||||
<Tr>
|
||||
<Th className='w-3/12'>
|
||||
<Th className="w-3/12">
|
||||
<div>
|
||||
<Button
|
||||
shape="circle"
|
||||
|
|
@ -478,12 +484,19 @@ function FormFields({
|
|||
}
|
||||
}}
|
||||
/>
|
||||
<span>{field.listOrderNo}</span>
|
||||
<span>{!field?.visible && <FaEyeSlash />}</span>
|
||||
<span>{!field?.isActive && <FaTimes />}</span>
|
||||
<span style={{ visibility: !field?.visible ? 'visible' : 'hidden' }}>
|
||||
<FaEyeSlash />
|
||||
</span>
|
||||
<span style={{ visibility: !field?.isActive ? 'visible' : 'hidden' }}>
|
||||
<FaTimes />
|
||||
</span>
|
||||
<span className="ml-5">
|
||||
{field.listOrderNo}
|
||||
{field.editOrderNo ? ` (${field.editOrderNo})` : ''}
|
||||
</span>
|
||||
</Td>
|
||||
<Td className='!p-0'>{field.fieldName}</Td>
|
||||
<Td className='align-middle text-center !p-0'>
|
||||
<Td className="!p-0">{field.fieldName}</Td>
|
||||
<Td className="align-middle text-center !p-0">
|
||||
<Avatar
|
||||
size={18}
|
||||
shape="circle"
|
||||
|
|
@ -505,7 +518,12 @@ function FormFields({
|
|||
</Table>
|
||||
</div>
|
||||
<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>
|
||||
</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 { useLocation, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
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 { EditingFormItemDto, GridDto, PlatformEditorTypes } from '@/proxy/form/models'
|
||||
import { ColumnFormatDto, GridDto, PlatformEditorTypes } from '@/proxy/form/models'
|
||||
import { getAccessDeniedPath } from '@/utils/routing'
|
||||
import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||
import { useLookupDataSource } from './useLookupDataSource'
|
||||
|
|
@ -218,10 +218,7 @@ const useGridData = (props: {
|
|||
)
|
||||
setDataSource(dataSource)
|
||||
|
||||
const items = gridDto?.gridOptions.editingFormDto
|
||||
?.sort((a: any, b: any) => {
|
||||
return a.order >= b.order ? 1 : -1
|
||||
})
|
||||
const items = getEditingFormGroups(gridDto)
|
||||
.map((e: any) => {
|
||||
return {
|
||||
itemType: e.itemType,
|
||||
|
|
@ -230,12 +227,12 @@ const useGridData = (props: {
|
|||
caption: e.caption,
|
||||
items: e.items
|
||||
?.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 parsedEditorOptions: Record<string, any> = {}
|
||||
const colData = gridDto.columnFormats.find((x) => x.fieldName === i.dataField)
|
||||
const colData = i
|
||||
|
||||
parsedEditorOptions = i.editorOptions ? JSON.parse(i.editorOptions) : {}
|
||||
const lookupEditorOptions = colData?.lookupDto?.dataSourceType
|
||||
|
|
@ -250,26 +247,14 @@ const useGridData = (props: {
|
|||
...parsedEditorOptions,
|
||||
}
|
||||
const item: SimpleItemWithColData = {
|
||||
canRead:
|
||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canRead ??
|
||||
false,
|
||||
canUpdate:
|
||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canUpdate ??
|
||||
false,
|
||||
canCreate:
|
||||
gridDto.columnFormats.find((x: any) => x.fieldName === i.dataField)?.canCreate ??
|
||||
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,
|
||||
canRead: i.canRead ?? false,
|
||||
canUpdate: i.canUpdate ?? false,
|
||||
canCreate: i.canCreate ?? false,
|
||||
canExport: i.canExport ?? false,
|
||||
allowEditing: i.allowEditing ?? true,
|
||||
allowAdding: i.allowAdding ?? true,
|
||||
dataField: i.fieldName,
|
||||
name: i.fieldName,
|
||||
editorType2: i.editorType2,
|
||||
editorType:
|
||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||
|
|
@ -286,8 +271,8 @@ const useGridData = (props: {
|
|||
imageUploadOptions: i.imageUploadOptions,
|
||||
editorScript: i.editorScript,
|
||||
}
|
||||
if (i.dataField.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
||||
if (i.fieldName?.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||
}
|
||||
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
||||
item.editorOptions = {
|
||||
|
|
@ -348,7 +333,7 @@ const useGridData = (props: {
|
|||
|
||||
const updateItems = (items: any[] = []): any[] =>
|
||||
items.map((item) => {
|
||||
const colData = gridDto.columnFormats.find((x) => x.fieldName === item.dataField)
|
||||
const colData = item.colData
|
||||
if (colData?.lookupDto?.dataSourceType && shouldRefreshLookup(item)) {
|
||||
const currentDataSource = item.editorOptions?.dataSource
|
||||
const keepCustomDataSource =
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { ImportDashboard } from '@/components/importManager/ImportDashboard'
|
|||
import { Dialog, Notification, toast } from '@/components/ui'
|
||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
DbTypeEnum,
|
||||
EditingFormItemDto,
|
||||
GridDto,
|
||||
PlatformEditorTypes,
|
||||
SubFormTabTypeEnum,
|
||||
|
|
@ -41,7 +41,12 @@ import GridFilterDialogs from './GridFilterDialogs'
|
|||
import { GridExtraFilterToolbar } from './GridExtraFilterToolbar'
|
||||
import { ImageUploadEditorComponent } from './editors/ImageUploadEditorComponent'
|
||||
import { ImageViewerEditorComponent } from './editors/ImageViewerEditorComponent'
|
||||
import { extractSearchParamsFields, GridExtraFilterState, safeJsonParse } from './Utils'
|
||||
import {
|
||||
extractSearchParamsFields,
|
||||
getEditingFormGroups,
|
||||
GridExtraFilterState,
|
||||
safeJsonParse,
|
||||
} from './Utils'
|
||||
import { useFilters } from './useFilters'
|
||||
import { useListFormColumns } from './useListFormColumns'
|
||||
import { useListFormCustomDataSource } from './useListFormCustomDataSource'
|
||||
|
|
@ -788,12 +793,9 @@ const CardView = (props: CardViewProps) => {
|
|||
}, [filterToolbarData, toolbarData])
|
||||
|
||||
const mapEditingFormItem = useCallback(
|
||||
(item: EditingFormItemDto) => {
|
||||
const fieldName = item.dataField.split(':')[0]
|
||||
const column = gridDto?.columnFormats.find(
|
||||
(candidate) => candidate.fieldName?.toLowerCase() === fieldName.toLowerCase(),
|
||||
)
|
||||
if (!column) return undefined
|
||||
(item: ColumnFormatDto) => {
|
||||
const fieldName = item.fieldName!
|
||||
const column = item
|
||||
if (
|
||||
mode === 'new' &&
|
||||
fieldName.toLowerCase() === gridDto?.gridOptions.keyFieldName?.toLowerCase()
|
||||
|
|
@ -813,7 +815,7 @@ const CardView = (props: CardViewProps) => {
|
|||
try {
|
||||
editorOptions = item.editorOptions ? JSON.parse(item.editorOptions) : {}
|
||||
} catch (error) {
|
||||
console.error('EditorOptions parse error:', item.dataField, error)
|
||||
console.error('EditorOptions parse error:', item.fieldName, error)
|
||||
}
|
||||
|
||||
if (column.sourceDbType === DbTypeEnum.Date) {
|
||||
|
|
@ -862,8 +864,8 @@ const CardView = (props: CardViewProps) => {
|
|||
name: fieldName,
|
||||
colSpan: item.colSpan,
|
||||
label: {
|
||||
text: item.dataField.includes(':')
|
||||
? item.dataField.split(':')[1]
|
||||
text: item.fieldName!.includes(':')
|
||||
? item.fieldName!.split(':')[1]
|
||||
: translate('::' + (column.captionName || column.fieldName)),
|
||||
},
|
||||
editorType:
|
||||
|
|
@ -888,7 +890,7 @@ const CardView = (props: CardViewProps) => {
|
|||
const editingFormItems = useMemo(() => {
|
||||
if (!gridDto || mode === 'view') return []
|
||||
|
||||
const groups = [...(gridDto.gridOptions.editingFormDto ?? [])].sort(
|
||||
const groups = [...(getEditingFormGroups(gridDto) ?? [])].sort(
|
||||
(left, right) => left.order - right.order,
|
||||
)
|
||||
const tabbedGroups = groups.filter((group) => group.itemType === 'tabbed')
|
||||
|
|
@ -896,7 +898,7 @@ const CardView = (props: CardViewProps) => {
|
|||
|
||||
groups.forEach((group) => {
|
||||
const items = [...(group.items ?? [])]
|
||||
.sort((left, right) => left.order - right.order)
|
||||
.sort((left, right) => (left.editOrderNo ?? 0) - (right.editOrderNo ?? 0))
|
||||
.map(mapEditingFormItem)
|
||||
.filter(Boolean)
|
||||
|
||||
|
|
@ -918,7 +920,7 @@ const CardView = (props: CardViewProps) => {
|
|||
title: tab.caption,
|
||||
colCount: useMobileEditPopup ? 1 : tab.colCount || 1,
|
||||
items: [...(tab.items ?? [])]
|
||||
.sort((left, right) => left.order - right.order)
|
||||
.sort((left, right) => (left.editOrderNo ?? 0) - (right.editOrderNo ?? 0))
|
||||
.map(mapEditingFormItem)
|
||||
.filter(Boolean),
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import '@/utils/registerDevExtremeEditors'
|
|||
import { Dialog, Notification, toast } from '@/components/ui'
|
||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
DbTypeEnum,
|
||||
EditingFormItemDto,
|
||||
FieldCustomValueTypeEnum,
|
||||
GridDto,
|
||||
PlatformEditorTypes,
|
||||
|
|
@ -53,6 +53,8 @@ import {
|
|||
autoNumber,
|
||||
controlStyleCondition,
|
||||
extractSearchParamsFields,
|
||||
getEditingFormFields,
|
||||
getEditingFormGroups,
|
||||
GridExtraFilterState,
|
||||
safeJsonParse,
|
||||
setFormEditingExtraItemValues,
|
||||
|
|
@ -218,13 +220,6 @@ const getActiveEditingForm = (component: any) => {
|
|||
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) => {
|
||||
if (!field) return undefined
|
||||
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
||||
|
|
@ -725,11 +720,10 @@ const Grid = (props: GridProps) => {
|
|||
const onEditorPreparing = useCallback(
|
||||
(editor: DataGridTypes.EditorPreparingEvent<any, any>) => {
|
||||
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
||||
const formItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
.find((i) => i.dataField === editor.dataField)
|
||||
const fieldName = editor.dataField.split(':')[0]
|
||||
const columnFormat = gridDto.columnFormats.find((column) => column.fieldName === fieldName)
|
||||
const columnFormat = gridDto.columnFormats.find(
|
||||
(column) => column.fieldName === editor.dataField,
|
||||
)
|
||||
const formItem = columnFormat?.editOrderNo != null ? columnFormat : undefined
|
||||
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
||||
|
||||
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
||||
|
|
@ -786,9 +780,9 @@ const Grid = (props: GridProps) => {
|
|||
(pf: string) => !rowData[pf],
|
||||
)
|
||||
try {
|
||||
const childFormItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
.find((i) => i.dataField === childFieldName)
|
||||
const childFormItem = gridDto.columnFormats.find(
|
||||
(column) => column.fieldName === childFieldName,
|
||||
)
|
||||
const childEditorOptions = childFormItem?.editorOptions
|
||||
? JSON.parse(childFormItem.editorOptions)
|
||||
: {}
|
||||
|
|
@ -858,7 +852,7 @@ const Grid = (props: GridProps) => {
|
|||
setFormData,
|
||||
})
|
||||
} 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
|
||||
const mapFormItem = useCallback(
|
||||
(i: EditingFormItemDto) => {
|
||||
(i: ColumnFormatDto) => {
|
||||
let editorOptions: EditorOptionsWithButtons = {}
|
||||
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
||||
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
||||
|
|
@ -1148,10 +1142,10 @@ const Grid = (props: GridProps) => {
|
|||
const parsed = JSON.parse(rawFilter)
|
||||
const filters = extractSearchParamsFields(parsed)
|
||||
|
||||
const hasFilter = filters.some(([field]) => field === i.dataField)
|
||||
const hasFilter = filters.some(([field]) => field === i.fieldName)
|
||||
|
||||
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) {
|
||||
forcedEditorOptions.readOnly = true
|
||||
|
|
@ -1159,11 +1153,11 @@ const Grid = (props: GridProps) => {
|
|||
}
|
||||
}
|
||||
} 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 listFormField = gridDto?.columnFormats.find((x: any) => x.fieldName === fieldName)
|
||||
const fieldName = i.fieldName!
|
||||
const listFormField = i
|
||||
|
||||
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
||||
|
||||
|
|
@ -1221,8 +1215,8 @@ const Grid = (props: GridProps) => {
|
|||
canExport: listFormField?.canExport ?? false,
|
||||
allowEditing: listFormField?.allowEditing ?? true,
|
||||
allowAdding: listFormField?.allowAdding ?? true,
|
||||
dataField: i.dataField,
|
||||
name: i.dataField,
|
||||
dataField: i.fieldName,
|
||||
name: i.fieldName,
|
||||
editorType2: i.editorType2,
|
||||
editorType:
|
||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||
|
|
@ -1240,12 +1234,12 @@ const Grid = (props: GridProps) => {
|
|||
item.template = 'cellEditImageViewer'
|
||||
item.editorOptions = {
|
||||
...item.editorOptions,
|
||||
value: getValueByField(editingFormDataRef.current, i.dataField),
|
||||
value: getValueByField(editingFormDataRef.current, i.fieldName),
|
||||
}
|
||||
}
|
||||
|
||||
if (i.dataField.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
||||
if (i.fieldName?.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||
}
|
||||
|
||||
if ((mode == 'edit' && !item.canUpdate) || (mode == 'new' && !item.canCreate)) {
|
||||
|
|
@ -1614,9 +1608,7 @@ const Grid = (props: GridProps) => {
|
|||
}
|
||||
|
||||
const runReadOnlyScripts = () => {
|
||||
const formItems = gridDto.gridOptions.editingFormDto.flatMap((group) =>
|
||||
flattenEditingFormItems([group]),
|
||||
)
|
||||
const formItems = getEditingFormFields(gridDto)
|
||||
const scriptItems = formItems.filter((formItem) =>
|
||||
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
||||
)
|
||||
|
|
@ -1627,9 +1619,9 @@ const Grid = (props: GridProps) => {
|
|||
|
||||
const editorValues = formItems.reduce<Record<string, any>>(
|
||||
(values, formItem) => {
|
||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
||||
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||
if (editorInstance?.option) {
|
||||
values[formItem.dataField] = editorInstance.option('value')
|
||||
values[formItem.fieldName!] = editorInstance.option('value')
|
||||
}
|
||||
return values
|
||||
},
|
||||
|
|
@ -1644,17 +1636,17 @@ const Grid = (props: GridProps) => {
|
|||
|
||||
scriptItems.forEach((formItem) => {
|
||||
try {
|
||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
||||
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||
const editorValue =
|
||||
editorInstance?.option?.('value') ??
|
||||
getValueByField(formData, formItem.dataField)
|
||||
getValueByField(formData, formItem.fieldName)
|
||||
const editor = {
|
||||
dataField: formItem.dataField,
|
||||
dataField: formItem.fieldName,
|
||||
component: grid,
|
||||
}
|
||||
const e = {
|
||||
component: form,
|
||||
dataField: formItem.dataField,
|
||||
dataField: formItem.fieldName,
|
||||
scriptEvent: 'contentReady',
|
||||
value: editorValue,
|
||||
}
|
||||
|
|
@ -1669,7 +1661,7 @@ const Grid = (props: GridProps) => {
|
|||
} catch (err) {
|
||||
console.error(
|
||||
'Script exec error on contentReady',
|
||||
formItem.dataField,
|
||||
formItem.fieldName!,
|
||||
err,
|
||||
)
|
||||
}
|
||||
|
|
@ -1685,11 +1677,10 @@ const Grid = (props: GridProps) => {
|
|||
...(e.component?.option?.('formData') || {}),
|
||||
}
|
||||
|
||||
const formItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
const formItem = getEditingFormFields(gridDto)
|
||||
.find(
|
||||
(i) =>
|
||||
String(i.dataField || '').toLowerCase() ===
|
||||
String(i.fieldName || '').toLowerCase() ===
|
||||
String(e.dataField || '').toLowerCase(),
|
||||
)
|
||||
if (formItem?.editorScript) {
|
||||
|
|
@ -1732,9 +1723,9 @@ const Grid = (props: GridProps) => {
|
|||
}
|
||||
},
|
||||
items:
|
||||
gridDto.gridOptions.editingFormDto?.length > 0
|
||||
getEditingFormGroups(gridDto)?.length > 0
|
||||
? (() => {
|
||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
||||
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||
.slice()
|
||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||
|
||||
|
|
@ -1756,7 +1747,9 @@ const Grid = (props: GridProps) => {
|
|||
colSpan: effectiveColSpan,
|
||||
caption: e.caption, // Group'larda caption olmalı
|
||||
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)
|
||||
.filter((a: any) => {
|
||||
if (mode === 'view') {
|
||||
|
|
@ -1785,7 +1778,9 @@ const Grid = (props: GridProps) => {
|
|||
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||
colCount: effectiveColCount,
|
||||
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)
|
||||
.filter((a: any) => {
|
||||
if (mode === 'view') {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ interface IGridColumnData extends DataGridTypes.Column {
|
|||
colData?: ColumnFormatDto
|
||||
extras?: {
|
||||
multiValue: boolean
|
||||
editorOptions?: string
|
||||
editorOptions?: Record<string, any>
|
||||
tagBoxOptions?: TagBoxOptionsDto
|
||||
gridBoxOptions?: GridBoxOptionsDto
|
||||
imageUploadOptions?: ImageUploadOptionsDto
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import Container from '@/components/shared/Container'
|
|||
import '@/utils/registerDevExtremeEditors'
|
||||
import { APP_NAME, DX_CLASSNAMES } from '@/constants/app.constant'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
DbTypeEnum,
|
||||
GridDto,
|
||||
PlatformEditorTypes,
|
||||
UiLookupDataSourceTypeEnum,
|
||||
EditingFormItemDto,
|
||||
} from '@/proxy/form/models'
|
||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||
import Scheduler, {
|
||||
|
|
@ -21,7 +21,12 @@ import { useCallback, useEffect, useRef, useState } from 'react'
|
|||
import { Helmet } from 'react-helmet'
|
||||
import { getList } from '@/services/form.service'
|
||||
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 WidgetGroup from '@/components/ui/Widget/WidgetGroup'
|
||||
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[] = []
|
||||
|
||||
if (gridDto.gridOptions.editingFormDto?.length > 0) {
|
||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
||||
if (getEditingFormGroups(gridDto)?.length > 0) {
|
||||
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||
.slice()
|
||||
.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')
|
||||
|
||||
// Ortak item mapper fonksiyonu - hem group hem tab için kullanılır
|
||||
const mapFormItem = (i: EditingFormItemDto) => {
|
||||
const mapFormItem = (i: ColumnFormatDto) => {
|
||||
let editorOptions: any = {}
|
||||
try {
|
||||
if (i.editorOptions) {
|
||||
|
|
@ -311,8 +316,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
console.log(err)
|
||||
}
|
||||
|
||||
const fieldName = i.dataField.split(':')[0]
|
||||
const listFormField = gridDto.columnFormats.find((x: any) => x.fieldName === fieldName)
|
||||
const fieldName = i.fieldName!
|
||||
const listFormField = i
|
||||
|
||||
if (listFormField?.sourceDbType === DbTypeEnum.Date) {
|
||||
editorOptions = {
|
||||
|
|
@ -351,7 +356,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
}
|
||||
|
||||
// EditorType belirleme
|
||||
let editorType: any = i.editorType2 || i.editorType
|
||||
let editorType: any = i.editorType2
|
||||
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||
editorType = 'dxDropDownBox'
|
||||
} else if (i.editorType2) {
|
||||
|
|
@ -409,8 +414,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
canExport: listFormField?.canExport ?? false,
|
||||
allowEditing: listFormField?.allowEditing ?? true,
|
||||
allowAdding: listFormField?.allowAdding ?? true,
|
||||
dataField: i.dataField,
|
||||
name: i.dataField,
|
||||
dataField: i.fieldName,
|
||||
name: i.fieldName,
|
||||
editorType2: i.editorType2,
|
||||
editorType:
|
||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||
|
|
@ -424,8 +429,8 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
editorScript: i.editorScript,
|
||||
}
|
||||
|
||||
if (i.dataField.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
||||
if (i.fieldName?.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
@ -445,7 +450,9 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
// Items'ları da order'a göre sırala
|
||||
const sortedItems = (e.items || [])
|
||||
.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)
|
||||
|
||||
|
|
@ -467,7 +474,9 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||
colCount: effectiveColCount,
|
||||
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)
|
||||
.filter((a: any) => {
|
||||
if (currentMode === 'new') {
|
||||
|
|
@ -490,11 +499,11 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
// Form'u tamamen yeniden baştan yapılandır
|
||||
e.form.option(
|
||||
'colCount',
|
||||
hasTabbedItems ? 1 : gridDto.gridOptions.editingFormDto?.[0]?.colCount || 2,
|
||||
hasTabbedItems ? 1 : getEditingFormGroups(gridDto)?.[0]?.colCount || 2,
|
||||
)
|
||||
e.form.option(
|
||||
'colCount',
|
||||
hasTabbedItems ? 1 : gridDto.gridOptions.editingFormDto?.[0]?.colCount || 2,
|
||||
hasTabbedItems ? 1 : getEditingFormGroups(gridDto)?.[0]?.colCount || 2,
|
||||
)
|
||||
e.form.option('showValidationSummary', false)
|
||||
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 { executeEditorScript } from '@/utils/editorScriptRuntime'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
DbTypeEnum,
|
||||
EditingFormItemDto,
|
||||
GridDto,
|
||||
PlatformEditorTypes,
|
||||
SubFormTabTypeEnum,
|
||||
|
|
@ -44,6 +44,8 @@ import {
|
|||
addJs,
|
||||
autoNumber,
|
||||
controlStyleCondition,
|
||||
getEditingFormFields,
|
||||
getEditingFormGroups,
|
||||
GridExtraFilterState,
|
||||
safeJsonParse,
|
||||
setFormEditingExtraItemValues,
|
||||
|
|
@ -206,13 +208,6 @@ const getActiveEditingForm = (component: any) => {
|
|||
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) => {
|
||||
if (!field) return undefined
|
||||
if (Object.prototype.hasOwnProperty.call(data, field)) return data[field]
|
||||
|
|
@ -664,11 +659,10 @@ const Tree = (props: TreeProps) => {
|
|||
|
||||
function onEditorPreparing(editor: TreeListTypes.EditorPreparingEvent) {
|
||||
if (editor.parentType === 'dataRow' && editor.dataField && gridDto) {
|
||||
const formItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
.find((i) => i.dataField === editor.dataField)
|
||||
const fieldName = editor.dataField.split(':')[0]
|
||||
const columnFormat = gridDto.columnFormats.find((column) => column.fieldName === fieldName)
|
||||
const columnFormat = gridDto.columnFormats.find(
|
||||
(column) => column.fieldName === editor.dataField,
|
||||
)
|
||||
const formItem = columnFormat?.editOrderNo != null ? columnFormat : undefined
|
||||
const isNewRow = Boolean((editor as any).row?.isNewRow) || mode === 'new'
|
||||
|
||||
const hasReadOnlyEditorOption = editor.editorOptions?.readOnly === true
|
||||
|
|
@ -689,7 +683,7 @@ const Tree = (props: TreeProps) => {
|
|||
}
|
||||
|
||||
// Cascade disabled mantığı
|
||||
const colFormat = gridDto.columnFormats.find((c) => c.fieldName === editor.dataField)
|
||||
const colFormat = columnFormat
|
||||
if (colFormat?.lookupDto?.cascadeParentFields) {
|
||||
const parentFields = colFormat.lookupDto.cascadeParentFields
|
||||
.split(',')
|
||||
|
|
@ -733,11 +727,8 @@ const Tree = (props: TreeProps) => {
|
|||
try {
|
||||
const editorInstance = formInstance.getEditor(col.fieldName!)
|
||||
if (editorInstance) {
|
||||
const formItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
.find((i) => i.dataField === col.fieldName)
|
||||
const editorOptions = formItem?.editorOptions
|
||||
? JSON.parse(formItem.editorOptions)
|
||||
const editorOptions = col.editorOptions
|
||||
? JSON.parse(col.editorOptions)
|
||||
: {}
|
||||
|
||||
editorInstance.option(
|
||||
|
|
@ -804,7 +795,7 @@ const Tree = (props: TreeProps) => {
|
|||
setFormData,
|
||||
})
|
||||
} 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 formItems = gridDto.gridOptions.editingFormDto.flatMap((group) =>
|
||||
flattenEditingFormItems([group]),
|
||||
)
|
||||
const formItems = getEditingFormFields(gridDto)
|
||||
const scriptItems = formItems.filter((formItem) =>
|
||||
shouldRunEditorScriptOnContentReady(formItem.editorScript),
|
||||
)
|
||||
|
|
@ -1282,9 +1271,9 @@ const Tree = (props: TreeProps) => {
|
|||
|
||||
const editorValues = formItems.reduce<Record<string, any>>(
|
||||
(values, formItem) => {
|
||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
||||
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||
if (editorInstance?.option) {
|
||||
values[formItem.dataField] = editorInstance.option('value')
|
||||
values[formItem.fieldName!] = editorInstance.option('value')
|
||||
}
|
||||
return values
|
||||
},
|
||||
|
|
@ -1299,17 +1288,17 @@ const Tree = (props: TreeProps) => {
|
|||
|
||||
scriptItems.forEach((formItem) => {
|
||||
try {
|
||||
const editorInstance = form?.getEditor?.(formItem.dataField)
|
||||
const editorInstance = form?.getEditor?.(formItem.fieldName)
|
||||
const editorValue =
|
||||
editorInstance?.option?.('value') ??
|
||||
getValueByField(formData, formItem.dataField)
|
||||
getValueByField(formData, formItem.fieldName)
|
||||
const editor = {
|
||||
dataField: formItem.dataField,
|
||||
dataField: formItem.fieldName,
|
||||
component: grid,
|
||||
}
|
||||
const e = {
|
||||
component: form,
|
||||
dataField: formItem.dataField,
|
||||
dataField: formItem.fieldName,
|
||||
scriptEvent: 'contentReady',
|
||||
value: editorValue,
|
||||
}
|
||||
|
|
@ -1324,7 +1313,7 @@ const Tree = (props: TreeProps) => {
|
|||
} catch (err) {
|
||||
console.error(
|
||||
'Script exec error on contentReady',
|
||||
formItem.dataField,
|
||||
formItem.fieldName!,
|
||||
err,
|
||||
)
|
||||
}
|
||||
|
|
@ -1340,11 +1329,10 @@ const Tree = (props: TreeProps) => {
|
|||
...(e.component?.option?.('formData') || {}),
|
||||
}
|
||||
|
||||
const formItem = gridDto.gridOptions.editingFormDto
|
||||
.flatMap((group) => flattenEditingFormItems([group]))
|
||||
const formItem = getEditingFormFields(gridDto)
|
||||
.find(
|
||||
(i) =>
|
||||
String(i.dataField || '').toLowerCase() ===
|
||||
String(i.fieldName || '').toLowerCase() ===
|
||||
String(e.dataField || '').toLowerCase(),
|
||||
)
|
||||
if (formItem?.editorScript) {
|
||||
|
|
@ -1387,9 +1375,9 @@ const Tree = (props: TreeProps) => {
|
|||
}
|
||||
},
|
||||
items:
|
||||
gridDto.gridOptions.editingFormDto?.length > 0
|
||||
getEditingFormGroups(gridDto)?.length > 0
|
||||
? (() => {
|
||||
const sortedFormDto = gridDto.gridOptions.editingFormDto
|
||||
const sortedFormDto = getEditingFormGroups(gridDto)
|
||||
.slice()
|
||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||
|
||||
|
|
@ -1400,7 +1388,7 @@ const Tree = (props: TreeProps) => {
|
|||
const result: any[] = []
|
||||
|
||||
// Helper function: item mapper
|
||||
const mapFormItem = (i: EditingFormItemDto) => {
|
||||
const mapFormItem = (i: ColumnFormatDto) => {
|
||||
let editorOptions: EditorOptionsWithButtons = {}
|
||||
let parsedEditorOptions: EditorOptionsWithButtons = {}
|
||||
const forcedEditorOptions: EditorOptionsWithButtons = {}
|
||||
|
|
@ -1415,12 +1403,12 @@ const Tree = (props: TreeProps) => {
|
|||
const filters = extractSearchParamsFields(parsed)
|
||||
|
||||
const hasFilter = filters.some(
|
||||
([field, op, val]) => field === i.dataField,
|
||||
([field, op, val]) => field === i.fieldName,
|
||||
)
|
||||
|
||||
if (hasFilter) {
|
||||
const existsInExtra = extraFilters.some(
|
||||
(f) => f.fieldName === i.dataField && !!f.value,
|
||||
(f) => f.fieldName === i.fieldName && !!f.value,
|
||||
)
|
||||
|
||||
if (!existsInExtra) {
|
||||
|
|
@ -1429,13 +1417,11 @@ const Tree = (props: TreeProps) => {
|
|||
}
|
||||
}
|
||||
} 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 listFormField = gridDto.columnFormats.find(
|
||||
(x: any) => x.fieldName === fieldName,
|
||||
)
|
||||
const fieldName = i.fieldName!
|
||||
const listFormField = i
|
||||
|
||||
const defaultEditorOptions: EditorOptionsWithButtons = {}
|
||||
|
||||
|
|
@ -1484,8 +1470,8 @@ const Tree = (props: TreeProps) => {
|
|||
canExport: listFormField?.canExport ?? false,
|
||||
allowEditing: listFormField?.allowEditing ?? true,
|
||||
allowAdding: listFormField?.allowAdding ?? true,
|
||||
dataField: i.dataField,
|
||||
name: i.dataField,
|
||||
dataField: i.fieldName,
|
||||
name: i.fieldName,
|
||||
editorType2: i.editorType2,
|
||||
editorType:
|
||||
i.editorType2 == PlatformEditorTypes.dxGridBox
|
||||
|
|
@ -1503,12 +1489,12 @@ const Tree = (props: TreeProps) => {
|
|||
item.template = 'cellEditImageViewer'
|
||||
item.editorOptions = {
|
||||
...item.editorOptions,
|
||||
value: getValueByField(editingFormDataRef.current, i.dataField),
|
||||
value: getValueByField(editingFormDataRef.current, i.fieldName),
|
||||
}
|
||||
}
|
||||
|
||||
if (i.dataField.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.dataField.split(':')[1]) }
|
||||
if (i.fieldName?.indexOf(':') >= 0) {
|
||||
item.label = { text: captionize(i.fieldName.split(':')[1]) }
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
@ -1532,7 +1518,9 @@ const Tree = (props: TreeProps) => {
|
|||
colSpan: e.colSpan,
|
||||
caption: e.caption, // Group'larda caption olmalı
|
||||
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)
|
||||
.filter((a: any) => {
|
||||
if (mode === 'view') {
|
||||
|
|
@ -1561,7 +1549,9 @@ const Tree = (props: TreeProps) => {
|
|||
title: tabbedItem.caption, // Her tab'ın title'ı
|
||||
colCount: effectiveColCount,
|
||||
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)
|
||||
.filter((a: any) => {
|
||||
if (mode === 'view') {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,24 @@ import type { DataType } from 'devextreme/common'
|
|||
import type { PivotGridDataType } from 'devextreme/ui/pivot_grid/data_source'
|
||||
import { MULTIVALUE_DELIMITER } from '../../constants/app.constant'
|
||||
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 {
|
||||
fieldName: string
|
||||
|
|
|
|||
|
|
@ -11,13 +11,12 @@ import { dynamicFetch } from '@/services/form.service'
|
|||
import { GridColumnData } from './GridColumnData'
|
||||
import {
|
||||
ColumnFormatDto,
|
||||
EditingFormItemDto,
|
||||
GridDto,
|
||||
PlatformEditorTypes,
|
||||
UiCommandButtonPositionTypeEnum,
|
||||
UiLookupDataSourceTypeEnum,
|
||||
} from '@/proxy/form/models'
|
||||
import { addCss } from './Utils'
|
||||
import { addCss, getEditingFormFields } from './Utils'
|
||||
|
||||
const NO_IMAGE = '/img/others/no-image.png'
|
||||
|
||||
|
|
@ -926,12 +925,11 @@ const useListFormColumns = ({
|
|||
// #region lookup ayarlari
|
||||
if (colData.lookupDto?.dataSourceType) {
|
||||
// UiColumnEditorTemplateTypeEnum : None:0, Table:1, TagBox:2
|
||||
const allItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
||||
const formItem = allItems.find((a) => a?.dataField === colData.fieldName)
|
||||
const formItem = colData.editOrderNo != null ? colData : undefined
|
||||
if (formItem?.editorType2 === PlatformEditorTypes.dxTagBox) {
|
||||
column.extras = {
|
||||
multiValue: true,
|
||||
editorOptions: formItem.editorOptions,
|
||||
editorOptions,
|
||||
tagBoxOptions: formItem.tagBoxOptions,
|
||||
}
|
||||
column.editCellTemplate = 'cellEditTagBox'
|
||||
|
|
@ -940,7 +938,7 @@ const useListFormColumns = ({
|
|||
} else if (formItem?.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||
column.extras = {
|
||||
multiValue: false,
|
||||
editorOptions: formItem.editorOptions,
|
||||
editorOptions,
|
||||
gridBoxOptions: formItem.gridBoxOptions,
|
||||
}
|
||||
column.editCellTemplate = 'cellEditGridBox'
|
||||
|
|
@ -976,8 +974,7 @@ const useListFormColumns = ({
|
|||
|
||||
// #region image upload editor
|
||||
if (!colData.lookupDto?.dataSourceType) {
|
||||
const allFormItems = gridDto.gridOptions.editingFormDto.flatMap((group) => group.items)
|
||||
const imageFormItem = allFormItems.find((a) => a?.dataField === colData.fieldName)
|
||||
const imageFormItem = colData.editOrderNo != null ? colData : undefined
|
||||
const isImageUploadEditor =
|
||||
imageFormItem?.editorType2 === PlatformEditorTypes.dxImageUpload
|
||||
const isImageViewerEditor =
|
||||
|
|
@ -1006,7 +1003,7 @@ const useListFormColumns = ({
|
|||
}
|
||||
column.extras = {
|
||||
multiValue: imageUploadOptions?.multiple ?? false,
|
||||
editorOptions: imageFormItem?.editorOptions ?? colData.editorOptions,
|
||||
editorOptions,
|
||||
imageUploadOptions: imageUploadOptions,
|
||||
}
|
||||
if (isImageUploadEditor) {
|
||||
|
|
@ -1091,25 +1088,19 @@ const useListFormColumns = ({
|
|||
}
|
||||
}
|
||||
|
||||
// FormEditingExtraItem
|
||||
// Devexpress Gridde kaydete basılınca
|
||||
// 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
|
||||
// Formda kullanılan fakat listede görünmeyen ColumnFormatDto alanlarını
|
||||
// DevExtreme'in düzenleme modeline gizli kolon olarak ekliyoruz.
|
||||
if (columns?.length) {
|
||||
gridDto.gridOptions.editingFormDto.forEach((group) => {
|
||||
group.items?.forEach((item: EditingFormItemDto) => {
|
||||
if (!columns.some((a) => a.dataField === item.dataField)) {
|
||||
columns.push({
|
||||
dataField: item.dataField,
|
||||
visible: false,
|
||||
showInColumnChooser: false,
|
||||
allowSearch: false
|
||||
})
|
||||
insertedColumns.push(item.dataField)
|
||||
}
|
||||
})
|
||||
getEditingFormFields(gridDto).forEach((item: ColumnFormatDto) => {
|
||||
if (!columns.some((a) => a.dataField === item.fieldName)) {
|
||||
columns.push({
|
||||
dataField: item.fieldName,
|
||||
visible: false,
|
||||
showInColumnChooser: false,
|
||||
allowSearch: false,
|
||||
})
|
||||
insertedColumns.push(item.fieldName)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue