| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Ui\Js; |
| 6: | |
| 7: | /** |
| 8: | * Same as JsChain class, but with annotated methods to make phpstan/PhpStorm happy. |
| 9: | * |
| 10: | * For jQuery: |
| 11: | * |
| 12: | * @method Jquery addClass(...$args) |
| 13: | * @method Jquery append(...$args) |
| 14: | * @method Jquery appendTo(...$args) |
| 15: | * @method JsChain attr(...$args) |
| 16: | * @method Jquery change(...$args) |
| 17: | * @method Jquery click(...$args) |
| 18: | * @method Jquery closest(...$args) |
| 19: | * @method JsChain css(...$args) |
| 20: | * @method JsChain data(...$args) |
| 21: | * @method Jquery each(...$args) |
| 22: | * @method Jquery fadeOut(...$args) |
| 23: | * @method Jquery find(...$args) |
| 24: | * @method Jquery first(...$args) |
| 25: | * @method Jquery focus(...$args) |
| 26: | * @method JsChain get(...$args) |
| 27: | * @method JsChain height(...$args) |
| 28: | * @method Jquery hide(...$args) |
| 29: | * @method JsChain html(...$args) |
| 30: | * @method Jquery map(...$args) |
| 31: | * @method Jquery off(...$args) |
| 32: | * @method Jquery on(string $events, ...$args) |
| 33: | * @method Jquery parent(...$args) |
| 34: | * @method Jquery parents(...$args) |
| 35: | * @method JsChain position(...$args) |
| 36: | * @method JsChain prop(...$args) |
| 37: | * @method Jquery removeAttr(...$args) |
| 38: | * @method Jquery removeClass(...$args) |
| 39: | * @method Jquery removeData(...$args) |
| 40: | * @method Jquery select(...$args) |
| 41: | * @method JsChain serialize(...$args) |
| 42: | * @method Jquery show(...$args) |
| 43: | * @method Jquery submit(...$args) |
| 44: | * @method JsChain text(...$args) |
| 45: | * @method Jquery toggle(...$args) |
| 46: | * @method Jquery toggleClass(...$args) |
| 47: | * @method Jquery trigger(...$args) |
| 48: | * @method JsChain val(...$args) |
| 49: | * |
| 50: | * For Fomantic-UI: |
| 51: | * @method Jquery accordion(...$args) |
| 52: | * @method Jquery api(...$args) |
| 53: | * @method Jquery checkbox(...$args) |
| 54: | * @method Jquery confirm(...$args) |
| 55: | * @method Jquery dropdown(...$args) |
| 56: | * @method Jquery form(...$args) |
| 57: | * @method Jquery modal(...$args) |
| 58: | * @method Jquery popup(...$args) |
| 59: | * @method Jquery progress(...$args) |
| 60: | * @method Jquery rating(...$args) |
| 61: | * @method Jquery tab(...$args) |
| 62: | * @method Jquery toast(...$args) |
| 63: | * @method Jquery transition(...$args) |
| 64: | * @method Jquery visibility(...$args) |
| 65: | * |
| 66: | * For atk4/ui JS (defined in js/src/plugin.js): |
| 67: | * @method Jquery atkAjaxec(...$args) |
| 68: | * @method Jquery atkColumnResizer(...$args) |
| 69: | * @method Jquery atkConditionalForm(...$args) |
| 70: | * @method Jquery atkConfirm(...$args) |
| 71: | * @method Jquery atkCreateModal(...$args) |
| 72: | * @method Jquery atkFileUpload(...$args) |
| 73: | * @method Jquery atkJsSearch(...$args) |
| 74: | * @method Jquery atkJsSortable(...$args) |
| 75: | * @method Jquery atkReloadView(...$args) |
| 76: | * @method Jquery atkScroll(...$args) |
| 77: | * @method Jquery atkServerEvent(...$args) |
| 78: | * @method Jquery atkSidenav(...$args) |
| 79: | * |
| 80: | * For other: |
| 81: | * @method Jquery flatpickr(...$args) |
| 82: | */ |
| 83: | class Jquery extends JsChain |
| 84: | { |
| 85: | public string $_library = '$'; |
| 86: | |
| 87: | /** |
| 88: | * @param mixed ...$constructorArgs arguments for JavaScript jQuery constructor |
| 89: | */ |
| 90: | public function __construct(...$constructorArgs) |
| 91: | { |
| 92: | parent::__construct($this->_library); |
| 93: | |
| 94: | if (count($constructorArgs) === 0) { |
| 95: | $constructorArgs = [new JsExpression('this')]; |
| 96: | } |
| 97: | |
| 98: | $this->_constructorArgs = $constructorArgs; |
| 99: | } |
| 100: | } |
| 101: |