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

fe-admin

v1.0.4

Published

FE Admin UI Components Library

Downloads

269

Readme

fe-admin Angular Package

This guide will help you integrate the fe-admin package into your Angular project.

1. Install the Package

First, install the fe-admin package using npm:

npm install --save fe-admin

2. Add Required Styles

In order to use the styles provided by the fe-admin package, you need to import them into your project.

Option 1: Add Imports in the angular.json file

Open your angular.json file and add the following paths to the "styles" array:

"styles": [
  "src/styles.scss",
  "../node_modules/fe-admin/src/assets/global/styles.scss",
  "../node_modules/fe-admin/src/assets/global/tailwind.css"
]

Option 2: Add Imports in Your Main Styles File

Alternatively, you can add these imports directly to your main SCSS file (typically src/styles.scss):

@import '../node_modules/fe-admin/src/assets/global/styles.scss';
@import '../node_modules/fe-admin/src/assets/global/tailwind.css';

3. Add Translation Assets to angular.json

The fe-admin package includes i18n (internationalization) files that you need to add to your assets in the angular.json file.

In the angular.json file, add the following object under the assets array:

"assets": [
  {
    "glob": "**/*",
    "input": "./node_modules/fe-admin/src/assets/i18n",
    "output": "/assets/fe-admin/i18n/"
  },
  ...
]

This will copy the translation files from the fe-admin package into your project's assets folder.

4. Create a Lazy-Loaded Module with FeAdminModule and Custom Translation Loader

You need to create a lazy-loaded Angular module that imports the FeAdminModule and sets up a custom translation loader using the translation files.

Here's an example of how to set it up:

import { NgModule } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { HttpLoaderFactory } from './app.translate.factory'; // Create this factory function

import { FeAdminModule } from 'fe-admin'; // Import FeAdminModule
import { AdminRoutingModule } from './admin-routing.module';
import { AdminComponent } from './admin.component'; // Your admin component

// Create the TranslateHttpLoader factory function
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
  return new TranslateHttpLoader(http, 'assets/fe-admin/i18n/', '.json');
}

@NgModule({
  imports: [
    FeAdminModule, // Add FeAdminModule here
    AdminRoutingModule,
    TranslateModule.forRoot({
      defaultLanguage: 'en',
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient],
      },
    }),
  ],
  declarations: [AdminComponent],
  exports: [],
})
export class AdminModule {}

In this setup:

FeAdminModule is imported from the fe-admin package.

TranslateModule is configured to load translation files from assets/fe-admin/i18n/ using the custom HttpLoaderFactory.

5.add urls configuration to our component.

app.component.ts;

import { FEAdminModule } from "fe-admin";

@Component({
  selector: "app-root",
  template: `<fe-admin />`,
  standalone: true,
  imports: [FEAdminModule],
})
export class AppComponent {
  constructor(private feAdmin: FeAdminService) {
    this.feAdmin.useLanguage("en");
    this.feAdmin.setUrlConfig({
      baseUrl: environment.apiUrl,
      imageUrl: environment.imageUrl,
      commonUrl: environment.commonUrl,
      otherUrl: environment.otherUrl, // for organization search
    });
  }
}

6. Add the fe-admin Component to Your HTML.

To display the fe-admin component in your application, simply add the tag to the HTML file where you want it to appear.

For example, in your admin.component.html:

<fe-admin />
This will render the fe-admin component in your Angular application.

Summary

Install the fe-admin package with npm install --save fe-admin.

mport the required styles into your angular.json or main styles file.

Add the translation assets in angular.json.

Create a lazy-loaded module, importing FeAdminModule and setting up a custom translation loader.

create urls configuaration for our admin component.

Use in your HTML to display the admin component.

That’s it! Your application should now be integrated with fe-admin.