diff --git a/components.js b/components.js deleted file mode 100644 index b8ce0ba..0000000 --- a/components.js +++ /dev/null @@ -1,312 +0,0 @@ -import { h, render, createContext, Fragment } from 'https://cdn.skypack.dev/preact'; -import { useReducer, useState } from 'https://cdn.skypack.dev/preact/hooks'; -import { css, cx } from 'https://cdn.skypack.dev/@emotion/css'; -import htm from 'https://unpkg.com/htm?module'; -const html = htm.bind(h); - -let Styles = { - Form:css` - position:realtive; - box-sizing: border-box; - padding: 10px; - color:black; - font-family:sans-serif; - - .Title - { - font-size:24px; - font-weight:100; - } - - .Section - { - padding:10px 0 10px 0; - - .Heading - { - display:inline-block; - color:#666; - font-family:sans-serif; - font-size:12px; - font-weight:900; - text-transform:uppercase; - } - .Group - { - display:inline-block; - padding:5px; - border-radius:5px; - margin:3px; - background:rgba(0, 0, 0, 0.3) - } - } - ` -}; - - - -let PivotForm = props => -{ - - let pivotColumns = N.Step(Pivot.Schema, "label")||[]; - let pivotColumnsUsed = N.Step(Pivot.Proto, "used-pivot")||[]; - - let sumColumns = N.Step(Pivot.Schema, "sum")||[]; - //let sumColumnsUsed = N.Step(Pivot.Proto, "used-sum")||[]; - - let indiciesPivot = pivotColumnsUsed.map(node=>node.Meta.Index); - let indiciesSum = sumColumns.map(node=>node.Meta.Index); - //let indiciesSum = sumColumnsUsed.map(node=>node.Meta.Index); - - let displayPivotsAll = html` -
-
Available Columns
-
- ${pivotColumns.map( columnPivot => - { - let attributes = {}; - if(N.Step(columnPivot, "used-pivot", false)) - { - attributes.disabled = true; - } - else - { - attributes.onClick = e=> - { - N.Connect(Pivot.Proto, columnPivot, "used-pivot"); - Render(); - } - } - return html``; - })} -
-
- `; - - let displayPivotsPending = null; - if(pivotColumnsUsed.length) - { - displayPivotsPending = html` -
-
Pending Pivot
-
- ${pivotColumnsUsed.map(columnPivot=>html` - - `)} -
- - -
- `; - } - - return html` -
-
Create New Pivot
- ${displayPivotsAll} - ${displayPivotsPending} -
- `; -} - -let Section = props => -{ - let styles = css` - .Heading - { - padding:6px 0 6px 0; - color:#666; - font-weight:900; - font-size:12px; - text-transform:uppercase; - cursor:pointer; - - span - { - display:inline-block; - width:20px; - height:20px; - margin-right:10px; - border-radius:20px; - background:black; - color:white; - text-align:center; - } - } - .Heading:hover - { - color:black; - } - .Body - { - position:relative; - padding:10px 0 20px 30px; - &::before - { - content: " "; - display:block; - position:absolute; - top:-8px; - left:8px; - width:3px; - height:100%; - background:black; - } - } - `; - - let [openGet, openSet] = useState(false); - return html` -
-
openSet(!openGet)}> - ${openGet ? `−` : `+`} - ${props.label} -
- ${ openGet ? html`
${props.children}
` : null } -
- `; -} - -let Modifier = props => -{ - let refNode = N.Step(props.modifier, "ModifyAt")[0]; - - let handleDelete = () => - { - Pivot.Unmodify(props.modifier); - Render(); - }; - - let displayFields = []; - N.Walk(node=>{ - displayFields.push(html``) - }, Pivot.Schema, "sum"); - - - return html` -
-
${refNode.Meta.Label}
- -
- `; -} - -let PivotBranch = props => -{ - let row = props.node.Meta.Row; - let displayCells = row.map(column=>h("td", null, column)); - let displayCellsModify = row.map(column=>false); - props.node.Meta.IndexSum.forEach(i=> - { - displayCellsModify[i] = html``; - }); - displayCellsModify.forEach((cell, i)=> - { - if(!cell) - { - displayCellsModify[i] = html`${row[i]}` - } - }); - - return html` - - -
- - - - ${props.node.Meta.Label} - - ${displayCells} - - - Modifications - - - At - ${displayCellsModify} - - - Below - ${displayCells} - - - Above - ${displayCells} - - - Outside - ${displayCells} - - - Computed - ${displayCells} - - - Goals - - - Max - ${displayCells} - - - Min - ${displayCells} - - - `; -}; - - -let PivotRoot = ({pivot}) => -{ - - let stylesRoot = css` - display:block; - box-sizing:border-box; - padding:15px; - font-family:sans-serif; - `; - let stylesHeading = css` - margin: 0 0 15px 0; - font-weight:0; - font-size:24px; - `; - - let modifiers = N.Step(pivot, "ModifyUp", false) || []; - let handleDelete = ()=> - { - Pivot.Delete(pivot); - Render(); - }; - - let rows = []; - N.ID.Walk++; - N.Walk(n=>rows.push(h(PivotBranch, {node:n}, null)), pivot, "Hierarchy"); - - return html` -
-
${pivot.Meta.Label}
- <${Section} key="settings" label=${`Settings`}> - - - <${Section} key="modifiers" label=${`Modifiers (${modifiers.length})`}> - ${ !modifiers.length ? html`No modifiers` : modifiers.map( m => html`<${Modifier} modifier=${m}/>`)} - - <${Section} key="tree" label=${"Tree"}> - - ${rows} -
- -
- `; -}; - -export {Section, PivotRoot, PivotForm}; \ No newline at end of file diff --git a/index.html b/index.html index 6a6bd84..b97369b 100755 --- a/index.html +++ b/index.html @@ -1,5 +1,6 @@
+ - - - + - - + + + + \ No newline at end of file