aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/PropertiesView.scss4
-rw-r--r--src/client/views/collections/CollectionView.tsx16
-rw-r--r--src/client/views/nodes/FilterBox.tsx10
3 files changed, 23 insertions, 7 deletions
diff --git a/src/client/views/PropertiesView.scss b/src/client/views/PropertiesView.scss
index 1d52136de..7c6d507b8 100644
--- a/src/client/views/PropertiesView.scss
+++ b/src/client/views/PropertiesView.scss
@@ -191,8 +191,8 @@
font-size: 10px;
padding: 10px;
margin-left: 5px;
- // max-height: 40%;
- overflow-y: visible;
+ max-height: 40%;
+ overflow-y: scroll;
.propertiesView-buttonContainer {
float: right;
diff --git a/src/client/views/collections/CollectionView.tsx b/src/client/views/collections/CollectionView.tsx
index 34fd20f1a..4f37747b0 100644
--- a/src/client/views/collections/CollectionView.tsx
+++ b/src/client/views/collections/CollectionView.tsx
@@ -38,6 +38,8 @@ import { SubCollectionViewProps } from './CollectionSubView';
import { CollectionTimeView } from './CollectionTimeView';
import { CollectionTreeView } from "./CollectionTreeView";
import './CollectionView.scss';
+import { FilterBox } from '../nodes/FilterBox';
+import { listSpec } from '../../../fields/Schema';
export const COLLECTION_BORDER_WIDTH = 2;
const path = require('path');
@@ -116,6 +118,19 @@ export class CollectionView extends Touchable<CollectionViewProps> {
whenActiveChanged = (isActive: boolean) => this.props.whenActiveChanged(this._isChildActive = isActive);
+ /**
+ * Applies the collection/dashboard's current filter attributes to the doc being added
+ */
+ addFilterAttributes = (doc: Doc) => {
+ Cast(FilterBox.targetDoc._docFilters, listSpec("string"))?.forEach(attribute => {
+ if (attribute.charAt(0).toUpperCase() === attribute.charAt(0)) {
+ const fields = attribute.split(':');
+ if (fields[2] === "check") doc[DataSym][fields[0]] = fields[1];
+ else if (fields[2] === "x" && doc[DataSym][fields[0]] === fields[1]) doc[DataSym][fields[0]] = undefined;
+ }
+ });
+ }
+
@action.bound
addDocument = (doc: Doc | Doc[]): boolean => {
if (this.props.filterAddDocument?.(doc) === false) {
@@ -157,6 +172,7 @@ export class CollectionView extends Touchable<CollectionViewProps> {
DocUtils.LeavePushpin(doc);
doc._stayInCollection = undefined;
doc.context = this.props.Document;
+ this.addFilterAttributes(doc); //
});
added.map(doc => this.props.layerProvider?.(doc, true));// assigns layer values to the newly added document... testing the utility of this
(targetDataDoc[this.props.fieldKey] as List<Doc>).push(...added);
diff --git a/src/client/views/nodes/FilterBox.tsx b/src/client/views/nodes/FilterBox.tsx
index 41e274e7a..541693cdf 100644
--- a/src/client/views/nodes/FilterBox.tsx
+++ b/src/client/views/nodes/FilterBox.tsx
@@ -39,7 +39,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
constructor(props: Readonly<FieldViewProps>) {
super(props);
- const targetDoc = this.targetDoc;
+ const targetDoc = FilterBox.targetDoc;
if (!targetDoc) CurrentUserUtils.setupFilterDocs(targetDoc);
}
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(FilterBox, fieldKey); }
@@ -52,7 +52,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
/**
* @returns the relevant doc according to the value of FilterBox._filterScope i.e. either the Current Dashboard or the Current Collection
*/
- @computed get targetDoc() {
+ @computed static get targetDoc() {
return FilterBox._filterScope === "Current Collection" ? SelectionManager.Views()[0].Document || CollectionDockingView.Instance.props.Document : CollectionDockingView.Instance.props.Document;
}
@@ -68,7 +68,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
@computed get allDocs() {
trace();
const allDocs = new Set<Doc>();
- const targetDoc = this.targetDoc;
+ const targetDoc = FilterBox.targetDoc;
if (this._loaded && targetDoc) {
// if (targetDoc) {
const activeTabs = DocListCast(targetDoc.data);
@@ -140,7 +140,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
public removeFilter = (filterName: string) => {
console.log("remove filter");
- const targetDoc = this.targetDoc;
+ const targetDoc = FilterBox.targetDoc;
const filterDoc = targetDoc.currentFilter as Doc;
const attributes = DocListCast(filterDoc["data"]);
const found = attributes.findIndex(doc => doc.title === filterName);
@@ -170,7 +170,7 @@ export class FilterBox extends ViewBoxBaseComponent<FieldViewProps, FilterBoxDoc
console.log("facetClick: " + facetHeader);
console.log(this.props.fieldKey);
- const targetDoc = this.targetDoc;
+ const targetDoc = FilterBox.targetDoc;
const found = this.activeAttributes.findIndex(doc => doc.title === facetHeader);
if (found !== -1) {
// comment this bit out later once the x works in treeview