npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dromo-uploader-angular

v2.1.7

Published

Check out our [developer documentation here](https://developer.dromo.io/)

Downloads

1,138

Readme

dromo

Check out our developer documentation here

Usage

Install the packge using npm install dromo-uploader-angular

Import module and add to imports

Manual Settings

// app.module.ts

import { DromoUploaderModule } from 'dromo-uploader-angular';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, DromoUploaderModule],
  providers: [],
  bootstrap: [AppComponent],
})

export class AppModule {}

The DromoUploaderModule provides the Dromo Uploader component, with the selector lib-dromo-uploader.

You may create a wrapper component which provides the Dromo Uploader component with your configuration.

// my-uploader.component.ts

import { Component } from '@angular/core';
import {
  DromoMethods,
  IColumnHook,
  IRowDeleteHook,
  IRowHook,
  IStepHook,
  IUploadStepData,
} from 'dromo-uploader-angular';

@Component({
  selector: 'my-uploader',
  template: `
    <lib-dromo-uploader
      [licenseKey]="licenseKey"
      [user]="user"
      [fields]="fields"
      [settings]="settings"
      [rowHooks]="rowHooks"
      [columnHooks]="columnHooks"
      [stepHooks]="stepHooks"
      [rowDeleteHooks]="rowDeleteHooks"
      [styles]="styles"
      [class]="class"
      class="dromo-importer"
      [onCancel]="onCancel"
      [onResults]="onResults"
      [beforeFinish]="beforeFinish"
      [bulkRowHooks]="bulkRowHooks"
      >
        Import with Dromo!
      </lib-dromo-uploader>
  `
})

export class MyUploader implements DromoMethods {
  licenseKey = "<YOUR LICENSE KEY>";

  user = { id: 'angular tester' };

  fields = [
    { label: 'first name', key: 'first_name' },
    { label: 'email address', key: 'email' },
  ];

  settings = {
    importIdentifier: 'angular imports',
    developmentMode: true,
  };

  rowHooks: IRowHook[] = [
    (record) => {
      const newRecord = { ...record };
      newRecord.row['first_name'].value =
        record.row['first_name'].value + '!!!';
      return newRecord;
    },
  ];

  rowDeleteHooks: IRowDeleteHook[] = [
    (record) => alert(`deleted ${record.index}`),
  ];

  columnHooks: IColumnHook[] = [
    {
      fieldName: 'email',
      callback: (values: IColumnHookInput[]) => {
        console.log('COLUMN HOOK', values);
        values = values.map(({ value, index }) => ({
          value: index + value,
          index,
        }));
        return values;
      },
    },
  ];

  stepHooks: IStepHook[] = [
    {
      type: 'UPLOAD_STEP',
      callback: (uploader, data) => {
        console.log(
          'STEP HOOK',
          `Filename: ${(data as IUploadStepData).filename}`
        );
      },
    },
  ];

  onCancel = () => alert('Something I said?');

  onResults = (data: any[], metaData: any) => {
    alert(`Submitted ${data.length} records`);
    console.table(data);
    console.log('MetaData', metaData);
  };

  bulkRowHooks: IBulkRowHook[] = [
    (data, _mode) => {
      console.log('in the bulk row hook!');
      return data;
    },
  ];

  beforeFinish: IBeforeFinishCallback = (data, metaData, _instance) => {
    console.log(`${data.length} total rows!`);
    if (metaData.rowsWithError.length > 2) {
      return {
        cancel: true,
        message: 'More than two errors, fix them first!',
      };
    }
    return undefined;
  };


  class = 'dromo-button';

  styles = {
    'background-color': 'rgb(0, 123, 255)',
    border: '1px solid rgb(0, 123, 255)',
    'border-radius': ' 0.25rem',
    color: 'white',
    padding: '15px',
    'text-align': 'center',
    'text-decoration': 'none',
    display: 'inline-block',
    'font-size': '16px',
    'box-shadow': '5px 5px 5px 0px #7F7F7F',
  };
}

Saved Schemas

// app.module.ts

import { DromoUploaderModule } from 'dromo-uploader-angular';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, DromoUploaderModule],
  providers: [],
  bootstrap: [AppComponent],
})

export class AppModule {}
// my-uploader.component.ts
import { Component } from "@angular/core";
import {
  IUser,
  IBeforeFinishCallback,
  DromoSavedSchemaMethods
} from "dromo-uploader-angular";
@Component({
  selector: "app-dromo-importer",
  template: `
    <lib-dromo-uploader
      [licenseKey]="licenseKey"
      [schemaName]="schemaName"
      [user]="user"
      [styles]="styles"
      [class]="class"
      [onCancel]="onCancel"
      [onResults]="onResults"
      [beforeFinish]="beforeFinish"
      [developmentMode]="developmentMode"
      class="dromo-importer"
      >Import with Dromo!</lib-dromo-uploader
    >
  `,
  styleUrls: ["./dromo-importer.component.css"]
})
export class DromoImporterComponent implements DromoSavedSchemaMethods {
  schemaName = "demo";
  licenseKey = "<YOUR LICENSE KEY>";
  user: IUser = { id: "angular tester" };
  developmentMode = true;
  onCancel = () => alert("Something I said?");
  onResults = (data: any[], metaData: any) => {
    alert(`Submitted ${data.length} records`);
    console.table(data);
    console.log("MetaData", metaData);
  };

  beforeFinish: IBeforeFinishCallback = (data, metaData, _instance) => {
    console.log(`${data.length} total rows!`);
    if (metaData.rowsWithError.length > 2) {
      return { cancel: true, message: "More than two errors, fix them first!" };
    }
    return undefined;
  };
  class = "dromo-button";
  styles = {
    "background-color": "rgb(0, 123, 255)",
    border: "1px solid rgb(0, 123, 255)",
    "border-radius": " 0.25rem",
    color: "white",
    padding: "15px",
    "text-align": "center",
    "text-decoration": "none",
    display: "inline-block",
    "font-size": "16px",
    "box-shadow": "5px 5px 5px 0px #7F7F7F"
  };

  ngOnInit(): void {}
}