ht.widget.ColorPicker()

new ColorPicker()

创建颜色选择框

Requires:
  • module:ht-form.js

Extends

Requires

  • module:ht-form.js

Methods

addPropertyChangeListener(listener, scope, ahead) → {void}

增加自身属性变化事件监听器

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope Object <optional>

监听器函数域

ahead boolean <optional>

是否将当前监听器插入到监听器列表开头

Returns:
void
Inherited From:
See:

addToDOM(parentNode) → {void}

将组件加入到指定的 DOM 元素底下,不指定则加入到 document.body 下

Parameters:
Name Type Attributes Description
parentNode HTMLElement <optional>

父 DOM,默认为 document.body

Returns:
void
Inherited From:

addViewListener(listener, scope, ahead) → {void}

监听视图事件,如布局、刷新等

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope Object <optional>

监听器函数域

ahead boolean <optional>

是否将当前监听器插入到监听器列表开头

Returns:
void
Inherited From:

close() → {void}

关闭下拉框

Returns:
void
Inherited From:

disableToolTip() → {void}

关闭文字提示

Returns:
void
Inherited From:

drawValue(g, x, y, width, height) → {void}

绘制值,可重载自定义绘制

Parameters:
Name Type Description
g CanvasRenderingContext2D

画笔对象

x number

矩形左上角 x 坐标

y number

矩形左上角 y 坐标

width number

矩形宽度

height number

矩形高度

Returns:
void
Inherited From:

enableToolTip() → {void}

启用ToolTip

Returns:
void
Inherited From:

firePropertyChange(property, oldValue, newValue, equalFunc, params) → {void}

派发属性变化事件

Parameters:
Name Type Attributes Description
property string

属性

oldValue any

旧值

newValue any

新值

equalFunc function <optional>

相等判断函数

params any <optional>

其它参数

Returns:
void
Inherited From:
See:

fireViewEvent(kind) → {void}

Parameters:
Name Type Description
kind string
Returns:
void
Inherited From:

fp(property, oldValue, newValue, equalFunc, params) → {void}

派发属性变化事件,firePropertyChange 方法的简写

Parameters:
Name Type Attributes Description
property string

属性

oldValue any

旧值

newValue any

新值

equalFunc function <optional>

相等判断函数

params any <optional>

其它参数

Returns:
void
Inherited From:
See:

getBackground() → {string}

获取背景颜色

Returns:
string -

背景颜色

Inherited From:

getClass() → {function}

获取类声明(构造函数)

Returns:
function -

类声明(构造函数)

Inherited From:

getClassName() → {string}

获取类全名

Returns:
string -

类全名

Inherited From:

getDisabledDiv() → {HTMLElement}

获取被禁用组件的div

Returns:
HTMLElement -

被禁用组件的div

Inherited From:

getDropDownComponent() → {Object}

获取下拉框模版类

Returns:
Object -

下拉框模版类

Inherited From:

getDropDownComponentInstance() → {Object}

获取下拉框模版实例

Returns:
Object -

下拉框模版实例

Inherited From:

getDropDownIcon() → {string}

获取下拉箭头图标

Returns:
string -

下拉箭头图标

Inherited From:

getHeight() → {number}

获取布局高度

Returns:
number -

布局高度

Inherited From:

getIndent() → {number}

获取图标缩进

Returns:
number -

图标缩进

Inherited From:

getLabelColor() → {string}

获取文本颜色

Returns:
string -

文本颜色

Inherited From:

getLabelFont() → {string}

获取文本字体

Returns:
string -

文本字体

Inherited From:

getPaletteColors() → {Array.<Array.<string>>}

获取颜色选择面板颜色配置

Returns:
Array.<Array.<string>> -

颜色配置数据

getSuperClass() → {function}

获取父类声明(构造函数)

Returns:
function -

父类声明(构造函数)

Inherited From:

getToolTip() → {string}

获取ToolTip文字,可重载返回自定义的toolTip文字

Returns:
string -

toolTip文字

Inherited From:

getValue() → {string}

获取属性值

Returns:
string -

属性值

Inherited From:

getView() → {HTMLElement}

获取组件的根层div

Returns:
HTMLElement -

组件的根层div

Inherited From:

getWidth() → {number}

获取布局宽度

Returns:
number -

布局宽度

Inherited From:

invalidate(delay) → {void}

无效组件,并调用延时刷新

Parameters:
Name Type Description
delay number

延迟刷新的间隔事件(单位:ms)

Returns:
void
Inherited From:
See:

isClearButtonVisible() → {boolean}

获取清空按钮是否可见

Returns:
boolean

isEditable() → {boolean}

获取组件是否编辑

Returns:
boolean
Inherited From:

isInstant() → {boolean}

组件是否立即使用

Returns:
boolean -

组件是否立即使用

isOpened() → {boolean}

获取下拉框是否打开

Returns:
boolean
Inherited From:

isToolTipEnabled() → {boolean}

获取提示功能是否可用

Returns:
boolean
Inherited From:

iv(delay) → {void}

无效组件,并调用延时刷新

Parameters:
Name Type Description
delay number

延迟刷新的间隔事件(单位:ms)

Returns:
void
Inherited From:
See:

layout(x, y, width, height) → {void}

执行布局

Parameters:
Name Type Description
x number

视图左上角布局 x 点位置

y number

视图左上角布局 y 点位置

width number

视图宽度

height number

视图高度

Returns:
void
Inherited From:

mp(listener, scope, ahead) → {void}

增加自身属性变化事件监听器的缩写

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope any <optional>

监听器函数域

ahead boolean <optional>

是否将当前监听器插入到监听器列表开头

Returns:
void
Inherited From:
See:

onInputCreated() → {void}

输入框创建后,可重载监听

Returns:
void
Inherited From:

onPropertyChanged(event) → {void}

属性变化回调函数,可重载做后续处理

Parameters:
Name Type Description
event Object

属性变化事件

Returns:
void
Inherited From:
Example
//event格式:
{
	property: 'name',//发生变化的属性
	oldValue: 'oldValue',//旧值
	newValue: 'newValue',''新值
	data: data//发生变化的data
}

onValueChanged(oldValue, newValue) → {void}

值改变,可重载监听

Parameters:
Name Type Description
oldValue string

旧值

newValue string

新值

Returns:
void
Inherited From:

open() → {void}

打开下拉框

Returns:
void
Inherited From:

removePropertyChangeListener(listener, scope) → {void}

删除自身属性变化事件监听器

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope Object <optional>

监听器函数域

Returns:
void
Inherited From:

removeViewListener(listener, scope) → {void}

删除视图事件监听器

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope Object <optional>

监听器函数域

Returns:
void
Inherited From:

setBackground(color) → {void}

设置背景颜色

Parameters:
Name Type Description
color string

颜色

Returns:
void
Inherited From:

setClearButtonVisible(visible) → {void}

设置清空按钮是否可见

Parameters:
Name Type Description
visible boolean

按钮是否可见

Returns:
void

setCursor(style) → {void}

设置 css 的鼠标样式,cursor

Parameters:
Name Type Description
style string

css 的鼠标样式

Returns:
void
Inherited From:

setDisabled(value, iconUrl) → {void}

设置组件是否处于不可用状态,处于不可用状态时不能进行任何操作并且会遮挡一层蒙板

Parameters:
Name Type Attributes Description
value boolean

是否禁用组件

iconUrl string <optional>

蒙板上显示的icon的路径

Returns:
void
Inherited From:

setDropDownComponent(component) → {void}

设置下拉框模版类,此类要从 ht.widget.BaseDropDownTemplate 继承

Parameters:
Name Type Description
component Object

组件

Returns:
void
Inherited From:

setDropDownIcon(icon) → {void}

设置下拉箭头图标

Parameters:
Name Type Description
icon string

下拉箭头图标

Returns:
void
Inherited From:

setEditable(editable) → {void}

设置组件是否可编辑

Parameters:
Name Type Description
editable boolean
Returns:
void
Inherited From:

setFocus(value) → {void}

根据值给组件设置焦点

Parameters:
Name Type Attributes Description
value string <optional>
Returns:
void
Inherited From:

setHeight(height) → {void}

设置布局高度

Parameters:
Name Type Description
height number

高度值

Returns:
void
Inherited From:

setIndent(indent) → {void}

设置图标缩进

Parameters:
Name Type Description
indent number

缩进

Returns:
void
Inherited From:

setInstant(v) → {void}

设置组件是否立即使用

Parameters:
Name Type Description
v boolean
Returns:
void

setLabelColor(color) → {void}

设置下拉文本颜色

Parameters:
Name Type Description
color string

文本颜色

Returns:
void
Inherited From:

setLabelFont(font) → {void}

设置下拉文本字体

Parameters:
Name Type Description
font string

文本字体

Returns:
void
Inherited From:

setPaletteColors(colors) → {void}

设置颜色选择面板颜色配置,格式同 [['green', 'red'],['yellow', 'pink']]

Parameters:
Name Type Description
colors Array.<Array.<string>>
Returns:
void

setToolTip(toolTip) → {void}

设置文字提示信息

Parameters:
Name Type Description
toolTip string

文字提示

Returns:
void
Inherited From:

setToolTipEnabled(enable) → {void}

设置提示是否可用

Parameters:
Name Type Description
enable boolean
Returns:
void
Inherited From:

setValue(value) → {void}

设置值

Parameters:
Name Type Description
value any
Returns:
void
Inherited From:

setWidth(width) → {void}

设置布局宽度

Parameters:
Name Type Description
width number

宽度值

Returns:
void
Inherited From:

toggle() → {void}

切换下拉框打开状态

Returns:
void
Inherited From:

ump(listener, scope) → {void}

删除自身属性变化事件监听器,removePropertyChangeListener的缩写

Parameters:
Name Type Attributes Description
listener function

监听器函数

scope Object <optional>

监听器函数域

Returns:
void
Inherited From:
See:

validate() → {void}

立刻刷新拓扑

Returns:
void
Inherited From:

validateImpl() → {void}

刷新

Returns:
void
Inherited From: