ETimePicker 时间选择
示例与代码
时间选择
禁用时间选项与范围角色
时间选择
属性
accessibleNamestring辅助技术读取的名称;建议为无文字控件设置可读名称。
placeholderTextappendComponentComponent自定义输入附加区或列表尾部的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。
nullarrowControlbool使用上下箭头调整时间字段。
trueclearIconint组件使用的图标。
EIcons.*
0(无图标)
EIcons.CIRCLE_XMARKclearablebool显示清除操作;评分中允许再次点击当前分数清零。
truecomparingDatevar范围比较使用的另一端日期。
nulldefaultValuevar未选中值时的默认面板定位值。
nulldisabledHoursvar禁用小时函数,返回禁用小时数组。
nulldisabledMinutesvar禁用分钟函数,根据所选小时返回禁用分钟数组。
nulldisabledSecondsvar禁用秒函数,根据所选小时和分钟返回禁用秒数组。
nullechoModeenum输入内容的显示模式。
TextInput.NormalTextInput.PasswordTextInput.NoEchoTextInput.PasswordEchoOnEdit
动态绑定emptyValuesvar判定为空值的数组;默认包含 undefined、null 和空字符串。
继承 Provider,默认 [undefined, null, ""]enabledbool是否允许交互;false 时控件禁用。
trueendPlaceholderstring空值时显示的占位文字。
""fallbackPlacementsvar首选位置空间不足时尝试的位置数组。
placement 可选值组成的数组
["top-start", "bottom-start"]fontfont字体配置,控制字体、字号及文字样式。
常用字段:
family、pixelSize、pointSize
bold、italic、weight
underline、strikeout
letterSpacing、wordSpacing
应用字体formatstring显示格式;日期时间使用格式串,进度可使用函数,倒计时使用时间占位符。
""formattervar格式化回调,把当前值转换为显示文字。
nullheightreal组件尺寸,单位为像素;可绑定父布局尺寸。
implicitHeightisRangebool启用起止范围选择。
falsemaxTimestring可选时间上下限,采用 HH:mm 或 HH:mm:ss;空字符串不限制。
""maximumLengthint最多允许输入的字符数。
32767minTimestring可选时间上下限,采用 HH:mm 或 HH:mm:ss;空字符串不限制。
""parservar输入解析函数,把显示文字转换为底层值。
nullpasswordVisiblebool密码是否以明文显示。
falseplaceholderTextstring空值时显示的占位文字。
随当前语言变化placementstring选择面板相对于输入框的位置。
"top" / "top-start""top-end" / "bottom""bottom-start" / "bottom-end""left" / "left-start""left-end" / "right""right-start" / "right-end"
"bottom-start"prefixComponentComponent自定义前缀的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。
nullprefixIconint组件使用的图标。
EIcons.*
0(无图标)
EIcons.CLOCKprependComponentComponent自定义输入前置区的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。
nullrangeSeparatorstring起止值之间的分隔文字。
" — "readOnlybool禁止用户编辑或评分,仍可通过属性设置值。
truerolestring范围选择时当前输入框的角色。
"" / "start""end"
""saveOnBlurbool失去焦点时提交合法时间输入。
falseshowPasswordbool启用密码输入及密码显示切换。
falseshowSecondsbool显示秒选择。
trueshowWordLimitbool显示当前字数与长度上限。
falsesizeint控件尺寸;默认继承最近的 EConfigProvider。
EStyle.SmallEStyle.MediumEStyle.Large
继承 Provider,默认 EStyle.MediumstartPlaceholderstring空值时显示的占位文字。
""styleTypeint语义配色风格。
EStyle.DefaultEStyle.PrimaryEStyle.SuccessEStyle.InfoEStyle.WarningEStyle.Danger
EStyle.PrimarysuffixComponentComponent自定义后缀的 Component 插槽;null 使用默认内容。 委托上下文见本页示例。
nullsuffixIconint组件使用的图标。
EIcons.*
0(无图标)
0textstring显示的文字内容。
展开默认值
Array.isArray(value) ? value.map(displayValue).join(rangeSeparator) : displayValue(value)textColorcolor文字颜色。
动态绑定validateEventbool值变化时是否向所属表单派发校验请求。
truevalidationMessagestring校验结果说明或外部错误文字。
""validationStateint输入校验状态。
EValidationState.NoneEValidationState.SuccessEValidationState.WarningEValidationState.Error
EValidationState.Nonevaluevar选中的时间字符串;TimePicker 范围模式为起止数组,格式由 valueFormat 决定。
""valueFormatstring对外 value 的日期时间格式;为空时使用组件默认格式。
""valueOnClearvar清除后的值,也可传函数返回清除值;默认继承配置。
继承 Provider,默认 undefinedvisiblebool是否显示组件。
truewidthreal组件尺寸,单位为像素;可绑定父布局尺寸。
implicitWidthcalendarLocalevar只读日期时间解析、格式化和面板使用的语言配置。
由运行时计算canonicalFormatstring只读用于解析和序列化 value 的实际日期时间格式。
由运行时计算displayFormatstring只读解析后的日期时间显示格式。
由运行时计算draftValidbool只读当前编辑中的时间草稿是否有效。
由运行时计算hasValidationErrorbool只读当前校验状态是否为 Error。
由运行时计算popupvar只读内部菜单、弹层或提示对象引用。
由运行时计算wordCountint只读当前输入字符数量。
由运行时计算showPasswordStrengthbool聚焦密码输入时显示强度与规则检查。
falsepasswordRulesvar密码规则数组;每项包含 label 及 minLength 或 pattern。
展开默认值
[ {label: ELocale.texts.PasswordLength, minLength: 8}, {label: ELocale.texts.PasswordUppercase, pattern: /[A-Z]/}, {label: ELocale.texts.PasswordLowercase, pattern: /[a-z]/}, {label: ELocale.texts.PasswordNumber, pattern: /[0-9]/}, {label: ELocale.texts.PasswordSymbol, pattern: /[^A-Za-z0-9]/} ]passwordStrengthreal只读通过规则的比例,范围为 0 到 1。
展开默认值
passwordRequirements.length ? passwordRequirements.filter(function(rule) { return rule.passed }).length / passwordRequirements.length : 0passwordRequirementsvar只读包含 label 与 passed 的规则检查结果。
展开默认值
Array.isArray(passwordRules) ? passwordRules.map(function(rule) { let passed = false try { if (rule && rule.minLength !== undefined) passed = text.length >= Number(rule.minLength) else if (rule && rule.pattern) { const expression = new RegExp(rule.pattern) passed = expression.test(text) } } catch (error) { passed = false } return {label: rule && rule.label ? String(rule.label) : "", passed: passed} }) : []信号
picked(var value)选定值后触发,value 为选中的值。
changed(var value)所选值变化时触发,value 为新的值。
inputRejected(string text)输入无法转换为有效值时触发,text 为被拒绝的输入文字。
popupVisibleChanged(bool visible)选择面板显示或隐藏时触发,visible 表示面板是否可见。
方法
close()关闭组件的面板或弹窗。
clearValue()清空当前日期选择。
selectTime(time)选择 time 指定的时间,并执行可选时间限制检查。
selectRange(start, end)选择 start 到 end 的时间范围。
open()打开组件的面板或弹窗。
commitInput(input)提交输入文字;内容无效时保留原值并发出 inputRejected。