From 4e478ed59d99e14318e29528a8f0d3bce03f9d23 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Tue, 11 May 2021 18:27:50 -0400 Subject: exclude selected filters, changed cursor to pointer --- src/client/views/collections/TreeView.scss | 1 + src/client/views/nodes/FilterBox.tsx | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/TreeView.scss b/src/client/views/collections/TreeView.scss index 0239ae863..3f6fc8b0c 100644 --- a/src/client/views/collections/TreeView.scss +++ b/src/client/views/collections/TreeView.scss @@ -118,6 +118,7 @@ align-items: center; margin-left: 0.25rem; opacity: 0.75; + cursor: pointer; >svg { margin-left: 0.25rem; diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx index c97de3402..847e2653e 100644 --- a/src/client/views/nodes/FilterBox.tsx +++ b/src/client/views/nodes/FilterBox.tsx @@ -357,9 +357,7 @@ export class FilterBox extends ViewBoxBaseComponent this.currentFacets.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet })); - const options = this._allFacets.map(facet => ({ value: facet, label: facet })); + const options = this._allFacets.filter(facet => this.currentFacets.indexOf(facet) === -1).map(facet => ({ value: facet, label: facet })); return this.props.dontRegisterView ? (null) :
-- cgit v1.2.3-70-g09d2 From 534877a9d75f828c50c37dc43a0555c307444709 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Tue, 11 May 2021 20:35:04 -0400 Subject: filters applied indicator --- .../collectionFreeForm/CollectionFreeFormView.tsx | 16 ++++++++++++---- src/client/views/nodes/FilterBox.tsx | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src') 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 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} + {StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length ? + { /** open filters? */ e.stopPropagation(); }} + /> + : (null)} +
{ - 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; -- cgit v1.2.3-70-g09d2 From cdb61a7a83dd6f6573c4667ce85fd1f613ce2f0a Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Tue, 11 May 2021 21:10:37 -0400 Subject: expand propertiesview on icon click --- .../views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 6b5b67bd8..870b0f79d 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1498,7 +1498,7 @@ export class CollectionFreeFormView extends CollectionSubView { /** open filters? */ e.stopPropagation(); }} + onPointerDown={e => { runInAction(() => CurrentUserUtils.propertiesWidth = 250); e.stopPropagation(); }} /> : (null)} -- cgit v1.2.3-70-g09d2 From c39a9b24345a77fc738d33b7c112296fd1f4279d Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Tue, 11 May 2021 21:22:23 -0400 Subject: icon displays for freeform, need to find position for the rest --- .../views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 870b0f79d..9bc764aca 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1495,7 +1495,7 @@ export class CollectionFreeFormView extends CollectionSubView} - {StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length ? + {StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docRangeFilters).length ? { runInAction(() => CurrentUserUtils.propertiesWidth = 250); e.stopPropagation(); }} -- cgit v1.2.3-70-g09d2 From 1e2e9feb78d9ea8c061c0141a5fd44ecb9f7fe1a Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Thu, 13 May 2021 01:34:35 -0400 Subject: filter icon shows up for all collections --- .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 6 ------ src/client/views/nodes/DocumentView.tsx | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 9bc764aca..0f9dbe23b 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1495,12 +1495,6 @@ export class CollectionFreeFormView extends CollectionSubView} - {StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docRangeFilters).length ? - { runInAction(() => CurrentUserUtils.propertiesWidth = 250); e.stopPropagation(); }} - /> - : (null)}
{ !this.props.dontRegisterView && DocumentManager.Instance.RemoveView(this); } + @computed get showFilterIcon() { + return this.props.Document.type === DocumentType.COL && !Doc.IsSystem(this.props.Document) && (StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docRangeFilters).length); + } render() { TraceMobx(); const xshift = () => (this.props.Document.isInkMask ? InkingStroke.MaskDim : Math.abs(this.Xshift) <= 0.001 ? this.props.PanelWidth() : undefined); @@ -1164,6 +1167,11 @@ export class DocumentView extends React.Component { focus={this.props.focus || emptyFunction} bringToFront={emptyFunction} ref={action((r: DocumentViewInternal | null) => this.docView = r)} /> + {this.showFilterIcon ? + + : (null)}
)}
); } -- cgit v1.2.3-70-g09d2 From f9733d1fcd50cd2805a3a0b7dfcd1462a42d6a0e Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Thu, 13 May 2021 21:06:24 -0400 Subject: filter icon on collections and clickable --- src/client/util/CurrentUserUtils.ts | 1 + src/client/views/collections/CollectionView.tsx | 18 ++++++++++++++++-- src/client/views/nodes/DocumentView.tsx | 8 -------- 3 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/client/util/CurrentUserUtils.ts b/src/client/util/CurrentUserUtils.ts index 14bb87e89..5874a7d2c 100644 --- a/src/client/util/CurrentUserUtils.ts +++ b/src/client/util/CurrentUserUtils.ts @@ -1196,6 +1196,7 @@ export class CurrentUserUtils { const createDashboard = ScriptField.MakeScript(`createNewDashboard()`); dashboardDoc.contextMenuScripts = new List([toggleTheme!, toggleComic!, snapshotDashboard!, createDashboard!]); dashboardDoc.contextMenuLabels = new List(["Toggle Theme Colors", "Toggle Comic Mode", "Snapshot Dashboard", "Create Dashboard"]); + dashboardDoc.isDashboard = true; Doc.AddDocToList(dashboards, "data", dashboardDoc); CurrentUserUtils.openDashboard(userDoc, dashboardDoc); diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index 85ae66fdc..f8b827c05 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -1,8 +1,8 @@ -import { computed, observable } from 'mobx'; +import { computed, observable, runInAction } from 'mobx'; import { observer } from "mobx-react"; import * as React from 'react'; import 'react-image-lightbox-with-rotate/style.css'; // This only needs to be imported once in your app -import { Doc, DocListCast } from '../../../fields/Doc'; +import { Doc, DocListCast, StrListCast } from '../../../fields/Doc'; import { documentSchema } from '../../../fields/documentSchemas'; import { Id } from '../../../fields/FieldSymbols'; import { ObjectField } from '../../../fields/ObjectField'; @@ -34,6 +34,7 @@ import { CollectionStackingView } from './CollectionStackingView'; import { SubCollectionViewProps } from './CollectionSubView'; import { CollectionTimeView } from './CollectionTimeView'; import { CollectionTreeView } from "./CollectionTreeView"; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import './CollectionView.scss'; export const COLLECTION_BORDER_WIDTH = 2; const path = require('path'); @@ -231,6 +232,13 @@ export class CollectionView extends ViewBoxAnnotatableComponent this.props.childLayoutTemplate?.() || Cast(this.rootDoc.childLayoutTemplate, Doc, null); @computed get childLayoutString() { return StrCast(this.rootDoc.childLayoutString); } + /** + * Shows the filter icon if it's a user-created collection which isn't a dashboard and has some docFilters applied on it or on the current dashboard. + */ + @computed get showFilterIcon() { + return !this.props.Document.isDashboard && !Doc.IsSystem(this.props.Document) && ((StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docRangeFilters).length)); + } + render() { TraceMobx(); const props: SubCollectionViewProps = { @@ -250,6 +258,12 @@ export class CollectionView extends ViewBoxAnnotatableComponent {this.showIsTagged()} {this.collectionViewType !== undefined ? this.SubView(this.collectionViewType, props) : (null)} + {this.showFilterIcon ? + { runInAction(() => CurrentUserUtils.propertiesWidth = 250); e.stopPropagation(); }} + /> + : (null)}
); } } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index f4a5c7e96..7ec9f5f74 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1136,9 +1136,6 @@ export class DocumentView extends React.Component { !this.props.dontRegisterView && DocumentManager.Instance.RemoveView(this); } - @computed get showFilterIcon() { - return this.props.Document.type === DocumentType.COL && !Doc.IsSystem(this.props.Document) && (StrListCast(this.props.Document._docFilters).length || StrListCast(this.props.Document._docRangeFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docFilters).length || StrListCast(CurrentUserUtils.ActiveDashboard._docRangeFilters).length); - } render() { TraceMobx(); const xshift = () => (this.props.Document.isInkMask ? InkingStroke.MaskDim : Math.abs(this.Xshift) <= 0.001 ? this.props.PanelWidth() : undefined); @@ -1167,11 +1164,6 @@ export class DocumentView extends React.Component { focus={this.props.focus || emptyFunction} bringToFront={emptyFunction} ref={action((r: DocumentViewInternal | null) => this.docView = r)} /> - {this.showFilterIcon ? - - : (null)}
)} ); } -- cgit v1.2.3-70-g09d2 From 5da41b393959616e123161a75cb6c72e701acc81 Mon Sep 17 00:00:00 2001 From: bobzel Date: Mon, 17 May 2021 11:08:28 -0400 Subject: use type of collection to determine if its a dashboard instead of a flag. --- src/client/views/collections/CollectionView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx index f8b827c05..fb60265e3 100644 --- a/src/client/views/collections/CollectionView.tsx +++ b/src/client/views/collections/CollectionView.tsx @@ -236,7 +236,7 @@ export class CollectionView extends ViewBoxAnnotatableComponent