diff options
| author | bobzel <zzzman@gmail.com> | 2020-08-22 14:21:41 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-08-22 14:21:41 -0400 |
| commit | 88b06945c8a1fcb7bc518de878a4894de70dda94 (patch) | |
| tree | e04d29ae0f68b042b4b6f2bcd9bd506b2e970d70 /src/client/views/collections/CollectionSchemaHeaders.tsx | |
| parent | 4ed30f48bd0c87f0a5ccb484d78bf4601ab6ff74 (diff) | |
major overhaul of search to avoid writing anything to filtered documents and to make the UI work properly.
Diffstat (limited to 'src/client/views/collections/CollectionSchemaHeaders.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSchemaHeaders.tsx | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx index 34a8bfa24..a90d78a87 100644 --- a/src/client/views/collections/CollectionSchemaHeaders.tsx +++ b/src/client/views/collections/CollectionSchemaHeaders.tsx @@ -287,12 +287,10 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> { const colpos = this._searchTerm.indexOf(":"); const temp = this._searchTerm.slice(colpos + 1, this._searchTerm.length); if (temp === "") { - console.log("here we are first"); Doc.setDocFilter(this.props.Document, this._key, this.tempfilter, undefined); this.updateFilter(); } else { - console.log("here we are first"); Doc.setDocFilter(this.props.Document, this._key, this.tempfilter, undefined); this.tempfilter = temp; Doc.setDocFilter(this.props.Document, this._key, temp, "check"); @@ -304,8 +302,8 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> { Doc.setDocFilter(this.props.Document, this._key, this.tempfilter, undefined); this.updateFilter(); let keyOptions = this._searchTerm === "" ? this.props.possibleKeys : this.props.possibleKeys.filter(key => key.toUpperCase().indexOf(this._searchTerm.toUpperCase()) > -1); - const blockedkeys = ["system", "ACL-Public", "_scrollTop", "customTitle", "limitHeight", "proto", "x", "y", "_width", "_height", "_autoHeight", "_fontSize", "_fontFamily", "context", "zIndex", "_timeStampOnEnter", "lines", "highlighting", "searchMatch", "creationDate", "isPrototype", "text-annotations", "aliases", "text-lastModified", "text-noTemplate", "layoutKey", "baseProto", "_xMargin", "_yMargin", "layout", "layout_keyValue", "links"]; - keyOptions = keyOptions.filter(n => !blockedkeys.includes(n)); + const blockedkeys = ["system", "customTitle", "limitHeight", "proto", "x", "y", "zIndex", "isPrototype", "text-annotations", "aliases", "text-lastModified", "text-noTemplate", "layoutKey", "baseProto", "layout", "layout_keyValue", "links"]; + keyOptions = keyOptions.filter(n => !blockedkeys.includes(n) && !n.startsWith("_") && !n.startsWith("ACL")); if (keyOptions.length) { this.onSelect(keyOptions[0]); } else if (this._searchTerm !== "" && this.props.canAddNew) { @@ -338,8 +336,8 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> { const exactFound = keyOptions.findIndex(key => key.toUpperCase() === this._searchTerm.toUpperCase()) > -1 || this.props.existingKeys.findIndex(key => key.toUpperCase() === this._searchTerm.toUpperCase()) > -1; - const blockedkeys = ["proto", "x", "y", "_width", "_height", "_autoHeight", "_fontSize", "_fontFamily", "context", "zIndex", "_timeStampOnEnter", "lines", "highlighting", "searchMatch", "creationDate", "isPrototype", "text-annotations", "aliases", "text-lastModified", "text-noTemplate", "layoutKey", "baseProto", "_xMargin", "_yMargin", "layout", "layout_keyValue", "links"]; - keyOptions = keyOptions.filter(n => !blockedkeys.includes(n)); + const blockedkeys = ["proto", "x", "y", "zIndex", "_timeStampOnEnter", "isPrototype", "text-annotations", "aliases", "text-lastModified", "text-noTemplate", "layoutKey", "baseProto", "layout", "layout_keyValue", "links"]; + keyOptions = keyOptions.filter(n => !blockedkeys.includes(n) && !n.startsWith("_") && !n.startsWith("ACL")); const options = keyOptions.map(key => { return <div key={key} className="key-option" style={{ @@ -498,11 +496,7 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> { } }); - keyOptions.forEach(key => { - Doc.setDocFilter(this.props.Document, this._key, key, undefined); - } - ); - Doc.setDocFilter(this.props.Document, this._key, this.tempfilter, undefined); + Doc.setDocFilter(this.props.Document, this._key, "", "remove"); this.props.col.setColor("rgb(241, 239, 235)"); this.closeResultsVisibility = "none"; } @@ -518,13 +512,9 @@ export class KeysDropdown extends React.Component<KeysDropdownProps> { <div className="keys-dropdown" style={{ zIndex: 1, width: this.props.width, maxWidth: this.props.width }}> <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); - }} - onClick={(e) => { - //this._inputRef.current!.select(); - e.stopPropagation(); - }} onFocus={this.onFocus} ></input> + onChange={e => this.onChange(e.target.value)} + onClick={(e) => { e.stopPropagation(); this._inputRef.current?.focus(); }} + onFocus={this.onFocus} ></input> <div style={{ display: this.closeResultsVisibility }}> <FontAwesomeIcon onPointerDown={this.removeFilters} icon={"times-circle"} size="lg" style={{ cursor: "hand", color: "grey", padding: 2, left: -20, top: -1, height: 15, position: "relative" }} /> |
