mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: autocomplete: fix styles & ensure key type (#191)
This commit is contained in:
1 parent
79ec4d300c
commit
fe36a3f17e
3 files changed
+7
-21
No files matched your search
@@ -53,7 +53,7 @@
|
|||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
|
|
||||||
&>svg
|
&>span.bp3-icon>svg
|
||||||
font-size: 12px
|
font-size: 12px
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
padding: 4px
|
padding: 4px
|
||||||
@@ -78,35 +78,19 @@
|
|||||||
&>div
|
&>div
|
||||||
flex-grow: 1
|
flex-grow: 1
|
||||||
|
|
||||||
&>svg
|
&>span.bp3-icon>svg
|
||||||
color: transparent
|
color: transparent
|
||||||
|
|
||||||
&[aria-selected='true']
|
&[aria-selected='true']
|
||||||
background-color: #fafafa
|
background-color: #fafafa
|
||||||
font-weight: 600
|
font-weight: 600
|
||||||
|
|
||||||
svg
|
&>span.bp3-icon>svg
|
||||||
color: #1890ff
|
color: #1890ff
|
||||||
|
|
||||||
&[data-focus='true']
|
&[data-focus='true']
|
||||||
background-color: #e6f7ff
|
background-color: #e6f7ff
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
svg
|
&>span.bp3-icon>svg
|
||||||
color: currentColor
|
color: currentColor
|
||||||
|
|
||||||
svg.autocomplete-icon
|
|
||||||
-webkit-user-select: none
|
|
||||||
-moz-user-select: none
|
|
||||||
-ms-user-select: none
|
|
||||||
user-select: none
|
|
||||||
width: 1em
|
|
||||||
height: 1em
|
|
||||||
display: inline-block
|
|
||||||
fill: currentColor
|
|
||||||
-webkit-flex-shrink: 0
|
|
||||||
-ms-flex-negative: 0
|
|
||||||
flex-shrink: 0
|
|
||||||
-webkit-transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms
|
|
||||||
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms
|
|
||||||
font-size: 1.25rem
|
|
||||||
+1
-1
@@ -11,7 +11,7 @@ const ProblemSelectAutoComplete = forwardRef(function ProblemSelectAutoComplete(
|
|||||||
return (pdoc.pid ? `${pdoc.pid} ` : '') + pdoc.title;
|
return (pdoc.pid ? `${pdoc.pid} ` : '') + pdoc.title;
|
||||||
}; */
|
}; */
|
||||||
|
|
||||||
const itemKey = (pdoc) => pdoc.docId || pdoc;
|
const itemKey = (pdoc) => `${pdoc.docId || pdoc}`; // force string
|
||||||
|
|
||||||
const renderItem = (pdoc) => (
|
const renderItem = (pdoc) => (
|
||||||
<div className="media">
|
<div className="media">
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ export default class AutoComplete extends DOMAttachedObject {
|
|||||||
this.onChange = this.onChange.bind(this);
|
this.onChange = this.onChange.bind(this);
|
||||||
this.container = document.createElement('div');
|
this.container = document.createElement('div');
|
||||||
this.$dom.addClass('autocomplete-dummy').after(this.container);
|
this.$dom.addClass('autocomplete-dummy').after(this.container);
|
||||||
|
// Note: use `setTimeout(fn, 0)` to ensure that code is executed after browser autofill
|
||||||
|
// also see https://stackoverflow.com/a/779785/13553984
|
||||||
setTimeout(() => this.attach(), 0);
|
setTimeout(() => this.attach(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user