diff options
author | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-05-11 20:35:04 -0400 |
---|---|---|
committer | usodhi <61431818+usodhi@users.noreply.github.com> | 2021-05-11 20:35:04 -0400 |
commit | 534877a9d75f828c50c37dc43a0555c307444709 (patch) | |
tree | 00a9f38fa0da8ec6120490122709bca16ff49806 /src | |
parent | 4e478ed59d99e14318e29528a8f0d3bce03f9d23 (diff) |
filters applied indicator
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 16 | ||||
-rw-r--r-- | src/client/views/nodes/FilterBox.tsx | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index a14ba036f..6b5b67bd8 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -48,6 +48,7 @@ import { CollectionFreeFormRemoteCursors } from "./CollectionFreeFormRemoteCurso import "./CollectionFreeFormView.scss"; import { MarqueeView } from "./MarqueeView"; import React = require("react"); +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; export const panZoomSchema = createSchema({ _panX: "number", @@ -833,10 +834,10 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P const measuredDocs = docs.filter(doc => doc && this.childDataProvider(doc, "")).map(doc => this.childDataProvider(doc, "")); if (measuredDocs.length) { const ranges = measuredDocs.reduce(({ xrange, yrange }, { x, y, width, height }) => // computes range of content - ({ - xrange: { min: Math.min(xrange.min, x), max: Math.max(xrange.max, x + width) }, - yrange: { min: Math.min(yrange.min, y), max: Math.max(yrange.max, y + height) } - }) + ({ + xrange: { min: Math.min(xrange.min, x), max: Math.max(xrange.max, x + width) }, + yrange: { min: Math.min(yrange.min, y), max: Math.max(yrange.max, y + height) } + }) , { xrange: { min: Number.MAX_VALUE, max: -Number.MAX_VALUE }, yrange: { min: Number.MAX_VALUE, max: -Number.MAX_VALUE } @@ -1494,6 +1495,13 @@ export class CollectionFreeFormView extends CollectionSubView<PanZoomDocument, P this.placeholder : this.marqueeView} {this.props.noOverlay ? (null) : <CollectionFreeFormOverlayView elements={this.elementFunc} />} + {StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length ? + <FontAwesomeIcon icon={"filter"} size="lg" + style={{ position: 'absolute', top: 5, right: 5, cursor: "pointer", padding: 1, color: '#18c718bd' }} + onPointerDown={e => { /** open filters? */ e.stopPropagation(); }} + /> + : (null)} + <div className={"pullpane-indicator"} style={{ display: this._pullDirection ? "block" : "none", diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx index 847e2653e..c892a9f6c 100644 --- a/src/client/views/nodes/FilterBox.tsx +++ b/src/client/views/nodes/FilterBox.tsx @@ -194,12 +194,12 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc * Responds to clicking the check box in the flyout menu */ facetClick = (facetHeader: string) => { - const targetDoc = FilterBox.targetDoc; + const { targetDoc } = FilterBox; const found = this.activeAttributes.findIndex(doc => doc.title === facetHeader); if (found !== -1) { this.removeFilter(facetHeader); } else { - const allCollectionDocs = DocListCast((targetDoc.data as any)[0].data); + const allCollectionDocs = DocListCast((targetDoc.data as any)?.[0].data); const facetValues = this.gatherFieldValues(targetDoc, facetHeader); let nonNumbers = 0; |