/* global owl */ const { Component, xml } = owl; export class SingleData extends Component { static props = { name: String, value: String, icon: { type: String, optional: true }, style: { type: String, optional: true }, slots: { type: Object, optional: true }, btnName: { type: String, optional: true }, btnAction: { type: Function, optional: true }, }; static defaultProps = { style: "primary", }; get valueIsURL() { const expression = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/; const regex = new RegExp(expression); if (this.props.value.match(regex)) { return true; } else { return false; } } static template = xml`
`; }