1
|
|
|
<?php |
2
|
|
|
namespace Ajax\semantic\html\elements; |
3
|
|
|
|
4
|
|
|
use Ajax\semantic\html\base\HtmlSemDoubleElement; |
5
|
|
|
use Ajax\semantic\html\base\constants\State; |
6
|
|
|
use Ajax\semantic\html\base\constants\Variation; |
7
|
|
|
use Ajax\semantic\html\base\traits\IconTrait; |
8
|
|
|
use Ajax\semantic\html\collections\form\traits\TextFieldsTrait; |
9
|
|
|
use Ajax\semantic\html\collections\form\traits\FieldTrait; |
10
|
|
|
use Ajax\JsUtils; |
11
|
|
|
|
12
|
|
|
class HtmlInput extends HtmlSemDoubleElement { |
13
|
|
|
use IconTrait,TextFieldsTrait,FieldTrait; |
14
|
|
|
|
15
|
|
|
public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16
|
|
|
parent::__construct("div-" . $identifier, "div", "ui input"); |
17
|
|
|
$this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
18
|
|
|
$this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
19
|
|
|
$this->_variations=[ Variation::TRANSPARENT ]; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function getField() { |
23
|
|
|
return $this->content["field"]; |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
public function getDataField() { |
27
|
|
|
return $this->getField(); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public static function outline($identifier, $icon, $value="", $placeholder="") { |
31
|
|
|
$result=new HtmlInput($identifier, "text", $value, $placeholder); |
32
|
|
|
$result->addToProperty("class", "transparent"); |
33
|
|
|
$result->addIcon($icon)->setOutline(); |
34
|
|
|
return $result; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function run(JsUtils $js) { |
38
|
|
|
$result=parent::run($js); |
39
|
|
|
$result->attach("#" . $this->getDataField()->getIdentifier()); |
40
|
|
|
return $result; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function setTransparent(){ |
44
|
|
|
return $this->addToProperty("class", "transparent"); |
45
|
|
|
} |
46
|
|
|
} |