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-inputs-calculator

v0.2.355-15

Published

> Component Calculator nâng cao hỗ trợ nhập liệu biểu thức toán học kết hợp với các trường dữ liệu động.

Readme

@libs-ui/components-inputs-calculator

Component Calculator nâng cao hỗ trợ nhập liệu biểu thức toán học kết hợp với các trường dữ liệu động.

Giới thiệu

LibsUiComponentsInputsCalculatorComponent là một standalone Angular component cho phép người dùng xây dựng các công thức tính toán phức tạp bằng cách kết hợp các phím số, toán tử và các trường dữ liệu từ hệ thống.

Tính năng

  • Token-based Input: Hiển thị biểu thức dưới dạng các khối (tokens) trực quan.
  • Dynamic Fields: Tích hợp với Popover và List để chọn tham số động.
  • Keyboard Shortcuts: Hỗ trợ đầy đủ phím số và phím toán tử.
  • Smart Editing: Cơ chế xóa thông minh (Backspace/Delete) tại vị trí cursor.
  • OnPush Change Detection: Tối ưu hiệu năng.
  • Angular Signals: Quản lý state hiện đại.

Khi nào sử dụng

  • Xây dựng trình soạn thảo công thức (Formula Editor).
  • Cấu hình các biểu thức tính toán lương, doanh thu, hoặc các chỉ số kinh doanh.
  • Khi cần một giao diện nhập liệu toán học an toàn, ngăn chặn nhập text tự do không hợp lệ.

Cài đặt

# npm
npm install @libs-ui/components-inputs-calculator

Import

import { LibsUiComponentsInputsCalculatorComponent } from '@libs-ui/components-inputs-calculator';

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

Ví dụ

Cơ bản

<libs_ui-components-inputs-calculator
  [configField]="calculatorConfig"
  (outChangeExpressions)="onSave($event)" />

Với giá trị khởi tạo

<libs_ui-components-inputs-calculator
  [configField]="calculatorConfig"
  [expressions]="initialExpressions" />

API

libs_ui-components-inputs-calculator

Inputs

| Property | Type | Default | Description | | ------------------------ | ----------------------------------- | ------------------------- | ----------------------------------------- | | [classContainerButton] | string | '' | Class CSS cho container chứa các nút bấm. | | [classContainerInput] | string | '' | Class CSS cho vùng hiển thị biểu thức. | | [classInclude] | string | '' | Class CSS cho wrapper ngoài cùng. | | [configField] | IInputCalculatorConfigField | - | Bắt buộc. Cấu hình chọn field. | | [expressions] | Array<IInputCalculatorExpression> | [] | Danh sách biểu thức mặc định. | | [ignoreButtonSave] | boolean | false | Ẩn/hiện nút Save mặc định. | | [labelButtonSave] | string | 'i18n_save_calculation' | Nhãn nút Save. | | [placeholder] | string | 'i18n_enter_params' | Placeholder khi trống. | | [validRequired] | IInputCalculatorValid | - | Cấu hình validation rỗng. | | [zIndex] | number | 10 | Z-index cho popover list. |

Outputs

| Property | Type | Description | | ------------------------ | ---------------------------------------------------- | ------------------------------ | | (outChangeExpressions) | EventEmitter<Array<IInputCalculatorExpression>> | Phát ra khi nhấn Save. | | (outFunctionControl) | EventEmitter<IInputCalculatorFunctionControlEvent> | Cung cấp interface điều khiển. |

Methods (via outFunctionControl)

| Method | Parameters | Description | | ---------------- | ---------- | ---------------------------------------------------- | | checkIsValid() | - | Kiểm tra xem biểu thức có hợp lệ (không rỗng) không. | | getData() | - | Trả về danh sách biểu thức hiện tại. |

Types & Interfaces

export interface IInputCalculatorExpression {
  type: 'value' | 'field' | 'operation';
  data: string | number;
}

export interface IInputCalculatorConfigField {
  label?: string;
  placeholderInputList?: string;
  listConfig: IListConfigItem;
  getFieldSelected: (field: string) => IInputCalculatorField | undefined;
}

Demo

Truy cập: http://localhost:4500/inputs/calculator

License

MIT