baseframe-js
Version:
A suite of useful Javascript plugins and functions to help with Front-end Development on websites
71 lines (70 loc) • 2.39 kB
TypeScript
import type { Cash } from "cash-dom";
import type { StringPluginArgChoices } from './types';
export interface ISelectEnhanceDefaults {
cssPrefix: string;
cssListModifer: string;
mobileNative: boolean;
emptyValAsPlaceholder: boolean;
blurDuration: number;
typeAheadDuration: number;
observeSelectbox: boolean;
focusIn($select: Cash): any;
focusOut($select: Cash): any;
beforeChange($select: Cash): any;
afterChange($select: Cash): any;
}
export interface ISelectEnhanceOptions extends Partial<ISelectEnhanceDefaults> {
}
export default class SelectEnhance {
$select: Cash;
select: HTMLSelectElement;
params: ISelectEnhanceDefaults;
index: number;
id: string;
selectId: string;
isReadOnly: boolean;
$label: Cash;
$selectEnhance: Cash;
selectEnhance: HTMLDivElement;
$textInput: Cash;
textInput: HTMLInputElement;
$selectList: Cash;
selectList: HTMLDivElement;
optionSet: WeakMap<object, any>;
listPosTop: boolean;
optionsShown: boolean;
selectboxObserver: MutationObserver;
selectListBoxInFullView: boolean;
private keyedInput;
private posTimeout;
private bodyCloseEvt;
static defaults: ISelectEnhanceDefaults;
static version: string;
static pluginName: string;
constructor(element: HTMLSelectElement, options: ISelectEnhanceOptions | StringPluginArgChoices, index: number);
mobileOnlyIfNavite(): void;
showOptions(): void;
closeOptions(focusBack?: boolean): void;
setSelectionState(optionBtn: HTMLDivElement, doBlur?: boolean): void;
eventLabelClick(): void;
eventResizeClose(): void;
eventShowOptions(): void;
eventOptionClick(): void;
eventOutsideClickClose(): void;
eventKeyboardSearch(): void;
eventArrowKeys(): void;
setUpSelectHtml(): void;
static buildOptionsList(s: SelectEnhance, $selectList?: Cash): void;
nextOptionButton(dir: 'next' | 'prev'): void;
selectInputMutationObserver(): void;
eventScrollGetListPosition(init?: boolean): void;
observeSelectListBoxInFullView(): void;
getListPosition(): void;
static refreshOptions(element: any): void;
static remove(element: Cash, plugin?: SelectEnhance): void;
}
declare module 'cash-dom' {
interface Cash {
selectEnhance(options?: ISelectEnhanceOptions | StringPluginArgChoices): Cash;
}
}