File tree Expand file tree Collapse file tree 7 files changed +110
-10
lines changed Expand file tree Collapse file tree 7 files changed +110
-10
lines changed Original file line number Diff line number Diff line change 1+ import Util from '../../_util' ;
2+
13( function ( ) {
24 const ICONS = [
35 '' ,
2325 icons : ICONS ,
2426 name : 'id_rsa.pub' ,
2527 progress : 42 ,
28+ readonly : false ,
2629 state : 'downloadable' ,
2730 } ,
2831 methods : {
4144 isInvalid : function ( ) {
4245 return this . state === 'invalid' ;
4346 } ,
47+ downloadableSnippet : function ( ) {
48+ return Util . snippet ( `
49+ <hx-file-input
50+ details="${ this . details } "
51+ href="${ this . href } "
52+ icon="${ this . icon } "
53+ name="${ this . name } "
54+ ${ this . readonly ? 'readonly' : '' }
55+ >
56+ </hx-file-input>
57+ ` ) ;
58+ } ,
4459 } ,
4560 } ) ;
4661 }
Original file line number Diff line number Diff line change @@ -159,6 +159,13 @@ <h2 id="file-tile">File Tile</h2>
159159 < label for ="txtDetails "> Details</ label >
160160 < input id ="txtDetails " class ="hxTextCtrl " v-model ="details " />
161161 </ p >
162+ < fieldset >
163+ < legend > Options</ legend >
164+ < label >
165+ < input type ="checkbox " v-model ="readonly " />
166+ Readonly
167+ </ label >
168+ </ fieldset >
162169 </ template >
163170 < p v-if ="isLoading ">
164171 < label for ="rngProgress "> Progress</ label >
@@ -174,20 +181,14 @@ <h2 id="file-tile">File Tile</h2>
174181 :href ="href "
175182 :icon ="icon "
176183 :name ="name "
184+ :readonly ="readonly "
177185 @cancel ="onEvent "
178186 @delete ="onEvent "
179187 > </ hx-file-tile >
180188 </ div >
181189
182190 < footer >
183- {% code 'html' %}{% raw %}
184- < hx-file-tile
185- details ="{{details}} "
186- href ="{{href}} "
187- icon ="{{icon}} "
188- name ="{{name}} ">
189- </ hx-file-tile > {% endraw %}
190- {% endcode %}
191+ < pre > < code v-text ="downloadableSnippet "> </ code > </ pre >
191192 </ footer >
192193 </ template >
193194
Original file line number Diff line number Diff line change @@ -131,6 +131,18 @@ <h3>Downloadable with Custom Name</h3>
131131 < small > href defined</ small >
132132 </ div >
133133
134+ < div class ="hxCol ">
135+ < h3 > Visually Truncated, Downloadable and Readonly</ h3 >
136+ < hx-file-tile
137+ details ="50B "
138+ href ="files/easteregg.txt "
139+ icon ="mime-text "
140+ name ="SupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidocious.txt "
141+ readonly
142+ > </ hx-file-tile >
143+ < small > visually truncated with many characters, downloadable and readonly</ small >
144+ </ div >
145+
134146 <!-- TODO: immitate hovering over <a> in Shadow DOM -->
135147 <!-- TODO: immitate hovering over <button id="hxDismiss"> in Shadow DOM -->
136148 </ div >
@@ -159,6 +171,26 @@ <h2>Loading State</h2>
159171 > </ hx-file-tile >
160172 </ div >
161173 {% endfor %}
174+
175+ < div class ="hxCol ">
176+ < small > [progress="100" and readonly]</ small >
177+ < hx-file-tile
178+ icon ="mime-system "
179+ name ="win32.exe "
180+ progress ="100 "
181+ readonly
182+ > </ hx-file-tile >
183+ </ div >
184+
185+ < div class ="hxCol ">
186+ < small > [progress="100", visually truncated and readonly]</ small >
187+ < hx-file-tile
188+ icon ="mime-system "
189+ name ="win32supercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidocious.exe "
190+ progress ="100 "
191+ readonly
192+ > </ hx-file-tile >
193+ </ div >
162194 </ div >
163195 </ section >
164196
@@ -173,6 +205,16 @@ <h3>Error</h3>
173205 name ="theinternet.tgz "
174206 > </ hx-file-tile >
175207 </ div >
208+
209+ < div class ="hxCol ">
210+ < h3 > Error, Visually Truncated and Readonly</ h3 >
211+ < hx-file-tile
212+ icon ="mime-archive "
213+ invalid
214+ name ="SupercalifragilisticexpialidociousSupercalifragilisticexpialidociousSupercalifragilisticexpialidocious.tgz "
215+ readonly
216+ > </ hx-file-tile >
217+ </ div >
176218 </ div >
177219 </ section >
178220
Original file line number Diff line number Diff line change @@ -102,6 +102,13 @@ <h2 id="methods">Methods</h2>
102102 When present, marks element as loading and denotes completion percentage.
103103 </ p >
104104 </ dd >
105+
106+ < dt > readonly {Boolean} < i > (optional)</ i > </ dt >
107+ < dd >
108+ < p >
109+ When present, mark element as readonly.
110+ </ p >
111+ </ dd >
105112 </ dl >
106113{% endblock %}
107114
@@ -158,6 +165,13 @@ <h2 id="methods">Methods</h2>
158165 </ p >
159166 </ dd >
160167
168+ < dt > readonly {Boolean} < i > (optional)</ i > </ dt >
169+ < dd >
170+ < p >
171+ Manipulates the < code > readonly</ code > attribute.
172+ </ p >
173+ </ dd >
174+
161175 < dt > truncated {Boolean}</ dt >
162176 < dd >
163177 < p >
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export class HXAlertElement extends HXElement {
112112 }
113113
114114 /**
115- * Property reflectin the `static` HTML attribute, indicating whether the
115+ * Property reflecting the `static` HTML attribute, indicating whether the
116116 * alert may be dismissed. If true, the dismiss button will not be shown.
117117 *
118118 * @default false
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export class HXFileTileElement extends HXElement {
5959 this . $upgradeProperty ( 'icon' ) ;
6060 this . $upgradeProperty ( 'name' ) ;
6161 this . $upgradeProperty ( 'progress' ) ;
62+ this . $upgradeProperty ( 'readonly' ) ;
6263
6364 this . _btnDismiss . addEventListener ( 'click' , this . _onDismiss ) ;
6465 this . _btnRetry . addEventListener ( 'click' , this . _onRetry ) ;
@@ -113,6 +114,23 @@ export class HXFileTileElement extends HXElement {
113114 return re . exec ( this . name ) [ 1 ] || '' ;
114115 }
115116
117+ /**
118+ * If present, the dismiss will not be shown.
119+ *
120+ * @default false
121+ * @type {Boolean }
122+ */
123+ get readonly ( ) {
124+ return this . hasAttribute ( 'readonly' ) ;
125+ }
126+ set readonly ( value ) {
127+ if ( value ) {
128+ this . setAttribute ( 'readonly' , '' ) ;
129+ } else {
130+ this . removeAttribute ( 'readonly' ) ;
131+ }
132+ }
133+
116134 /**
117135 * URL to download the file.
118136 *
Original file line number Diff line number Diff line change 2727 #Button .tertiary ();
2828
2929 hx- icon {
30- // FIXME: fix in SURF-1219
30+ // FIXME
3131 margin-left : 0.25rem !important ;
3232 }
3333 }
180180 display : block ;
181181 }
182182}
183+
184+ :host ([readonly]) {
185+ #hxDismiss {
186+ display : none ;
187+ }
188+
189+ #hxContentWrapper {
190+ padding : 0.5rem ;
191+ }
192+ }
You can’t perform that action at this time.
0 commit comments