listForm ve Chart birleştirildi
This commit is contained in:
parent
04cf4328cb
commit
e74484fbc2
20 changed files with 426 additions and 297 deletions
|
|
@ -28,7 +28,8 @@ public class ListFormAutoMapperProfile : Profile
|
||||||
CreateMap<ExtraFilterEditDto, ExtraFilterDto>()
|
CreateMap<ExtraFilterEditDto, ExtraFilterDto>()
|
||||||
.ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.Items));
|
.ForMember(dest => dest.Items, opt => opt.MapFrom(src => src.Items));
|
||||||
CreateMap<ExtraFilterEditDto, ExtraFilter>().ReverseMap();
|
CreateMap<ExtraFilterEditDto, ExtraFilter>().ReverseMap();
|
||||||
CreateMap<ChartSeriesDto, ChartSeries>();
|
CreateMap<ChartSeriesDto, ChartSeries>().ReverseMap();
|
||||||
|
CreateMap<ChartLabelDto, ChartLabel>();
|
||||||
|
|
||||||
CreateMap<ChartValueAxisDto, ChartValueAxis>();
|
CreateMap<ChartValueAxisDto, ChartValueAxis>();
|
||||||
CreateMap<ChartAxisGridDto, ChartAxisGrid>();
|
CreateMap<ChartAxisGridDto, ChartAxisGrid>();
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,25 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Domain.Values;
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
namespace Kurs.Platform.Queries;
|
namespace Kurs.Platform.Queries;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Break tanımı
|
||||||
|
/// </summary>
|
||||||
public class Break : ValueObject
|
public class Break : ValueObject
|
||||||
{
|
{
|
||||||
public int EndValue { get; set; }
|
[JsonPropertyName("StartValue")]
|
||||||
public int StartValue { get; set; }
|
public int StartValue { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("EndValue")]
|
||||||
|
public int EndValue { get; private set; }
|
||||||
|
|
||||||
|
protected Break() { } // Json buradan set edecek
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
yield return EndValue;
|
|
||||||
yield return StartValue;
|
yield return StartValue;
|
||||||
|
yield return EndValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,24 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Domain.Values;
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
namespace Kurs.Platform.Queries;
|
namespace Kurs.Platform.Queries;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Break style tanımı
|
||||||
|
/// </summary>
|
||||||
public class BreakStyle : ValueObject
|
public class BreakStyle : ValueObject
|
||||||
{
|
{
|
||||||
public string Color { get; private set; } = "#ababab";
|
[JsonPropertyName("Color")]
|
||||||
public string Line { get; private set; } = "waved";
|
public string Color { get; private set; }
|
||||||
public int Width { get; private set; } = 5;
|
|
||||||
|
[JsonPropertyName("Line")]
|
||||||
|
public string Line { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Width")]
|
||||||
|
public int Width { get; private set; }
|
||||||
|
|
||||||
|
protected BreakStyle() { }
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,24 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Domain.Values;
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
namespace Kurs.Platform.Queries;
|
namespace Kurs.Platform.Queries;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Grid tanımı
|
||||||
|
/// </summary>
|
||||||
public class ChartAxisGrid : ValueObject
|
public class ChartAxisGrid : ValueObject
|
||||||
{
|
{
|
||||||
public string Color { get; private set; } = "#d3d3d3";
|
[JsonPropertyName("Color")]
|
||||||
|
public string Color { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Visible")]
|
||||||
public bool Visible { get; private set; }
|
public bool Visible { get; private set; }
|
||||||
public int Width { get; private set; } = 1;
|
|
||||||
|
|
||||||
private ChartAxisGrid() { } // EF Core için gerekli
|
[JsonPropertyName("Width")]
|
||||||
|
public int Width { get; private set; }
|
||||||
|
|
||||||
public ChartAxisGrid(string color, bool visible, int width)
|
protected ChartAxisGrid() { }
|
||||||
{
|
|
||||||
Color = string.IsNullOrWhiteSpace(color) ? "#d3d3d3" : color;
|
|
||||||
Visible = visible;
|
|
||||||
Width = width > 0 ? width : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ public class ChartFont : ValueObject
|
||||||
public int Size { get; private set; } = 12;
|
public int Size { get; private set; } = 12;
|
||||||
public int Weight { get; private set; } = 400;
|
public int Weight { get; private set; } = 400;
|
||||||
|
|
||||||
|
// EF Core + JSON için korumalı ctor
|
||||||
|
protected ChartFont() { }
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
yield return Color;
|
yield return Color;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ public class ChartLabel : ValueObject
|
||||||
public bool Visible { get; private set; }
|
public bool Visible { get; private set; }
|
||||||
public string Format { get; private set; }
|
public string Format { get; private set; }
|
||||||
|
|
||||||
|
// EF Core + JSON için korumalı ctor
|
||||||
|
protected ChartLabel() { }
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
yield return BackgroundColor;
|
yield return BackgroundColor;
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,55 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Domain.Values;
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
namespace Kurs.Platform.Queries;
|
namespace Kurs.Platform.Queries;
|
||||||
|
|
||||||
public class ChartSeries : ValueObject
|
public class ChartSeries : ValueObject
|
||||||
{
|
{
|
||||||
|
[JsonPropertyName("ArgumentField")]
|
||||||
public string ArgumentField { get; private set; } = "arg";
|
public string ArgumentField { get; private set; } = "arg";
|
||||||
|
[JsonPropertyName("Axis")]
|
||||||
public string Axis { get; private set; }
|
public string Axis { get; private set; }
|
||||||
|
[JsonPropertyName("BarOverlapGroup")]
|
||||||
public string BarOverlapGroup { get; private set; }
|
public string BarOverlapGroup { get; private set; }
|
||||||
|
[JsonPropertyName("BarPadding")]
|
||||||
public int BarPadding { get; private set; }
|
public int BarPadding { get; private set; }
|
||||||
|
[JsonPropertyName("BarWidth")]
|
||||||
public int BarWidth { get; private set; }
|
public int BarWidth { get; private set; }
|
||||||
|
[JsonPropertyName("Color")]
|
||||||
public string Color { get; private set; }
|
public string Color { get; private set; }
|
||||||
|
[JsonPropertyName("CornerRadius")]
|
||||||
public int CornerRadius { get; private set; } = 0;
|
public int CornerRadius { get; private set; } = 0;
|
||||||
|
[JsonPropertyName("DashStyle")]
|
||||||
public string DashStyle { get; private set; } = "solid";
|
public string DashStyle { get; private set; } = "solid";
|
||||||
|
[JsonPropertyName("IgnoreEmptyPoints")]
|
||||||
public bool IgnoreEmptyPoints { get; private set; } = false;
|
public bool IgnoreEmptyPoints { get; private set; } = false;
|
||||||
|
[JsonPropertyName("Name")]
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
|
[JsonPropertyName("Pane")]
|
||||||
public string Pane { get; private set; }
|
public string Pane { get; private set; }
|
||||||
|
[JsonPropertyName("RangeValue1Field")]
|
||||||
public string RangeValue1Field { get; private set; } = "val1";
|
public string RangeValue1Field { get; private set; } = "val1";
|
||||||
|
[JsonPropertyName("RangeValue2Field")]
|
||||||
public string RangeValue2Field { get; private set; } = "val2";
|
public string RangeValue2Field { get; private set; } = "val2";
|
||||||
|
[JsonPropertyName("SelectionMode")]
|
||||||
public string SelectionMode { get; private set; } = "none";
|
public string SelectionMode { get; private set; } = "none";
|
||||||
|
[JsonPropertyName("ShowInLegend")]
|
||||||
public bool ShowInLegend { get; private set; } = true;
|
public bool ShowInLegend { get; private set; } = true;
|
||||||
|
[JsonPropertyName("Type")]
|
||||||
public string Type { get; private set; }
|
public string Type { get; private set; }
|
||||||
|
[JsonPropertyName("ValueField")]
|
||||||
public string ValueField { get; private set; }
|
public string ValueField { get; private set; }
|
||||||
|
[JsonPropertyName("Visible")]
|
||||||
public bool Visible { get; private set; } = true;
|
public bool Visible { get; private set; } = true;
|
||||||
|
[JsonPropertyName("Width")]
|
||||||
public int Width { get; private set; } = 2;
|
public int Width { get; private set; } = 2;
|
||||||
|
[JsonPropertyName("Label")]
|
||||||
public ChartLabel Label { get; private set; }
|
public ChartLabel Label { get; private set; }
|
||||||
|
|
||||||
|
// EF Core + JSON için korumalı ctor
|
||||||
|
public ChartSeries() { }
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
yield return ArgumentField;
|
yield return ArgumentField;
|
||||||
|
|
|
||||||
|
|
@ -1,53 +1,61 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using Volo.Abp.Domain.Values;
|
using Volo.Abp.Domain.Values;
|
||||||
|
|
||||||
namespace Kurs.Platform.Queries;
|
namespace Kurs.Platform.Queries;
|
||||||
|
|
||||||
public class ChartValueAxis : ValueObject
|
public class ChartValueAxis : ValueObject
|
||||||
{
|
{
|
||||||
|
[JsonPropertyName("Grid")]
|
||||||
public ChartAxisGrid Grid { get; private set; }
|
public ChartAxisGrid Grid { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Name")]
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
public string Position { get; private set; } = "left";
|
|
||||||
|
[JsonPropertyName("Position")]
|
||||||
|
public string Position { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Title")]
|
||||||
public string Title { get; private set; }
|
public string Title { get; private set; }
|
||||||
public string ValueType { get; private set; } = "numeric";
|
|
||||||
public bool Visible { get; private set; } = true;
|
[JsonPropertyName("ValueType")]
|
||||||
public int Width { get; private set; } = 1;
|
public string ValueType { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Visible")]
|
||||||
|
public bool Visible { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Width")]
|
||||||
|
public int Width { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Breaks")]
|
||||||
public IReadOnlyCollection<Break> Breaks { get; private set; }
|
public IReadOnlyCollection<Break> Breaks { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("BreakStyle")]
|
||||||
public BreakStyle BreakStyle { get; private set; }
|
public BreakStyle BreakStyle { get; private set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("Type")]
|
||||||
public string Type { get; private set; }
|
public string Type { get; private set; }
|
||||||
public bool AutoBreaksEnabled { get; private set; } = true;
|
|
||||||
public int MaxAutoBreakCount { get; private set; } = 2;
|
|
||||||
|
|
||||||
public ChartValueAxis(
|
[JsonPropertyName("AutoBreaksEnabled")]
|
||||||
ChartAxisGrid grid,
|
public bool AutoBreaksEnabled { get; private set; }
|
||||||
string name,
|
|
||||||
string position,
|
[JsonPropertyName("MaxAutoBreakCount")]
|
||||||
string title,
|
public int MaxAutoBreakCount { get; private set; }
|
||||||
string valueType,
|
|
||||||
bool visible,
|
// 🔑 Bunu bırak yeterli
|
||||||
int width,
|
[JsonConstructor]
|
||||||
IEnumerable<Break> breaks,
|
protected ChartValueAxis()
|
||||||
BreakStyle breakStyle,
|
|
||||||
string type,
|
|
||||||
bool autoBreaksEnabled,
|
|
||||||
int maxAutoBreakCount)
|
|
||||||
{
|
{
|
||||||
Grid = grid;
|
Breaks = [];
|
||||||
Name = name;
|
Position = "left";
|
||||||
Position = position ?? "left";
|
ValueType = "numeric";
|
||||||
Title = title;
|
Visible = true;
|
||||||
ValueType = valueType ?? "numeric";
|
Width = 1;
|
||||||
Visible = visible;
|
AutoBreaksEnabled = true;
|
||||||
Width = width > 0 ? width : 1;
|
MaxAutoBreakCount = 2;
|
||||||
Breaks = breaks?.ToList() ?? [];
|
|
||||||
BreakStyle = breakStyle;
|
|
||||||
Type = type;
|
|
||||||
AutoBreaksEnabled = autoBreaksEnabled;
|
|
||||||
MaxAutoBreakCount = maxAutoBreakCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override IEnumerable<object> GetAtomicValues()
|
protected override IEnumerable<object> GetAtomicValues()
|
||||||
{
|
{
|
||||||
yield return Grid;
|
yield return Grid;
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ export interface ChartFontDto {
|
||||||
export interface ChartLabelDto {
|
export interface ChartLabelDto {
|
||||||
backgroundColor?: string
|
backgroundColor?: string
|
||||||
customizeText?: string
|
customizeText?: string
|
||||||
font: ChartFontDto
|
font?: ChartFontDto | null
|
||||||
visible: boolean
|
visible: boolean
|
||||||
format?: string
|
format?: string
|
||||||
}
|
}
|
||||||
|
|
@ -285,9 +285,9 @@ export interface ChartOptionsRequestDto {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChartPanesDto {
|
export interface ChartPanesDto {
|
||||||
|
name: string
|
||||||
backgroundColor?: string
|
backgroundColor?: string
|
||||||
height: number
|
height: number
|
||||||
name?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChartScrollBarDto {
|
export interface ChartScrollBarDto {
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ export interface ListFormJsonRowDto {
|
||||||
itemExtraFilter?: ExtraFilterEditDto
|
itemExtraFilter?: ExtraFilterEditDto
|
||||||
|
|
||||||
itemChartAnnotation?: ChartAnnotationDto
|
itemChartAnnotation?: ChartAnnotationDto
|
||||||
itemChartPane?: ChartPanesDto
|
itemChartPanes?: ChartPanesDto
|
||||||
itemChartSerie?: ChartSeriesDto
|
itemChartSeries?: ChartSeriesDto
|
||||||
itemChartValueAxis?: ChartValueAxisDto
|
itemChartValueAxis?: ChartValueAxisDto
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export interface AdminStoreActions {
|
||||||
setListFormValues: Action<AdminStoreModel, GridOptionsEditDto>
|
setListFormValues: Action<AdminStoreModel, GridOptionsEditDto>
|
||||||
setJsonValue: Action<
|
setJsonValue: Action<
|
||||||
AdminStoreModel,
|
AdminStoreModel,
|
||||||
{ field: keyof GridOptionsEditDto; data: FieldsDefaultValueDto[] }
|
{ field: keyof GridOptionsEditDto; data: any[] }
|
||||||
>
|
>
|
||||||
getListFormValues: Thunk<AdminStoreActions, string | undefined, Injections>
|
getListFormValues: Thunk<AdminStoreActions, string | undefined, Injections>
|
||||||
// onSetLang: ThunkOn<AdminModel, Injections, StoreModel>
|
// onSetLang: ThunkOn<AdminModel, Injections, StoreModel>
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import {
|
||||||
import { ChartSeriesDto } from '@/proxy/admin/charts/models'
|
import { ChartSeriesDto } from '@/proxy/admin/charts/models'
|
||||||
import { JsonRowDialogData } from './json-row-operations/types'
|
import { JsonRowDialogData } from './json-row-operations/types'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
import JsonRowOpDialogAnnotation from './json-row-operations/JsonRowOpDialogAnnotation'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = object().shape({
|
||||||
name: string().required(),
|
name: string().required(),
|
||||||
|
|
@ -93,7 +94,7 @@ function ChartTabAnnotations(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
||||||
operation: 'create',
|
operation: 'create',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index: -1,
|
index: -1,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
@ -124,9 +125,9 @@ function ChartTabAnnotations(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
chartAnnotationValues: values.annotationsDto[index],
|
chartAnnotationValues: listFormValues.annotationsDto[index],
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
}}
|
}}
|
||||||
|
|
@ -142,7 +143,7 @@ function ChartTabAnnotations(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartAnnotations.GeneralJsonRow,
|
||||||
operation: 'delete',
|
operation: 'delete',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
@ -161,6 +162,12 @@ function ChartTabAnnotations(props: FormEditProps) {
|
||||||
</TBody>
|
</TBody>
|
||||||
</Table>
|
</Table>
|
||||||
</Card>
|
</Card>
|
||||||
|
<JsonRowOpDialogAnnotation
|
||||||
|
isOpen={isJsonRowOpDialogOpen}
|
||||||
|
setIsOpen={setIsJsonRowOpDialogOpen}
|
||||||
|
data={jsonRowOpModalData}
|
||||||
|
setData={setJsonRowOpModalData}
|
||||||
|
/>
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="annotations_common">
|
<TabContent value="annotations_common">
|
||||||
<Card className="my-2">
|
<Card className="my-2">
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ function ChartTabAxis(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
||||||
operation: 'create',
|
operation: 'create',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index: -1,
|
index: -1,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
@ -118,9 +118,9 @@ function ChartTabAxis(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
chartValueAxisValues: values.valueAxisDto[index],
|
chartValueAxisValues: listFormValues.valueAxisDto[index],
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
}}
|
}}
|
||||||
|
|
@ -136,7 +136,7 @@ function ChartTabAxis(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
tabName: ListFormEditTabs.ChartAxis.ValueAxisJsonRow,
|
||||||
operation: 'delete',
|
operation: 'delete',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ import { useState } from 'react'
|
||||||
import JsonRowOpDialogPane from './json-row-operations/JsonRowOpDialogPane'
|
import JsonRowOpDialogPane from './json-row-operations/JsonRowOpDialogPane'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = object().shape({
|
||||||
|
height: string().required('Height Required'),
|
||||||
|
name: string().required('Name Required'),
|
||||||
backgroundColor: string().notRequired(),
|
backgroundColor: string().notRequired(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -75,7 +77,7 @@ function ChartTabPanes(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
||||||
operation: 'create',
|
operation: 'create',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index: -1,
|
index: -1,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
@ -103,9 +105,9 @@ function ChartTabPanes(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
chartPaneValues: values.panesDto[index],
|
chartPaneValues: listFormValues.panesDto[index],
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
}}
|
}}
|
||||||
|
|
@ -121,7 +123,7 @@ function ChartTabPanes(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
tabName: ListFormEditTabs.ChartPanes.PanesJsonRow,
|
||||||
operation: 'delete',
|
operation: 'delete',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ function ChartTabSeries(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
||||||
operation: 'create',
|
operation: 'create',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index: -1,
|
index: -1,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
@ -132,9 +132,9 @@ function ChartTabSeries(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
||||||
operation: 'update',
|
operation: 'update',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
chartSeriesValues: values.seriesDto[index],
|
chartSeriesValues: listFormValues.seriesDto[index],
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
}}
|
}}
|
||||||
|
|
@ -150,7 +150,7 @@ function ChartTabSeries(props: FormEditProps) {
|
||||||
setJsonRowOpModalData({
|
setJsonRowOpModalData({
|
||||||
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
tabName: ListFormEditTabs.ChartSeries.GeneralJsonRow,
|
||||||
operation: 'delete',
|
operation: 'delete',
|
||||||
id: values.id ?? '',
|
id: listFormValues.id ?? '',
|
||||||
index,
|
index,
|
||||||
})
|
})
|
||||||
setIsJsonRowOpDialogOpen(true)
|
setIsJsonRowOpDialogOpen(true)
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ function FormFieldTabPivotSetting({
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
validationSchema={schema}
|
validationSchema={schema}
|
||||||
onSubmit={async (values, formikHelpers) => {
|
onSubmit={async (values, formikHelpers) => {
|
||||||
//console.log(values)
|
|
||||||
await onSubmit(ListFormFieldEditTabs.PivotSettingsForm, values, formikHelpers)
|
await onSubmit(ListFormFieldEditTabs.PivotSettingsForm, values, formikHelpers)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ function JsonRowOpDialogAnnotation({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const resp = await getListFormJsonRow(data.id, data.tabName)
|
const resp = await getListFormJsonRow(data.id, data.tabName)
|
||||||
setJsonValue({ field: 'panesDto', data: resp.data })
|
setJsonValue({ field: 'annotationsDto', data: resp.data })
|
||||||
}
|
}
|
||||||
|
|
||||||
setData(undefined)
|
setData(undefined)
|
||||||
|
|
@ -92,7 +92,7 @@ function JsonRowOpDialogAnnotation({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
id="paneOperation"
|
id="annotationOperation"
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
preventScroll={true}
|
preventScroll={true}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
|
|
@ -182,6 +182,7 @@ function JsonRowOpDialogAnnotation({
|
||||||
<TabNav value="annotations_border">Border</TabNav>
|
<TabNav value="annotations_border">Border</TabNav>
|
||||||
</TabList>
|
</TabList>
|
||||||
<TabContent value="annotations_general">
|
<TabContent value="annotations_general">
|
||||||
|
<div className="p-2">
|
||||||
<FormItem
|
<FormItem
|
||||||
label="Tooltip Enabled"
|
label="Tooltip Enabled"
|
||||||
invalid={errors.tooltipEnabled && touched.tooltipEnabled}
|
invalid={errors.tooltipEnabled && touched.tooltipEnabled}
|
||||||
|
|
@ -205,7 +206,9 @@ function JsonRowOpDialogAnnotation({
|
||||||
value={chartAnnotationTypeListOptions.filter(
|
value={chartAnnotationTypeListOptions.filter(
|
||||||
(option) => option.value === values.type,
|
(option) => option.value === values.type,
|
||||||
)}
|
)}
|
||||||
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
onChange={(option) =>
|
||||||
|
form.setFieldValue(field.name, option?.value)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
@ -287,7 +290,9 @@ function JsonRowOpDialogAnnotation({
|
||||||
value={chartTitleWordWrapListOptions.filter(
|
value={chartTitleWordWrapListOptions.filter(
|
||||||
(option) => option.value === values.wordWrap,
|
(option) => option.value === values.wordWrap,
|
||||||
)}
|
)}
|
||||||
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
onChange={(option) =>
|
||||||
|
form.setFieldValue(field.name, option?.value)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
@ -341,11 +346,19 @@ function JsonRowOpDialogAnnotation({
|
||||||
<Field type="number" name="paddingTopBottom" component={Input} />
|
<Field type="number" name="paddingTopBottom" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="X" invalid={errors.x && touched.x} errorMessage={errors.x}>
|
<FormItem
|
||||||
|
label="X"
|
||||||
|
invalid={errors.x && touched.x}
|
||||||
|
errorMessage={errors.x}
|
||||||
|
>
|
||||||
<Field type="number" name="x" component={Input} />
|
<Field type="number" name="x" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem label="Y" invalid={errors.y && touched.y} errorMessage={errors.y}>
|
<FormItem
|
||||||
|
label="Y"
|
||||||
|
invalid={errors.y && touched.y}
|
||||||
|
errorMessage={errors.y}
|
||||||
|
>
|
||||||
<Field type="number" name="y" component={Input} />
|
<Field type="number" name="y" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
|
@ -364,8 +377,10 @@ function JsonRowOpDialogAnnotation({
|
||||||
>
|
>
|
||||||
<Field type="number" name="offsetY" component={Input} />
|
<Field type="number" name="offsetY" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
</div>
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="annotations_border">
|
<TabContent value="annotations_border">
|
||||||
|
<div className="p-2">
|
||||||
<FormItem
|
<FormItem
|
||||||
label="Visible"
|
label="Visible"
|
||||||
invalid={errors.border?.visible && touched.border?.visible}
|
invalid={errors.border?.visible && touched.border?.visible}
|
||||||
|
|
@ -397,7 +412,9 @@ function JsonRowOpDialogAnnotation({
|
||||||
value={chartSeriesDashStyleOptions.filter(
|
value={chartSeriesDashStyleOptions.filter(
|
||||||
(option) => option.value === values.border.dashStyle,
|
(option) => option.value === values.border.dashStyle,
|
||||||
)}
|
)}
|
||||||
onChange={(option) => form.setFieldValue(field.name, option?.value)}
|
onChange={(option) =>
|
||||||
|
form.setFieldValue(field.name, option?.value)
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
|
|
@ -410,6 +427,7 @@ function JsonRowOpDialogAnnotation({
|
||||||
>
|
>
|
||||||
<Field type="number" name="border.width" component={Input} />
|
<Field type="number" name="border.width" component={Input} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
</div>
|
||||||
</TabContent>
|
</TabContent>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models'
|
||||||
import { SelectBoxOption } from '@/shared/types'
|
import { SelectBoxOption } from '@/shared/types'
|
||||||
import { useStoreActions } from '@/store'
|
import { useStoreActions } from '@/store'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { Field, FieldArray, FieldProps, Form, Formik, FormikProps } from 'formik'
|
import { Field, FieldArray, FieldProps, Form, Formik, FormikProps, getIn } from 'formik'
|
||||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
import { Dispatch, SetStateAction } from 'react'
|
||||||
import { getIn, number, object, string } from 'yup'
|
import * as Yup from 'yup'
|
||||||
import { JsonRowDialogData } from './types'
|
import { JsonRowDialogData } from './types'
|
||||||
import {
|
import {
|
||||||
deleteListFormJsonRow,
|
deleteListFormJsonRow,
|
||||||
|
|
@ -36,10 +36,30 @@ import {
|
||||||
} from '../options'
|
} from '../options'
|
||||||
import { BreakDto } from '@/proxy/admin/charts/models'
|
import { BreakDto } from '@/proxy/admin/charts/models'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = Yup.object().shape({
|
||||||
name: string().required('Name Required'),
|
visible: Yup.boolean().notRequired(),
|
||||||
backgroundColor: string().notRequired(),
|
valueType: Yup.string().notRequired(),
|
||||||
height: number().notRequired(),
|
type: Yup.string().notRequired(),
|
||||||
|
position: Yup.string().notRequired(),
|
||||||
|
name: Yup.string().required('Name Required'),
|
||||||
|
title: Yup.string().notRequired(),
|
||||||
|
width: Yup.number().min(0, 'Width must be greater than or equal to 0').notRequired(),
|
||||||
|
grid: Yup.object().shape({
|
||||||
|
color: Yup.string().notRequired(),
|
||||||
|
visible: Yup.boolean().notRequired(),
|
||||||
|
width: Yup.number().min(0, 'Width must be greater than or equal to 0').notRequired(),
|
||||||
|
}),
|
||||||
|
breakStyle: Yup.object().shape({
|
||||||
|
color: Yup.string().notRequired(),
|
||||||
|
line: Yup.string().notRequired(),
|
||||||
|
width: Yup.number().min(0, 'Width must be greater than or equal to 0').notRequired(),
|
||||||
|
}),
|
||||||
|
breaks: Yup.array().of(
|
||||||
|
Yup.object().shape({
|
||||||
|
startValue: Yup.number().required(),
|
||||||
|
endValue: Yup.number().required(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
function JsonRowOpDialogAxis({
|
function JsonRowOpDialogAxis({
|
||||||
|
|
@ -63,7 +83,8 @@ function JsonRowOpDialogAxis({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const resp = await getListFormJsonRow(data.id, data.tabName)
|
const resp = await getListFormJsonRow(data.id, data.tabName)
|
||||||
setJsonValue({ field: 'axisDto', data: resp.data })
|
|
||||||
|
setJsonValue({ field: 'valueAxisDto', data: resp.data })
|
||||||
}
|
}
|
||||||
|
|
||||||
setData(undefined)
|
setData(undefined)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import {
|
||||||
toast,
|
toast,
|
||||||
} from '@/components/ui'
|
} from '@/components/ui'
|
||||||
import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models'
|
import { ListFormJsonRowDto } from '@/proxy/admin/list-form/models'
|
||||||
import { SelectBoxOption } from '@/shared/types'
|
|
||||||
import { useStoreActions, useStoreState } from '@/store'
|
import { useStoreActions, useStoreState } from '@/store'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { Field, Form, Formik } from 'formik'
|
import { Field, Form, Formik } from 'formik'
|
||||||
|
|
@ -76,20 +75,19 @@ function JsonRowOpDialogPane({
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={
|
initialValues={
|
||||||
data.chartPaneValues ?? {
|
data.chartPaneValues ?? {
|
||||||
|
name: '',
|
||||||
backgroundColor: '',
|
backgroundColor: '',
|
||||||
height: 200,
|
height: 200,
|
||||||
name: '',
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
validationSchema={schema}
|
validationSchema={schema}
|
||||||
onSubmit={async (values, { setSubmitting }) => {
|
onSubmit={async (values, { setSubmitting }) => {
|
||||||
console.log('submit', values)
|
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
try {
|
try {
|
||||||
const input: ListFormJsonRowDto = {
|
const input: ListFormJsonRowDto = {
|
||||||
index: data.index,
|
index: data.index,
|
||||||
fieldName: data.tabName,
|
fieldName: data.tabName,
|
||||||
itemChartPane: values,
|
itemChartPanes: values,
|
||||||
}
|
}
|
||||||
if (data.index === -1) {
|
if (data.index === -1) {
|
||||||
await postListFormJsonRow(data.id, input)
|
await postListFormJsonRow(data.id, input)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import { useStoreActions } from '@/store'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import { Field, FieldProps, Form, Formik } from 'formik'
|
import { Field, FieldProps, Form, Formik } from 'formik'
|
||||||
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
import { Dispatch, SetStateAction, useEffect, useState } from 'react'
|
||||||
import { number, object, string } from 'yup'
|
import { boolean, number, object, string } from 'yup'
|
||||||
import { JsonRowDialogData } from './types'
|
import { JsonRowDialogData } from './types'
|
||||||
import {
|
import {
|
||||||
deleteListFormJsonRow,
|
deleteListFormJsonRow,
|
||||||
|
|
@ -32,7 +32,33 @@ import {
|
||||||
} from '../options'
|
} from '../options'
|
||||||
|
|
||||||
const schema = object().shape({
|
const schema = object().shape({
|
||||||
|
visible: boolean().notRequired(),
|
||||||
|
showInLegend: boolean().notRequired(),
|
||||||
|
ignoreEmptyPoints: boolean().notRequired(),
|
||||||
|
type: string().notRequired(),
|
||||||
name: string().required('Name Required'),
|
name: string().required('Name Required'),
|
||||||
|
argumentField: string().notRequired(),
|
||||||
|
valueField: string().notRequired(),
|
||||||
|
axis: string().notRequired(),
|
||||||
|
pane: string().notRequired(),
|
||||||
|
dashStyle: string().notRequired(),
|
||||||
|
color: string().notRequired(),
|
||||||
|
selectionMode: string().notRequired(),
|
||||||
|
width: number().notRequired(),
|
||||||
|
cornerRadius: number().notRequired(),
|
||||||
|
label: object().shape({
|
||||||
|
visible: boolean().notRequired(),
|
||||||
|
backgroundColor: string().notRequired(),
|
||||||
|
customizeText: string().notRequired(),
|
||||||
|
format: string().notRequired(),
|
||||||
|
font: object().notRequired(),
|
||||||
|
}),
|
||||||
|
|
||||||
|
barOverlapGroup: string().notRequired(),
|
||||||
|
barPadding: number().notRequired(),
|
||||||
|
barWidth: number().notRequired(),
|
||||||
|
rangeValue1Field: string().notRequired(),
|
||||||
|
rangeValue2Field: string().notRequired(),
|
||||||
backgroundColor: string().notRequired(),
|
backgroundColor: string().notRequired(),
|
||||||
height: number().notRequired(),
|
height: number().notRequired(),
|
||||||
})
|
})
|
||||||
|
|
@ -58,7 +84,7 @@ function JsonRowOpDialogSeries({
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const resp = await getListFormJsonRow(data.id, data.tabName)
|
const resp = await getListFormJsonRow(data.id, data.tabName)
|
||||||
setJsonValue({ field: 'panesDto', data: resp.data })
|
setJsonValue({ field: 'seriesDto', data: resp.data })
|
||||||
}
|
}
|
||||||
|
|
||||||
setData(undefined)
|
setData(undefined)
|
||||||
|
|
@ -104,7 +130,6 @@ function JsonRowOpDialogSeries({
|
||||||
<Formik
|
<Formik
|
||||||
initialValues={
|
initialValues={
|
||||||
data.chartSeriesValues ?? {
|
data.chartSeriesValues ?? {
|
||||||
id: '',
|
|
||||||
argumentField: '',
|
argumentField: '',
|
||||||
axis: '',
|
axis: '',
|
||||||
barOverlapGroup: '',
|
barOverlapGroup: '',
|
||||||
|
|
@ -137,11 +162,10 @@ function JsonRowOpDialogSeries({
|
||||||
onSubmit={async (values, { setSubmitting }) => {
|
onSubmit={async (values, { setSubmitting }) => {
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
try {
|
try {
|
||||||
console.log(values)
|
|
||||||
const input: ListFormJsonRowDto = {
|
const input: ListFormJsonRowDto = {
|
||||||
index: data.index,
|
index: data.index,
|
||||||
fieldName: data.tabName,
|
fieldName: data.tabName,
|
||||||
itemChartSerie: values,
|
itemChartSeries: values,
|
||||||
}
|
}
|
||||||
if (data.index === -1) {
|
if (data.index === -1) {
|
||||||
await postListFormJsonRow(data.id, input)
|
await postListFormJsonRow(data.id, input)
|
||||||
|
|
@ -280,7 +304,7 @@ function JsonRowOpDialogSeries({
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
label="Type"
|
label="Dash Style"
|
||||||
invalid={errors.dashStyle && touched.dashStyle}
|
invalid={errors.dashStyle && touched.dashStyle}
|
||||||
errorMessage={errors.dashStyle}
|
errorMessage={errors.dashStyle}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue