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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dhiru959921/user-management-lib

v1.0.1

Published

A comprehensive Angular library for user creation and management with Material Design components

Downloads

9

Readme

User Management Library

A comprehensive Angular library for user creation and management functionality.

Features

  • 🎯 Easy Integration: Simple service-based API for opening user creation modals
  • 🎨 Material Design: Built with Angular Material for consistent UI
  • 🛡️ Type Safety: Full TypeScript support with comprehensive interfaces
  • 🔧 Customizable: Configurable roles, validation, and modal options
  • 📱 Responsive: Mobile-friendly design that works on all screen sizes
  • No inject() Issues: Uses traditional constructor injection to avoid injection context errors

Installation

Install the library via npm:

npm install @your-username/user-management-lib

Peer Dependencies

Make sure you have these peer dependencies installed:

npm install @angular/common @angular/core @angular/cdk @angular/material @angular/forms rxjs

Import Required Modules

In your app module or standalone component, make sure to import:

import { MatDialogModule } from '@angular/material/dialog';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

// In your app.config.ts or app.module.ts
providers: [
  provideAnimations(), // or BrowserAnimationsModule in imports
  // ... other providers
]

Quick Start

1. Import the Service

import { UserManagementLibService, UserCreationResult } from 'user-management-lib';

constructor(private userManagementService: UserManagementLibService) {}

2. Open User Creation Modal

openCreateUserModal() {
  this.userManagementService.openCreateUserModal({
    width: '600px',
    maxWidth: '90vw',
    disableClose: false,
    roles: [
      { value: 'admin', label: 'Administrator' },
      { value: 'user', label: 'Regular User' },
      { value: 'moderator', label: 'Moderator' }
    ]
  }).subscribe((result: UserCreationResult) => {
    if (result && result.success) {
      console.log('User created:', result.user);
      alert(\`User \${result.user?.name} created successfully!\`);
    }
  });
}

API Reference

UserManagementLibService

Methods

openCreateUserModal(options?: UserManagementOptions): Observable<UserCreationResult>

Opens a modal dialog for creating a new user.

Parameters:

  • options (optional): Configuration options for the modal

Returns:

  • Observable<UserCreationResult>: Emits the result when modal is closed

Interfaces

UserManagementOptions

interface UserManagementOptions {
  roles?: Array<{ value: string; label: string }>;
  width?: string;
  maxWidth?: string;
  disableClose?: boolean;
}

UserCreationResult

interface UserCreationResult {
  success: boolean;
  user?: IUser;
  message?: string;
}

IUser

interface IUser {
  id?: number;
  name: string;
  email: string;
  role: string;
  department?: string;
  phone?: string;
  isActive?: boolean;
  createdAt?: string;
  updatedAt?: string;
}

Components

UserCreateModalComponent

A complete modal dialog for user creation with form validation and error handling.

UserCreateFormComponent

A standalone form component that can be used independently for user creation.

Services

UserApiService

Handles HTTP requests for user operations:

  • createUser(userData: CreateUserRequest): Observable<IUser>
  • getUsers(): Observable<IUser[]>
  • getUserById(id: number): Observable<IUser>
  • updateUser(id: number, userData: Partial<IUser>): Observable<IUser>
  • deleteUser(id: number): Observable<void>

Examples

Basic Usage

// Simple modal with default roles
this.userManagementService.openCreateUserModal().subscribe((result) => {
  if (result?.success) {
    console.log("New user:", result.user);
  }
});

Custom Roles

// Modal with custom role options
this.userManagementService
  .openCreateUserModal({
    roles: [
      { value: "admin", label: "System Administrator" },
      { value: "manager", label: "Project Manager" },
      { value: "developer", label: "Software Developer" },
      { value: "tester", label: "Quality Assurance" },
    ],
  })
  .subscribe((result) => {
    // Handle result
  });

Custom Modal Size

// Larger modal for more content
this.userManagementService
  .openCreateUserModal({
    width: "800px",
    maxWidth: "95vw",
  })
  .subscribe((result) => {
    // Handle result
  });

Error Handling

The library includes comprehensive error handling:

  • 409 Conflict: User with email already exists
  • 400 Bad Request: Invalid user data
  • 403 Forbidden: Insufficient permissions
  • Generic Errors: Network or server issues

Styling

The library uses Angular Material components and can be styled using Material themes. Add custom styles by targeting the .user-management-modal class:

.user-management-modal {
  /* Custom modal styles */
}

Dependencies

  • Angular 17+
  • Angular Material
  • Angular CDK
  • RxJS

Contributing

This library is part of the patch tracker application. To modify:

  1. Make changes in projects/user-management-lib/
  2. Build the library: ng build user-management-lib
  3. Test integration in the main app

License

Private - Part of Patch Tracker Application