| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SyForm::ViewField::InputHTML; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
7
|
|
|
7
|
|
320
|
$SyForm::ViewField::InputHTML::AUTHORITY = 'cpan:GETTY'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
$SyForm::ViewField::InputHTML::VERSION = '0.103'; |
|
6
|
7
|
|
|
7
|
|
45
|
use Moo; |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
45
|
|
|
7
|
7
|
|
|
7
|
|
2314
|
use List::MoreUtils qw( uniq ); |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
72
|
|
|
8
|
7
|
|
|
7
|
|
4727
|
use HTML::Declare ':all'; |
|
|
7
|
|
|
|
|
18
|
|
|
|
7
|
|
|
|
|
6203
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with qw( |
|
11
|
|
|
|
|
|
|
MooX::Traits |
|
12
|
|
|
|
|
|
|
SyForm::CommonRole::EventHTML |
|
13
|
|
|
|
|
|
|
SyForm::CommonRole::GlobalHTML |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @input_attributes = qw( |
|
17
|
|
|
|
|
|
|
accept |
|
18
|
|
|
|
|
|
|
align |
|
19
|
|
|
|
|
|
|
alt |
|
20
|
|
|
|
|
|
|
autocomplete |
|
21
|
|
|
|
|
|
|
autofocus |
|
22
|
|
|
|
|
|
|
checked |
|
23
|
|
|
|
|
|
|
disabled |
|
24
|
|
|
|
|
|
|
form |
|
25
|
|
|
|
|
|
|
formaction |
|
26
|
|
|
|
|
|
|
formenctype |
|
27
|
|
|
|
|
|
|
formmethod |
|
28
|
|
|
|
|
|
|
formnovalidate |
|
29
|
|
|
|
|
|
|
formtarget |
|
30
|
|
|
|
|
|
|
height |
|
31
|
|
|
|
|
|
|
list |
|
32
|
|
|
|
|
|
|
max |
|
33
|
|
|
|
|
|
|
maxlength |
|
34
|
|
|
|
|
|
|
min |
|
35
|
|
|
|
|
|
|
multiple |
|
36
|
|
|
|
|
|
|
name |
|
37
|
|
|
|
|
|
|
pattern |
|
38
|
|
|
|
|
|
|
placeholder |
|
39
|
|
|
|
|
|
|
readonly |
|
40
|
|
|
|
|
|
|
required |
|
41
|
|
|
|
|
|
|
size |
|
42
|
|
|
|
|
|
|
src |
|
43
|
|
|
|
|
|
|
step |
|
44
|
|
|
|
|
|
|
type |
|
45
|
|
|
|
|
|
|
value |
|
46
|
|
|
|
|
|
|
width |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
our @textarea_attributes = qw( |
|
50
|
|
|
|
|
|
|
autocomplete |
|
51
|
|
|
|
|
|
|
autofocus |
|
52
|
|
|
|
|
|
|
cols |
|
53
|
|
|
|
|
|
|
disabled |
|
54
|
|
|
|
|
|
|
form |
|
55
|
|
|
|
|
|
|
maxlength |
|
56
|
|
|
|
|
|
|
minlength |
|
57
|
|
|
|
|
|
|
name |
|
58
|
|
|
|
|
|
|
placeholder |
|
59
|
|
|
|
|
|
|
readonly |
|
60
|
|
|
|
|
|
|
required |
|
61
|
|
|
|
|
|
|
rows |
|
62
|
|
|
|
|
|
|
selectionDirection |
|
63
|
|
|
|
|
|
|
selectionEnd |
|
64
|
|
|
|
|
|
|
selectionStart |
|
65
|
|
|
|
|
|
|
spellcheck |
|
66
|
|
|
|
|
|
|
wrap |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
our @valid_types = qw( |
|
70
|
|
|
|
|
|
|
button |
|
71
|
|
|
|
|
|
|
checkbox |
|
72
|
|
|
|
|
|
|
color |
|
73
|
|
|
|
|
|
|
date |
|
74
|
|
|
|
|
|
|
datetime |
|
75
|
|
|
|
|
|
|
datetime-local |
|
76
|
|
|
|
|
|
|
email |
|
77
|
|
|
|
|
|
|
file |
|
78
|
|
|
|
|
|
|
hidden |
|
79
|
|
|
|
|
|
|
image |
|
80
|
|
|
|
|
|
|
month |
|
81
|
|
|
|
|
|
|
number |
|
82
|
|
|
|
|
|
|
password |
|
83
|
|
|
|
|
|
|
radio |
|
84
|
|
|
|
|
|
|
range |
|
85
|
|
|
|
|
|
|
reset |
|
86
|
|
|
|
|
|
|
search |
|
87
|
|
|
|
|
|
|
submit |
|
88
|
|
|
|
|
|
|
tel |
|
89
|
|
|
|
|
|
|
text |
|
90
|
|
|
|
|
|
|
time |
|
91
|
|
|
|
|
|
|
url |
|
92
|
|
|
|
|
|
|
week |
|
93
|
|
|
|
|
|
|
); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
my @own_attributes = uniq( |
|
96
|
|
|
|
|
|
|
@input_attributes, |
|
97
|
|
|
|
|
|
|
@textarea_attributes, |
|
98
|
|
|
|
|
|
|
); |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my @remote_attributes = uniq( |
|
101
|
|
|
|
|
|
|
@SyForm::CommonRole::EventHTML::attributes, |
|
102
|
|
|
|
|
|
|
@SyForm::CommonRole::GlobalHTML::attributes, |
|
103
|
|
|
|
|
|
|
); |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
our @attributes; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
for my $own_attribute (@own_attributes) { |
|
108
|
|
|
|
|
|
|
push @attributes, $own_attribute |
|
109
|
|
|
|
|
|
|
unless grep { $own_attribute eq $_ } @remote_attributes; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
for my $attribute (@attributes) { |
|
113
|
|
|
|
|
|
|
has $attribute => ( |
|
114
|
|
|
|
|
|
|
is => 'ro', |
|
115
|
|
|
|
|
|
|
predicate => 1, |
|
116
|
|
|
|
|
|
|
); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
has html_declare => ( |
|
120
|
|
|
|
|
|
|
is => 'lazy', |
|
121
|
|
|
|
|
|
|
); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _build_html_declare { |
|
124
|
19
|
|
|
19
|
|
12514
|
my ( $self ) = @_; |
|
125
|
19
|
|
|
|
|
37
|
my %html_attributes = %{$self->data_attributes}; |
|
|
19
|
|
|
|
|
285
|
|
|
126
|
19
|
|
|
|
|
50
|
for my $key (@remote_attributes) { |
|
127
|
1615
|
|
|
|
|
2284
|
my $has = 'has_'.$key; |
|
128
|
1615
|
100
|
|
|
|
3530
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
19
|
100
|
|
|
|
75
|
if ($self->type eq 'textarea') { |
|
131
|
2
|
|
|
|
|
6
|
for my $key (@textarea_attributes) { |
|
132
|
34
|
|
|
|
|
50
|
my $has = 'has_'.$key; |
|
133
|
34
|
100
|
|
|
|
80
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
134
|
|
|
|
|
|
|
} |
|
135
|
2
|
50
|
|
|
|
5
|
delete $html_attributes{value} if defined $html_attributes{value}; |
|
136
|
2
|
100
|
|
|
|
9
|
my $value = $self->has_value ? $self->value : ""; |
|
137
|
2
|
|
|
|
|
11
|
return TEXTAREA { %html_attributes, _ => $value }; |
|
138
|
|
|
|
|
|
|
} else { |
|
139
|
|
|
|
|
|
|
SyForm->throw("Unknown type") |
|
140
|
17
|
50
|
|
|
|
41
|
unless grep { $self->type eq $_ } @valid_types; |
|
|
391
|
|
|
|
|
709
|
|
|
141
|
17
|
|
|
|
|
35
|
for my $key (@input_attributes) { |
|
142
|
510
|
|
|
|
|
732
|
my $has = 'has_'.$key; |
|
143
|
510
|
100
|
|
|
|
1155
|
$html_attributes{$key} = $self->$key if $self->$has; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
17
|
|
|
|
|
99
|
return INPUT { %html_attributes }; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
} |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
__END__ |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=pod |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 NAME |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
SyForm::ViewField::InputHTML |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 VERSION |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
version 0.103 |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHOR |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Torsten Raudssus <torsten@raudss.us> |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Torsten Raudssus. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
172
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=cut |