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

@libs-ui/components-preview-file

v0.2.356-9

Published

> Component xem trước tệp tin hỗ trợ nhiều định dạng từ hình ảnh đến tài liệu văn phòng, PDF thông qua các bộ Viewer phổ biến.

Downloads

945

Readme

@libs-ui/components-preview-file

Component xem trước tệp tin hỗ trợ nhiều định dạng từ hình ảnh đến tài liệu văn phòng, PDF thông qua các bộ Viewer phổ biến.

Giới thiệu

LibsUiComponentsPreviewFileComponent là một component cung cấp giao diện modal để xem nhanh nội dung của tệp tin. Nó hỗ trợ điều hướng giữa một danh sách tệp, các nút hành động tùy chỉnh (như download, share) và tự động nhận diện định dạng để sử dụng viewer phù hợp (Google Viewer cho PDF/Images, Microsoft Viewer cho Office documents).

Tính năng

  • Hỗ trợ đa định dạng: Image (JPEG, PNG, SVG), PDF, Office (DOCX, XLSX, PPTX).
  • Viewer tích hợp: Sử dụng Google và Microsoft Online Viewers cho các tài liệu phức tạp.
  • Điều hướng: Hỗ trợ xem danh sách nhiều tệp với nút Prev/Next.
  • Tùy biến hành động: Cho phép thêm các nút điều khiển tùy chỉnh trên header.
  • Lazy Loading: Chỉ load viewer khi tệp được chọn.
  • OnPush Change Detection
  • Angular Signals

Khi nào sử dụng

  • Khi cần xem nhanh nội dung của một hoặc nhiều tệp đính kèm.
  • Hỗ trợ duyệt album ảnh hoặc danh sách tài liệu PDF, Office.
  • Tránh việc phải tải tệp về máy chỉ để xem nội dung cơ bản.

Cài đặt

# npm
npm install @libs-ui/components-preview-file

# yarn
yarn add @libs-ui/components-preview-file

Import

import { LibsUiComponentsPreviewFileComponent } from '@libs-ui/components-preview-file';

@Component({
  standalone: true,
  imports: [LibsUiComponentsPreviewFileComponent],
  // ...
})
export class YourComponent {}

Ví dụ

Cơ bản

<libs_ui-components-preview_file
  [data]="fileList"
  [(index)]="currentIndex"
  (outClose)="onClose()" />

Với nút bấm tùy chỉnh

<libs_ui-components-preview_file
  [data]="fileList"
  [(index)]="currentIndex"
  [buttons]="customButtons"
  (outClose)="onClose()" />

API

libs_ui-components-preview_file

Inputs

| Property | Type | Default | Description | | ----------- | ----------- | ------------ | ------------------------------------------------------------- | | [data] | IFile[] | Bắt buộc | Danh sách các đối tượng tệp tin cần xem trước. | | [(index)] | number | Bắt buộc | Vị trí tệp hiện tại trong danh sách (hỗ trợ Two-way binding). | | [buttons] | IButton[] | [] | Danh sách các nút hành động bổ sung hiển thị trên header. | | [zIndex] | number | undefined | Thiết lập z-index cho modal preview. |

Outputs

| Property | Type | Description | | ------------ | ------ | --------------------------------------------------------------- | | (outClose) | void | Phát ra khi người dùng nhấn nút đóng hoặc click ra ngoài modal. |

Types & Interfaces

export interface IFile {
  id?: string;
  name?: string;
  file?: File;
  size?: string;
  url?: string;
  origin_url?: string;
  mimetype?: string;
  type?: 'document' | 'image' | 'video' | 'audio';
  extension?: string;
}

export interface IButton {
  key: string;
  label?: string;
  type?: string;
  classIconLeft?: string;
  iconOnlyType?: boolean;
  action?: (index: number) => Promise<void>;
}

Styling

CSS Classes

| Class | Description | | ------------------------- | -------------------------------------------------- | | .preview-file-container | Container chính của modal preview. | | .preview-header | Thanh tiêu đề chứa tên file và các nút điều hướng. | | .preview-body | Vùng hiển thị nội dung file (iframe/img). |

Công nghệ

| Technology | Version | Purpose | | ----------------------- | ------- | ----------------------- | | Angular | 18+ | Framework | | Google Viewer | - | PDF & Image Viewing | | Microsoft Office Online | - | Office Document Viewing | | Angular Signals | - | State management |

Demo

npx nx serve core-ui

Truy cập: http://localhost:4200/preview-file

Unit Tests

# Chạy tests
npx nx test components-preview-file

# Coverage
npx nx test components-preview-file --coverage

License

MIT