|
|
|
@ -17,7 +17,8 @@ import {
|
|
|
|
|
BlankSplitChar, |
|
|
|
|
Events, |
|
|
|
|
EVENT_RESPONSE_TIME, |
|
|
|
|
Func |
|
|
|
|
Func, |
|
|
|
|
isFunction, |
|
|
|
|
} from "@/core"; |
|
|
|
|
import { ButtonGroup } from "./group.button"; |
|
|
|
|
import { Maskers } from "@/base/0.base"; |
|
|
|
@ -127,7 +128,8 @@ export class Searcher extends Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_assertPopupView() { |
|
|
|
|
const { masker, popup, chooseType, isAutoSync, adapter } = this.options; |
|
|
|
|
const { masker, popup, chooseType, isAutoSync } = this.options; |
|
|
|
|
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter; |
|
|
|
|
if ((masker && !Maskers.has(this.getName())) || (masker === false && !this.popupView)) { |
|
|
|
|
this.popupView = createWidget(popup, { |
|
|
|
|
type: SearcherView.xtype, |
|
|
|
@ -213,7 +215,8 @@ export class Searcher extends Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_search() { |
|
|
|
|
const { isAutoSearch, adapter, isAutoSync, onSearch } = this.options; |
|
|
|
|
const { isAutoSearch, isAutoSync, onSearch } = this.options; |
|
|
|
|
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter; |
|
|
|
|
const keyword = this.editor.getValue(); |
|
|
|
|
if (keyword === "" || this._stop) { |
|
|
|
|
return; |
|
|
|
@ -333,7 +336,8 @@ export class Searcher extends Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getValue() { |
|
|
|
|
const { isAutoSync, adapter, popup } = this.options; |
|
|
|
|
const { isAutoSync, popup } = this.options; |
|
|
|
|
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter; |
|
|
|
|
if (isAutoSync && adapter && adapter.getValue) { |
|
|
|
|
return adapter.getValue(); |
|
|
|
|
} |
|
|
|
@ -350,7 +354,8 @@ export class Searcher extends Widget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
populate(result, searchResult, keyword) { |
|
|
|
|
const { isAutoSync, adapter } = this.options; |
|
|
|
|
const { isAutoSync } = this.options; |
|
|
|
|
const adapter = isFunction(this.options.adapter) ? this.options.adapter() : this.options.adapter; |
|
|
|
|
this._assertPopupView(); |
|
|
|
|
this.popupView.populate(...arguments); |
|
|
|
|
if (isAutoSync && adapter && adapter.getValue) { |
|
|
|
|