@dotglitch/ngx-common 1.0.14 → 1.0.16

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.
@@ -305,7 +305,7 @@ class TooltipDirective {
305
305
  return;
306
306
  // If the click trigger is set, we will immediately open the tooltip.
307
307
  // This will bypass all other triggers.
308
- if (this.config.triggers.includes("click")) {
308
+ if (this.config?.triggers?.includes("click")) {
309
309
  if (!this.dialogInstance) {
310
310
  const el = this.viewContainer.element.nativeElement;
311
311
  const data = this.data;
@@ -1280,6 +1280,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1280
1280
  args: ["window:resize"]
1281
1281
  }] } });
1282
1282
 
1283
+ /**
1284
+ * Service that listens for global keyboard events
1285
+ */
1286
+ class FileService {
1287
+ constructor(fetch) {
1288
+ this.fetch = fetch;
1289
+ this.chooseFile = (accept, multiple = false, formMetadata = {}) => {
1290
+ return new Promise(r => {
1291
+ const inEl = document.createElement('input');
1292
+ inEl.setAttribute('type', 'file');
1293
+ if (multiple)
1294
+ inEl.setAttribute('multiple', '');
1295
+ if (accept)
1296
+ inEl.setAttribute('accept', accept);
1297
+ inEl.click();
1298
+ let formData = new FormData();
1299
+ inEl.addEventListener('change', () => {
1300
+ Object.keys(inEl.files).forEach(k => {
1301
+ const file = inEl.files[k];
1302
+ const name = file.name;
1303
+ formData.append(name, file);
1304
+ });
1305
+ formData.append("data", JSON.stringify(formMetadata));
1306
+ inEl.remove();
1307
+ r(formData);
1308
+ });
1309
+ });
1310
+ };
1311
+ }
1312
+ }
1313
+ FileService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FileService, deps: [{ token: Fetch }], target: i0.ɵɵFactoryTarget.Injectable });
1314
+ FileService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FileService, providedIn: 'root' });
1315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FileService, decorators: [{
1316
+ type: Injectable,
1317
+ args: [{
1318
+ providedIn: 'root'
1319
+ }]
1320
+ }], ctorParameters: function () { return [{ type: Fetch }]; } });
1321
+
1283
1322
  var ComponentResolveStrategy;
1284
1323
  (function (ComponentResolveStrategy) {
1285
1324
  /**
@@ -2034,5 +2073,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2034
2073
  * Generated bundle index. Do not edit.
2035
2074
  */
2036
2075
 
2037
- export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, HtmlBypass, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NgxDynamicHTMLModule, OnMount, ResourceBypass, ScriptBypass, StyleBypass, TooltipDirective, UrlBypass, openMenu, openTooltip };
2076
+ export { ComponentResolveStrategy, DependencyService, DialogService, DynamicHTMLComponent, DynamicHTMLOptions, DynamicHTMLRenderer, Fetch, FileService, HtmlBypass, KeyboardService, LazyLoaderComponent, LazyLoaderModule, LazyLoaderService, MenuDirective, NGX_DYNAMIC_CONFIG, NGX_LAZY_LOADER_CONFIG, NgxDynamicHTMLModule, OnMount, ResourceBypass, ScriptBypass, StyleBypass, TooltipDirective, UrlBypass, openMenu, openTooltip };
2038
2077
  //# sourceMappingURL=dotglitch-ngx-common.mjs.map