From 324b3c22cb72f1637c3be9da93d87254dcf44454 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Sat, 29 May 2021 16:55:02 -0400 Subject: [PATCH] toggleable columns --- index.html | 87 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 27 deletions(-) diff --git a/index.html b/index.html index 0197df2..391f105 100755 --- a/index.html +++ b/index.html @@ -773,9 +773,21 @@ let PivotBranch = props => let PivotRoot = ({pivot}) => { + let labelsDefault = (N.Step(Pivot.Schema, "hidden")||[]).map(column => column.Meta.Index); + let labelsSum = (N.Step(Pivot.Schema, "sum")||[]).map(column => column.Meta.Index); + let labelsPivot = (N.Step(Pivot.Schema, "label")||[]).map(column => column.Meta.Index); + let labelsAll = (N.Step(Pivot.Schema, "all")||[]).map(column => column.Meta.Label); + let labelsAllState = useState(labelsAll.map(column=>true)); - let labels = (N.Step(Pivot.Schema, "all")||[]).map(column => column.Meta.Label); - let [visibleGet, visibleSet] = useState(labels.map(column=>true)); + let headersDisplay = []; + labelsAllState[0].forEach((visible, index)=> + { + if(visible) + { + headersDisplay.push(html`${labelsAll[index]}`); + } + } + ); let stylesRoot = css` display:block; @@ -796,42 +808,63 @@ let PivotRoot = ({pivot}) => Render(); }; + + let displayColumnGroup = (inAllLabels, inAllState, inIndicies) => + { + return html` +
+ + +
+
+ ${inIndicies.map((index) => html``)} +
`; + }; + let rows = []; N.ID.Walk++; - N.Walk(n=>rows.push(h(PivotBranch, {node:n, visible:visibleGet}, null)), pivot, "Hierarchy"); + N.Walk(n=>rows.push(h(PivotBranch, {node:n, visible:labelsAllState[0]}, null)), pivot, "Hierarchy"); return html`
${pivot.Meta.Label}
<${Section} key="settings" label=${`Settings`}> -

pivot

-

columns

-
- - -
-
- ${visibleGet.map((v, i) => html``)} -
+ + <${Section} key="columns" label="Columns"> +

Unused

+ ${displayColumnGroup(labelsAll, labelsAllState, labelsDefault)} +

Summation

+ ${displayColumnGroup(labelsAll, labelsAllState, labelsSum)} +

Pivot

+ ${displayColumnGroup(labelsAll, labelsAllState, labelsPivot)} <${Section} key="tree" label=${"Tree"}> - ${rows} + + + ${headersDisplay} + + + ${rows}
LabelModifications