index.ts 481 Bytes
import type { ValidatorRule } from 'ant-design-vue/lib/form/interface'
import { useTranslation } from '@/hooks/useTranslation'

export { default as ThingsModelForm } from './index.vue'

const { t } = useTranslation()
export const validateTCPCustomCommand: ValidatorRule['validator'] = (_rule, value) => {
  const reg = /^[\s0-9a-fA-F]+$/
  if (reg.test(value)) return Promise.resolve()
  return Promise.reject(new Error(t('Please enter ASCII or HEX service command (0~9/A~F)')))
}