aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-02-16 00:59:28 -0500
committerbobzel <zzzman@gmail.com>2021-02-16 00:59:28 -0500
commit05a9a3eed9a1afb55ec0ca55845b33cc745289e0 (patch)
tree2f8b7350fd5a2c3b4570cbc0a4464d5ffd2b51e5 /src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
parent53b13f534431266e6efc856c8b5dc6e886cd171d (diff)
updated pivot views to have a getAnchor() method to save the pivotField when linking. added an engineProp to layoutEngiens so that you can preview a change in a LinkDocPreview without modifying the document.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx')
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
index 5cf758e9b..272773d87 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLayoutEngines.tsx
@@ -85,7 +85,8 @@ export function computerPassLayout(
pivotDoc: Doc,
childPairs: { layout: Doc, data?: Doc }[],
panelDim: number[],
- viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[]
+ viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[],
+ engineProps: any
) {
const docMap = new Map<string, PoolData>();
childPairs.forEach(({ layout, data }, i) => {
@@ -106,7 +107,8 @@ export function computerStarburstLayout(
pivotDoc: Doc,
childPairs: { layout: Doc, data?: Doc }[],
panelDim: number[],
- viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[]
+ viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[],
+ engineProps: any
) {
const docMap = new Map<string, PoolData>();
const burstRadius = [NumCast(pivotDoc._starburstRadius, panelDim[0]), NumCast(pivotDoc._starburstRadius, panelDim[1])];
@@ -133,14 +135,15 @@ export function computePivotLayout(
pivotDoc: Doc,
childPairs: { layout: Doc, data?: Doc }[],
panelDim: number[],
- viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[]
+ viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[],
+ engineProps: any
) {
const docMap = new Map<string, PoolData>();
const fieldKey = "data";
const pivotColumnGroups = new Map<FieldResult<Field>, PivotColumn>();
let nonNumbers = 0;
- const pivotFieldKey = toLabel(pivotDoc._pivotField);
+ const pivotFieldKey = toLabel(engineProps?.pivotField ?? pivotDoc._pivotField);
childPairs.map(pair => {
const lval = pivotFieldKey === "#" ? Array.from(Object.keys(Doc.GetProto(pair.layout))).filter(k => k.startsWith("#")).map(k => k.substring(1)) :
Cast(pair.layout[pivotFieldKey], listSpec("string"), null);
@@ -274,7 +277,8 @@ export function computeTimelineLayout(
pivotDoc: Doc,
childPairs: { layout: Doc, data?: Doc }[],
panelDim: number[],
- viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[]
+ viewDefsToJSX: (views: ViewDefBounds[]) => ViewDefResult[],
+ engineProps?: any
) {
const fieldKey = "data";
const pivotDateGroups = new Map<number, Doc[]>();