aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx4
-rw-r--r--src/client/views/collections/CollectionSchemaHeaders.tsx25
-rw-r--r--src/client/views/collections/SchemaTable.tsx23
3 files changed, 13 insertions, 39 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index d11d6a5ba..0bc2afd47 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -294,7 +294,6 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
bing={() => {
const cfield = ComputedField.WithoutComputed(() => FieldValue(props.Document[props.fieldKey]));
if (cfield !== undefined) {
- console.log(typeof (cfield));
// if (typeof(cfield)===RichTextField)
const a = cfield as RichTextField;
if (a.Text !== undefined) {
@@ -896,7 +895,6 @@ export class CollectionSchemaButtons extends CollectionSchemaCell {
}}><button onClick={() => {
doc.searchMatch = false;
setTimeout(() => doc.searchMatch = true, 0);
- doc.searchIndex = NumCast(doc.searchIndex);
}} style={{ padding: 2, left: 77 }}>
<FontAwesomeIcon icon="arrow-up" size="sm" />
</button>
@@ -904,7 +902,6 @@ export class CollectionSchemaButtons extends CollectionSchemaCell {
{
doc.searchMatchAlt = false;
setTimeout(() => doc.searchMatchAlt = true, 0);
- doc.searchIndex = NumCast(doc.searchIndex);
}
}} style={{ padding: 2 }}>
<FontAwesomeIcon icon="arrow-down" size="sm" />
@@ -922,7 +919,6 @@ export class CollectionSchemaButtons extends CollectionSchemaCell {
onClick={() => {
doc.searchMatch = false;
setTimeout(() => doc.searchMatch = true, 0);
- doc.searchIndex = NumCast(doc.searchIndex);
}}>
<FontAwesomeIcon icon="arrow-down" size="sm" />
</button></div >;
diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx
index e65adcf76..a05b12292 100644
--- a/src/client/views/collections/CollectionSchemaHeaders.tsx
+++ b/src/client/views/collections/CollectionSchemaHeaders.tsx
@@ -301,8 +301,10 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
@action
onSelect = (key: string): void => {
- if (key.slice(0, this._key.length) === this._key && this._key !== key) {
- const filter = key.slice(this._key.length - key.length);
+ if (this._searchTerm.includes(":")) {
+ const colpos = this._searchTerm.indexOf(":");
+ const filter = this._searchTerm.slice(colpos + 1, this._searchTerm.length);
+ //const filter = key.slice(this._key.length - key.length);
this.props.onSelect(this._key, this._key, this.props.addNew, filter);
}
else {
@@ -314,9 +316,12 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
}
@action
- onSelect2 = (key: string): void => {
- this._searchTerm = this._searchTerm.slice(0, this._key.length) + key;
+ onSelectValue = (key: string): void => {
+ const colpos = this._searchTerm.indexOf(":");
+ this.onSelect(key);
+ this._searchTerm = this._searchTerm.slice(0, colpos + 1) + key;
this._isOpen = false;
+ this.props.onSelect(this._key, this._key, this.props.addNew, key);
}
@@ -396,7 +401,8 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
renderFilterOptions = (): JSX.Element[] | JSX.Element => {
if (!this._isOpen) return <></>;
const keyOptions: string[] = [];
- const temp = this._searchTerm.slice(this._key.length);
+ const colpos = this._searchTerm.indexOf(":")
+ const temp = this._searchTerm.slice(colpos + 1, this._searchTerm.length);
this.props.docs?.forEach((doc) => {
const key = StrCast(doc[this._key]);
if (keyOptions.includes(key) === false && key.includes(temp)) {
@@ -410,7 +416,7 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
border: "1px solid lightgray",
width: this.props.width, maxWidth: this.props.width, overflowX: "hidden"
}}
- onPointerDown={e => e.stopPropagation()} onClick={() => { this.onSelect2(key); }}>{key}</div>;
+ onPointerDown={e => e.stopPropagation()} onClick={() => { this.onSelectValue(key); }}>{key}</div>;
});
return options;
@@ -420,11 +426,6 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
render() {
return (
<div className="keys-dropdown" style={{ zIndex: 10, width: this.props.width, maxWidth: this.props.width }}>
- {this._key === this._searchTerm.slice(0, this._key.length) ?
- <div style={{ position: "absolute", marginLeft: "4px", marginTop: "3", color: "grey", pointerEvents: "none", lineHeight: 1.15 }}>
- {this._key}
- </div>
- : undefined}
<input className="keys-search" style={{ width: "100%" }}
ref={this._inputRef} type="text" value={this._searchTerm} placeholder="Column key" onKeyDown={this.onKeyDown}
onChange={e => this.onChange(e.target.value)}
@@ -437,7 +438,7 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> {
width: this.props.width, maxWidth: this.props.width,
}}
onPointerEnter={this.onPointerEnter} onPointerLeave={this.onPointerOut}>
- {this._key === this._searchTerm.slice(0, this._key.length) ?
+ {this._searchTerm.includes(":") ?
this.renderFilterOptions() : this.renderOptions()}
</div>
</div >
diff --git a/src/client/views/collections/SchemaTable.tsx b/src/client/views/collections/SchemaTable.tsx
index 0a5ef987a..0bdf302e8 100644
--- a/src/client/views/collections/SchemaTable.tsx
+++ b/src/client/views/collections/SchemaTable.tsx
@@ -177,7 +177,6 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
}
);
}
- console.log(columns);
const cols = this.props.columns.map(col => {
@@ -315,32 +314,10 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
width: 28,
resizable: false
});
- console.log(columns);
return columns;
}
-
- @action
- nextHighlight = (e: React.MouseEvent, doc: Doc) => {
- e.preventDefault();
- e.stopPropagation();
- doc.searchMatch = false;
- console.log(doc.searchMatch);
- setTimeout(() => doc.searchMatch = true, 0);
- console.log(doc.searchMatch);
-
- doc.searchIndex = NumCast(doc.searchIndex);
- }
-
- @action
- nextHighlight2 = (doc: Doc) => {
-
- doc.searchMatchAlt = false;
- setTimeout(() => doc.searchMatchAlt = true, 0);
- doc.searchIndex = NumCast(doc.searchIndex);
- }
-
constructor(props: SchemaTableProps) {
super(props);
// convert old schema columns (list of strings) into new schema columns (list of schema header fields)