@rxap/directives 19.0.4 → 19.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/compodoc/changelog.html +7 -0
- package/compodoc/dependencies.html +4 -4
- package/compodoc/directives/ShareButtonDirective.html +234 -140
- package/compodoc/injectables/ShareService.html +109 -40
- package/compodoc/interfaces/ShareData.html +500 -0
- package/compodoc/js/menu-wc.js +3 -0
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/overview.html +1 -1
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +645 -478
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/AvatarBackgroundImageDirective.html +4 -4
- package/docs/html/classes/BackgroundImageDirective.html +4 -4
- package/docs/html/classes/ConfirmClick.html +2 -2
- package/docs/html/classes/ContenteditableDirective.html +2 -2
- package/docs/html/classes/FullWidthDirective.html +2 -2
- package/docs/html/classes/IfTruthyDirective.html +4 -4
- package/docs/html/classes/IsDevModeDirective.html +4 -4
- package/docs/html/classes/MethodDirective.html +4 -4
- package/docs/html/classes/MethodTemplateDirective.html +5 -5
- package/docs/html/classes/MovableDividerDirective.html +4 -4
- package/docs/html/classes/PreventDefaultDirective.html +2 -2
- package/docs/html/classes/ShareButtonDirective.html +5 -3
- package/docs/html/classes/ShareService.html +3 -2
- package/docs/html/classes/StopImmediatePropagationDirective.html +2 -2
- package/docs/html/classes/StopPropagationDirective.html +2 -2
- package/docs/html/enums/BackgroundPositionOptions.html +2 -2
- package/docs/html/enums/BackgroundRepeatOptions.html +2 -2
- package/docs/html/enums/BackgroundSizeOptions.html +2 -2
- package/docs/html/enums/GlobalStyleOptions.html +2 -2
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/ContenteditableEvent.html +2 -2
- package/docs/html/interfaces/IfTruthyDirectiveTemplateContext.html +2 -2
- package/docs/html/interfaces/MethodTemplateDirectiveContext.html +2 -2
- package/docs/html/interfaces/MethodTemplateDirectiveErrorContext.html +2 -2
- package/docs/html/interfaces/ShareData.html +5 -0
- package/docs/html/modules.html +1 -1
- package/docs/html/types/BackgroundPosition.html +1 -1
- package/docs/html/types/BackgroundRepeat.html +1 -1
- package/docs/html/types/BackgroundSize.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/AvatarBackgroundImageDirective.md +11 -11
- package/docs/markdown/classes/BackgroundImageDirective.md +10 -10
- package/docs/markdown/classes/ConfirmClick.md +6 -6
- package/docs/markdown/classes/ContenteditableDirective.md +11 -11
- package/docs/markdown/classes/FullWidthDirective.md +3 -3
- package/docs/markdown/classes/IfTruthyDirective.md +10 -10
- package/docs/markdown/classes/IsDevModeDirective.md +5 -5
- package/docs/markdown/classes/MethodDirective.md +19 -19
- package/docs/markdown/classes/MethodTemplateDirective.md +27 -27
- package/docs/markdown/classes/MovableDividerDirective.md +10 -10
- package/docs/markdown/classes/PreventDefaultDirective.md +3 -3
- package/docs/markdown/classes/ShareButtonDirective.md +30 -22
- package/docs/markdown/classes/ShareService.md +15 -17
- package/docs/markdown/classes/StopImmediatePropagationDirective.md +3 -3
- package/docs/markdown/classes/StopPropagationDirective.md +3 -3
- package/docs/markdown/enumerations/BackgroundPositionOptions.md +4 -4
- package/docs/markdown/enumerations/BackgroundRepeatOptions.md +3 -3
- package/docs/markdown/enumerations/BackgroundSizeOptions.md +5 -5
- package/docs/markdown/enumerations/GlobalStyleOptions.md +4 -4
- package/docs/markdown/globals.md +3 -2
- package/docs/markdown/interfaces/ContenteditableEvent.md +4 -4
- package/docs/markdown/interfaces/IfTruthyDirectiveTemplateContext.md +3 -3
- package/docs/markdown/interfaces/MethodTemplateDirectiveContext.md +3 -3
- package/docs/markdown/interfaces/MethodTemplateDirectiveErrorContext.md +4 -4
- package/docs/markdown/interfaces/ShareData.md +41 -0
- package/docs/markdown/type-aliases/BackgroundPosition.md +2 -2
- package/docs/markdown/type-aliases/BackgroundRepeat.md +2 -2
- package/docs/markdown/type-aliases/BackgroundSize.md +2 -2
- package/docs/wiki/Class.AvatarBackgroundImageDirective.md +10 -10
- package/docs/wiki/Class.BackgroundImageDirective.md +9 -9
- package/docs/wiki/Class.ConfirmClick.md +5 -5
- package/docs/wiki/Class.ContenteditableDirective.md +10 -10
- package/docs/wiki/Class.FullWidthDirective.md +2 -2
- package/docs/wiki/Class.IfTruthyDirective.md +9 -9
- package/docs/wiki/Class.IsDevModeDirective.md +4 -4
- package/docs/wiki/Class.MethodDirective.md +18 -18
- package/docs/wiki/Class.MethodTemplateDirective.md +26 -26
- package/docs/wiki/Class.MovableDividerDirective.md +9 -9
- package/docs/wiki/Class.PreventDefaultDirective.md +2 -2
- package/docs/wiki/Class.ShareButtonDirective.md +29 -21
- package/docs/wiki/Class.ShareService.md +14 -16
- package/docs/wiki/Class.StopImmediatePropagationDirective.md +2 -2
- package/docs/wiki/Class.StopPropagationDirective.md +2 -2
- package/docs/wiki/Enumeration.BackgroundPositionOptions.md +3 -3
- package/docs/wiki/Enumeration.BackgroundRepeatOptions.md +2 -2
- package/docs/wiki/Enumeration.BackgroundSizeOptions.md +4 -4
- package/docs/wiki/Enumeration.GlobalStyleOptions.md +3 -3
- package/docs/wiki/Interface.ContenteditableEvent.md +3 -3
- package/docs/wiki/Interface.IfTruthyDirectiveTemplateContext.md +2 -2
- package/docs/wiki/Interface.MethodTemplateDirectiveContext.md +2 -2
- package/docs/wiki/Interface.MethodTemplateDirectiveErrorContext.md +3 -3
- package/docs/wiki/Interface.ShareData.md +37 -0
- package/docs/wiki/TypeAlias.BackgroundPosition.md +1 -1
- package/docs/wiki/TypeAlias.BackgroundRepeat.md +1 -1
- package/docs/wiki/TypeAlias.BackgroundSize.md +1 -1
- package/docs/wiki/_Sidebar.md +1 -0
- package/docs/wiki/globals.md +2 -1
- package/fesm2022/rxap-directives.mjs +82 -77
- package/fesm2022/rxap-directives.mjs.map +1 -1
- package/lib/share-button.directive.d.ts +16 -14
- package/package.json +12 -12
|
@@ -126,6 +126,21 @@
|
|
|
126
126
|
<h3 id="index">Index</h3>
|
|
127
127
|
<table class="table table-sm table-bordered index-table">
|
|
128
128
|
<tbody>
|
|
129
|
+
<tr>
|
|
130
|
+
<td class="col-md-4">
|
|
131
|
+
<h6><b>Properties</b></h6>
|
|
132
|
+
</td>
|
|
133
|
+
</tr>
|
|
134
|
+
<tr>
|
|
135
|
+
<td class="col-md-4">
|
|
136
|
+
<ul class="index-list">
|
|
137
|
+
<li>
|
|
138
|
+
<span class="modifier">Readonly</span>
|
|
139
|
+
<a href="#isSupported" >isSupported</a>
|
|
140
|
+
</li>
|
|
141
|
+
</ul>
|
|
142
|
+
</td>
|
|
143
|
+
</tr>
|
|
129
144
|
|
|
130
145
|
<tr>
|
|
131
146
|
<td class="col-md-4">
|
|
@@ -136,7 +151,6 @@
|
|
|
136
151
|
<td class="col-md-4">
|
|
137
152
|
<ul class="index-list">
|
|
138
153
|
<li>
|
|
139
|
-
<span class="modifier">Public</span>
|
|
140
154
|
<span class="modifier">Async</span>
|
|
141
155
|
<a href="#share" >share</a>
|
|
142
156
|
</li>
|
|
@@ -164,7 +178,6 @@
|
|
|
164
178
|
<td class="col-md-4">
|
|
165
179
|
<a name="share"></a>
|
|
166
180
|
<span class="name">
|
|
167
|
-
<span class="modifier">Public</span>
|
|
168
181
|
<span class="modifier">Async</span>
|
|
169
182
|
<span ><b>share</b></span>
|
|
170
183
|
<a href="#share"><span class="icon ion-ios-link"></span></a>
|
|
@@ -174,15 +187,15 @@
|
|
|
174
187
|
<tr>
|
|
175
188
|
<td class="col-md-4">
|
|
176
189
|
<span class="modifier-icon icon ion-ios-reset"></span>
|
|
177
|
-
<code>share(data:
|
|
190
|
+
<code>share(data: <a href="../interfaces/ShareData.html" target="_self">ShareData</a>, softFail)</code>
|
|
178
191
|
</td>
|
|
179
192
|
</tr>
|
|
180
193
|
|
|
181
194
|
|
|
182
195
|
<tr>
|
|
183
196
|
<td class="col-md-4">
|
|
184
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
185
|
-
class="link-to-prism">src/lib/share-button.directive.ts:
|
|
197
|
+
<div class="io-line">Defined in <a href="" data-line="22"
|
|
198
|
+
class="link-to-prism">src/lib/share-button.directive.ts:22</a></div>
|
|
186
199
|
</td>
|
|
187
200
|
</tr>
|
|
188
201
|
|
|
@@ -199,19 +212,36 @@
|
|
|
199
212
|
<td>Name</td>
|
|
200
213
|
<td>Type</td>
|
|
201
214
|
<td>Optional</td>
|
|
215
|
+
<td>Default value</td>
|
|
202
216
|
</tr>
|
|
203
217
|
</thead>
|
|
204
218
|
<tbody>
|
|
205
219
|
<tr>
|
|
206
220
|
<td>data</td>
|
|
207
221
|
<td>
|
|
208
|
-
|
|
222
|
+
<code><a href="../interfaces/ShareData.html" target="_self" >ShareData</a></code>
|
|
209
223
|
</td>
|
|
210
224
|
|
|
211
225
|
<td>
|
|
212
226
|
No
|
|
213
227
|
</td>
|
|
214
228
|
|
|
229
|
+
<td>
|
|
230
|
+
</td>
|
|
231
|
+
|
|
232
|
+
</tr>
|
|
233
|
+
<tr>
|
|
234
|
+
<td>softFail</td>
|
|
235
|
+
<td>
|
|
236
|
+
</td>
|
|
237
|
+
|
|
238
|
+
<td>
|
|
239
|
+
No
|
|
240
|
+
</td>
|
|
241
|
+
|
|
242
|
+
<td>
|
|
243
|
+
<code>true</code>
|
|
244
|
+
</td>
|
|
215
245
|
|
|
216
246
|
</tr>
|
|
217
247
|
</tbody>
|
|
@@ -226,6 +256,38 @@
|
|
|
226
256
|
</div>
|
|
227
257
|
</td>
|
|
228
258
|
</tr>
|
|
259
|
+
</tbody>
|
|
260
|
+
</table>
|
|
261
|
+
</section>
|
|
262
|
+
<section data-compodoc="block-properties">
|
|
263
|
+
|
|
264
|
+
<h3 id="inputs">
|
|
265
|
+
Properties
|
|
266
|
+
</h3>
|
|
267
|
+
<table class="table table-sm table-bordered">
|
|
268
|
+
<tbody>
|
|
269
|
+
<tr>
|
|
270
|
+
<td class="col-md-4">
|
|
271
|
+
<a name="isSupported"></a>
|
|
272
|
+
<span class="name">
|
|
273
|
+
<span class="modifier">Readonly</span>
|
|
274
|
+
<span ><b>isSupported</b></span>
|
|
275
|
+
<a href="#isSupported"><span class="icon ion-ios-link"></span></a>
|
|
276
|
+
</span>
|
|
277
|
+
</td>
|
|
278
|
+
</tr>
|
|
279
|
+
<tr>
|
|
280
|
+
<td class="col-md-4">
|
|
281
|
+
<i>Default value : </i><code>'share' in navigator && 'canShare' in navigator && typeof navigator.canShare === 'function' && typeof navigator.share === 'function'</code>
|
|
282
|
+
</td>
|
|
283
|
+
</tr>
|
|
284
|
+
<tr>
|
|
285
|
+
<td class="col-md-4">
|
|
286
|
+
<div class="io-line">Defined in <a href="" data-line="20" class="link-to-prism">src/lib/share-button.directive.ts:20</a></div>
|
|
287
|
+
</td>
|
|
288
|
+
</tr>
|
|
289
|
+
|
|
290
|
+
|
|
229
291
|
</tbody>
|
|
230
292
|
</table>
|
|
231
293
|
</section>
|
|
@@ -237,70 +299,77 @@
|
|
|
237
299
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
|
|
238
300
|
Directive,
|
|
239
301
|
HostListener,
|
|
302
|
+
inject,
|
|
240
303
|
Injectable,
|
|
241
|
-
|
|
304
|
+
input,
|
|
305
|
+
output,
|
|
242
306
|
} from '@angular/core';
|
|
243
|
-
|
|
307
|
+
|
|
308
|
+
export interface ShareData {
|
|
309
|
+
files?: File[];
|
|
310
|
+
text?: string;
|
|
311
|
+
title?: string;
|
|
312
|
+
url?: string;
|
|
313
|
+
}
|
|
244
314
|
|
|
245
315
|
@Injectable({ providedIn: 'root' })
|
|
246
316
|
export class ShareService {
|
|
247
317
|
|
|
248
|
-
|
|
318
|
+
readonly isSupported = 'share' in navigator && 'canShare' in navigator && typeof navigator.canShare === 'function' && typeof navigator.share === 'function';
|
|
249
319
|
|
|
250
|
-
|
|
320
|
+
async share(data: ShareData, softFail = true) {
|
|
251
321
|
|
|
252
|
-
|
|
322
|
+
if (this.isSupported) {
|
|
253
323
|
|
|
254
|
-
|
|
324
|
+
if (navigator.canShare(data)) {
|
|
325
|
+
|
|
326
|
+
await navigator.share(data);
|
|
255
327
|
|
|
256
328
|
} else {
|
|
257
|
-
console.
|
|
258
|
-
throw new Error('Can not share data
|
|
329
|
+
console.warn('Can not share data', data);
|
|
330
|
+
throw new Error('Can not share data');
|
|
259
331
|
}
|
|
260
332
|
|
|
333
|
+
} else if (softFail) {
|
|
334
|
+
console.warn(`Native share is not supported!`);
|
|
261
335
|
} else {
|
|
262
336
|
alert('Native share is not supported!');
|
|
263
337
|
}
|
|
264
338
|
|
|
265
339
|
}
|
|
266
340
|
|
|
267
|
-
private isShareSupported(): boolean {
|
|
268
|
-
return !!(navigator as any).share;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
341
|
}
|
|
272
342
|
|
|
273
343
|
@Directive({
|
|
274
|
-
selector: '[rxapShareButton]',
|
|
344
|
+
selector: '[rxapShareButton],[rxapShare]',
|
|
275
345
|
standalone: true,
|
|
276
346
|
})
|
|
277
347
|
export class ShareButtonDirective {
|
|
278
348
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
public text!: string;
|
|
349
|
+
readonly url = input<string>();
|
|
350
|
+
readonly text = input<string>();
|
|
351
|
+
readonly title = input<string>();
|
|
352
|
+
readonly files = input<File[] | undefined>();
|
|
284
353
|
|
|
285
|
-
|
|
286
|
-
|
|
354
|
+
readonly failed = output<any>();
|
|
355
|
+
readonly success = output<void>();
|
|
287
356
|
|
|
288
|
-
|
|
289
|
-
public files?: ReadonlyArray<File>;
|
|
290
|
-
|
|
291
|
-
constructor(private readonly shareService: ShareService) {
|
|
292
|
-
}
|
|
357
|
+
private readonly shareService = inject(ShareService);
|
|
293
358
|
|
|
294
359
|
@HostListener('click')
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
360
|
+
async share() {
|
|
361
|
+
try {
|
|
362
|
+
await this.shareService.share({
|
|
363
|
+
url: this.url(),
|
|
364
|
+
text: this.text(),
|
|
365
|
+
files: this.files(),
|
|
366
|
+
title: this.title(),
|
|
367
|
+
});
|
|
368
|
+
this.success.emit();
|
|
369
|
+
} catch (err: any) {
|
|
370
|
+
console.error(`share failed: ${ err.message }`);
|
|
371
|
+
this.failed.emit(err);
|
|
372
|
+
}
|
|
304
373
|
}
|
|
305
374
|
|
|
306
375
|
}
|