From b90e4b8f956dfe8608f390422ef427a2245bb6e1 Mon Sep 17 00:00:00 2001 From: James Wexler Date: Thu, 31 Jan 2019 13:20:12 -0500 Subject: [PATCH 01/14] hybrid mode changes --- .../components/facets_dive/facets-dive.html | 2 +- .../facets_dive_controls/facets-dive-controls.ts | 15 ++++++--------- .../facets-dive-info-card.html | 5 +++-- .../facets-dive-info-card.ts | 8 +++++--- .../facets_dive_vis/facets-dive-vis.html | 8 +++++--- .../facets_dive_vis/facets-dive-vis.ts | 16 ++++++++++++---- .../facets_overview/facets-overview.html | 4 ++-- 7 files changed, 34 insertions(+), 24 deletions(-) diff --git a/facets_dive/components/facets_dive/facets-dive.html b/facets_dive/components/facets_dive/facets-dive.html index 58d7b19..05f6fc1 100644 --- a/facets_dive/components/facets_dive/facets-dive.html +++ b/facets_dive/components/facets_dive/facets-dive.html @@ -32,7 +32,7 @@ * This CSS rule forces the containing element to have the correct height * in either case. */ - ::content paper-input-container > .floated-label-placeholder { + :host paper-input-container > .floated-label-placeholder { min-height: 20px; } diff --git a/facets_dive/components/facets_dive_controls/facets-dive-controls.ts b/facets_dive/components/facets_dive_controls/facets-dive-controls.ts index 5288e31..ba8b536 100644 --- a/facets_dive/components/facets_dive_controls/facets-dive-controls.ts +++ b/facets_dive/components/facets_dive_controls/facets-dive-controls.ts @@ -240,15 +240,12 @@ Polymer({ }, _updateCSSVars(this: any) { - this.customStyle['--grid-faceting-vertical-label-color'] = - this.gridFacetingVerticalLabelColor; - this.customStyle['--grid-faceting-horizontal-label-color'] = - this.gridFacetingHorizontalLabelColor; - this.customStyle['--item-positioning-vertical-label-color'] = - this.itemPositioningVerticalLabelColor; - this.customStyle['--item-positioning-horizontal-label-color'] = - this.itemPositioningHorizontalLabelColor; - this.updateStyles(); + this.updateStyles({ + '--grid-faceting-vertical-label-color': this.gridFacetingVerticalLabelColor, + '--grid-faceting-horizontal-label-color': this.gridFacetingHorizontalLabelColor, + '--item-positioning-vertical-label-color': this.itemPositioningVerticalLabelColor, + '--item-positioning-horizontal-label-color': this.itemPositioningHorizontalLabelColor + }); }, /** diff --git a/facets_dive/components/facets_dive_info_card/facets-dive-info-card.html b/facets_dive/components/facets_dive_info_card/facets-dive-info-card.html index a213731..a205e7e 100644 --- a/facets_dive/components/facets_dive_info_card/facets-dive-info-card.html +++ b/facets_dive/components/facets_dive_info_card/facets-dive-info-card.html @@ -30,16 +30,17 @@ overflow: auto; padding: 8px; } - ::content dt { + dt { color: #9e7c65; font-size: 14px; } - ::content dd { + dd { @apply --paper-font-common-code; color: #513726; margin: 0 0 16px 0; } +
diff --git a/facets_dive/components/facets_dive_info_card/facets-dive-info-card.ts b/facets_dive/components/facets_dive_info_card/facets-dive-info-card.ts index a1c4772..6a849f3 100644 --- a/facets_dive/components/facets_dive_info_card/facets-dive-info-card.ts +++ b/facets_dive/components/facets_dive_info_card/facets-dive-info-card.ts @@ -41,9 +41,11 @@ Polymer({ observer: '_updateSelected', }, }, + ready(this: any) { + this.scopeSubtree(this.$.holder, true); + }, _updateSelected(this: any, selectedData: Object[]) { - const root = Polymer.dom(this.root); - root.innerHTML = ''; + this.$.holder.innerHTML = ''; if (!selectedData) { return; @@ -56,7 +58,7 @@ Polymer({ const div = document.createElement('div'); div.style.width = '100%'; - root.appendChild(div); + this.$.holder.appendChild(div); infoRenderer(selectedObject, div); } diff --git a/facets_dive/components/facets_dive_vis/facets-dive-vis.html b/facets_dive/components/facets_dive_vis/facets-dive-vis.html index cf093cd..05bacdb 100644 --- a/facets_dive/components/facets_dive_vis/facets-dive-vis.html +++ b/facets_dive/components/facets_dive_vis/facets-dive-vis.html @@ -38,11 +38,11 @@ height: 100%; width: 100%; } - ::content .labels { + .labels { @apply --paper-font-common-base; @apply --paper-font-headline; } - ::content .rotate { + .rotate { stroke-dasharray: 1.5, 0.5; animation: rotate 1s linear infinite; } @@ -55,7 +55,9 @@ } } - +
+ +
diff --git a/facets_dive/components/facets_dive_vis/facets-dive-vis.ts b/facets_dive/components/facets_dive_vis/facets-dive-vis.ts index 1cc1f04..d8818ad 100644 --- a/facets_dive/components/facets_dive_vis/facets-dive-vis.ts +++ b/facets_dive/components/facets_dive_vis/facets-dive-vis.ts @@ -835,6 +835,11 @@ class FacetsDiveVizInternal { */ ignoreChange: boolean; + /** + * Div holding all dynamically created content in this element. + */ + holder: HTMLElement; + /** * Capture Polymer element instance and prep internal state. */ @@ -845,6 +850,7 @@ class FacetsDiveVizInternal { this.autoColorBy = false; this.verticalFacetInfo = null; this.horizontalFacetInfo = null; + this.holder = (this.elem as any).$.holder; } /** @@ -855,8 +861,10 @@ class FacetsDiveVizInternal { // to fit within the viewport. this.layout = new Layout(); + (this.elem as any).scopeSubtree(this.holder, true); + // Insert background SVG used for cell backgrounds. - this.cellBackgroundSVG = d3.select(this.elem) + this.cellBackgroundSVG = d3.select(this.holder) .append('svg') .style('left', 0) .style('position', 'absolute') @@ -882,7 +890,7 @@ class FacetsDiveVizInternal { .style('pointer-events', 'none') .style('position', 'absolute') .style('top', 0); - this.elem.appendChild(this.renderer.domElement); + this.holder.appendChild(this.renderer.domElement); } catch (err) { // An error will be displayed below. } @@ -893,7 +901,7 @@ class FacetsDiveVizInternal { d3.select(this.elem).call(this.zoom); // Insert background SVG used for labels and axes. - this.labelsAndAxesSVG = d3.select(this.elem) + this.labelsAndAxesSVG = d3.select(this.holder) .append('svg') .style('left', 0) .style('position', 'absolute') @@ -920,7 +928,7 @@ class FacetsDiveVizInternal { if (!this.renderer) { this.labelsAndAxesSVG.style('display', 'none'); this.cellBackgroundSVG.style('display', 'none'); - d3.select(this.elem) + d3.select(this.holder) .append('p') .attr('class', 'error') .style('color', 'darkred') diff --git a/facets_overview/components/facets_overview/facets-overview.html b/facets_overview/components/facets_overview/facets-overview.html index 2fe0485..dd86b76 100644 --- a/facets_overview/components/facets_overview/facets-overview.html +++ b/facets_overview/components/facets_overview/facets-overview.html @@ -28,7 +28,7 @@ @@ -1265,7 +15017,7 @@ + + + + @@ -1699,14 +15463,13 @@ @@ -2367,7 +16130,7 @@ @@ -2380,15 +16143,15 @@ display: inline-block; float: right; - @apply(--paper-font-caption); - @apply(--paper-input-char-counter); + @apply --paper-font-caption; + @apply --paper-input-char-counter; } :host([hidden]) { display: none !important; } - :host-context([dir="rtl"]) { + :host(:dir(rtl)) { float: left; } @@ -2398,7 +16161,7 @@ @@ -2408,14 +16171,37 @@ + + + + @@ -2690,10 +16463,10 @@ display: inline-block; visibility: hidden; - color: var(--paper-input-container-invalid-color, --error-color); + color: var(--paper-input-container-invalid-color, var(--error-color)); - @apply(--paper-font-caption); - @apply(--paper-input-error); + @apply --paper-font-caption; + @apply --paper-input-error; position: absolute; left:0; right:0; @@ -2704,12 +16477,12 @@ }; - + @@ -2730,37 +16503,67 @@ display: none !important; } + input { + /* Firefox sets a min-width on the input, which can cause layout issues */ + min-width: 0; + } + + /* In 1.x, the is distributed to paper-input-container, which styles it. + In 2.x the is distributed to paper-input-container, which styles + it, but in order for this to work correctly, we need to reset some + of the native input's properties to inherit (from the iron-input) */ + iron-input > input { + @apply --paper-input-container-shared-input-style; + font-family: inherit; + font-weight: inherit; + font-size: inherit; + letter-spacing: inherit; + word-spacing: inherit; + line-height: inherit; + text-shadow: inherit; + color: inherit; + cursor: inherit; + } + + input:disabled { + @apply --paper-input-container-input-disabled; + } + input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { - @apply(--paper-input-container-input-webkit-spinner); + @apply --paper-input-container-input-webkit-spinner; } input::-webkit-clear-button { - @apply(--paper-input-container-input-webkit-clear); + @apply --paper-input-container-input-webkit-clear; + } + + input::-webkit-calendar-picker-indicator { + @apply --paper-input-container-input-webkit-calendar-picker-indicator; } input::-webkit-input-placeholder { - color: var(--paper-input-container-color, --secondary-text-color); + color: var(--paper-input-container-color, var(--secondary-text-color)); } input:-moz-placeholder { - color: var(--paper-input-container-color, --secondary-text-color); + color: var(--paper-input-container-color, var(--secondary-text-color)); } input::-moz-placeholder { - color: var(--paper-input-container-color, --secondary-text-color); + color: var(--paper-input-container-color, var(--secondary-text-color)); } input::-ms-clear { - @apply(--paper-input-container-ms-clear); + @apply --paper-input-container-ms-clear; } - input::-webkit-calendar-picker-indicator { - @apply --paper-input-container-input-webkit-calendar-picker-indicator; + input::-ms-reveal { + @apply --paper-input-container-ms-reveal; } input:-ms-input-placeholder { - color: var(--paper-input-container-color, --secondary-text-color); + color: var(--paper-input-container-color, var(--secondary-text-color)); } label { @@ -2768,30 +16571,44 @@ } - + - + - + - + - + + + + + + + @@ -2800,35 +16617,34 @@ - - + - @@ -2868,57 +16684,58 @@ @@ -2927,49 +16744,28 @@ - - - - - - - - - - + + + @@ -3018,7 +16819,7 @@ @@ -3091,12 +16892,10 @@ - - @@ -3113,28 +16912,28 @@ padding: 8px; outline: none; - @apply(--paper-menu-button); + @apply --paper-menu-button; } :host([disabled]) { cursor: auto; color: var(--disabled-text-color); - @apply(--paper-menu-button-disabled); + @apply --paper-menu-button-disabled; } iron-dropdown { - @apply(--paper-menu-button-dropdown); + @apply --paper-menu-button-dropdown; } .dropdown-content { - @apply(--shadow-elevation-2dp); + @apply --shadow-elevation-2dp; position: relative; border-radius: 2px; - background-color: var(--paper-menu-button-dropdown-background, --primary-background-color); + background-color: var(--paper-menu-button-dropdown-background, var(--primary-background-color)); - @apply(--paper-menu-button-content); + @apply --paper-menu-button-content; } :host([vertical-align="top"]) .dropdown-content { @@ -3148,31 +16947,32 @@ margin-bottom: -10px; margin-top: 20px; } - + #trigger { cursor: pointer; }
- +
-