new ColorPicker(properties)
颜色选择器组件;从组件从 ComboBox 继承并使用 ht.ui.ColorDropDown 作为下拉模板
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
any |
<optional> |
Example
colorPicker = new ht.ui.ColorPicker();
colorPicker.addPropertyChangeListener(function(e) {
if (e.property === 'value') {
console.log(e.newValue);
}
});
colorPicker.addToDOM(window, {x: 10, y: 20, width: 120, height: 26});
Extends
Methods
-
a(property, value) → {any}
-
Parameters:
Name Type Attributes Description property
any value
any <optional>
Returns:
any- Inherited From:
-
addPropertyChangeListener(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
addStyleProperty(property) → {void}
-
追加样式属性,将参数属性加入到样式属性列表中
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
addToDOM(dom, rect) → {void}
-
将组件加到页面的 DOM 树中;如果没有任何参数,或者只指定第一个参数并且第一个参数为 window,则组件会填满整个浏览器窗口,
并且浏览器窗口大小变化时也会自动刷新组件Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定组件的父亲 DOM,如果为空,则加到 body 中
rect
Object <optional>
组件的范围,格式为 {x: x, y: y, width: width, height: height};如果为空,则填满父亲 DOM
Returns:
void- Inherited From:
-
addViewListener(listener, scope, ahead) → {void}
-
增加 View 事件监听器,如 invalidate(无效事件)、beginValidate 等事件
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
checkPreferredSize(property) → {void}
-
Parameters:
Name Type Description property
string Returns:
void- Inherited From:
-
close() → {void}
-
关闭下拉框
Returns:
void- Inherited From:
-
containsEvent(e) → {boolean}
-
判断交互事件对象位置是否在组件区域
Parameters:
Name Type Description e
UIEvent Returns:
boolean- Inherited From:
-
disableToolTip() → {void}
-
禁用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
drawBackground(background, x, y, width, height, dom) → {void}
-
绘制背景
Parameters:
Name Type Attributes Description background
ht.ui.drawable.Drawable <optional>
背景 Drawable
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawBorder(border, x, y, width, height, dom) → {void}
-
绘制边框
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawIcon(drawable, x, y, width, height) → {void}
-
绘制图标
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围 x 坐标
y
number 绘制范围 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawPrefixIcon(drawable, x, y, width, height) → {any}
-
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable x
number y
number width
number height
number Returns:
any- Inherited From:
-
drawSuffixIcon(drawable, x, y, width, height) → {any}
-
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable x
number y
number width
number height
number Returns:
any- Inherited From:
-
drawValueIcon(drawable, x, y, width, height) → {void}
-
绘制选中值图标
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围 x 坐标
y
number 绘制范围 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
enableToolTip() → {void}
-
启用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
figureMaxSize() → {Object}
-
计算 maxSize,maxSize 表示组件的最大尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -maxSize
- Inherited From:
-
figureMinSize() → {Object}
-
计算 minSize,minSize 表示组件的最小尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -minSize
- Inherited From:
-
figurePreferredSize() → {Object}
-
计算 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果自定义组件一般需要重写此函数Returns:
Object -preferredSize
- Inherited From:
-
fireViewEvent(event) → {void}
-
派发 View 事件
Parameters:
Name Type Description event
string | Object 事件对象;如果是字符串,表示事件类型,函数内自动组装一个事件对象并派发示例:view.fireViewEvent('myevent') 等同于 view.fireViewEvent({kind: 'myevent'})
Returns:
void- Inherited From:
-
fp(property, oldValue, newValue, compareFunc) → {boolean}
-
派发属性变化事件,firePropertyChange 的缩写
Parameters:
Name Type Attributes Description property
string 属性名
oldValue
any 属性变化之前的值
newValue
any 属性变化之后的值
compareFunc
Object <optional>
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
Returns:
boolean -事件是否派发成功
- Inherited From:
-
getActiveIcon() → {any}
-
获取 active 状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getActiveIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 active 状态下的图标的 Drawable 对象
- Inherited From:
-
getActiveReadOnlyBackground() → {any}
-
获取 active 和 readOnly 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getActiveReadOnlyBackgroundDrawble() → {ht.ui.drawable.Drawable}
-
获取 active 和 readOnly 状态下背景的 Drawable 对象
- Inherited From:
-
getAttr(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getBackground() → {any}
-
获取组件的背景,可以是颜色或者图片等
Returns:
any -组件背景
- Inherited From:
-
getBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取组件背景的 Drawable 对象
- Inherited From:
-
getBorder() → {ht.ui.border.Border}
-
获取组件的边框
- Inherited From:
-
getBorderBottom() → {number}
-
获取组件边框的底部高度
Returns:
number -组件边框底部高度
- Inherited From:
-
getBorderLeft() → {number}
-
获取组件边框的左侧宽度
Returns:
number -组件边框左侧宽度
- Inherited From:
-
getBorderRadius() → {number|Array.<number>}
-
获取 CSS 边框圆角
Returns:
number | Array.<number> -边框圆角
- Inherited From:
-
getBorderRight() → {number}
-
获取组件边框的右侧宽度
Returns:
number -组件边框右侧宽度
- Inherited From:
-
getBorderTop() → {number}
-
获取组件边框的顶部高度
Returns:
number -组件边框顶部高度
- Inherited From:
-
getBoxShadow() → {string}
-
获取 CSS 阴影值
Returns:
string -阴影值
- Inherited From:
-
getClassName() → {string}
-
获取类名
Returns:
string- Inherited From:
-
getColor() → {string}
-
获取文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getColorMode() → {string}
-
Returns:
string- Inherited From:
-
getContentBottom() → {number}
-
获取内容底部距离,即底部边框高度加底部内边距高度
Returns:
number -内容底部距离
- Inherited From:
-
getContentDiv() → {HTMLElement}
-
获取内容 div;对于普通组件,contentDiv 里放置了 canvas 画布;对于容器组件,contentDiv 里除了画布,还有所有的子组件
Returns:
HTMLElement -内容 div
- Inherited From:
-
getContentHeight() → {number}
-
获取内容高度,即组件高度减去边框高度和上下内边距高度
Returns:
number -内容高度
- Inherited From:
-
getContentLeft() → {number}
-
获取内容左侧距离,即左侧边框宽度加左侧内边距宽度
Returns:
number -内容左侧距离
- Inherited From:
-
getContentPoint(event) → {Object}
-
获取内容坐标点;此坐标与内边距和边框无关,是从内容区域左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -内容坐标点,包含 x、y 坐标
- Inherited From:
-
getContentRight() → {number}
-
获取内容右侧距离,即右侧边框宽度加右侧内边距宽度
Returns:
number -内容右侧距离
- Inherited From:
-
getContentTop() → {number}
-
获取内容顶部距离,即顶部边框高度加顶部内边距高度
Returns:
number -内容顶部距离
- Inherited From:
-
getContentWidth() → {number}
-
获取内容宽度,即组件宽度减去边框宽度和左右内边距宽度
Returns:
number -内容宽度
- Inherited From:
-
getContextMenu() → {ht.ui.ContextMenu}
-
获取绑定的右键菜单
- Inherited From:
-
getCurrentIconDrawable(state) → {ht.ui.drawable.Drawable}
-
获取图标的 Drawable 对象;此函数根据当前按钮的状态(normal、hover、active) 返回相应的 Drawable,如:hover 状态下返回 getHoverIconDrawable()
Parameters:
Name Type Attributes Description state
string <optional>
状态,如果未指定,使用 textField.getIconState()
- Inherited From:
-
getCurrentSuffixIconDrawable() → {ht.ui.drawable.Drawable}
-
Returns:
ht.ui.drawable.Drawable- Inherited From:
-
getCursor() → {string}
-
获取鼠标样式(CSS 格式)
Returns:
string -鼠标样式
- Inherited From:
-
getDatas() → {Array.<any>}
-
获取下拉数据数组,格式为:[{ id: id1, label: label1, icon: icon1 }, { id: id2, label: label2, icon: icon2 }] 或 [label1, label2, label3]
Returns:
Array.<any> -数据
- Inherited From:
-
getDisabledBackground() → {any}
-
组件被禁用时,遮罩的背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Returns:
any -遮罩背景
- Inherited From:
-
getDisplayField() → {string}
-
获取数据对象中用于显示的属性,默认为 label
Returns:
string -属性名
- Inherited From:
-
getDisplayFunc() → {function}
-
获取显示值的格式化函数
Returns:
function -格式化函数
- Inherited From:
-
getDOMProperties() → {any}
-
获取 DOM 属性映射表,格式为:{'width': true ...};这些属性发生变化才会更新 DOM 结构,否则只需要绘制内容即可
Returns:
any -DOM 属性映射表
- Inherited From:
-
getDropDownConfig() → {any}
-
获取下拉模板属性配置表
Returns:
any -属性配置表
- Inherited From:
-
getDropDownTemplate() → {string|function}
-
获取下拉模板类
Returns:
string | function -下拉模板类
- Inherited From:
-
getErrorMessage() → {string}
-
获取错误信息
Returns:
string -错误信息
- Inherited From:
-
getFont() → {string}
-
获取文字字体
Returns:
string -文字字体
- Inherited From:
-
getFormDataName() → {string}
-
获取组件在表单中的名称
Returns:
string -名称
- Inherited From:
-
getFormDataProperties() → {any}
-
获取影响表单值的属性映射表;这些属性发生变化会使表单工具重新从此组件取值
Returns:
any -属性映射表
- Inherited From:
-
getFormDataValue() → {any}
-
获取组件在表单中的值
Returns:
any -值
- Inherited From:
-
getHeight() → {number}
-
获取组件的高度
Returns:
number -组件高度
- Inherited From:
-
getHoverIcon() → {any}
-
获取 hover 状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getHoverIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 hover 状态下的图标的 Drawable 对象
- Inherited From:
-
getHoverReadOnlyBackground() → {any}
-
获取 hover 和 readOnly 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getHoverReadOnlyBackgroundDrawble() → {ht.ui.drawable.Drawable}
-
获取 hover 和 readOnly 状态下背景的 Drawable 对象
- Inherited From:
-
getIcon() → {any}
-
获取正常状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常状态下图标的 Drawable 对象
- Inherited From:
-
getIconField() → {string}
-
获取数据对象中的图标属性名,默认为 icon
Returns:
string -属性名
- Inherited From:
-
getIconHeight() → {number}
-
获取图标高度
Returns:
number -高度值
- Inherited From:
-
getIconPosition() → {string}
-
获取图标的位置
Returns:
string -图标位置,值可能为 'left'|'right'
- Inherited From:
-
getIconState() → {string}
-
获取图标状态
Returns:
string -图标状态,值可能为:'normal'|'hover'|'active'
- Inherited From:
-
getIconTextGap() → {number}
-
获取图标和文字内容之间的距离
Returns:
number -距离值
- Inherited From:
-
getIconWidth() → {number}
-
获取图标宽度
Returns:
number -宽度值
- Inherited From:
-
getId() → {any}
-
获取唯一标识,根据标识可快速查找到组件
Returns:
any -唯一标识
- Inherited From:
-
getInput() → {HTMLInputElement}
-
获取组件内部的 input 框
Returns:
HTMLInputElement -input 框
- Inherited From:
-
getInteractorClasses() → {Array.<string>}
-
获取交互器类名数组
Returns:
Array.<string> -交互器类名数组
- Inherited From:
-
getLayoutParams(key) → {any}
-
获取布局参数
Parameters:
Name Type Attributes Description key
string <optional>
布局参数中的 key
Returns:
any -如果指定 key 参数返回布局参数中 key 对应的值,否则返回整个布局参数对象
- Inherited From:
-
getMargin() → {number|Array.<number>}
-
获取组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -外边距
- Inherited From:
-
getMarginBottom() → {number}
-
获取组件底部外边距高度
Returns:
number -底部外边距高度
- Inherited From:
-
getMarginRight() → {number}
-
获取组件右侧外边距宽度
Returns:
number -右侧外边距宽度
- Inherited From:
-
getMarginTop() → {number}
-
获取组件顶部外边距高度
Returns:
number -顶部外边距高度
- Inherited From:
-
getMarignLeft() → {number}
-
获取组件左侧外边距宽度
Returns:
number -左侧外边距宽度
- Inherited From:
-
getMaskRe() → {RegExp}
-
获取输入验证正则表达式
Returns:
RegExp -正则表达式
- Inherited From:
-
getMatchedStyles() → {any}
-
获取组件匹配到的样式
Returns:
any- Inherited From:
-
getMaxLength() → {number}
-
获取输入文本的最大长度
Returns:
number -最大长度
- Inherited From:
-
getMaxSize() → {Object}
-
获取 maxSize,maxSize 表示组件自身最合适的尺寸;
如果用户没有设置,则调用 figureMaxSize 计算Returns:
Object -maxSize
- Inherited From:
-
getMaxSizeProperties() → {any}
-
获取 maxSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 maxSize
Returns:
any -maxSize 属性映射表
- Inherited From:
-
getMinSize() → {Object}
-
获取 minSize,minSize 表示组件的最小尺寸;
如果用户没有设置,则调用 figureMinSize 计算Returns:
Object -minSize
- Inherited From:
-
getMinSizeProperties() → {any}
-
获取 minSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 minSize
Returns:
any -minSize 属性映射表
- Inherited From:
-
getPadding() → {number|Array.<number>}
-
获取组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -内边距
- Inherited From:
-
getPaddingBottom() → {number}
-
获取组件底部内边距高度
Returns:
number -底部内边距高度
- Inherited From:
-
getPaddingLeft() → {number}
-
获取组件左侧内边距宽度
Returns:
number -左侧内边距宽度
- Inherited From:
-
getPaddingRight() → {number}
-
获取组件右侧内边距宽度
Returns:
number -右侧内边距宽度
- Inherited From:
-
getPaddingTop() → {number}
-
获取组件顶部内边距高度
Returns:
number -顶部内边距高度
- Inherited From:
-
getParent() → {ht.ui.ViewGroup}
-
获取父容器
- Inherited From:
-
getPlaceholder() → {string}
-
获取输入提示
Returns:
string -输入提示
- Inherited From:
-
getPopover() → {ht.ui.Popover}
-
获取弹框组件
- Inherited From:
-
getPopoverPlacements() → {Array.<string>}
-
获取弹框组件的弹出位置
Returns:
Array.<string> -弹出位置
- Inherited From:
-
getPopoverTrigger() → {string}
-
获取弹框触发器
Returns:
string -弹框触发器,值为:click|hover
- Inherited From:
-
getPreferredSize() → {Object}
-
获取 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果用户没有设置,则调用 figurePreferredSize 计算Returns:
Object -preferredSize
- Inherited From:
-
getPreferredSizeProperties() → {any}
-
获取 preferredSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 preferredSize
Returns:
any -preferredSize 属性映射表
- Inherited From:
-
getPrefixIconWidth() → {number}
-
Returns:
number- Inherited From:
-
getPreviewBackground() → {any}
-
获取预览背景;可以是颜色或者图片等
Returns:
any -背景
-
getPreviewBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取预览背景的 Drawable 对象
-
getPropertyValue(name) → {any}
-
取组件的某个属性的原始值;
不要直接去取私有变量,例如 padding,不要直接取 _padding 私有变量,而是应该使用此函数取值;
此函数取值顺序:
先取 _padding 私有变量
如果为 undefind,再去取样式表中取值
如果为 undefied,再取 __padding 私有变量Parameters:
Name Type Description name
string 属性名
Returns:
any -属性值
- Inherited From:
Example
// 这段代码演示了覆盖 getPadding 函数,先取出旧的 padding,再 +2 并返回 button.getPadding = function() { var oldPadding = this.getPropertyValue('padding'); oldPadding += 2; return oldPadding; }
-
getReadOnlyBackground() → {any}
-
获取 readOnly 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getReadOnlyBackgroundDrawble() → {ht.ui.drawable.Drawable}
-
获取 readOnly 状态下背景的 Drawable 对象
- Inherited From:
-
getReadOnlyIcon() → {any}
-
获取 readOnly 状态下的展开图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getReadOnlyIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 readOnly 状态下的展开图标的 Drawable 对象
- Inherited From:
-
getRootCanvas() → {HTMLCanvasElement}
-
获取根 Canvas,这个 Canvas 用来绘制背景、边框、内容等
Returns:
HTMLCanvasElement -Canvas DOM 对象
- Inherited From:
-
getRootContext(dom, ignoreCache) → {CanvasRenderingContext2D}
-
获取默认的 canvas 画布的画笔对象,或者获取参数 DOM 对象的画笔;
此函数在绘制背景、边框和自定义组件的情况下经常使用Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定目标 DOM,通常是个 canvas 类型的 DOM 对象
ignoreCache
boolean <optional>
Returns:
CanvasRenderingContext2D -画笔对象
- Inherited From:
-
getStyle(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getStyleProperties() → {any}
-
获取样式属性映射表,格式为:{'padding': true, 'border': true ...}
Returns:
any -样式属性映射表
- Inherited From:
-
getStyleValue(property) → {any}
-
获取样式属性对应的样式值
Parameters:
Name Type Description property
string 属性名
Returns:
any -样式值
- Inherited From:
-
getSuffixIconWidth() → {number}
-
Returns:
number- Inherited From:
-
getToolTip(event) → {string}
-
获取工具提示文本内容
Parameters:
Name Type Attributes Description event
any <optional>
Returns:
string -工具提示文本内容
- Inherited From:
-
getType() → {string}
-
获取文本框类型;注意:这个属性本质是 input 标签的 type 属性的映射,因此某些特殊 type 类型依赖浏览器是否支持
Returns:
string -文本框类型
- Inherited From:
-
getValue() → {any}
-
获取组合框选中的值,默认情况下这个函数的返回值是一个数据对象(datas 数组中的元素)
如果指定了 valueField,此函数返回值为数据对象中的属性值Returns:
any -组件值
- Inherited From:
-
getValueField() → {string}
-
获取数据对象中的 id 属性名
Returns:
string -属性名
- Inherited From:
-
getValueIconHeight(height) → {void}
-
设置选中值的图标的高度
Parameters:
Name Type Description height
number 高度值
Returns:
void- Inherited From:
-
getValueIconTextGap() → {number}
-
获取选中值的图标的和文字之间的距离
Returns:
number -间距值
- Inherited From:
-
getValueIconWidth() → {number}
-
获取选中值的图标的宽度
Returns:
number -宽度值
- Inherited From:
-
getValueMode() → {string}
-
获取颜色值在下拉框中的显示方式
Returns:
string -颜色值的显示方式
-
getValueObject() → {any}
-
获取当前选中的属性对象
Returns:
any -属性对象
- Inherited From:
-
getView() → {HTMLElement}
-
获取组件最根层的 div
Returns:
HTMLElement -组件 div
- Inherited From:
-
getViewPoint(event) → {Object}
-
获取组件坐标点;从组件的左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -组件坐标点,包含 x、y 坐标
- Inherited From:
-
getWidth() → {number}
-
获取组件的宽度
Returns:
number -组件宽度
- Inherited From:
-
getX() → {number}
-
获取组件的 x 坐标
Returns:
number -x 坐标
- Inherited From:
-
getY() → {number}
-
获取组件的 y 坐标
Returns:
number -y 坐标
- Inherited From:
-
getZIndex() → {number}
-
获取组件的堆叠顺序
Returns:
number -堆叠顺序
- Inherited From:
-
getZoom() → {number}
-
获取缩放值
Returns:
number -缩放值
- Inherited From:
-
getZoomAnchor() → {Array.<number>}
-
获取缩放锚点
Returns:
Array.<number> -锚点数组
- Inherited From:
-
hasContentCanvas() → {boolean}
-
判断组件是否有私有 canvas
Returns:
boolean -组件是否有私有 canvas
- Inherited From:
-
hasFocus() → {boolean}
-
判断焦点是否在组件上
Returns:
boolean -焦点是否在组件上
- Inherited From:
-
hidePopover() → {void}
-
隐藏弹框组件
Returns:
void- Inherited From:
-
hideToolTip() → {void}
-
隐藏 toolTip
Returns:
void- Inherited From:
-
iconHitTest(event) → {void}
-
判断是否点击中图标
Parameters:
Name Type Description event
any 事件对象
Returns:
void- Inherited From:
-
initInput() → {HTMLInputElement}
-
创建并初始化 input 框
Returns:
HTMLInputElement -input 框
- Inherited From:
-
initView(canvas) → {void}
-
初始化组件的 DOM 结构
Parameters:
Name Type Attributes Description canvas
boolean <optional>
是否创建一个私有的 canvas 用来绘制私有内容,一般情况下在默认的 canvas 中绘制就可以,不需要此参数
Returns:
void- Inherited From:
-
invalidate(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
invalidateDOM() → {void}
-
设置重新布局 DOM 标记并调用 invalidate, 组件下次刷新时会强制更新 DOM
Returns:
void- Inherited From:
-
isDescendantOf(viewGroup) → {boolean}
-
判断当前组件是否是参数容器的子孙组件
Parameters:
Name Type Description viewGroup
ht.ui.ViewGroup 容器
Returns:
boolean- Inherited From:
-
isDisabled() → {boolean}
-
组件是否被禁用
Returns:
boolean -是否被禁用
- Inherited From:
-
isFloatLayout() → {boolean}
-
Returns:
boolean- Inherited From:
-
isFocusable() → {boolean}
-
组件是否可以获取焦点
Returns:
boolean -是否可获取焦点
- Inherited From:
-
isInDOM() → {boolean}
-
判断组件是否在 DOM 树中
Returns:
boolean -组件是否在 DOM 树中
- Inherited From:
-
isInstant() → {boolean}
-
是否是即时模式;在这种模式下,每输入一个字符 value 属性变化事件就会立即被派发,否则只有失去焦点或敲回车时才被派发
Returns:
boolean -是否是即时模式
- Inherited From:
-
isMaxSizeSet() → {boolean}
-
判断 maxSize 是否被设置(如果为 true, 组件不再调用 figureMaxSize 自动计算)
Returns:
boolean -maxSize 是否被设置
- Inherited From:
-
isMinSizeSet() → {boolean}
-
判断 minSize 是否被设置(如果为 true, 组件不再调用 figureMinSize 自动计算)
Returns:
boolean -minSize 是否被设置
- Inherited From:
-
isOpened() → {boolean}
-
判断下拉框是否处于打开状态
Returns:
boolean -是否处于打开状态
- Inherited From:
-
isPreferredSizeSet() → {boolean}
-
判断 preferredSize 是否被设置(如果为 true, 组件不再调用 figurePreferredSize 自动计算)
Returns:
boolean -preferredSize 是否被设置
- Inherited From:
-
isReadOnly() → {string|boolean}
-
是否只读
Returns:
string | boolean -是否只读,值为:true|false|'entire'
- Inherited From:
-
isRedrawOnFocus() → {boolean}
-
判断组件获取或失去焦点时,是否重绘自身
Returns:
boolean -是否重绘自身
- Inherited From:
-
isSelfViewEvent(event) → {boolean}
-
判断鼠标事件是否发生在组件自身上,例如容器的 div 上监听到一个原生的鼠标点击事件,此事件可能来自容器,也可能来自子组件的冒泡传播;
如果自定义组件,并且改变了组件的 DOM 结构,需要重写此函数Parameters:
Name Type Description event
any 事件对象
Returns:
boolean -事件是否发生在自身 DOM 上
- Inherited From:
-
isStyleProperty(property) → {boolean}
-
判断属性是否是样式属性
Parameters:
Name Type Description property
string 属性名
Returns:
boolean -是否是样式属性
- Inherited From:
-
isToolTipEnabled() → {boolean}
-
是否启用工具提示
Returns:
boolean -是否启用工具提示
- Inherited From:
-
isVisible() → {boolean}
-
判断组件是否可见
Returns:
boolean -组件是否可见
- Inherited From:
-
iv(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
layoutDOM(x, y, width, height) → {void}
-
重新调整组件的 DOM 结构布局,设置坐标、宽高以及内边距等
Parameters:
Name Type Attributes Description x
number 组件的 x 坐标
y
number <optional>
组件的 y 坐标
width
number <optional>
组件宽度
height
number <optional>
组件高度
Returns:
void- Inherited From:
-
makeDisabled(disabled, disabledDiv) → {void}
-
设置禁用组件样式,默认会将 disabedDiv 插入到组件内部
Parameters:
Name Type Description disabled
boolean 是否禁用
disabledDiv
HTMLElement 遮罩 div
Returns:
void- Inherited From:
-
mp(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数,addPropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
off(name, listener, scope) → {void}
-
删除事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
on(name, listener, scope, ahead) → {void}
-
增加事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听的是属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onOnce(name, listener, scope, ahead) → {void}
-
增加一次性事件监听(监听器执行一次,然后马上被删除)
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onPropertyChanged(e) → {void}
-
属性变化回调
Parameters:
Name Type Description e
Object Returns:
void- Inherited From:
-
open() → {void}
-
打开下拉框
Returns:
void- Inherited From:
-
processValidate() → {void}
-
绘制组件边框、背景及调用 validateImpl;此函数在 validate 中被调用
Returns:
void- Inherited From:
-
redraw(forceLayoutChildren) → {void}
-
设置所有的重绘标记包括重绘 canvas 标记、重绘 border 标记和重新布局 DOM 标记 并调用 iv
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
removeFromDOM() → {void}
-
将组件从页面的 DOM 树中删除;如果要删除通过 addToDOM 添加到页面的组件,应使用此函数,以免内存泄漏
Returns:
void- Inherited From:
-
removePropertyChangeListener(listener, scope) → {void}
-
删除属性事件变化监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
removeStyleProperty(property) → {void}
-
删除样式属性,将参数属性从样式属性列表中移除
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
removeViewListener(listener, scope) → {void}
-
删除 View 事件监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
requestFocus() → {void}
-
请求获取焦点
Returns:
void- Inherited From:
-
resetTranslate() → {any}
-
Returns:
any- Inherited From:
-
selectAt(index) → {void}
-
根据下标选中数据
Parameters:
Name Type Description index
number 下标
Returns:
void- Inherited From:
-
set(properties) → {void}
-
批量设置组件属性
Parameters:
Name Type Description properties
any 格式示范:{ background: 'red', border: new ht.ui.border.LineBorder(1, 'red'), padding: 20 }
Returns:
void- Inherited From:
-
setAcceptInput(searchable) → {void}
-
Parameters:
Name Type Description searchable
boolean Returns:
void- Inherited From:
-
setActiveIcon(icon) → {void}
-
设置 active 状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveIconDrawable(drawable) → {void}
-
设置 active 状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setActiveReadOnlyBackground(background) → {void}
-
设置 active 和 readOnly 状态下的背景;可以是颜色或者图片等
Parameters:
Name Type Description background
any 背景
Returns:
void- Inherited From:
-
setActiveReadOnlyBackgroundDrawble(drawable) → {void}
-
设置 active 和 readOnly 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setAttr(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setBackground(background) → {void}
-
设置组件的背景,可以是颜色或者图片等;此值最终会被转换为 Drawable 对象
Parameters:
Name Type Description background
any 颜色值、图片名、图片路径、矢量对象等
Returns:
void- Inherited From:
-
setBackgroundDrawable(drawable) → {void}
-
设置组件的背景 Drawable 对象;组件渲染时优先使用此 Drawable 对象,如果为空,再用 background 转换
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable Drawable 对象
Returns:
void- Inherited From:
-
setBorder(border) → {void}
-
设置组件的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setBorderRadius(radius) → {void}
-
设置 CSS 边框圆角
Parameters:
Name Type Description radius
number | Array.<number> 边框圆角;如果是数组,则表示[左上角圆角、右上角圆角、右下角圆角、左下角圆角]
Returns:
void- Inherited From:
-
setBoxShadow(boxShadow) → {void}
-
设置 CSS 阴影值
Parameters:
Name Type Description boxShadow
string 阴影值
Returns:
void- Inherited From:
-
setClearable(clearable) → {void}
-
Parameters:
Name Type Description clearable
boolean Returns:
void- Inherited From:
-
setColor(color) → {void}
-
设置文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setColorMode(mode) → {void}
-
Parameters:
Name Type Description mode
string Returns:
void- Inherited From:
-
setContextMenu(contextMenu) → {void}
-
设置绑定的右键菜单
Parameters:
Name Type Description contextMenu
ht.ui.ContextMenu 右键菜单
Returns:
void- Inherited From:
-
setCursor(cursor) → {void}
-
设置鼠标样式(CSS 格式)
Parameters:
Name Type Description cursor
string 鼠标样式
Returns:
void- Inherited From:
-
setDatas(datas) → {void}
-
设置下拉数据数组
Parameters:
Name Type Description datas
Array.<any> 数据数组,格式为:[{ id: id1, label: label1, icon: icon1 }, { id: id2, label: label2, icon: icon2 }] 或 [label1, label2, label3]
Returns:
void- Inherited From:
-
setDisabled(disabled) → {void}
-
设置组件是否被禁用
Parameters:
Name Type Description disabled
string | boolean 是否被禁用;如果为字符串,组件除了被禁用,disabledDiv 还会被设置相应的 CSS 样式名
Returns:
void- Inherited From:
-
setDisabledBackground(background) → {void}
-
设置组件被禁用时,遮罩的背景;这个值被设置到遮罩 div 的 background 样式上,因此可以使用所有 CSS 支持的 background 类型
Parameters:
Name Type Description background
string 遮罩背景
Returns:
void- Inherited From:
Example
// 设置一个居中的 gif 图片 作为背景 view.setDisabledBackground('url(a.gif) no-repeat 50% 50%');
-
setDisplayField(displayField) → {void}
-
设置数据对象中用于显示的属性
Parameters:
Name Type Description displayField
string 属性名,默认为 label
Returns:
void- Inherited From:
-
setDisplayFunc(func) → {void}
-
设置显示值的格式化函数
Parameters:
Name Type Description func
Object 格式化函数,示例:function(value) { return 'Format:' + value };
Returns:
void- Inherited From:
-
setDropDownConfig(config) → {void}
-
设置下拉模板属性配置表
Parameters:
Name Type Description config
any 属性配置表
Returns:
void- Inherited From:
Example
comboBox.setDropDownConfig({ 'width': 100, // 下拉框宽度 'height': 100, // 下拉框高度 'dropDownView.background': 'red' // dropDownView.xxx 用来设置下拉组件的属性 });
-
setDropDownTemplate(template) → {void}
-
设置下拉模板类;这个模板类必须是 ht.ui.DropDownTemplate 的子类,开发者也可以继承这个类实现自己的下拉组件
Parameters:
Name Type Description template
string | function 下拉模板类,如果是字符串,可以使用 $ 加样式名指定外部样式,如:'ht.ui.ListDropDown$myList'
Returns:
void- Inherited From:
-
setErrorMessage(message, params) → {ht.ui.Popover}
-
设置错误信息
Parameters:
Name Type Description message
string 错误信息
params
any ErrorMessagePopover 组件的属性配置,如 { placements: ['top'] } 将错误提示显示在上方
- Inherited From:
-
setFloatLayout(floatLayout) → {void}
-
Parameters:
Name Type Description floatLayout
boolean Returns:
void- Inherited From:
-
setFocusable(focusable) → {void}
-
设置组件是否可以获取焦点
Parameters:
Name Type Description focusable
boolean 是否可获取焦点
Returns:
void- Inherited From:
-
setFont(font) → {void}
-
设置文字字体
Parameters:
Name Type Description font
string 文字字体
Returns:
void- Inherited From:
-
setFormDataName(name) → {void}
-
设置组件在表单中的名称
Parameters:
Name Type Description name
string 名称
Returns:
void- Inherited From:
-
setHeight(height) → {void}
-
设置组件的高度
Parameters:
Name Type Description height
number 组件高度
Returns:
void- Inherited From:
-
setHoverIcon(icon) → {void}
-
设置 hover 状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverIconDrawable(drawable) → {void}
-
设置 hover 状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setHoverReadOnlyBackground(background) → {void}
-
设置 hover 和 readOnly 状态下的背景;可以是颜色或者图片等
Parameters:
Name Type Description background
any 背景
Returns:
void- Inherited From:
-
setHoverReadOnlyBackgroundDrawble(drawable) → {void}
-
设置 hover 和 readOnly 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setIcon(icon) → {void}
-
设置正常状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setIconDrawable(drawable) → {void}
-
设置正常状态下图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setIconField(iconField) → {void}
-
设置数据对象中的图标属性名
Parameters:
Name Type Description iconField
string 属性名,默认为 icon
Returns:
void- Inherited From:
-
setIconHeight(height) → {void}
-
设置图标高度
Parameters:
Name Type Description height
number 高度值
Returns:
void- Inherited From:
-
setIconPosition(position) → {void}
-
设置图标的位置
Parameters:
Name Type Description position
string 图标位置,值可能为 'left'|'right'
Returns:
void- Inherited From:
-
setIconTextGap(gap) → {void}
-
设置图标和文字内容之间的距离
Parameters:
Name Type Description gap
number 距离值
Returns:
void- Inherited From:
-
setIconWidth(width) → {void}
-
设置图标宽度
Parameters:
Name Type Description width
number 宽度值
Returns:
void- Inherited From:
-
setId(id) → {void}
-
设置唯一标识,根据标识可快速查找到组件
Parameters:
Name Type Description id
string | number 唯一标识
Returns:
void- Inherited From:
-
setInputValue(value) → {void}
-
Parameters:
Name Type Description value
number Returns:
void- Inherited From:
-
setInstant(instant) → {void}
-
设置即时模式;在这种模式下,每输入一个字符 value 属性变化事件就会立即被派发,否则只有失去焦点或敲回车时才被派发
Parameters:
Name Type Description instant
boolean 是否是即时模式
Returns:
void- Inherited From:
-
setLayoutParams(layoutParams, value) → {void}
-
设置布局参数;这个函数有两种使用方式:
view.setLayoutParams({ marginLeft: 20, marginRight: 20 }) 指定布局参数对象
view.setLayoutParams('marginLeft', 20) 传入两个参数设置布局参数对象中的属性Parameters:
Name Type Attributes Description layoutParams
any <optional>
布局参数对象或 key
value
any <optional>
布局参数值
Returns:
void- Inherited From:
-
setLoading(arg0) → {void}
-
Parameters:
Name Type Description arg0
boolean Returns:
void- Inherited From:
-
setMargin(margin) → {void}
-
设置组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description margin
number | Array.<number> 外边距;父容器布局时,会动态将此参数填充到 layoutParams 中(优先级低于 layoutParams,如果 layoutParams 参数中没有指定相应的 margin 才会从组件上取值)
Returns:
void- Inherited From:
-
setMaskRe(maskRe) → {void}
-
设置输入验证正则表达式;用户每输入一个字符,都会通过这个正则表达式进行验证,如果验证失败,这个字符会被忽略
Parameters:
Name Type Description maskRe
RegExp 正则表达式
Returns:
void- Inherited From:
Example
textField.setMaskRe(/[\d\-]/); // 只允许数字输入
-
setMaxLength(maxLength) → {void}
-
设置输入文本的最大长度
Parameters:
Name Type Description maxLength
number 最大长度
Returns:
void- Inherited From:
-
setMaxSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setMemoryValidate(validate) → {void}
-
Parameters:
Name Type Description validate
boolean Returns:
void- Inherited From:
-
setMinSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setPadding(padding) → {void}
-
设置组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description padding
number | Array.<Number> 内边距
Returns:
void- Inherited From:
-
setPlaceholder(placeholder) → {void}
-
设置输入提示
Parameters:
Name Type Description placeholder
string 输入提示
Returns:
void- Inherited From:
-
setPopover(popover, trigger) → {void}
-
设置弹框组件
Parameters:
Name Type Attributes Description popover
string | ht.ui.Popover 弹框组件,如果参数是字符串,则用这段文本作为弹框内容(内部自动创建 Popover 和 HtmlView 组件)
trigger
string <optional>
触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPopoverPlacements(placements) → {void}
-
设置弹框组件的弹出位置
Parameters:
Name Type Description placements
Array.<string> 位置数组
Returns:
void- Inherited From:
-
setPopoverTrigger(trigger) → {void}
-
设置弹框触发器
Parameters:
Name Type Description trigger
string 弹框触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPreferredSize(width, height) → {void}
-
设置 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸作为布局尺寸;
如果设置过 preferredSize,就不会再调用 figurePreferredSize 计算;
如果要清空设置过的 preferredSize,可以调用 setPreferredSize(undefined, undefined);Parameters:
Name Type Attributes Description width
number | Size2d <optional>
首选宽度
height
number <optional>
首选高度
Returns:
void- Inherited From:
-
setPrefixIconWidth(wdith) → {void}
-
Parameters:
Name Type Description wdith
number Returns:
void- Inherited From:
-
setPreviewBackground(previewbackground) → {void}
-
设置预览背景;可以是颜色或者图片等
Parameters:
Name Type Description previewbackground
any Returns:
void -
setPreviewBackgroundDrawable(drawable) → {void}
-
设置预览背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景 Drawable
Returns:
void -
setPropertyValue(name, value) → {void}
-
设置属性值并派发事件,自定义 set 函数内部应该调用此函数设值
Parameters:
Name Type Description name
string 属性名
value
any 属性值
Returns:
void- Inherited From:
-
setReadOnly(readOnly) → {void}
-
设置只读
Parameters:
Name Type Description readOnly
string | boolean 是否只读,值为:true|false|'entire';当值为 true 时,只有文本框被禁用,右侧图标仍然可以点击;值为 'entire' 时,文本框和右侧图标都不响应交互动作
Returns:
void- Inherited From:
-
setReadOnlyBackground(background) → {void}
-
设置 readOnly 状态下的背景;可以是颜色或者图片等
Parameters:
Name Type Description background
any 背景
Returns:
void- Inherited From:
-
setReadOnlyBackgroundDrawble(drawable) → {void}
-
设置 readOnly 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setReadOnlyIcon(icon) → {void}
-
设置 readOnly 状态下的展开图标;可以是颜色或者图片等
Parameters:
Name Type Description icon
any 图标
Returns:
void- Inherited From:
-
setReadOnlyIconDrawable(drawable) → {void}
-
设置 readOnly 状态下的展开图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setRedrawOnFocus(redrawOnFocus) → {void}
-
设置组件获取或失去焦点时,是否重绘自身
Parameters:
Name Type Description redrawOnFocus
boolean 是否重绘自身
Returns:
void- Inherited From:
-
setSearchable(searchable) → {void}
-
Parameters:
Name Type Description searchable
boolean Returns:
void- Inherited From:
-
setStyle(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setSuffixIcon(icon) → {void}
-
Parameters:
Name Type Description icon
any Returns:
void- Inherited From:
-
setSuffixIconVisible(visible) → {void}
-
Parameters:
Name Type Description visible
boolean Returns:
void- Inherited From:
-
setSuffixIconWidth(width) → {void}
-
Parameters:
Name Type Description width
number Returns:
void- Inherited From:
-
setToolTipEnabled(enabled) → {void}
-
设置是否启用工具提示
Parameters:
Name Type Description enabled
boolean 是否启用工具提示
Returns:
void- Inherited From:
-
setToolTipPlacements(placements) → {any}
-
Parameters:
Name Type Description placements
Array.<string> Returns:
any- Inherited From:
-
setTranslateX(tx) → {void}
-
设置横向滚动偏移
Parameters:
Name Type Description tx
number Returns:
void- Inherited From:
-
setTranslateY(translateY) → {void}
-
Parameters:
Name Type Description translateY
number Returns:
void- Inherited From:
-
setType(type) → {void}
-
设置文本框类型;注意:这个属性本质是 input 标签的 type 属性的映射,因此某些特殊 type 类型依赖浏览器是否支持
Parameters:
Name Type Description type
string 文本框类型
Returns:
void- Inherited From:
-
setValue(value) → {void}
-
设置组合框的值
Parameters:
Name Type Description value
any 组件值
Returns:
void- Inherited From:
-
setValueField(valueField) → {void}
-
设置数据对象中的 id 属性名;需要注意,默认情况下 comboBox.getValue() 返回的是数据对象,如果指定了此参数,
getValue() 和 setValue() 的返回值和参数都是数据对象中对应的属性Parameters:
Name Type Description valueField
string 属性名
Returns:
void- Inherited From:
-
setValueIconTextGap(gap) → {void}
-
设置选中值的图标的和文字之间的距离
Parameters:
Name Type Description gap
number 间距值
Returns:
void- Inherited From:
-
setValueIconWidth(width) → {void}
-
设置选中值的图标的宽度
Parameters:
Name Type Description width
number 宽度值
Returns:
void- Inherited From:
-
setValueMode(mode) → {void}
-
设置颜色值在下拉框中的显示方式
Parameters:
Name Type Description mode
string 颜色值的显示方式
Returns:
void -
setVisible(visible) → {void}
-
设置组件是否可见
Parameters:
Name Type Description visible
boolean 组件是否可见
Returns:
void- Inherited From:
-
setWidth(width) → {void}
-
设置组件的宽度
Parameters:
Name Type Description width
number 组件宽度
Returns:
void- Inherited From:
-
setX(x) → {void}
-
设置组件的 x 坐标
Parameters:
Name Type Description x
number x 坐标
Returns:
void- Inherited From:
-
setY(y) → {void}
-
设置组件的 y 坐标
Parameters:
Name Type Description y
number y 坐标
Returns:
void- Inherited From:
-
setZIndex(zIndex) → {void}
-
设置组件的堆叠顺序
Parameters:
Name Type Description zIndex
number 堆叠顺序
Returns:
void- Inherited From:
-
setZoom(zoom) → {void}
-
设置缩放
Parameters:
Name Type Description zoom
number 缩放值
Returns:
void- Inherited From:
-
setZoomAnchor(anchor) → {void}
-
设置缩放锚点
Parameters:
Name Type Description anchor
Array.<number> 横向和纵向锚点数组,如右上角为:[1, 0]
Returns:
void- Inherited From:
-
showPopover() → {void}
-
显示弹框组件
Returns:
void- Inherited From:
-
showToolTip(moveEvent) → {void}
-
显示 toolTip
Parameters:
Name Type Description moveEvent
MouseEvent | TouchEvent 鼠标事件对象
Returns:
void- Inherited From:
-
suffixIconHitTest(event) → {boolean}
-
Parameters:
Name Type Description event
any Returns:
boolean- Inherited From:
-
tearDownBorder(border, x, y, width, height, dom) → {void}
-
卸载边框;只有 CSS 类型的边框才需要此函数
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
toggle() → {void}
-
切换下拉框状态(如果处于关闭状态将其打开;如果处于打开状态则将其关闭)
Returns:
void- Inherited From:
-
ump(listener, scope) → {void}
-
删除属性事件变化监听器,removePropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
validate() → {void}
-
重绘组件;此函数负责重新布局组件 DOM、设置层叠关系、加载需要的图片资源、派发 validate 事件等
如果自定义组件,不要重写此函数,而是重写 validateImpl 函数Returns:
void- Inherited From:
-
validateImpl(x, y, width, height) → {void}
-
绘制组件内容;如果自定义组件,一般要重写此函数,通过 getRootContext() 获取画笔然后绘制
Parameters:
Name Type Attributes Description x
number <optional>
内容范围的 x 坐标
y
number <optional>
内容范围的 y 坐标
width
number <optional>
内容范围宽度
height
number <optional>
内容范围高度
Returns:
void- Inherited From: