fix маппинга + fix добавлении строки
This commit is contained in:
parent
72aea5c82d
commit
ce8c57881c
@ -46,9 +46,9 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.plan.comment",
|
||||
},
|
||||
"data.contract_summary.amount": {
|
||||
"data.contract_summary.total": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract_summary.amount",
|
||||
accessorKey: "data.contract_summary.total",
|
||||
},
|
||||
"data.contract_summary.reference": {
|
||||
color_type: orangeColumn,
|
||||
@ -66,17 +66,17 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract_summary.comment",
|
||||
},
|
||||
"data.contract_summary.future_payments_y1": {
|
||||
"data.contract_summary.future_y1": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract_summary.future_payments_y1",
|
||||
accessorKey: "data.contract_summary.future_y1",
|
||||
},
|
||||
"data.contract_summary.future_payments_y2": {
|
||||
"data.contract_summary.future_y2": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract_summary.future_payments_y2",
|
||||
accessorKey: "data.contract_summary.future_y2",
|
||||
},
|
||||
"data.contract_summary.other_ssp_amount": {
|
||||
"data.contract_summary.ssp_amount": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract_summary.other_ssp_amount",
|
||||
accessorKey: "data.contract_summary.ssp_amount",
|
||||
},
|
||||
"data.contract_summary.centralized_flag": {
|
||||
color_type: orangeColumn,
|
||||
@ -158,13 +158,13 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.approved.year",
|
||||
},
|
||||
"data.collegial.amount": {
|
||||
"data.collegial.approved": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.collegial.amount",
|
||||
accessorKey: "data.collegial.approved",
|
||||
},
|
||||
"data.collegial.protocol_reference": {
|
||||
"data.collegial.protocol": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.collegial.protocol_reference",
|
||||
accessorKey: "data.collegial.protocol",
|
||||
},
|
||||
field_kollegialnye_organy_field: {
|
||||
color_type: orangeColumn,
|
||||
@ -182,37 +182,37 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.ceiling",
|
||||
},
|
||||
"data.ckk.expenses_q1": {
|
||||
"data.ckk.q1": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q1",
|
||||
accessorKey: "data.ckk.q1",
|
||||
},
|
||||
"data.ckk.expenses_q2": {
|
||||
"data.ckk.q2": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q2",
|
||||
accessorKey: "data.ckk.q2",
|
||||
},
|
||||
"data.ckk.expenses_q3": {
|
||||
"data.ckk.q3": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q3",
|
||||
accessorKey: "data.ckk.q3",
|
||||
},
|
||||
"data.ckk.expenses_q4": {
|
||||
"data.ckk.q4": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q4",
|
||||
accessorKey: "data.ckk.q4",
|
||||
},
|
||||
"data.ckk.rf_schedule": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.rf_schedule",
|
||||
},
|
||||
"data.ckk.delivery_deadline": {
|
||||
"data.ckk.deadline": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.delivery_deadline",
|
||||
accessorKey: "data.ckk.deadline",
|
||||
},
|
||||
"data.ckk.procurement_plan": {
|
||||
"data.ckk.proc_plan": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.procurement_plan",
|
||||
accessorKey: "data.ckk.proc_plan",
|
||||
},
|
||||
"data.ckk.procurement_method": {
|
||||
"data.ckk.proc_method": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.procurement_method",
|
||||
accessorKey: "data.ckk.proc_method",
|
||||
},
|
||||
"data.ckk.comment": {
|
||||
color_type: orangeColumn,
|
||||
@ -242,21 +242,21 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.ceiling",
|
||||
},
|
||||
"data.contract.expenses_q1": {
|
||||
"data.contract.q1": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q1",
|
||||
accessorKey: "data.contract.q1",
|
||||
},
|
||||
"data.contract.expenses_q2": {
|
||||
"data.contract.q2": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q2",
|
||||
accessorKey: "data.contract.q2",
|
||||
},
|
||||
"data.contract.expenses_q3": {
|
||||
"data.contract.q3": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q3",
|
||||
accessorKey: "data.contract.q3",
|
||||
},
|
||||
"data.contract.expenses_q4": {
|
||||
"data.contract.q4": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q4",
|
||||
accessorKey: "data.contract.q4",
|
||||
},
|
||||
"data.contract.rf_schedule": {
|
||||
color_type: orangeColumn,
|
||||
@ -957,7 +957,7 @@ export const config = {
|
||||
columns: [
|
||||
{
|
||||
header: "Сумма",
|
||||
accessorKey: "data.contract_summary.amount",
|
||||
accessorKey: "data.contract_summary.total",
|
||||
columnLetter: "L",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1022,7 +1022,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Платежив 2027 году",
|
||||
accessorKey: "data.contract_summary.future_payments_y1",
|
||||
accessorKey: "data.contract_summary.future_y1",
|
||||
columnLetter: "Q",
|
||||
size: 190,
|
||||
filterFn: "contains",
|
||||
@ -1035,7 +1035,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Платежив 2028 году",
|
||||
accessorKey: "data.contract_summary.future_payments_y2",
|
||||
accessorKey: "data.contract_summary.future_y2",
|
||||
columnLetter: "R",
|
||||
size: 190,
|
||||
filterFn: "contains",
|
||||
@ -1048,7 +1048,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Сумма в других ССП",
|
||||
accessorKey: "data.contract_summary.other_ssp_amount",
|
||||
accessorKey: "data.contract_summary.ssp_amount",
|
||||
columnLetter: "S",
|
||||
size: 180,
|
||||
filterFn: "contains",
|
||||
@ -1479,7 +1479,7 @@ export const config = {
|
||||
columns: [
|
||||
{
|
||||
header: "Сумма (без НДС)",
|
||||
accessorKey: "data.collegial.amount",
|
||||
accessorKey: "data.collegial.approved",
|
||||
columnLetter: "AS",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1492,7 +1492,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Реквизиты протокола (дата, номер)",
|
||||
accessorKey: "data.collegial.protocol_reference",
|
||||
accessorKey: "data.collegial.protocol",
|
||||
columnLetter: "AT",
|
||||
size: 330,
|
||||
filterFn: "contains",
|
||||
@ -1545,7 +1545,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 1 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q1",
|
||||
accessorKey: "data.ckk.q1",
|
||||
columnLetter: "AY",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1558,7 +1558,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 2 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q2",
|
||||
accessorKey: "data.ckk.q2",
|
||||
columnLetter: "AZ",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1571,7 +1571,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 3 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q3",
|
||||
accessorKey: "data.ckk.q3",
|
||||
columnLetter: "BA",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1584,7 +1584,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 4 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q4",
|
||||
accessorKey: "data.ckk.q4",
|
||||
columnLetter: "BB",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1610,7 +1610,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Срок поставки",
|
||||
accessorKey: "data.ckk.delivery_deadline",
|
||||
accessorKey: "data.ckk.deadline",
|
||||
columnLetter: "BD",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1623,7 +1623,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "План закупок",
|
||||
accessorKey: "data.ckk.procurement_plan",
|
||||
accessorKey: "data.ckk.proc_plan",
|
||||
columnLetter: "BE",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1636,7 +1636,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Способ закупки",
|
||||
accessorKey: "data.ckk.procurement_method",
|
||||
accessorKey: "data.ckk.proc_method",
|
||||
columnLetter: "BF",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1752,7 +1752,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 1 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q1",
|
||||
accessorKey: "data.contract.q1",
|
||||
columnLetter: "BO",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1765,7 +1765,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 2 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q2",
|
||||
accessorKey: "data.contract.q2",
|
||||
columnLetter: "BP",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1778,7 +1778,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 3 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q3",
|
||||
accessorKey: "data.contract.q3",
|
||||
columnLetter: "BQ",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1791,7 +1791,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 4 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q4",
|
||||
accessorKey: "data.contract.q4",
|
||||
columnLetter: "BR",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
|
||||
@ -46,9 +46,9 @@ export const config = {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.plan.comment",
|
||||
},
|
||||
"data.contract_summary.amount": {
|
||||
"data.contract_summary.total": {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.contract_summary.amount",
|
||||
accessorKey: "data.contract_summary.total",
|
||||
},
|
||||
"data.contract_summary.reference": {
|
||||
color_type: blueColumn,
|
||||
@ -66,17 +66,17 @@ export const config = {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.contract_summary.comment",
|
||||
},
|
||||
"data.contract_summary.future_payments_y1": {
|
||||
"data.contract_summary.future_y1": {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.contract_summary.future_payments_y1",
|
||||
accessorKey: "data.contract_summary.future_y1",
|
||||
},
|
||||
"data.contract_summary.future_payments_y2": {
|
||||
"data.contract_summary.future_y2": {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.contract_summary.future_payments_y2",
|
||||
accessorKey: "data.contract_summary.future_y2",
|
||||
},
|
||||
"data.contract_summary.other_ssp_amount": {
|
||||
"data.contract_summary.other_ssp": {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.contract_summary.other_ssp_amount",
|
||||
accessorKey: "data.contract_summary.other_ssp",
|
||||
},
|
||||
"data.contract_summary.centralized_flag": {
|
||||
color_type: blueColumn,
|
||||
@ -158,13 +158,13 @@ export const config = {
|
||||
color_type: blueColumn,
|
||||
accessorKey: "data.approved.year",
|
||||
},
|
||||
"data.collegial.amount": {
|
||||
"data.collegial.approved": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.collegial.amount",
|
||||
accessorKey: "data.collegial.approved",
|
||||
},
|
||||
"data.collegial.protocol_reference": {
|
||||
"data.collegial.protocol": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.collegial.protocol_reference",
|
||||
accessorKey: "data.collegial.protocol",
|
||||
},
|
||||
field_kollegialnye_organy_field: {
|
||||
color_type: orangeColumn,
|
||||
@ -182,29 +182,29 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.ceiling",
|
||||
},
|
||||
"data.ckk.expenses_q1": {
|
||||
"data.ckk.q1": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q1",
|
||||
accessorKey: "data.ckk.q1",
|
||||
},
|
||||
"data.ckk.expenses_q2": {
|
||||
"data.ckk.q2": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q2",
|
||||
accessorKey: "data.ckk.q2",
|
||||
},
|
||||
"data.ckk.expenses_q3": {
|
||||
"data.ckk.q3": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q3",
|
||||
accessorKey: "data.ckk.q3",
|
||||
},
|
||||
"data.ckk.expenses_q4": {
|
||||
"data.ckk.q4": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.expenses_q4",
|
||||
accessorKey: "data.ckk.q4",
|
||||
},
|
||||
"data.ckk.rf_schedule": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.rf_schedule",
|
||||
},
|
||||
"data.ckk.delivery_deadline": {
|
||||
"data.ckk.deadline": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.ckk.delivery_deadline",
|
||||
accessorKey: "data.ckk.deadline",
|
||||
},
|
||||
"data.ckk.procurement_plan": {
|
||||
color_type: orangeColumn,
|
||||
@ -242,21 +242,21 @@ export const config = {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.ceiling",
|
||||
},
|
||||
"data.contract.expenses_q1": {
|
||||
"data.contract.q1": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q1",
|
||||
accessorKey: "data.contract.q1",
|
||||
},
|
||||
"data.contract.expenses_q2": {
|
||||
"data.contract.q2": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q2",
|
||||
accessorKey: "data.contract.q2",
|
||||
},
|
||||
"data.contract.expenses_q3": {
|
||||
"data.contract.q3": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q3",
|
||||
accessorKey: "data.contract.q3",
|
||||
},
|
||||
"data.contract.expenses_q4": {
|
||||
"data.contract.q4": {
|
||||
color_type: orangeColumn,
|
||||
accessorKey: "data.contract.expenses_q4",
|
||||
accessorKey: "data.contract.q4",
|
||||
},
|
||||
"data.contract.rf_schedule": {
|
||||
color_type: orangeColumn,
|
||||
@ -957,7 +957,7 @@ export const config = {
|
||||
columns: [
|
||||
{
|
||||
header: "Сумма",
|
||||
accessorKey: "data.contract_summary.amount",
|
||||
accessorKey: "data.contract_summary.total",
|
||||
columnLetter: "L",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1022,7 +1022,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Платежи в 2027 году",
|
||||
accessorKey: "data.contract_summary.future_payments_y1",
|
||||
accessorKey: "data.contract_summary.future_y1",
|
||||
columnLetter: "Q",
|
||||
size: 190,
|
||||
filterFn: "contains",
|
||||
@ -1035,7 +1035,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Платежи в 2028 году",
|
||||
accessorKey: "data.contract_summary.future_payments_y2",
|
||||
accessorKey: "data.contract_summary.future_y2",
|
||||
columnLetter: "R",
|
||||
size: 190,
|
||||
filterFn: "contains",
|
||||
@ -1048,7 +1048,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Сумма в других ССП",
|
||||
accessorKey: "data.contract_summary.other_ssp_amount",
|
||||
accessorKey: "data.contract_summary.other_ssp",
|
||||
columnLetter: "S",
|
||||
size: 180,
|
||||
filterFn: "contains",
|
||||
@ -1479,7 +1479,7 @@ export const config = {
|
||||
columns: [
|
||||
{
|
||||
header: "Сумма (без НДС)",
|
||||
accessorKey: "data.collegial.amount",
|
||||
accessorKey: "data.collegial.approved",
|
||||
columnLetter: "AS",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1492,7 +1492,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Реквизиты протокола (дата, номер)",
|
||||
accessorKey: "data.collegial.protocol_reference",
|
||||
accessorKey: "data.collegial.protocol",
|
||||
columnLetter: "AT",
|
||||
size: 330,
|
||||
filterFn: "contains",
|
||||
@ -1544,7 +1544,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 1 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q1",
|
||||
accessorKey: "data.ckk.q1",
|
||||
columnLetter: "AY",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1557,7 +1557,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 2 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q2",
|
||||
accessorKey: "data.ckk.q2",
|
||||
columnLetter: "AZ",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1570,7 +1570,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 3 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q3",
|
||||
accessorKey: "data.ckk.q3",
|
||||
columnLetter: "BA",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1583,7 +1583,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 4 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.ckk.expenses_q4",
|
||||
accessorKey: "data.ckk.q4",
|
||||
columnLetter: "BB",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1609,7 +1609,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Срок поставки",
|
||||
accessorKey: "data.ckk.delivery_deadline",
|
||||
accessorKey: "data.ckk.deadline",
|
||||
columnLetter: "BD",
|
||||
size: 150,
|
||||
filterFn: "contains",
|
||||
@ -1751,7 +1751,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 1 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q1",
|
||||
accessorKey: "data.contract.q1",
|
||||
columnLetter: "BO",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1764,7 +1764,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 2 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q2",
|
||||
accessorKey: "data.contract.q2",
|
||||
columnLetter: "BP",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1777,7 +1777,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 3 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q3",
|
||||
accessorKey: "data.contract.q3",
|
||||
columnLetter: "BQ",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
@ -1790,7 +1790,7 @@ export const config = {
|
||||
},
|
||||
{
|
||||
header: "Расходы 4 кв. 2026 г. тыс. руб. (без НДС)",
|
||||
accessorKey: "data.contract.expenses_q4",
|
||||
accessorKey: "data.contract.q4",
|
||||
columnLetter: "BR",
|
||||
size: 420,
|
||||
filterFn: "contains",
|
||||
|
||||
@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useRef } from "react";
|
||||
import { FormsSheetApi } from "../../../api/form_sheet";
|
||||
import { useRealtime } from "../contexts/RealtimeContext";
|
||||
import {
|
||||
addRootRow,
|
||||
deleteRow,
|
||||
insertCell,
|
||||
insertProjectRow,
|
||||
@ -207,8 +208,13 @@ const useRealtimeData = (formId, sheetName, direction, formType, year) => {
|
||||
return;
|
||||
}
|
||||
setData((prevData) => {
|
||||
const updateData = updateCells(prevData, updatedCells);
|
||||
const newData = insertCell(updateData, newRow, parent_id);
|
||||
let data = structuredClone(prevData);
|
||||
if (prevData[0]?.row_type !== "ROOT") {
|
||||
const newRowRoot = updates[0];
|
||||
data = addRootRow(data, newRowRoot);
|
||||
}
|
||||
const updatedData = updateCells(data, updatedCells);
|
||||
const newData = insertCell(updatedData, newRow, parent_id);
|
||||
return newData;
|
||||
});
|
||||
});
|
||||
|
||||
@ -111,6 +111,31 @@ export function updateCells(data, newRows) {
|
||||
return updatedRows;
|
||||
}
|
||||
|
||||
export function addRootRow(data, newRowRoot) {
|
||||
function updateSortOrder(rows) {
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
const row = rows[i];
|
||||
row.sort_order = row.sort_order + 1;
|
||||
if (row.subRows && Array.isArray(row.subRows) && row.subRows.length > 0) {
|
||||
const found = updateSortOrder(row.subRows);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateSortOrder(data);
|
||||
const [row_type, depth, sort_order, dataRow] = newRowRoot;
|
||||
const newRowObject = {
|
||||
row_type: row_type,
|
||||
depth: depth,
|
||||
sort_order: sort_order,
|
||||
subRows: [],
|
||||
data: dataRow,
|
||||
};
|
||||
|
||||
newRowObject.subRows = data;
|
||||
|
||||
return [newRowObject];
|
||||
}
|
||||
|
||||
export function insertCell(data, newRow, parent_id) {
|
||||
const updatedRows = JSON.parse(JSON.stringify(data));
|
||||
const [row_type, depth, sort_order, dataRow] = newRow;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user