1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace Formularium\Frontend\Vuetify; |
4
|
|
|
|
5
|
|
|
use Formularium\FrameworkComposer; |
6
|
|
|
use Formularium\HTMLNode; |
7
|
|
|
use Formularium\Frontend\Vue\Framework as FrameworkVue; |
8
|
|
|
use Formularium\Frontend\Vue\VueCode; |
9
|
|
|
|
10
|
|
|
class Framework extends \Formularium\Framework |
11
|
|
|
{ |
12
|
|
|
public function __construct(string $name = 'Vuetify') |
13
|
|
|
{ |
14
|
|
|
parent::__construct($name); |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
protected function addToVue(FrameworkComposer $composer): void |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var FrameworkVue $vue |
21
|
|
|
*/ |
22
|
|
|
$vue = $composer->getByName('Vue'); |
23
|
|
|
$vue->setEditableContainerTag('v-app'); |
24
|
|
|
$vue->setViewableContainerTag('v-app'); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function htmlHead(HTMLNode &$head) |
28
|
|
|
{ |
29
|
|
|
$head->appendContent( |
30
|
|
|
HTMLNode::factory('meta', ['name' => "viewport", 'content' => "width=device-width, initial-scale=1, shrink-to-fit=no"]) |
31
|
|
|
)->appendContent( |
32
|
|
|
HTMLNode::factory( |
33
|
|
|
'link', |
34
|
|
|
[ |
35
|
|
|
'rel' => "stylesheet", |
36
|
|
|
'href' => "https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css", |
37
|
|
|
] |
38
|
|
|
) |
39
|
|
|
)->appendContent( |
40
|
|
|
HTMLNode::factory( |
41
|
|
|
'link', |
42
|
|
|
[ |
43
|
|
|
'rel' => "stylesheet", |
44
|
|
|
'href' => "https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css", |
45
|
|
|
] |
46
|
|
|
) |
47
|
|
|
)->appendContent( |
48
|
|
|
HTMLNode::factory( |
49
|
|
|
'script', |
50
|
|
|
[ |
51
|
|
|
'src' => "https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.js", |
52
|
|
|
] |
53
|
|
|
) |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function viewableCompose(\Formularium\Model $m, array $elements, string $previousCompose, FrameworkComposer $composer): string |
58
|
|
|
{ |
59
|
|
|
$this->addToVue($composer); |
60
|
|
|
return $previousCompose; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function editableCompose(\Formularium\Model $m, array $elements, string $previousCompose, FrameworkComposer $composer): string |
64
|
|
|
{ |
65
|
|
|
$this->addToVue($composer); |
66
|
|
|
return $previousCompose; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|