17 if (! isset($placeholder) && $type ===
"text")
18 $placeholder = $label;
26 $field = $field->getDataField();
55 $action->asIcon($buttonIcon);
57 case self::TOGGLE_CLICK:
58 $action->onClick(
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'(_,attr)=>(attr=="text")?"password":"text"',
'toggle'));
60 case self::TOGGLE_MOUSEDOWN:
62 $action->addEvent(
'mousedown',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"text"',
'add'));
63 $action->addEvent(
'mouseup',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"password"',
'remove'));
64 $action->addEvent(
'mouseout',
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"password"',
'remove'));
66 case self::TOGGLE_INTERVAL:
67 $action->onClick(
'let th=$(this);' . $this->
getJsToggle($slashIcon,
'"text"',
'add') .
'setTimeout(function(){ ' . $this->
getJsToggle($slashIcon,
'"password"',
'remove') .
' }, 5000);');
73 private function getJsToggle($slashIcon, $type, $actionClass) {
74 return 'th.find(".icon").' . $actionClass .
'Class("' . $slashIcon .
'");th.closest(".field").find("input").attr("type",' . $type .
');';