({
groupByPropertyId,
sourceGroupKey,
targetGroupKey,
lookupMappingKey,
isListTypeProperty,
}: BuildTaskListGroupDropPlanOptions)
| 49 | } |
| 50 | |
| 51 | export function buildTaskListGroupDropPlan({ |
| 52 | groupByPropertyId, |
| 53 | sourceGroupKey, |
| 54 | targetGroupKey, |
| 55 | lookupMappingKey, |
| 56 | isListTypeProperty, |
| 57 | }: BuildTaskListGroupDropPlanOptions): TaskListGroupDropPlan { |
| 58 | const cleanGroupBy = groupByPropertyId ? stripPropertyPrefix(groupByPropertyId) : null; |
| 59 | const isFormulaGrouping = !!groupByPropertyId?.startsWith("formula."); |
| 60 | const normalizedTargetGroupKey = targetGroupKey === "None" ? null : targetGroupKey; |
| 61 | const needsGroupUpdate = |
| 62 | !!groupByPropertyId && normalizedTargetGroupKey !== sourceGroupKey; |
| 63 | const groupByTaskProp = cleanGroupBy ? lookupMappingKey(cleanGroupBy) : null; |
| 64 | const isListGrouping = !!cleanGroupBy && isListTypeProperty(cleanGroupBy); |
| 65 | const frontmatterKey = groupByPropertyId |
| 66 | ? groupByPropertyId.replace(/^(note\.|file\.|task\.)/, "") |
| 67 | : null; |
| 68 | |
| 69 | return { |
| 70 | groupByPropertyId, |
| 71 | cleanGroupBy, |
| 72 | frontmatterKey, |
| 73 | groupByTaskProp, |
| 74 | isFormulaGrouping, |
| 75 | isListGrouping, |
| 76 | needsGroupUpdate, |
| 77 | normalizedTargetGroupKey, |
| 78 | sourceGroupKey, |
| 79 | }; |
| 80 | } |
| 81 | |
| 82 | export function applyTaskListDropFrontmatterMutation({ |
| 83 | frontmatter, |
no test coverage detected